/* Nagami Studio — Nagami identity: Dinamit, monochrome, hard edges. */
@font-face { font-family: "Dinamit"; src: url("fonts/Dinamit_Thin.otf"); font-weight: 100; }
@font-face { font-family: "Dinamit"; src: url("fonts/Dinamit_Extralight.otf"); font-weight: 200; }
@font-face { font-family: "Dinamit"; src: url("fonts/Dinamit_Light.otf"); font-weight: 300; }
@font-face { font-family: "Dinamit"; src: url("fonts/Dinamit_Regular.otf"); font-weight: 400; }
@font-face { font-family: "Dinamit"; src: url("fonts/Dinamit_Medium.otf"); font-weight: 500; }
@font-face { font-family: "Dinamit"; src: url("fonts/Dinamit_Semibold.otf"); font-weight: 600; }

:root {
  --black: #000;
  --ink: #111;
  --grey-dark: #212121;
  --grey-mid: #6f6f6f;
  --grey-two: #9b9b9b;
  --grey-line: #e3e3e3;
  --grey-one: #f1f1f1;
  --white: #fff;
  --line: rgba(0, 0, 0, 0.09);
  --line-2: rgba(0, 0, 0, 0.18);
  --rail-line: rgba(255, 255, 255, 0.1);
  --live: #1f8a4c;
  --warn: #b3261e;
  --rail-w: 276px;
  --insp-w: 420px;
  --f: "Dinamit", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --top-safe: 0px;
  --corner-bg: rgba(255, 255, 255, 0.88);
  --inv-bg: #000;
  --inv-fg: #fff;
  --inv-hover: #222;
  --stage-bg: #f1f1f1;
  color-scheme: light;
  /* rail — dark by default */
  --r-bg: #000; --r-fg: #fff; --r-fg2: #d8d8d8; --r-fg3: #bdbdbd; --r-mute: #7d7d7d; --r-mute2: #9b9b9b;
  --r-hover: #111; --r-on: #1a1a1a; --r-line: rgba(255,255,255,0.1); --r-line2: rgba(255,255,255,0.35);
  --r-pill: #262626; --r-thumb: #1d1d1d; --r-dot: #3a3a3a; --r-edge: #000;
}

/* Appearance. data-main = colour of the work area, data-rail = colour of the product list. */
html[data-main="dark"] {
  --black: #f4f4f4; --ink: #ededed; --grey-dark: #d4d4d4; --grey-mid: #9a9a9a; --grey-two: #6c6c6c;
  --grey-line: #2b2b2b; --grey-one: #151515; --white: #0a0a0a;
  --line: rgba(255,255,255,0.09); --line-2: rgba(255,255,255,0.2);
  --corner-bg: rgba(10,10,10,0.8); --inv-bg: #f4f4f4; --inv-fg: #0a0a0a; --inv-hover: #dcdcdc;
  --stage-bg: #121212; --live: #3fbf72; --warn: #ff6b5e;
  color-scheme: dark;
}
html[data-rail="light"] {
  --r-bg: #fff; --r-fg: #000; --r-fg2: #2a2a2a; --r-fg3: #4a4a4a; --r-mute: #8a8a8a; --r-mute2: #8a8a8a;
  --r-hover: #f3f3f3; --r-on: #ebebeb; --r-line: rgba(0,0,0,0.09); --r-line2: rgba(0,0,0,0.3);
  --r-pill: #ececec; --r-thumb: #efefef; --r-dot: #cfcfcf; --r-edge: rgba(0,0,0,0.09);
}
html[data-main="dark"][data-rail="dark"] { --r-edge: rgba(255,255,255,0.08); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--f);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; flex: none; }
img { display: block; }
[hidden] { display: none !important; }

#app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--insp-w); height: 100vh; }

