:root {
  color-scheme: dark;
  --ink: #071019;
  --panel: #101c29;
  --panel-high: #172637;
  --line: #34485d;
  --text: #e7edf3;
  --muted: #8fa0b2;
  --ember: #d96d4c;
  --amber: #d4b761;
  --good: #638f7b;
  --warn: #b08b4f;
  --danger: #a25f5a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(61, 88, 116, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 88, 116, .07) 1px, transparent 1px),
    radial-gradient(circle at 15% -10%, rgba(31, 70, 106, .42), transparent 38%),
    #071019;
  background-size: 36px 36px, 36px 36px, auto, auto;
  font-family: Overpass, sans-serif;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.beta-header {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 30px 38px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 25, .88);
  backdrop-filter: blur(14px);
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 54px); letter-spacing: .02em; }
h2 { margin-bottom: 0; font-size: 23px; }
.eyebrow { margin-bottom: 7px; color: var(--ember); font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.lede { max-width: 760px; margin-bottom: 0; color: var(--muted); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.beta-badge { padding: 8px 10px; border: 1px solid rgba(217,109,76,.55); color: #efad96; font: 600 11px "Roboto Mono", monospace; text-transform: uppercase; }
.button, .text-button {
  border: 1px solid #5a7188;
  color: var(--text);
  background: #1b2a3a;
  padding: 10px 15px;
  cursor: pointer;
  text-decoration: none;
}
.button:hover, .text-button:hover { border-color: var(--ember); }
.button.secondary { background: transparent; }
.text-button { border-color: transparent; color: var(--muted); background: transparent; }
.beta-shell { padding: 24px 38px 48px; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.summary-card { border: 1px solid var(--line); background: rgba(16,28,41,.82); padding: 14px; }
.summary-card strong { display: block; font-size: 24px; color: var(--amber); }
.summary-card span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.toolbar { display: flex; align-items: end; gap: 16px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); background: rgba(10,20,30,.8); }
.search-field { flex: 1; min-width: 240px; }
label span, .search-field span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
input, select, textarea { width: 100%; border: 1px solid #425a72; color: var(--text); background: #0b1621; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ember); }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill { border: 1px solid #3c5166; color: var(--muted); background: #0c1722; padding: 8px 10px; cursor: pointer; }
.filter-pill.is-active { border-color: var(--ember); color: #fff; background: #3a2726; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr); gap: 18px; align-items: start; }
.item-catalog { display: grid; gap: 18px; }
.item-category { border: 1px solid var(--line); background: rgba(10,20,30,.88); }
.item-category-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.item-category-heading h2 { font-size: 22px; letter-spacing: .05em; text-transform: uppercase; }
.item-category-heading span { color: var(--muted); font-size: 11px; }
.category-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 14px; }
.collection-panel { min-height: 430px; border: 1px solid var(--line); background: rgba(10,20,30,.88); }
.collection-panel.is-drop-target { border-color: var(--ember); box-shadow: inset 0 0 0 2px rgba(217,109,76,.2); }
.panel-heading { display: flex; justify-content: space-between; align-items: end; padding: 18px; border-bottom: 1px solid var(--line); }
.drop-hint { color: #718397; font-size: 12px; }
.asset-grid, .assembly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 14px; }
.asset-card, .assembly-card { position: relative; border: 1px solid #3c5268; background: linear-gradient(145deg, #172636, #0d1823); cursor: grab; }
.asset-card:hover, .assembly-card:hover { border-color: #7990a6; transform: translateY(-1px); }
.asset-card.is-dragging { opacity: .35; }
.asset-thumbnail { height: 112px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 10%, #28425a, #0b141d 65%); }
.asset-thumbnail img { width: auto; height: 96px; max-width: calc(100% - 16px); object-fit: contain; }
.asset-monogram { color: #6f879d; font-size: 34px; font-weight: 800; letter-spacing: .04em; }
.asset-copy { padding: 12px; }
.asset-copy h3 { margin: 0 0 6px; font-size: 15px; }
.asset-subtitle { margin: 0 0 5px; color: #f1f5f8; font-size: 13px; font-weight: 800; letter-spacing: .01em; }
.asset-location { margin: 0 0 9px; color: var(--muted); font-size: 11px; }
.asset-code { margin: 0 0 9px; color: var(--amber); font: 600 11px "Roboto Mono", monospace; }
.asset-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #53a77c; display: inline-block; margin-right: 5px; }
.status-dot.usable { background: #d77a3f; }
.status-dot.needs-repair { background: #d8bd4d; }
.assembly-card { padding: 14px; cursor: pointer; }
.assembly-card.is-drop-target { border-color: var(--ember); box-shadow: inset 0 0 0 2px rgba(217,109,76,.18); }
.assembly-card h3 { margin: 0 0 4px; }
.combined-item-card { grid-column: span 2; min-height: 250px; border-color: #6f8295; background: linear-gradient(145deg, #203448, #0d1823); }
.combined-item-card::before { content: "COMBINED ITEM"; display: block; margin-bottom: 10px; color: var(--ember); font: 700 10px "Roboto Mono", monospace; letter-spacing: .12em; }
.combined-thumbnails { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 7px; margin-bottom: 12px; }
.combined-thumb { height: 125px; display: grid; place-items: center; overflow: hidden; border: 1px solid #40566b; background: radial-gradient(circle at 50% 10%, #28425a, #0b141d 65%); }
.combined-thumb img { width: auto; height: 110px; max-width: calc(100% - 10px); object-fit: contain; }
.combined-thumb .asset-monogram { font-size: 30px; }
.assembly-members { display: grid; gap: 7px; margin-top: 14px; }
.assembly-member { display: grid; grid-template-columns: 40px 1fr auto; gap: 9px; align-items: center; padding: 7px; border: 1px solid #34495d; background: #0b1621; cursor: grab; }
.member-thumb { width: 40px; height: 32px; display: grid; place-items: center; overflow: hidden; color: #7890a6; background: #182b3d; font-weight: 800; }
.member-thumb img { width: auto; height: 28px; max-width: 36px; object-fit: contain; }
.member-thumb .asset-monogram { font-size: 14px; }
.member-copy strong, .member-copy small { display: block; }
.member-copy { min-width: 0; }
.member-copy strong { line-height: 1.15; }
.member-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.member-copy small:first-of-type { color: #e8eef3; font-size: 11px; font-weight: 800; }
.member-type { color: var(--amber); font-size: 10px; text-transform: uppercase; }
.empty-state { grid-column: 1 / -1; padding: 40px 20px; color: var(--muted); text-align: center; border: 1px dashed #3b5064; }
.asset-dialog { width: min(760px, calc(100vw - 30px)); border: 1px solid #536a80; color: var(--text); background: #0c1722; padding: 0; }
.asset-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.asset-dialog form { padding: 20px; }
.combined-item-dialog-inner { padding: 20px; }
.combined-item-hint { color: var(--muted); }
.combined-item-members { display: grid; gap: 10px; }
.combined-component { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid #40566b; background: #0b1621; }
.combined-component-thumb { width: 84px; height: 66px; display: grid; place-items: center; overflow: hidden; background: #172637; }
.combined-component-thumb img { width: auto; height: 58px; max-width: 78px; object-fit: contain; }
.combined-component-copy strong, .combined-component-copy span { display: block; }
.combined-component-copy span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.combined-component-actions { display: flex; gap: 6px; }
.combined-component-actions .text-button { border-color: #40566b; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.icon-button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.thumbnail-upload-field > input[type="file"] { padding: 8px; border-style: dashed; color: var(--muted); cursor: pointer; }
.thumbnail-upload-field > input[type="file"]::file-selector-button { margin-right: 10px; border: 1px solid #5a7188; color: var(--text); background: #1b2a3a; padding: 7px 10px; cursor: pointer; }
.thumbnail-upload-preview { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 8px; border: 1px solid #34495d; background: #09131d; }
.thumbnail-upload-preview[hidden] { display: none; }
.thumbnail-upload-preview img { width: 90px; height: 68px; object-fit: contain; background: radial-gradient(circle at 50% 10%, #28425a, #0b141d 65%); }
.thumbnail-upload-preview .text-button { margin-left: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.asset-detail-dialog { width: min(940px, calc(100vw - 32px)); max-height: min(860px, calc(100vh - 32px)); border: 1px solid #5b7187; color: var(--text); background: #0b1621; padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.72); }
.asset-detail-dialog::backdrop { background: rgba(2,7,12,.8); backdrop-filter: blur(7px); }
.asset-detail-dialog form { padding: 24px; }
.detail-dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.detail-dialog-heading h2 { font-size: clamp(24px, 3vw, 38px); }
.detail-close { width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid #536a80; color: var(--text); background: #132231; font-size: 25px; line-height: 1; cursor: pointer; }
.detail-close:hover { border-color: var(--ember); color: #fff; }
.detail-dialog-grid { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.5fr); gap: 24px; margin-top: 20px; }
.detail-visual { align-self: start; border: 1px solid #34495d; background: linear-gradient(145deg, #172636, #0d1823); }
.detail-thumbnail { height: 210px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 10%, #28425a, #0b141d 65%); }
.detail-thumbnail img { width: auto; height: 174px; max-width: calc(100% - 36px); object-fit: contain; }
.detail-thumbnail .asset-monogram { font-size: 52px; }
.detail-code { margin: 15px 15px 5px; color: var(--amber); font: 600 13px "Roboto Mono", monospace; }
.detail-type { margin: 0 15px 15px; color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.detail-share { margin: 0 12px 12px; padding: 10px; border: 1px solid #40566b; background: rgba(5, 13, 21, .72); }
.detail-share-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--text); font: 700 10px "Roboto Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.detail-share-heading span:last-child { color: var(--muted); font-size: 8px; font-weight: 500; letter-spacing: .04em; }
.detail-share-content { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; align-items: center; }
.detail-qr { width: 82px; height: 82px; margin: 0; padding: 5px; background: #fff; cursor: context-menu; }
.detail-qr img, .detail-qr canvas { width: 100% !important; height: 100% !important; display: block; }
.detail-link-copy { min-width: 0; }
.detail-link-copy label { display: block; margin-bottom: 4px; color: var(--muted); font: 600 9px "Roboto Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.detail-link-copy input { width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid #40566b; color: #bed2e3; background: #0c1722; font: 500 9px "Roboto Mono", monospace; cursor: context-menu; }
.detail-qr-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.detail-qr-actions .text-button { padding: 5px 7px; font-size: 9px; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-fields .wide, .location-time.wide { grid-column: 1 / -1; }
.location-time { margin: -7px 0 0; color: var(--muted); font: 500 11px "Roboto Mono", monospace; }
.condition-excellent { border-color: #4f9d77; color: #a9dfc4; background: #10251d; }
.condition-usable { border-color: #c8753f; color: #ffc39c; background: #2b1b12; }
.condition-needs-repair { border-color: #cdb54c; color: #f2dc78; background: #292511; }
.context-menu { position: fixed; z-index: 10; min-width: 210px; border: 1px solid #5a7085; background: #0c1722; box-shadow: 0 15px 40px rgba(0,0,0,.45); }
.context-menu button { width: 100%; border: 0; border-bottom: 1px solid #26394b; color: var(--text); background: transparent; padding: 10px 12px; text-align: left; cursor: pointer; }
.context-menu button:hover { background: #1b2c3d; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 12px 15px; border: 1px solid var(--good); background: #10241d; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.public-view .beta-header .header-actions, .public-view .toolbar, .public-view .workspace-grid, .public-view .summary-strip { display: none; }
.embed-view .beta-header { display: none; }
.embed-view .beta-shell { padding-top: 18px; }

@media (max-width: 900px) {
  .beta-header { flex-direction: column; padding: 22px; }
  .header-actions { justify-content: flex-start; }
  .beta-shell { padding: 18px; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .workspace-grid { grid-template-columns: 1fr; }
  .combined-item-card { grid-column: span 1; }
  .form-grid, .detail-dialog-grid, .detail-fields { grid-template-columns: 1fr; }
  .detail-fields .wide, .location-time.wide { grid-column: auto; }
  .asset-detail-dialog form { padding: 18px; }
}

@media (max-width: 600px) {
  .asset-detail-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; border: 0; margin: 0; }
  .asset-detail-dialog form { min-height: 100%; padding: 16px; }
  .detail-dialog-heading { position: sticky; top: -16px; z-index: 2; margin: -16px -16px 16px; padding: 16px; background: #0b1621; }
  .detail-dialog-heading h2 { font-size: 25px; }
  .detail-dialog-grid { margin-top: 0; }
  .combined-component { grid-template-columns: 64px minmax(0, 1fr); }
  .combined-component-thumb { width: 64px; }
  .combined-component-actions { grid-column: 1 / -1; }
  .detail-thumbnail { height: 150px; }
  .detail-thumbnail img { height: 126px; max-width: calc(100% - 24px); }
  .detail-share { margin: 0 10px 10px; }
  .detail-share-content { grid-template-columns: 76px minmax(0, 1fr); }
  .detail-qr { width: 76px; height: 76px; }
  .dialog-actions { position: sticky; bottom: -16px; margin: 18px -16px -16px; padding: 12px 16px; background: rgba(11,22,33,.96); border-top: 1px solid var(--line); }
}