/* ---------- rail ---------- */
#rail { background: var(--r-bg); color: var(--r-fg); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--r-edge); position: relative; }
.rail-head { display: flex; align-items: center; gap: 10px; padding: calc(26px + var(--top-safe)) 22px 20px; }
.wordmark { height: 15px; width: auto; }
.wordmark.for-light { display: none; }
html[data-rail="light"] .wordmark.for-dark { display: none; }
html[data-rail="light"] .wordmark.for-light { display: block; }
.rail-sub { font-weight: 200; font-size: 17px; line-height: 1; letter-spacing: 0.02em; color: var(--r-mute2); transform: translateY(1px); }
.rail-search { margin: 0 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--r-line); padding: 8px 6px; color: var(--r-mute2); }
.rail-search input { background: none; border: 0; outline: 0; color: var(--r-fg); width: 100%; font-size: 13px; }
.rail-search input::placeholder { color: var(--r-mute); }
.rail-new { margin: 14px 16px 6px; display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border: 1px solid var(--r-line2); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500; transition: background .15s, color .15s; }
.rail-new:hover { background: var(--r-fg); color: var(--r-bg); }
.rail-list { flex: 1; overflow-y: auto; padding: 8px 0 16px; scrollbar-width: thin; scrollbar-color: var(--r-pill) transparent; }
.cat { margin-top: 14px; }
.cat-h { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 6px 16px 6px 22px; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--r-mute); font-weight: 500; text-align: left; }
.cat-h:hover { color: var(--r-fg); }
.cat-h span:last-child { display: inline-flex; align-items: center; gap: 6px; }
.cat-h .chev { width: 12px; height: 12px; stroke-width: 1.8; transition: transform .18s var(--ease); }
.cat.closed .chev { transform: rotate(-90deg); }
.prod { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; width: 100%; padding: 6px 16px 6px 20px; text-align: left; position: relative; color: var(--r-fg2); transition: background .12s; }
.prod:hover { background: var(--r-hover); color: var(--r-fg); }
.prod.on { background: var(--r-on); color: var(--r-fg); }
.prod.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--r-fg); }
.prod-thumb { width: 34px; height: 34px; background: var(--r-thumb); object-fit: cover; }
.prod-name { font-size: 13.5px; line-height: 1.2; min-width: 0; }
.prod-name b { display: block; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-name i { font-style: normal; font-size: 11px; color: var(--r-mute); }
.prod-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--r-mute); font-variant-numeric: tabular-nums; }
.webdot { width: 6px; height: 6px; border-radius: 50%; background: var(--r-dot); }
.webdot.live { background: #3fbf72; }
.rail-foot { border-top: 1px solid var(--r-line); padding: 10px 8px 12px; }
.rail-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 14px; color: var(--r-fg3); font-size: 13px; }
.rail-link:hover { color: var(--r-fg); }
.pill { margin-left: auto; font-size: 11px; min-width: 20px; padding: 1px 7px; background: var(--r-pill); color: var(--r-fg2); text-align: center; font-variant-numeric: tabular-nums; }
.pill:empty { display: none; }
.rail-status { padding: 8px 14px 0; font-size: 11px; color: var(--r-mute); line-height: 1.4; }

/* ---------- main ---------- */
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--white); }
.head { padding: calc(30px + var(--top-safe) * 0.4) 36px 0; }
.eyebrow { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--grey-mid); font-weight: 500; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 10px; }
h1 { font-weight: 200; font-size: 46px; line-height: 0.95; letter-spacing: -0.02em; margin: 0; }
.designer { font-weight: 300; font-size: 17px; color: var(--grey-mid); margin-top: 10px; }
.head-actions { display: flex; gap: 8px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border: 1px solid var(--line-2); background: var(--white); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.btn:hover { border-color: var(--black); }
a.btn { text-decoration: none; color: inherit; }
.btn.solid { background: var(--black); color: var(--white); border-color: var(--black); }
.btn.solid:hover { opacity: .86; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--line-2); }
.btn.danger { color: var(--warn); }
.btn.small { height: 30px; padding: 0 12px; font-size: 11px; }
.btn:disabled { opacity: .35; pointer-events: none; }
.webstate { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--grey-mid); margin-top: 16px; }
.webstate a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.webstate .webdot { width: 7px; height: 7px; background: var(--grey-two); }
.webstate .webdot.live { background: var(--live); }

.tabs { display: flex; gap: 28px; padding: 0 36px; margin-top: 26px; border-bottom: 1px solid var(--line); }
.tab { padding: 12px 0 13px; font-size: 13px; color: var(--grey-mid); position: relative; display: flex; gap: 7px; align-items: baseline; }
.tab em { font-style: normal; font-size: 11px; color: var(--grey-two); font-variant-numeric: tabular-nums; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--black); }

.toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 36px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.toolbar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.toolbar .chips::-webkit-scrollbar { display: none; }
.toolbar .chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border: 1px solid var(--line); font-size: 12px; color: var(--grey-dark); transition: border-color .12s; white-space: nowrap; flex: none; }
.chip:hover { border-color: var(--line-2); }
.chip.on { border-color: var(--black); background: var(--black); color: var(--white); }
.sw { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); flex: none; }
.chip.on .sw { border-color: rgba(255,255,255,0.4); }
.tool-right { display: flex; align-items: center; gap: 14px; color: var(--grey-mid); font-size: 12px; white-space: nowrap; }
.tool-right .toggle-line { white-space: nowrap; }
.toggle-line { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }

.scroller { flex: 1; overflow-y: auto; padding: 22px 36px 120px; scrollbar-width: thin; }
.group { margin-bottom: 34px; }
.group-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 16px; }
.group-h h3 { margin: 0; font-weight: 400; font-size: 13px; color: var(--grey-dark); }
.group-h h3 span { color: var(--grey-two); margin-left: 8px; font-variant-numeric: tabular-nums; }
.group-h .link { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--grey-mid); font-weight: 500; }
.group-h .link:hover { color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile, 168px), 1fr)); gap: 10px; }
.tile { position: relative; aspect-ratio: 1; background: var(--grey-one); overflow: hidden; outline: 0 solid var(--black); outline-offset: 2px; transition: outline-width .1s; }
.tile img { width: 100%; height: 100%; object-fit: contain; transition: transform .5s var(--ease), opacity .3s; opacity: 0; }
.tile img.ld { opacity: 1; }
.tile.env img, .tile.video img { object-fit: cover; }
.tile:hover img { transform: scale(1.025); }
.tile.active { outline-width: 2px; }
.tile .corner { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 1.5px solid var(--line-2); background: var(--corner-bg); opacity: 0; transition: opacity .12s; display: grid; place-items: center; }
.tile:hover .corner, .tile.sel .corner, .selecting .tile .corner { opacity: 1; }
.tile.sel .corner { background: var(--black); border-color: var(--black); color: var(--white); }
.tile .corner svg { width: 12px; height: 12px; stroke-width: 2.2; opacity: 0; }
.tile.sel .corner svg { opacity: 1; }
.tile.sel { outline-width: 2px; }
.badge-web { position: absolute; top: 8px; left: 8px; height: 20px; padding: 0 7px; background: var(--black); color: var(--white); font-size: 9.5px; letter-spacing: 0.14em; font-weight: 500; display: flex; align-items: center; gap: 5px; }
.badge-web::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #5bd08a; }
.badge-bot { position: absolute; left: 8px; bottom: 8px; height: 20px; padding: 0 7px; background: rgba(0,0,0,0.72); color: #fff; font-size: 10.5px; display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.badge-bot svg { width: 10px; height: 10px; fill: #fff; stroke: none; }
.badge-regen { position: absolute; right: 8px; bottom: 8px; height: 20px; padding: 0 7px; background: var(--white); font-size: 9.5px; letter-spacing: .12em; font-weight: 500; display: flex; align-items: center; }
.tile.busy::after { content: ""; position: absolute; inset: 0; background: rgba(128,128,128,0.35) linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent) no-repeat; background-size: 40% 100%; animation: sweep 1.2s infinite linear; }
@keyframes sweep { from { background-position: -60% 0; } to { background-position: 160% 0; } }

.empty { padding: 80px 0; text-align: center; color: var(--grey-mid); }
.empty h2 { font-weight: 200; font-size: 30px; color: var(--ink); margin: 0 0 10px; }
.empty p { margin: 0 auto 22px; max-width: 420px; }

/* ---------- inspector ---------- */
#inspector { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--white); position: relative; padding-top: var(--top-safe); }
.insp-stage { position: relative; background: var(--stage-bg); height: var(--stage-h, auto); aspect-ratio: var(--stage-ar, 1); flex: none; display: grid; place-items: center; overflow: hidden; }
.insp-stage img, .insp-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.insp-stage { display: block; min-height: 120px; }
.insp-stage .stage-btns { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; background: var(--white); border: 1px solid var(--line); transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--black); color: var(--white); border-color: var(--black); }
.insp-body { flex: 1; overflow-y: auto; padding: 22px 26px 30px; }
.insp-name { font-size: 14px; line-height: 1.35; word-break: break-word; margin: 0 0 4px; font-weight: 400; }
.insp-folder { font-size: 11.5px; color: var(--grey-mid); word-break: break-word; }
.onoff { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 16px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.onoff b { font-weight: 400; font-size: 13px; display: block; }
.onoff small { color: var(--grey-mid); font-size: 11.5px; }
.switch { width: 44px; height: 24px; background: var(--black); position: relative; transition: background .18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 23px; width: 18px; height: 18px; background: var(--white); transition: left .18s var(--ease); }
.switch.off { background: var(--grey-line); }
.switch.off::after { left: 3px; }
.meta { display: grid; grid-template-columns: 96px 1fr; gap: 7px 12px; font-size: 12.5px; margin: 0 0 20px; }
.meta dt { color: var(--grey-mid); }
.meta dd { margin: 0; word-break: break-word; font-variant-numeric: tabular-nums; }
.meta a { color: inherit; }
.insp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.insp-actions .wide { grid-column: 1 / -1; }
.regen { margin-top: 18px; padding: 16px; background: var(--grey-one); }
.regen label { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--grey-mid); font-weight: 500; margin-bottom: 8px; }
.regen textarea { width: 100%; min-height: 84px; resize: vertical; border: 1px solid var(--line-2); background: var(--white); padding: 10px; outline: 0; font-size: 13px; }
.regen textarea:focus { border-color: var(--black); }
.regen .row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 11.5px; color: var(--grey-mid); gap: 10px; }
.insp-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--grey-mid); padding: 40px; font-size: 13px; }
.insp-empty b { display: block; font-weight: 200; font-size: 24px; color: var(--ink); margin-bottom: 8px; }

/* ---------- selection bar ---------- */
.selbar { position: fixed; left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--insp-w)) / 2); transform: translateX(-50%); bottom: 26px; background: var(--inv-bg); color: var(--inv-fg); display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 18px; box-shadow: 0 18px 50px rgba(0,0,0,0.28); z-index: 30; animation: rise .22s var(--ease); }
@keyframes rise { from { transform: translate(-50%, 14px); opacity: 0; } }
.selbar .count { font-size: 13px; margin-right: 12px; font-variant-numeric: tabular-nums; }
.selbar button { height: 34px; padding: 0 14px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; display: flex; align-items: center; gap: 7px; color: var(--inv-fg); opacity: .85; }
.selbar button:hover { background: var(--inv-hover); opacity: 1; }

/* ---------- overlays ---------- */
#overlay:empty { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.38); z-index: 50; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 92vw); background: var(--white); z-index: 51; display: flex; flex-direction: column; animation: slide .26s var(--ease); box-shadow: -30px 0 60px rgba(0,0,0,0.12); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.sheet-h { padding: calc(28px + var(--top-safe)) 34px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.sheet-h h2 { font-weight: 200; font-size: 32px; margin: 8px 0 0; line-height: 1; letter-spacing: -0.01em; }
.sheet-b { flex: 1; overflow-y: auto; padding: 8px 34px 40px; }
.sheet-f { padding: 16px 34px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--white); }
.sheet-f .note { font-size: 12px; color: var(--grey-mid); }
.sec { padding: 26px 0 6px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.sec-h .eyebrow b { color: var(--ink); font-weight: 500; }
.field { margin-bottom: 16px; }
.field > label, .lbl { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--grey-mid); font-weight: 500; margin-bottom: 7px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-2); padding: 10px 12px; outline: 0; background: var(--white); font-size: 14px; border-radius: 0; }
.field textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--black); }
.field .hint { font-size: 11.5px; color: var(--grey-mid); margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); }
.seg button { height: 36px; padding: 0 18px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; color: var(--grey-mid); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--black); color: var(--white); }
.bgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.bg { border: 1px solid var(--line); padding: 8px 8px 10px; text-align: left; transition: border-color .12s; }
.bg.on { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.bg i { display: block; aspect-ratio: 4/3; margin-bottom: 8px; border: 1px solid var(--line); }
.bg span { font-size: 12px; }
.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style { border: 1px solid var(--line); padding: 14px 12px; text-align: left; min-height: 64px; transition: border-color .12s, background .12s; font-size: 13px; }
.style small { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey-two); margin-bottom: 6px; }
.style.on { background: var(--black); color: var(--white); border-color: var(--black); }
.style.on small { color: #aaa; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); height: 38px; }
.stepper button { width: 38px; height: 100%; display: grid; place-items: center; }
.stepper button:hover { background: var(--grey-one); }
.stepper output { width: 44px; text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px; }
.pick { position: relative; aspect-ratio: 1; background: var(--grey-one); outline: 0 solid var(--black); outline-offset: 1px; }
.pick img { width: 100%; height: 100%; object-fit: contain; }
.pick.on { outline-width: 2px; }
.pick.on::after { content: attr(data-n); position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; background: var(--black); color: var(--white); font-size: 10.5px; display: grid; place-items: center; }
.drop { border: 1px dashed var(--line-2); padding: 22px; text-align: center; color: var(--grey-mid); font-size: 13px; transition: border-color .12s, background .12s; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--black); background: var(--grey-one); color: var(--ink); }
.drop b { display: block; color: var(--ink); font-weight: 400; margin-bottom: 4px; }
.slot { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); padding: 8px; min-height: 64px; }
.slot .sq { width: 48px; height: 48px; background: var(--grey-one); flex: none; background-size: contain; background-position: center; background-repeat: no-repeat; }
.slot .sq.checker { background-color: var(--white); background-image: linear-gradient(45deg, var(--grey-line) 25%, transparent 25%, transparent 75%, var(--grey-line) 75%), linear-gradient(45deg, var(--grey-line) 25%, transparent 25%, transparent 75%, var(--grey-line) 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.slot .sq img { width: 100%; height: 100%; object-fit: contain; }
.slot .txt { flex: 1; min-width: 0; font-size: 12.5px; }
.slot .txt small { display: block; color: var(--grey-mid); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.variant-card { border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; }
.variant-card .vh { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.variant-card .vh input[type=color] { width: 32px; height: 32px; border: 1px solid var(--line-2); padding: 0; background: none; }
.variant-card .vh input[type=text] { flex: 1; border: 0; border-bottom: 1px solid var(--line-2); padding: 6px 0; outline: 0; font-size: 16px; }
.slots3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.banner { background: var(--grey-one); padding: 14px 16px; font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; }
.banner.dark { background: var(--inv-bg); color: var(--inv-fg); }
.banner.dark a { color: inherit; }
.cost { font-variant-numeric: tabular-nums; }

/* jobs */
.job { padding: 16px 0; border-bottom: 1px solid var(--line); }
.job-h { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.job-h small { color: var(--grey-mid); font-size: 11.5px; white-space: nowrap; }
.bar { height: 2px; background: var(--grey-line); margin: 10px 0 8px; position: relative; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--black); transition: width .4s var(--ease); }
.bar.run i { min-width: 8%; }
.job-log { font-size: 11.5px; color: var(--grey-mid); }
.job.failed .job-h b { color: var(--warn); }
.status-tag { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; }

/* lightbox */
.lb { position: fixed; inset: 0; background: #050505; z-index: 60; display: grid; grid-template-rows: auto 1fr auto; color: #fff; animation: fade .2s; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: calc(16px + var(--top-safe)) 20px 16px; font-size: 12.5px; color: #aaa; gap: 20px; }
.lb-top .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-top .acts { display: flex; gap: 6px; flex: none; }
.lb .icon-btn { background: transparent; border-color: #333; color: #ddd; }
.lb .icon-btn:hover { background: #fff; color: #000; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 70px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; display: grid; place-items: center; color: #999; }
.lb-nav:hover { color: #fff; }
.lb-nav svg { width: 28px; height: 28px; stroke-width: 1.2; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lb-foot { padding: 14px 20px; text-align: center; font-size: 11.5px; color: #777; font-variant-numeric: tabular-nums; }

.toast { position: fixed; bottom: 26px; right: 26px; background: var(--inv-bg); color: var(--inv-fg); padding: 12px 16px; font-size: 13px; z-index: 70; max-width: 380px; animation: rise2 .2s var(--ease); display: flex; gap: 14px; align-items: center; }
.toast button { color: inherit; text-decoration: underline; font-size: 12px; }
@keyframes rise2 { from { transform: translateY(10px); opacity: 0; } }

.loading { flex: 1; display: grid; place-items: center; color: var(--grey-mid); }
.loading .big { font-weight: 100; font-size: 54px; color: var(--ink); letter-spacing: -0.02em; }
.spin { width: 14px; height: 14px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 1280px) { :root { --insp-w: 360px; --rail-w: 248px; } h1 { font-size: 38px; } }

/* narrower windows: the inspector slides over the grid instead of taking a column */
.insp-close { display: none; }
@media (max-width: 1180px) {
  #app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  #inspector { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--insp-w), 92vw); z-index: 40; transform: translateX(105%); transition: transform .26s var(--ease); box-shadow: -24px 0 60px rgba(0,0,0,0.14); }
  body.insp-open #inspector { transform: none; }
  .insp-close { display: grid; }
  .selbar { left: calc(var(--rail-w) + (100vw - var(--rail-w)) / 2); }
  .head-actions .btn { padding: 0 12px; }
}
@media (max-width: 1000px) {
  :root { --rail-w: 220px; }
  .title-row { flex-direction: column; align-items: flex-start; }
  .head { padding: 24px 24px 0; } .tabs, .toolbar { padding-left: 24px; padding-right: 24px; } .scroller { padding: 18px 24px 120px; }
  .tabs { gap: 18px; overflow-x: auto; } .tab { white-space: nowrap; }
  .styles { grid-template-columns: repeat(2, 1fr); } .bgs { grid-template-columns: repeat(2, 1fr); } .row3 { grid-template-columns: 1fr; }
}

/* ---------- resizable panes ---------- */
.splitter { position: absolute; z-index: 20; }
.splitter::after { content: ""; position: absolute; background: var(--black); opacity: 0; transition: opacity .15s; }
.splitter:hover::after, .splitter.drag::after { opacity: .5; }
.splitter.v { top: 0; bottom: 0; width: 9px; cursor: col-resize; }
.splitter.v::after { top: 0; bottom: 0; left: 4px; width: 1px; }
.splitter.h { left: 0; right: 0; height: 9px; cursor: row-resize; margin: -4px 0; position: relative; flex: none; }
.splitter.h::after { left: 0; right: 0; top: 4px; height: 1px; }
#rail .splitter.v { right: -5px; }
#rail .splitter.v::after { background: var(--r-fg); }
#inspector > .splitter.v { left: -5px; }
body.resizing, body.resizing * { user-select: none !important; cursor: inherit; }
body.resizing.col { cursor: col-resize; } body.resizing.row { cursor: row-resize; }
body.resizing iframe, body.resizing video { pointer-events: none; }

/* ---------- appearance picker ---------- */
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.theme { border: 1px solid var(--line); padding: 8px 8px 10px; text-align: left; font-size: 12px; transition: border-color .12s; }
.theme.on { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.theme .mini { display: grid; grid-template-columns: 30% 1fr; aspect-ratio: 16/10; margin-bottom: 8px; border: 1px solid var(--line-2); overflow: hidden; }
.theme .mini i { display: block; } .theme .mini .auto { grid-column: 1 / -1; background: linear-gradient(135deg, #fff 0 49.5%, #000 50.5%); }
.theme-pop { position: fixed; z-index: 60; background: var(--white); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0,0,0,0.2); padding: 14px; width: 440px; color: var(--ink); animation: fade .15s; }
.theme-pop .themes { grid-template-columns: repeat(5, 1fr); }

/* native window: leave room for the traffic lights */
html.native { --top-safe: 28px; }
.sheet-f { flex-wrap: wrap; } .sheet-f > span:last-child { flex-wrap: wrap; justify-content: flex-end; }

/* rail filters */
.rail-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 96px); gap: 6px; margin: 10px 16px 0; overflow: hidden; }
.rail-filters select { min-width: 0; width: 100%; background: var(--r-hover); color: var(--r-fg2); border: 1px solid var(--r-line); height: 28px; font-size: 11.5px; padding: 0 6px; outline: 0; border-radius: 0; max-width: 100%; }
html[data-rail="light"] .rail-filters select { background: var(--r-bg); }
/* jobs strip in the product view */
.jobstrip { margin: 0 0 22px; border: 1px solid var(--line); padding: 10px 14px 12px; display: grid; gap: 10px; }
.jobstrip.closed { padding-bottom: 10px; }
.jobstrip-h { display: flex; justify-content: space-between; align-items: center; width: 100%; font-size: 12.5px; text-align: left; }
.jobstrip-h .chev { width: 14px; height: 14px; transition: transform .18s var(--ease); }
.jobstrip.closed .chev { transform: rotate(-90deg); }
.jobstrip-h .link:hover { color: var(--ink); }
.jobstrip .row { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
.jobstrip .row .bar { flex: 1; margin: 0; }
.jobstrip .thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.jobstrip .thumbs img, .job .thumbs img { width: 52px; height: 52px; object-fit: cover; background: var(--grey-one); }
.job .thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* library picker tabs */
.ptabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.ptabs button { padding: 10px 0; font-size: 12.5px; color: var(--grey-mid); position: relative; }
.ptabs button.on { color: var(--ink); } .ptabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--black); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.lib-item { border: 1px solid var(--line); padding: 6px; text-align: left; font-size: 11.5px; }
.lib-item.on { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.lib-item .sq { aspect-ratio: 1; background: var(--grey-one); margin-bottom: 6px; display: grid; place-items: center; overflow: hidden; }
.lib-item .sq img { width: 100%; height: 100%; object-fit: contain; }
.lib-item .sq.checker { background-color: var(--white); background-image: linear-gradient(45deg, var(--grey-line) 25%, transparent 25%, transparent 75%, var(--grey-line) 75%), linear-gradient(45deg, var(--grey-line) 25%, transparent 25%, transparent 75%, var(--grey-line) 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.cropper { position: relative; display: inline-block; max-width: 100%; user-select: none; }
.cropper img { display: block; max-width: 100%; max-height: 420px; }
.cropper .box { position: absolute; border: 2px solid #fff; outline: 1px solid rgba(0,0,0,.6); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); cursor: move; }

/* stars */
.stars, .starfilter { display: inline-flex; align-items: center; }
.star { font-size: 18px; line-height: 1; color: var(--grey-line); padding: 0 2px; transition: color .1s, transform .1s; }
.star:hover { transform: scale(1.15); color: var(--grey-two); }
.star.on { color: var(--black); }
.starfilter .star { font-size: 15px; }
.selbar .star { color: rgba(128,128,128,.6); } .selbar .star:hover { color: var(--inv-fg); }
.insp-body .stars { margin: 0 0 16px; }
.badge-stars { position: absolute; right: 8px; bottom: 8px; height: 20px; padding: 0 6px; background: var(--white); color: var(--black); font-size: 11px; letter-spacing: .05em; display: flex; align-items: center; }

/* colour palettes */
.pal-row { display: block; margin-bottom: 14px; }
.pal-label { display: block; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--grey-mid); font-weight: 500; margin-bottom: 8px; }
.pal-row .swatch { display: inline-grid; vertical-align: top; }
.pal-row > .swatch { margin: 0 6px 6px 0; }
.swatch { display: grid; gap: 4px; justify-items: center; width: 60px; padding: 3px; border: 1px solid transparent; font-size: 9.5px; color: var(--grey-mid); transition: border-color .12s; text-align: center; line-height: 1.15; }
.swatch span { min-height: 2.3em; }
.swatch .sq { position: relative; width: 44px; height: 44px; display: block; }
.swatch img, .swatch .sq i { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--line); display: block; }
.swatch .ex { position: absolute; right: -4px; top: -4px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--black); color: var(--white); font-size: 9px; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; justify-content: center; }
.swatch .ex .webdot { width: 5px; height: 5px; }
.swatch.exists span:last-child { color: var(--ink); }
.swatch:hover { border-color: var(--line-2); }
.swatch.on { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); color: var(--ink); }

/* profile row + people table */
.rail-link.me { gap: 10px; }
.rail-link.me b { display: block; font-weight: 400; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-link.me i { display: block; font-style: normal; font-size: 10.5px; color: var(--r-mute); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--r-fg); color: var(--r-bg); display: inline-grid; place-items: center; font-size: 12px; font-weight: 500; flex: none; }
.people { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.people td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.people select { border: 1px solid var(--line-2); padding: 5px 8px; background: var(--white); font-size: 12px; }
.people .chip { height: 24px; font-size: 11px; padding: 0 8px; }
