/* Doppel — one stylesheet. Theme tokens first; light and dark. */
/* Theme: light by default; dark when chosen ([data-theme=dark]) or when the OS is dark and the user hasn't picked
   light ([data-theme=system] / unset). Plexus Labs brand: orange accent, navy/teal dark surfaces. */
:root {
  --bg: #f6f5f3; --bg-2: #eeecea; --panel: #ffffff; --panel-2: #f8f7f5; --panel-3: #f0eeeb;
  --border: #e6e2de; --border-2: #d8d2cc;
  --text: #17161a; --text-2: #3d3a40; --muted: #67636c; --faint: #a39ea6;
  --accent: #d9481f; --accent-2: #fdece5; --accent-3: #f8d2c3; --accent-ink: #ffffff;
  --ok: #138a4a; --ok-bg: #e4f6ec; --warn: #9a6100; --warn-bg: #fff2d3; --err: #c0261b; --err-bg: #fde8e5;
  --info: #1f6fd1; --info-bg: #e5f0fd;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(30, 20, 15, .04), 0 4px 16px rgba(30, 20, 15, .05);
  --shadow-lg: 0 10px 40px rgba(30, 20, 15, .12);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  --grad: linear-gradient(135deg, #ff9a5c 0%, #e0492b 100%);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #091017; --bg-2: #0c151d; --panel: #0f1922; --panel-2: #13202b; --panel-3: #192835;
  --border: #1d2b37; --border-2: #283a49;
  --text: #e9eef2; --text-2: #c3ccd4; --muted: #8796a3; --faint: #56636e;
  --accent: #ff8a4c; --accent-2: #2b1810; --accent-3: #4a2617; --accent-ink: #1a0d06;
  --ok: #4fd08a; --ok-bg: #0f2a1d; --warn: #f0b44a; --warn-bg: #2d2311; --err: #ff7a6b; --err-bg: #331512;
  --info: #6aa8ff; --info-bg: #102338;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #091017; --bg-2: #0c151d; --panel: #0f1922; --panel-2: #13202b; --panel-3: #192835;
    --border: #1d2b37; --border-2: #283a49;
    --text: #e9eef2; --text-2: #c3ccd4; --muted: #8796a3; --faint: #56636e;
    --accent: #ff8a4c; --accent-2: #2b1810; --accent-3: #4a2617; --accent-ink: #1a0d06;
    --ok: #4fd08a; --ok-bg: #0f2a1d; --warn: #f0b44a; --warn-bg: #2d2311; --err: #ff7a6b; --err-bg: #331512;
    --info: #6aa8ff; --info-bg: #102338;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--panel-3); padding: 1px 5px; border-radius: 5px; }
pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; max-height: 520px; margin: 0; line-height: 1.5; }
h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; } .icon.lg { width: 28px; height: 28px; }

/* ---- layout ---------------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 3px 8px rgba(224, 73, 43, .35)); }
.brand .name { display: flex; flex-direction: column; line-height: 1.1; }
.brand .name b { font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.brand .name span { font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.nav .soon { margin-left: auto; font-size: 10px; color: var(--faint); border: 1px solid var(--border); border-radius: 99px; padding: 0 6px; font-weight: 500; }
.side .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--border); margin-top: 14px; }
.me .who { min-width: 0; flex: 1; font-size: 12.5px; line-height: 1.3; }
.me .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 26px 34px 70px; min-width: 0; max-width: 1480px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.page-head .crumbs a { color: var(--muted); }
.page-head .lede { color: var(--muted); margin: 6px 0 0; max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- surfaces ------------------------------------------------------------------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }

.stat { display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-2); color: var(--accent); display: grid; place-items: center; flex: none; }
.stat .n { font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table.hover tr:hover td { background: var(--panel-2); }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }

/* ---- badges, dots ------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--panel-3); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); } .pill.accent { background: var(--accent-2); color: var(--accent); }
.pill.info { background: var(--info-bg); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.err { background: var(--err); } .dot.accent { background: var(--accent); }
.dot.live { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- avatars ------------------------------------------------------------------------ */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--grad); flex: none; overflow: hidden; font-size: 14px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; } .avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.c1 { background: linear-gradient(135deg, #6d4aff, #c045ff); } .avatar.c2 { background: linear-gradient(135deg, #ff5d8f, #ff9a5a); }
.avatar.c3 { background: linear-gradient(135deg, #10b3a3, #3b82f6); } .avatar.c4 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.c5 { background: linear-gradient(135deg, #0ea5e9, #6366f1); } .avatar.c0 { background: linear-gradient(135deg, #64748b, #334155); }

/* ---- character cards ------------------------------------------------------------------ */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.ccard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ccard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-2); }
.ccard .top { padding: 18px 18px 12px; display: flex; gap: 14px; align-items: center; }
.ccard .name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--text); }
.ccard .key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.ccard .meta { padding: 0 18px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ccard .foot { margin-top: auto; border-top: 1px solid var(--border); display: flex; }
.ccard .foot a { flex: 1; text-align: center; padding: 10px 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); display: flex; justify-content: center; gap: 6px; align-items: center; }
.ccard .foot a + a { border-left: 1px solid var(--border); }
.ccard .foot a:hover { background: var(--panel-2); color: var(--accent); text-decoration: none; }
.ccard.new { border-style: dashed; align-items: center; justify-content: center; min-height: 190px; color: var(--muted); cursor: pointer; background: transparent; box-shadow: none; }
.ccard.new:hover { color: var(--accent); border-color: var(--accent); }

.hero { display: flex; gap: 18px; align-items: center; }
.hero .title { display: flex; flex-direction: column; gap: 4px; }

/* ---- forms ------------------------------------------------------------------------------ */
form.stack > * + * { margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
label, .label { display: block; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s; }
textarea { font-family: inherit; font-size: 14px; min-height: 260px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; }
input:disabled, select:disabled, textarea:disabled, fieldset:disabled input { opacity: .6; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); padding: 3px 0; cursor: pointer; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-2); }
.choice b { display: block; }
fieldset { border: 0; padding: 0; margin: 0; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; }

.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover, button:hover { background: var(--panel-2); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px rgba(224, 73, 43, .25); }
.btn.primary:hover, button.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover, button.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger, button.danger { color: var(--err); }
.btn.danger.solid, button.danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.sm, button.sm { padding: 5px 10px; font-size: 12px; }
button:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 550; display: flex; gap: 7px; align-items: center; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.err { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); }
.alert a { color: inherit; text-decoration: underline; }
.msg { padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 10px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); } .msg.err { background: var(--err-bg); color: var(--err); } .msg.warn { background: var(--warn-bg); color: var(--warn); }

.banner { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); } .banner.error { background: var(--err-bg); color: var(--err); }
.banner a { color: inherit; font-weight: 650; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty .icon { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 15px; }
.empty .btn { margin-top: 12px; }

/* ---- media ---------------------------------------------------------------------------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.thumb { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.thumb .pics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0/14px 14px; }
.thumb .cap { padding: 9px 10px; font-size: 12px; }
.viewer img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gallery .item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.gallery .item img { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; background: var(--panel-2); cursor: zoom-in; }
.gallery .item .cap { padding: 8px 10px; font-size: 12px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .82); display: grid; place-items: center; z-index: 50; padding: 30px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.dropzone { border: 2px dashed var(--border-2); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-2); color: var(--accent); }
.dropzone .icon { width: 30px; height: 30px; margin-bottom: 6px; }
.dropzone b { color: var(--text); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.files img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.segmented { display: inline-flex; background: var(--panel-3); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; color: var(--muted); }
.segmented button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

.progress { height: 8px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); transition: width .4s; }

.diff .add { color: var(--ok); } .diff .del { color: var(--err); } .diff .hunk { color: var(--accent); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.swatch { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 7px 10px; background: var(--panel-2); min-width: 0; }
.swatch .what { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.swatch .model { font-weight: 600; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.swatch .via { font-size: 11px; color: var(--muted); }
.swatch.unrestricted { border-left-color: var(--err); }

/* ---- chat --------------------------------------------------------------------------- */
.chat { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; height: calc(100vh - 150px); min-height: 520px; }
.chat .convs { display: flex; flex-direction: column; overflow: hidden; }
.chat .convs .list { overflow-y: auto; margin: 10px -8px 0; flex: 1; }
.chat .convs a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.chat .convs a:hover { background: var(--panel-2); text-decoration: none; }
.chat .convs a.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.chat .pane { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat .pane-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding: 18px; background: var(--panel-2); }
.bubble { max-width: min(72%, 620px); padding: 9px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.composer { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--panel); }
.composer input { border-radius: 99px; padding: 10px 16px; }
.composer button { border-radius: 99px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---- login ---------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 600px at 10% -10%, rgba(224, 73, 43, .16), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(31, 92, 102, .22), transparent 60%), var(--bg); }
.auth .card { width: 100%; max-width: 380px; padding: 30px; box-shadow: var(--shadow-lg); }
.auth .brand { padding: 0 0 6px; font-size: 22px; }
.auth .brand .mark { width: 34px; height: 34px; font-size: 18px; }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
.muted { color: var(--muted); } .small { font-size: 12px; }

.menu-btn { display: none; margin-right: auto; }
.nav-scrim { display: none; }
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  /* the sidebar becomes a drawer: one tap on the menu button, closed again by the scrim, Esc or a link */
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); height: 100vh; z-index: 60; transform: translateX(-102%);
    visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; visibility: visible; transition: transform .2s ease; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .45); }
  .g2, .g3, .g4, .split, .split-wide, .chat { grid-template-columns: 1fr; }
  .chat { height: auto; }
  main { padding: 18px 16px 60px; }
}
@media (prefers-reduced-motion: reduce) { .side, body.nav-open .side { transition: none; } }

/* ---- training curation grid ----------------------------------------------------- */
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { position: relative; border: 2px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); outline: none; }
.tile:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.tile.st-kept { border-color: var(--ok); } .tile.st-dropped { opacity: .45; }
.tile img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: var(--panel-2); cursor: zoom-in; }
.tile .sel { position: absolute; top: 6px; left: 6px; background: var(--panel); border-radius: 6px; padding: 3px 4px; line-height: 0; }
.tile .flags { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.tile .flags .pill { font-size: 10px; padding: 0 6px; }
.tile .acts { display: flex; gap: 4px; padding: 6px; justify-content: space-between; }
.tile .acts .sm { padding: 4px 8px; }

[x-cloak] { display: none !important; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 18px; align-items: start; }
.studio-side .card summary { cursor: pointer; list-style: none; }
.studio-side .card summary::-webkit-details-marker { display: none; }
@media (max-width: 1000px) { .studio-grid { grid-template-columns: minmax(0, 1fr); } }

/* notices: a bell with a count, top right — instead of a banner per character on every page */
main { position: relative; }
.notices { position: absolute; top: 14px; right: 18px; z-index: 30; }
.notices .bell { position: relative; padding: 6px 8px; }
.notices .count { position: absolute; top: -3px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; color: #fff; background: var(--warn); }
.notices .count.err { background: var(--err); }
.notices .panel { position: absolute; right: 0; top: 40px; width: min(380px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.notices .head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.notices .list { max-height: 60vh; overflow-y: auto; }
.notices .notice { display: flex; gap: 10px; align-items: flex-start; padding: 9px 14px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); }
.notices .notice:hover { background: var(--panel-2); }
.notices .notice .dot { margin-top: 5px; }
.page-head { padding-right: 56px; }
.bubble.thinking { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.proposal .steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.proposal .steps li { display: flex; gap: 8px; align-items: flex-start; }
.proposal .steps .st { width: 16px; flex: none; text-align: center; color: var(--muted); }
.proposal .steps li.done .st { color: var(--ok); } .proposal .steps li.failed .st { color: var(--err); }
.proposal .steps li.running { color: var(--text); font-weight: 600; } .proposal .steps li.skipped { color: var(--muted); text-decoration: line-through; }
.tile-menu { position: fixed; z-index: 60; width: 300px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 10px; margin: 0; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.tile-menu .row { gap: 4px 10px; } .tile-menu .check { padding: 1px 0; font-size: 12px; }
.studio-tabs { margin-bottom: 12px; }
.studio-tabs .pill { font-size: 10.5px; padding: 0 7px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.sheet-section { padding: 14px 16px; margin-bottom: 12px; }
.sheet-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.sheet-shot { width: 132px; flex: none; display: flex; flex-direction: column; gap: 4px; }
.sheet-shot img { width: 132px; height: 176px; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--panel-2); }
select.tiny { font-size: 11.5px; padding: 3px 6px; height: auto; }
.mark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mark-pick { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; }
.mark-pick img { width: 56px; height: 56px; object-fit: contain; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0/12px 12px; border-radius: 6px; }
.mark-maker { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; cursor: default; }
.mark-canvas { position: relative; display: inline-block; user-select: none; touch-action: none; cursor: crosshair; max-width: 100%; }
.mark-canvas img { display: block; max-width: 100%; max-height: 60vh; border-radius: 8px; }
.mark-box { position: absolute; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); pointer-events: none; }
.wardrobe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.wardrobe-item { margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.wardrobe-item img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--panel-2); border-radius: 8px; cursor: zoom-in; }
.studio-tabs { flex-wrap: nowrap; overflow-x: auto; }
.loc { width: 180px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.loc img { width: 180px; height: 120px; object-fit: cover; border-radius: 8px; }
.review { display: flex; gap: 16px; width: min(1200px, 94vw); height: min(860px, 90vh); padding: 14px; }
.review-main { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; background: var(--panel-2); border-radius: 10px; }
.review-main img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.review-flags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.review-side { width: 340px; flex-shrink: 0; overflow-y: auto; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 10px; }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; font: 11px var(--mono, monospace); text-align: center; background: var(--panel); }
pre.prompt { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 4px 0 10px; max-height: 260px; overflow-y: auto; }
figure.ref { margin: 0; width: 96px; } figure.ref img { width: 96px; height: 120px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
@media (max-width: 760px) { .review { flex-direction: column; height: 92vh; } .review-side { width: auto; } }
.meter { height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--warn, #d9a23b); }
.meter span.ok { background: var(--ok, #3a9a5b); }

/* ---- navigation: five items + a folded Admin group -------------------------------- */
details.nav-fold > summary { list-style: none; cursor: pointer; }
details.nav-fold > summary::-webkit-details-marker { display: none; }
details.nav-fold > summary .chev { margin-left: auto; transition: transform .15s; }
details.nav-fold[open] > summary .chev { transform: rotate(90deg); }
details.nav-fold .nav.sub { padding-left: 38px; font-size: 13px; }

/* ---- top bar: generation tray, notices --------------------------------------------- */
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: -10px 0 14px; min-height: 34px; }
.tray { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); color: var(--text-2); font-size: 12.5px; }
.tray:hover { text-decoration: none; border-color: var(--border-2); }
.tray .live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); animation: pulse 1.6s infinite; }
.tray .idle { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- theme switch in the account area ----------------------------------------------- */
.theme-switch { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel-2); margin: 10px 8px 0; }
.theme-switch button { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; padding: 3px 0; border-radius: 99px; cursor: pointer; }
.theme-switch button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* ---- page sub-tabs (Create: Shots · Planner · Review; Jobs: Local · Pod) ------------- */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 18px; }
.subtabs a { padding: 8px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { color: var(--text); text-decoration: none; }
.subtabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.subtabs .count { font-size: 11px; background: var(--accent-2); color: var(--accent); border-radius: 99px; padding: 0 6px; margin-left: 4px; }
.topbar .notices { position: relative; top: auto; right: auto; }

/* ---- top bar: the GPU pod indicator and its popover (admins; api/gpu_view.py) ---------- */
.gpu-ind { position: relative; z-index: 31; }
.gpu-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); color: var(--text-2); font-size: 12.5px; font-weight: 500; min-height: 32px; }
.gpu-btn:hover { border-color: var(--border-2); }
.gpu-face { display: inline-flex; align-items: center; gap: 6px; }
.gpu-face .gdot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.gpu-face.starting .gdot, .gpu-face.draining .gdot { background: var(--warn); animation: pulse 1.6s infinite; }
.gpu-face.busy .gdot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); animation: pulse 1.6s infinite; }
.gpu-face.idle .gdot { background: var(--ok); }
.gpu-face.local .gdot { background: var(--info); }
.gpu-face.blocked .gdot { background: var(--err); }
.gpu-face .glabel { font-variant-numeric: tabular-nums; }
.gpu-ind .panel { position: absolute; right: 0; top: 40px; width: min(420px, calc(100vw - 32px)); max-height: 78vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.gpu-pop-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.gpu-pop-body { padding: 12px 14px; font-size: 13px; }
.gpu-pop-body p { margin: 0 0 8px; }
.gpu-pod-head { gap: 8px; margin-bottom: 4px; }
.gpu-warm, .gpu-stop { gap: 6px; margin: 6px 0; }
.gpu-warm form, .gpu-stop form { margin: 0; }
.gpu-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.gpu-steps { list-style: none; margin: 0; padding: 0; }
.gpu-steps li { padding: 4px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.gpu-steps .gneed { display: block; } .gpu-steps .gneed.err { color: var(--err); }
.gpu-opts { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
.gpu-opts legend { font-weight: 650; padding: 0; margin-bottom: 4px; }
.gopt { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.gopt input { margin-top: 3px; flex: none; }
.gopt.off { opacity: .55; cursor: default; }
.gopt-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.gopt-fits .gfirst { font-weight: 650; color: var(--text-2); }
.gpu-start-opts { margin: 8px 0; } .gpu-start-opts select, .gpu-adv select { margin-left: 6px; }
.gpu-adv { margin: 4px 0 8px; } .gpu-pick { margin: 8px 0; }
.gpu-card-pod .gpu-pod { max-width: 640px; }

/* ---- Create ---------------------------------------------------------------------------- */
.composer .who { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-char { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--border); border-radius: 99px; cursor: pointer; background: var(--panel-2); }
.chip-char input { display: none; }
.chip-char img, .chip-char .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.chip-char:has(input:checked) { border-color: var(--accent); background: var(--accent-2); color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 550; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.advanced > summary { cursor: pointer; }
.feed { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.post-head .kind { color: var(--accent); display: inline-flex; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.post-grid img { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.shot-row { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.shot-row:first-of-type { border-top: 0; }
.shot-row video { width: 200px; aspect-ratio: 9/16; border-radius: 10px; background: #000; flex: none; }
.bar { height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--grad); }
.planned { display: flex; gap: 8px; align-items: flex-end; padding: 8px 0; border-top: 1px solid var(--border); }
.planned .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-2); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; margin-bottom: 8px; }
.prompt-box textarea[name=prompt] { font-size: 15px; line-height: 1.5; resize: vertical; }
.mention-wrap { position: relative; }
.mention-pop { position: absolute; left: 12px; top: 100%; z-index: 20; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 220px; }
.mention-pop button { display: flex; gap: 8px; width: 100%; border: 0; background: transparent; padding: 6px 10px; border-radius: 7px; text-align: left; cursor: pointer; color: var(--text); }
.mention-pop button.on, .mention-pop button:hover { background: var(--accent-2); }
.cast-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.cast-chips .chip-char { font-size: 12.5px; }
.prompt-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prompt-bar select { width: auto; }
.prompt-echo { margin: 0 0 10px; color: var(--text-2); font-style: italic; }
.stepper { display: flex; gap: 4px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 12px; }
.stepper li { padding: 3px 10px; border-radius: 99px; color: var(--faint); background: var(--panel-2); }
.stepper li.done { color: var(--ok); }
.stepper li.on { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.shot-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; }
.shot-card textarea { font-size: 13px; }
.final video { width: 300px; max-width: 100%; aspect-ratio: 9/16; border-radius: 12px; background: #000; }

/* ---- character workspace ----------------------------------------------------------------- */
.ws-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.ws-face .avatar { width: 64px; height: 64px; }
.ws-title { flex: 1; min-width: 260px; }
.ws-title h1 { margin: 2px 0 6px; }
.ws-at { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.ws-ready { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ready-chip { font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); background: var(--panel); }
.ready-chip:hover { text-decoration: none; border-color: var(--border-2); }
.ready-chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.ready-chip.todo { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-bg); }
.ready-chip.opt { color: var(--muted); }
.ws-actions { display: flex; gap: 8px; }
.ws-tabs { margin-bottom: 14px; }

/* ---- Look tab: the work on the left, the Assistant on the right ------------------------- */
.look-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 18px; align-items: start; }
.look-assistant { position: sticky; top: 14px; }
.assistant-title { display: flex; gap: 8px; align-items: baseline; margin: 0 0 8px; flex-wrap: wrap; }
.look-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.look-switch { position: relative; }
.look-switch > summary { list-style: none; cursor: pointer; }
.look-switch > summary::-webkit-details-marker { display: none; }
.look-pop { position: absolute; right: 0; top: 36px; width: 320px; z-index: 25; box-shadow: var(--shadow-lg); }
.fill-sheet > summary { cursor: pointer; }
@media (max-width: 1100px) { .look-grid { grid-template-columns: minmax(0, 1fr); } .look-assistant { position: static; } }

/* Create › Planner (brief §9.52) */
.planner-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 14px; }
.planner-bar form.inline { display: flex; gap: 8px; align-items: center; }
.week-nav { display: flex; gap: 8px; align-items: center; margin-right: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
@media (max-width: 1100px) { .cal { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.cal-day { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
.cal-day.today { border-color: var(--accent); }
.cal-day > header { display: flex; gap: 6px; align-items: baseline; }
.post-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; white-space: normal; font-weight: 500; width: 100%; }
.post-card:hover { border-color: var(--accent); background: var(--panel); }
.post-card .post-text { font-size: 12.5px; line-height: 1.4; color: var(--text); }
.post-card.status-needs-approval { border-color: var(--warn); }
.post-add { align-self: flex-start; }
.set.idea { max-width: 720px; margin: 0 auto; }
.post-card[open] { box-shadow: var(--shadow, 0 4px 18px rgba(0,0,0,.08)); }
.post-card summary { list-style: none; color: var(--text); font-weight: 500; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.post-card summary::-webkit-details-marker { display: none; }
.post-card summary p { margin: 2px 0 0; width: 100%; line-height: 1.4; }
.post-card .err-text, .err-text { color: var(--err); font-size: 12px; margin: 2px 0 0; width: 100%; }
.post-edit { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.post-edit textarea, .post-edit input[type=text], .post-add textarea, .post-add input[type=text] { width: 100%; font-size: 12.5px; }
.post-edit .row, .post-add .row { gap: 6px; }
.post-edit select, .post-add select { font-size: 12px; padding: 4px 6px; }
.post-edit .check, .post-add .check { font-size: 12px; gap: 4px; }
.post-add form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.approval-row { display: flex; gap: 14px; align-items: center; padding: 4px 0; }
.approval-row span { min-width: 160px; }

/* Create sets (brief §9.53): a cube per set in the feed; the set view grows out of it */
.feed.sets { display: flex; flex-direction: column; gap: 12px; }
.set-card { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 14px 18px; }
.set-card-body { cursor: pointer; min-width: 0; }
.set-card-body .prompt-echo { margin: 6px 0 0; }
.set-card-video { width: 120px; max-height: 200px; border-radius: 10px; background: #000; }
.cube-btn { width: 96px; height: 96px; padding: 0; border: 0; background: none; perspective: 420px; }
.cube-btn:hover { background: none; }
.cube { --s: 56px; width: var(--s); height: var(--s); margin: auto; position: relative; transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-34deg); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.cube-btn:hover .cube { transform: rotateX(-28deg) rotateY(146deg) scale(1.08); }
.cube.spin { animation: cube-spin 9s linear infinite; }
@keyframes cube-spin { from { transform: rotateX(-22deg) rotateY(0deg); } to { transform: rotateX(-22deg) rotateY(360deg); } }
.cube-face { position: absolute; inset: 0; border-radius: 6px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(135deg, var(--accent-2), var(--panel-2)); display: grid; place-items: center; backface-visibility: hidden; }
.cube-face img { width: 100%; height: 100%; object-fit: cover; }
.cube-face span { font-weight: 700; color: var(--accent); }
.cube-face.front { transform: translateZ(calc(var(--s) / 2)); }
.cube-face.back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.cube-face.right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.stage-needs-approval .cube-face { border-color: var(--warn); }

body.set-open { overflow: hidden; }
.set-layer { position: fixed; inset: 0; z-index: 60; }
.set-layer[hidden] { display: none; }
.set-scrim { position: absolute; inset: 0; background: color-mix(in srgb, #000 45%, transparent); backdrop-filter: blur(3px); }
.set-panel { position: absolute; inset: 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35); transform-origin: 0 0; display: flex; }
.set-slot { flex: 1; overflow: auto; padding: 18px 24px 28px; min-width: 0; }
.set-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; top: -18px; background: var(--bg); padding: 12px 0; z-index: 2; }
.set-title { margin-right: auto; min-width: 0; }
.set-title h2 { margin: 0; }
.set-head .stepper { margin: 0; }
.set-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 300px); gap: 14px; overflow-x: auto; padding: 4px 2px 14px; }
.set-shot { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px;
  animation: shot-in .45s cubic-bezier(.2, .8, .2, 1) both; }
.set-shot:nth-child(2) { animation-delay: .05s; } .set-shot:nth-child(3) { animation-delay: .1s; } .set-shot:nth-child(4) { animation-delay: .15s; }
.set-shot:nth-child(n+5) { animation-delay: .2s; }
@keyframes shot-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.set-shot.needs { border-color: var(--warn); }
.set-frame { position: relative; border-radius: 10px; overflow: hidden; background: var(--panel-2); aspect-ratio: 9 / 16; max-height: 360px; }
.set-frame.aspect-4x5 { aspect-ratio: 4 / 5; } .set-frame.aspect-1x1 { aspect-ratio: 1; } .set-frame.aspect-16x9 { aspect-ratio: 16 / 9; }
.set-frame img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.set-frame-empty { position: absolute; inset: 0; padding: 14px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  background: linear-gradient(160deg, var(--accent-2), var(--panel-2) 70%); color: var(--text-2); font-size: 12.5px; }
.set-frame-empty b { font-size: 34px; color: var(--accent); line-height: 1; }
.set-num { position: absolute; top: 8px; left: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.set-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .25); }
.set-progress span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.set-shot-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.set-edit { display: flex; flex-direction: column; gap: 6px; }
.set-edit textarea { width: 100%; font-size: 12.5px; }
.set-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.set-final video { max-height: 62vh; max-width: 100%; border-radius: 12px; background: #000; }

.set-drawer { width: 0; overflow: hidden; border-left: 1px solid var(--border); background: var(--panel); transition: width .32s cubic-bezier(.2, .8, .2, 1); }
.set-drawer.open { width: min(460px, 92vw); overflow-y: auto; padding: 0 18px 24px; }
@media (max-width: 760px) { .set-drawer.open { position: absolute; inset: 0 0 0 auto; z-index: 3; } .set-panel { inset: 0; border-radius: 0; } }
.drawer-head { display: flex; gap: 8px; align-items: center; position: sticky; top: 0; background: var(--panel); padding: 14px 0 10px; z-index: 1; }
.drawer-head .hint { margin-right: auto; }
.drawer-form { display: flex; flex-direction: column; gap: 10px; }
.drawer-form textarea, .drawer-form input[type=text], .drawer-form input[type=number], .drawer-form select { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-frame { width: 100%; border-radius: 10px; cursor: zoom-in; }
.drawer-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.drawer-facts dt { color: var(--muted); }
.drawer-facts dd { margin: 0; }
.drawer-shot { border-bottom: 1px solid var(--border); padding: 8px 0; }
.regen-shot { border-bottom: 1px solid var(--border); padding: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.regen-shot-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.regen-thumb { width: 40px; height: 52px; object-fit: cover; border-radius: 6px; }
.regen-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.regen-row .regen-from { display: flex; gap: 6px; align-items: center; flex: 1 1 220px; font-size: 13px; }
.drawer-form .regen-row select { width: auto; flex: 1; min-width: 0; }
.regen-indent { padding-left: 24px; }
.regen-edit[open] { display: flex; flex-direction: column; gap: 8px; }
.regen-preview ul { margin: 6px 0; padding-left: 18px; }
.regen-shot .regen-del { margin-left: auto; font-size: 13px; }
.regen-new { border-left: 3px solid var(--accent); padding-left: 8px; }
.regen-gone, .regen-shot:has(.regen-del input:checked) { opacity: .55; }
.regen-add { display: flex; justify-content: center; margin: -4px 0; }
.regen-add button { font-size: 12px; padding: 2px 10px; }
.regen .field label, .regen .regen-row > label.field { font-size: 13px; }
.regen .regen-row > label.field { display: flex; gap: 6px; align-items: center; }
.assist-set { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.assist-note { font-size: 13px; }
@media (max-width: 560px) { .regen-shot .regen-del { margin-left: 0; } .regen .regen-row > label.field { flex: 1 1 100%; } }
/* Assistants (the dock, the Lab page, the set drawer): a chat that reads like the ones people know — their message on the
   right in the accent colour, the assistant's on the left with its mark and no box around it. The dock is its own dark
   surface in both themes: its tokens are remapped inside it, so every button, pill and input in it follows. */
.assist-thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.assist-msg { display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.assist-msg.mine { justify-content: flex-end; }
.assist-msg.mine .assist-text { background: var(--accent); color: var(--accent-ink); padding: 9px 14px; border-radius: 18px 18px 4px 18px; max-width: 86%; }
.assist-msg.ai .assist-text { flex: 1; min-width: 0; padding-top: 3px; line-height: 1.55; }
.assist-text { white-space: normal; }
.assist-msg.mine .assist-text { white-space: pre-wrap; }
.assist-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--grad); color: #fff; }
.assist-avatar .icon { width: 15px; height: 15px; }
.assist-avatar.lg { width: 44px; height: 44px; } .assist-avatar.lg .icon { width: 22px; height: 22px; }
.assist-images { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.assist-images img { width: 92px; height: 122px; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 1px solid var(--border); }
.assist-card { margin: 0 0 0 38px; padding: 12px 14px; border: 1px solid var(--border-2); border-left: 3px solid var(--accent); border-radius: 12px; background: var(--panel-2); overflow-wrap: anywhere; font-size: 13.5px; }
.assist-card ul { margin: 6px 0; padding-left: 18px; }
.assist-event { margin-left: 38px; font-size: 12px; color: var(--muted); }
.assist-event > summary { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border); list-style: none; }
.assist-event > summary::-webkit-details-marker { display: none; }
.assist-event pre { max-height: 220px; overflow: auto; white-space: pre-wrap; }
.assist-diff { width: 100%; border-collapse: collapse; margin: 4px 0; table-layout: fixed; }
.assist-diff th { text-align: left; vertical-align: top; width: 88px; padding: 2px 6px 2px 0; font-weight: 600; }
.assist-diff td { overflow-wrap: anywhere; }
.assist-diff del { display: block; color: var(--err); }
.assist-diff ins { display: block; color: var(--ok); text-decoration: none; }
.assist-divider { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.assist-divider::before, .assist-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
/* what a reply asks the screen to do (open a panel, go to a page): shown as a question — nothing moves until they say so */
.assist-ui { margin-left: 38px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border: 1px dashed var(--border-2); border-radius: 12px; font-size: 13px; }
.assist-ui.done { opacity: .55; }
.assist-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 22px 10px; color: var(--muted); }
.assist-empty p { margin: 0; max-width: 320px; line-height: 1.55; }
.assist-typing { display: inline-flex; gap: 4px; margin: 0 0 0 38px; padding: 4px 0; }
.assist-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: assist-dot 1.2s ease-in-out infinite; }
.assist-typing i:nth-child(2) { animation-delay: .15s; } .assist-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes assist-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .assist-typing i { animation: none; opacity: .6; } }
/* the composer: a rounded input that grows, with a round send button */
.assist-ask { position: sticky; bottom: -10px; margin: 0 -12px -10px; padding: 12px 12px 10px; background: linear-gradient(to top, var(--panel) 80%, transparent); display: block; }
.assist-composer { display: flex; align-items: flex-end; gap: 8px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 22px; padding: 6px 6px 6px 16px; transition: border-color .15s, box-shadow .15s; }
.assist-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.assist-composer textarea[data-enter-send] { flex: 1; min-height: 24px; max-height: 160px; border: 0; background: transparent; box-shadow: none; padding: 6px 0; resize: none; font: inherit; font-size: 14px; line-height: 1.45; outline: none; }
.assist-send { width: 34px; height: 34px; border-radius: 50%; padding: 0; flex: none; background: var(--accent); color: var(--accent-ink); border: 0; display: grid; place-items: center; }
.assist-send:disabled { opacity: .35; cursor: not-allowed; }
.assist-keys { margin: 6px 0 0 8px; font-size: 11px; color: var(--muted); }
.assist-hl { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; transition: outline-color .3s; }
/* the dock: bottom-right, above the set layer (60) and the GPU popover (31), under the busy bar; it steps left of an open
   set drawer on a wide screen, and is a bottom sheet on a phone */
.assist-dock { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
.assist-dock > * { pointer-events: auto; }
.assist-launch { height: 48px; padding: 0 20px 0 16px; border-radius: 99px; gap: 8px; display: inline-flex; align-items: center; font-weight: 650; box-shadow: var(--shadow-lg); background: var(--grad); color: #fff; border: 0; position: relative; }
.assist-launch:hover { filter: brightness(1.07); }
.assist-launch .icon { width: 18px; height: 18px; }
.assist-launch.working { animation: assist-pulse 1.6s ease-in-out infinite; }
@keyframes assist-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }
.assist-badge { position: absolute; top: -5px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #fff; color: #c0261b; font-size: 11.5px; font-weight: 800; line-height: 20px; text-align: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.assist-badge[hidden] { display: none; }
.assist-panel { color-scheme: dark;
  --bg: #091017; --bg-2: #0c151d; --panel: #101c28; --panel-2: #172737; --panel-3: #1e3144; --border: #223446; --border-2: #30465b;
  --text: #eef3f7; --text-2: #cdd7df; --muted: #93a6b6; --faint: #5f7080;
  --accent: #ff8a4c; --accent-2: #3a2013; --accent-3: #5a2f1a; --accent-ink: #1a0d06;
  --ok: #4fd08a; --ok-bg: #0f2a1d; --warn: #f0b44a; --warn-bg: #2d2311; --err: #ff7a6b; --err-bg: #331512; --info: #6aa8ff; --info-bg: #102338;
  width: min(420px, calc(100vw - 36px)); height: min(72vh, 740px); background: var(--panel); color: var(--text); border: 1px solid var(--border-2); border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 138, 76, .16); display: flex; flex-direction: column; overflow: hidden; }
.assist-panel[hidden] { display: none; }
.assist-dock[data-max="1"] .assist-panel { width: min(780px, calc(100vw - 36px)); height: calc(100vh - 110px); }
.assist-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(135deg, #1c3047, #111d2a); border-bottom: 1px solid var(--border); }
.assist-heading { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.assist-heading b { font-size: 14px; } .assist-heading span { font-size: 11.5px; color: var(--muted); }
.assist-bar .spacer, .assist-where .spacer { flex: 1; }
.assist-bar button { color: var(--text-2); }
.assist-body { flex: 1; overflow-y: auto; padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.assist-body .assist-thread { flex: 1; margin-bottom: 0; }
.assist-where { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; position: sticky; top: -12px; background: var(--panel); padding: 8px 0 6px; z-index: 1; }
.assist-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.assist-waiting ul, .assist-sessions { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.assist-session { width: 100%; justify-content: flex-start; text-align: left; white-space: normal; flex-direction: column; align-items: flex-start; gap: 2px; }
body:has(.set-drawer.open) .assist-dock { right: calc(18px + min(460px, 92vw) + 14px); }
body:has(#assist-dock[data-open="1"]) #busy-note { right: 90px; }
@media (max-width: 760px) {
  .assist-dock, body:has(.set-drawer.open) .assist-dock { right: 12px; bottom: 12px; }
  .assist-dock[data-open="1"] { left: 0; right: 0; bottom: 0; align-items: stretch; }
  .assist-dock[data-open="1"] .assist-launch { display: none; }
  .assist-panel, .assist-dock[data-max="1"] .assist-panel { width: 100%; height: 86vh; border-radius: 18px 18px 0 0; }
  .assist-dock[data-max="1"] .assist-panel { height: 100vh; border-radius: 0; }
}
.takes .take { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.spec-json { font-size: 11px; max-height: 320px; overflow: auto; background: var(--panel-2); padding: 8px; border-radius: 8px; }
.pod-log { max-height: 520px; white-space: pre-wrap; word-break: break-all; }
.steps-table { width: 100%; font-size: 12px; }
.steps-table td { padding: 6px 4px; vertical-align: top; border-bottom: 1px solid var(--border); }
.steps-table img, .steps-table video { height: 60px; border-radius: 6px; }
.steps-table audio { width: 160px; height: 28px; }
@media (max-width: 640px) { .set-card { grid-template-columns: 72px minmax(0, 1fr); } .set-card-video { grid-column: 1 / -1; width: 100%; } .cube-btn { width: 72px; height: 72px; } .cube { --s: 44px; } }
@media (prefers-reduced-motion: reduce) { .cube.spin { animation: none; } .set-shot { animation: none; } }
.set-frame:has(.set-frame-empty) { aspect-ratio: auto; height: 150px; }
.set-edit textarea[name=description] { max-height: 180px; }
.idea-form textarea { min-height: 0; }
.idea-form .row select { width: auto; min-width: 110px; }
.set-plan-row { display: flex; gap: 10px; align-items: center; margin: -4px 0 12px; flex-wrap: wrap; }
.set-schedule summary { display: inline-flex; gap: 6px; align-items: center; }
.post-open { display: flex; flex-direction: column; gap: 4px; cursor: pointer; width: 100%; }
.post-open video, .post-open img { width: 100%; border-radius: 8px; background: #000; max-height: 220px; object-fit: cover; }
.tier-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.post-card.tier-plan { border-left: 3px solid var(--accent); }
.post-card.tier-made { border-left: 3px solid var(--ok); }
.post-card.status-new-idea { border-style: dashed; }

/* Home's flow (brief §9.53): needs you · making & up next · recently made */
.home-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.home-flow .home-made { grid-column: 1 / -1; }
@media (max-width: 900px) { .home-flow { grid-template-columns: 1fr; } }
.home-tile { display: flex; gap: 12px; align-items: center; width: 100%; padding: 8px; margin-bottom: 6px; text-align: left; white-space: normal; font-weight: 500; }
.home-tile video, .home-tile img, .home-tile-ph { width: 54px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; display: grid; place-items: center; color: var(--accent); }
.home-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-made-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.home-made-grid .home-tile { flex-direction: column; align-items: stretch; }
.home-made-grid .home-tile video, .home-made-grid .home-tile img, .home-made-grid .home-tile-ph { width: 100%; height: 200px; }
.home-next { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); color: inherit; }
.home-next:hover { text-decoration: none; background: var(--panel-2); }
.home-ideas { display: block; margin-top: 8px; font-weight: 600; }
.home-tile { justify-content: flex-start; }
.lightbox video { max-height: 100%; max-width: 100%; border-radius: 12px; background: #000; cursor: default; }
.vid { position: relative; }
.vid video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; background: #000; display: block; }
.vid-expand, .vid-dl { position: absolute; top: 8px; width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; opacity: .85; }
.vid-expand { right: 8px; }
.vid-dl { right: 44px; }
.vid-expand:hover, .vid-dl:hover { background: rgba(0, 0, 0, .8); opacity: 1; }
.set-shot:has(.set-frame-empty.cont) { border-left: 3px solid var(--accent); }
.set-frame-empty.cont { background: linear-gradient(160deg, var(--panel-2), var(--accent-2)); }
.sfw-target { padding: 8px 12px; margin: 6px 0 4px; background: var(--panel-2); border-radius: var(--radius-sm); gap: 8px; }
.link-btn { padding: 2px 8px; border: 0; background: none; color: var(--accent); font-weight: 650; text-decoration: underline dotted; }
.link-btn:hover { background: var(--accent-2); }

/* Voice Builder (brief §9.55 A) */
.voice-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.6fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1200px) { .voice-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .voice-grid { grid-template-columns: 1fr; } }
.voice-round { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.voice-round > .hint { grid-column: 1 / -1; }
.voice-cand { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.voice-cand audio { width: 100%; height: 34px; }
.voice-cand .hint { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
.voice-cand.picked { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
@media (max-width: 640px) { .voice-round { grid-template-columns: 1fr; } }
.voice-way { padding: 10px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.voice-way:first-of-type { border-top: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* Library v2 (brief §9.55 G) */
.lib-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.lib-bar .grow { flex: 1; min-width: 220px; }
.lib-cols { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.lib-newcol summary { list-style: none; cursor: pointer; }
.lib-newcol[open] { display: flex; gap: 6px; align-items: center; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lib-tile { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.lib-tile > img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
.lib-tile .cap { display: flex; align-items: center; gap: 4px; font-size: 12px; min-width: 0; }
.lib-tile .cap .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-actions { margin-left: auto; display: flex; gap: 2px; }
.lib-voice { display: flex; flex-direction: column; gap: 8px; padding: 12px; min-height: 140px; justify-content: center; background: var(--panel-2); border-radius: 8px; font-size: 13px; }
.lib-voice audio { width: 100%; height: 32px; }
.lib-pick { position: absolute; right: 6px; bottom: 34px; z-index: 5; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.frame-chip { display: flex; gap: 10px; align-items: center; padding: 6px; margin: 8px 0; border: 1px dashed var(--accent); border-radius: var(--radius-sm); }
.frame-chip img { width: 54px; height: 72px; object-fit: cover; border-radius: 6px; }
.frame-chip a { margin-left: auto; }
.voice-samples { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.voice-sample { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--panel-2); }
.voice-sample.new { background: var(--ok-bg); }
.voice-sample audio { width: 100%; height: 32px; }

/* Busy feedback (app.js Busy): a bar along the top, a note in the corner, a spinner on the pressed button. */
#busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat;
  transition: opacity .2s; }
body.busy #busy-bar { opacity: 1; animation: busy-slide 1.1s ease-in-out infinite; }
@keyframes busy-slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
#busy-note { position: fixed; right: 16px; bottom: 16px; z-index: 1000; padding: 8px 14px; border-radius: 999px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--border); box-shadow: 0 4px 18px rgb(0 0 0 / .18); opacity: 0;
  transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
body.busy #busy-note { opacity: 1; transform: none; transition-delay: .5s; }
.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--accent); border-right-color: transparent; animation: busy-spin .7s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { body.busy #busy-bar, .is-busy::after { animation-duration: 3s; } }
.set-planning { display: flex; gap: 22px; align-items: center; padding: 26px 8px; }
.set-planning .cube { --s: 52px; margin: 0 12px; }

/* Voice lab (characters/voice_lab.html) */
.lab-form { display: grid; gap: 8px; }
.lab-engines { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.lab-engine { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; opacity: .7; }
.lab-engine.on { opacity: 1; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.lab-ctl { display: grid; grid-template-columns: 80px 1fr 38px; align-items: center; gap: 6px; font-size: 13px; }
.lab-takes { display: grid; gap: 10px; margin-top: 14px; }
.lab-take { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.lab-take audio { width: 100%; }

/* Deleting and removing (Create sets, photos, Library) */
.set-delete { position: relative; }
.set-delete > summary { list-style: none; cursor: pointer; }
.set-delete > summary::-webkit-details-marker { display: none; }
.set-delete-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: grid; gap: 8px; min-width: 240px;
  padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .2); }
.post-tile { position: relative; }
.post-tile .tile-x { position: absolute; top: 6px; right: 6px; background: color-mix(in srgb, var(--panel) 85%, transparent); opacity: 0; transition: opacity .15s; }
.post-tile:hover .tile-x, .post-tile:focus-within .tile-x { opacity: 1; }
@media (hover: none) { .post-tile .tile-x { opacity: 1; } }

/* ---- jobs: class badge, lane, waiting reason, pod mini stats ---------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.job-filter { flex-wrap: wrap; margin: 0 0 12px; }
.job-filter a.btn { border: 0; background: transparent; color: var(--muted); }
.job-filter a.btn.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.job-class { font-size: 10.5px; padding: 0 7px; letter-spacing: .02em; }
.job-lane { font-size: 11px; color: var(--muted); margin-left: 2px; }
.job-wait { font-size: 12.5px; line-height: 1.45; margin: 2px 0; }
.job-wait-text { display: flex; gap: 6px; align-items: flex-start; color: var(--text-2); }
.job-wait-text .icon { flex: none; margin-top: 2px; color: var(--muted); }
.job-wait.wait-gpu .job-wait-text .icon, .job-wait.wait-held .job-wait-text .icon { color: var(--accent); }
.job-pod { margin: 4px 0 2px 20px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.job-pod .job-boot { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.job-wait > .hint { margin-left: 20px; }
.job-card-wait { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); padding: 10px 12px; margin: 8px 0 10px; }
.job-card-wait .job-boot { max-width: none; white-space: normal; overflow-wrap: anywhere; }
.job-usage { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 6px 0 0; font-size: 12.5px; }
.job-usage dt { color: var(--muted); } .job-usage dd { margin: 0; }
@media (max-width: 700px) {
  .jobs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .jobs-table, .jobs-table tbody, .jobs-table tr, .jobs-table td { display: block; width: 100%; }
  .jobs-table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .jobs-table td { border: 0; padding: 3px 16px !important; }
  .jobs-table td[data-label]:not([data-label="Job"])::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .jobs-table td.job-acts { justify-content: flex-start !important; display: flex; }
  .job-pod .job-boot { max-width: 100%; }
  .job-usage { grid-template-columns: minmax(0, 1fr); } .job-usage dd { margin-bottom: 4px; }
}

/* products to wear (Create › shot Advanced and the prompt box; Wardrobe › From the store) */
.wear-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; }
.wear-pick .chip-char img { border-radius: 6px; }
.store-grid { max-height: 60vh; overflow-y: auto; }
.store-grid .wardrobe-item { cursor: pointer; }


/* ---- keyboard focus, toasts, confirm dialog, small utilities (UI review) ------------------------------ */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox-x { position: absolute; top: 14px; right: 14px; background: rgba(0, 0, 0, .55); color: #fff; border: 0; border-radius: 99px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; }
.lightbox [role=button], img[role=button] { cursor: zoom-in; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); color: var(--text); border: 1px solid var(--border-2); border-left: 4px solid var(--info); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 13px; }
.toast.err { border-left-color: var(--err); } .toast.ok { border-left-color: var(--ok); }
.toast .msg-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast button { flex: none; }
dialog.confirm { border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg); padding: 20px 22px; max-width: min(440px, calc(100vw - 32px)); }
dialog.confirm::backdrop { background: rgba(0, 0, 0, .5); }
dialog.confirm p { margin: 0 0 16px; line-height: 1.5; white-space: pre-line; }
dialog.confirm .row { justify-content: flex-end; }
.nav .badge { margin-left: auto; min-width: 18px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; background: var(--accent); color: var(--accent-ink); }
.nav .badge.err { background: var(--err); color: #fff; }
.nav .badge[hidden] { display: none; }
a.stat { color: inherit; text-decoration: none; transition: border-color .15s; } a.stat:hover { border-color: var(--accent); }
.lib-more { grid-column: 1 / -1; text-align: center; padding: 8px 0 16px; }
.lib-tile .lib-check { position: absolute; top: 10px; left: 10px; z-index: 3; width: 20px; height: 20px; display: none; }
.lib-select .lib-tile .lib-check { display: block; }
.lib-select .lib-tile.picked { outline: 2px solid var(--accent); outline-offset: -2px; }
.lib-bulk { position: sticky; top: 8px; z-index: 6; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px 12px; margin-bottom: 12px; }
.prompt-bar .prompt-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1 1 100%; }
.prompt-bar .prompt-row + .prompt-row { padding-top: 2px; }
.mt-0 { margin-top: 0 !important; } .mt-4 { margin-top: 4px !important; } .mt-6 { margin-top: 6px !important; } .mt-8 { margin-top: 8px !important; }
.mt-10 { margin-top: 10px !important; } .mt-12 { margin-top: 12px !important; } .mt-14 { margin-top: 14px !important; } .mb-12 { margin-bottom: 12px !important; } .ml-auto { margin-left: auto !important; }
.m-0 { margin: 0 !important; } .gap-6 { gap: 6px !important; } .gap-6-mt-6 { gap: 6px !important; margin-top: 6px !important; }
.flex-1 { flex: 1 !important; } .flex-2 { flex: 2 !important; } .jc-between { justify-content: space-between !important; }
.w-auto { width: auto !important; } .w-full { width: 100% !important; } .nowrap { white-space: nowrap !important; } .ta-center { text-align: center !important; } .ta-right { text-align: right !important; }
.clickable { cursor: pointer !important; } .inline { display: inline !important; } .va-icon { vertical-align: -2px !important; }
.text-err { color: var(--err) !important; } .text-warn { color: var(--warn) !important; } .pad-head { padding: 16px 20px 0 !important; }
.lib-tile[hidden] { display: none; }
.fs-wrap { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.fs-pane { flex: 1 1 260px; min-width: 240px; }
.fs-pane h3 { margin: 0 0 8px; }
.fs-preview { aspect-ratio: 3 / 4; background: var(--bg-2, #eee); border: 1px dashed var(--border-2); border-radius: 8px; display: grid; place-items: center; overflow: hidden; margin-bottom: 8px; }
.fs-preview img { width: 100%; height: 100%; object-fit: contain; }
.fs-go { flex: 1 1 180px; align-self: center; text-align: center; }
.fs-result img { max-width: 360px; width: 100%; border-radius: 8px; cursor: zoom-in; }
.ref-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ref-strip:empty { margin-top: 0; }
.ref-tile { position: relative; width: 72px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.ref-tile img { width: 100%; height: 100%; object-fit: cover; }
.ref-tile .ref-tag { position: absolute; left: 2px; bottom: 2px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 4px; }
.ref-tile button { position: absolute; top: 2px; right: 2px; padding: 0 5px; line-height: 18px; }

/* second round of inline-style utilities */
.minh-50 { min-height: 50px !important; } .minh-60 { min-height: 60px !important; } .minh-90 { min-height: 90px !important; } .minh-120 { min-height: 120px !important; } .minh-420 { min-height: 420px !important; }
.minh-64s { min-height: 64px !important; font-family: var(--sans) !important; } .minh-96s { min-height: 96px !important; font-family: var(--sans) !important; }
.plain-link { color: inherit !important; text-decoration: none !important; }
.w-70 { width: 70px !important; } .w-80 { width: 80px !important; } .w-90 { width: 90px !important; } .w-110 { width: 110px !important; } .w-120 { width: 120px !important; } .w-140 { width: 140px !important; } .w-170 { width: 170px !important; } .w-190 { width: 190px !important; } .w-200 { width: 200px !important; }
.w-full-mt-6 { width: 100% !important; margin-top: 6px !important; } .m-b12 { margin: 0 0 12px !important; } .gap-4 { gap: 4px !important; } .gap-8 { gap: 8px !important; }
.gap-8-wrap { gap: 8px !important; flex-wrap: wrap !important; } .gap-6-wrap { gap: 6px !important; flex-wrap: wrap !important; } .gap-6-mt-8 { gap: 6px !important; margin-top: 8px !important; }
.va-top { vertical-align: top !important; } .minw-0 { min-width: 0 !important; } .pad-12 { padding: 12px !important; } .pad-foot { padding: 0 20px 16px !important; }

/* home: counts as a slim strip of links, "Needs you" stands out when something waits */
.stat-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.stat-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 99px; color: inherit; text-decoration: none; font-size: 13px; transition: border-color .15s; }
.stat-chip:hover { border-color: var(--accent); }
.stat-chip .icon { width: 16px; height: 16px; color: var(--accent); }
.stat-chip b { font-size: 15px; font-weight: 750; letter-spacing: -.01em; }
.stat-chip span { color: var(--muted); }
.card.needs { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2), var(--shadow); }

/* video tiles hold a placeholder until their first frame arrives */
.vid:not(.ready) video { opacity: 0; }
.vid:not(.ready)::before { content: ""; position: absolute; inset: 0; border-radius: 10px; background: var(--panel-2); }
.vid:not(.ready)::after { content: ""; position: absolute; left: 50%; top: 50%; margin: -14px 0 0 -9px; border-left: 22px solid var(--faint); border-top: 14px solid transparent; border-bottom: 14px solid transparent; opacity: .7; }
details.card > summary.card-head { cursor: pointer; list-style: none; } details.card > summary.card-head::-webkit-details-marker { display: none; }
textarea[data-enter-send] { min-height: 44px; max-height: 200px; resize: vertical; }

/* ---- Studio: the assistant panel beside the work (the chat itself is the dock) ----------------------------- */
.studio-assist { margin-bottom: 12px; }
.studio-assist .assist-ideas { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 10px; }
.studio-assist .assist-ideas .ghost { text-align: left; white-space: normal; height: auto; padding: 4px 8px; }
.studio-assist .genbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.studio-assist .genbar select { width: auto; flex: 0 0 auto; }
.studio-assist .genbar input[type=text] { flex: 1 1 160px; width: auto; }
.activity-item + .activity-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.activity-thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.activity-thumbs img { height: 64px; border-radius: 8px; cursor: zoom-in; }
.activity-clip { max-width: 100%; border-radius: 8px; margin-top: 4px; }
.assist-media { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; } .assist-media video { max-width: 100%; max-height: 280px; border-radius: 10px; background: #000; } .assist-media audio { width: 100%; }

/* assistant replies as markdown (api/markup.py) and what sits under them: Copy, thumbs */
.assist-msg.ai .assist-text > p { margin: 0 0 8px; } .assist-msg.ai .assist-text > p:last-of-type { margin-bottom: 0; }
.assist-msg.ai .assist-text ul, .assist-msg.ai .assist-text ol { margin: 4px 0 8px; padding-left: 20px; } .assist-msg.ai .assist-text li { margin: 2px 0; }
.assist-msg.ai .assist-text code { font-family: var(--mono); font-size: .88em; background: var(--panel-3); border-radius: 5px; padding: 1px 5px; }
.assist-msg.ai .assist-text a { color: var(--accent); text-decoration: underline; }
.assist-link { display: inline; font: inherit; padding: 0 8px; border-radius: 99px; border: 1px solid var(--accent); background: var(--accent-2); color: var(--accent); cursor: pointer; }
.assist-link:hover { background: var(--accent-3); }
.assist-actions { display: flex; gap: 2px; margin-top: 6px; opacity: .55; transition: opacity .15s; }
.assist-msg.ai:hover .assist-actions, .assist-actions:focus-within { opacity: 1; }
.assist-act { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.assist-act:hover { background: var(--panel-3); color: var(--text); } .assist-act.on { color: var(--accent); background: var(--accent-2); } .assist-act.on.down { color: var(--err); background: var(--err-bg); }
@media (hover: none) { .assist-actions { opacity: 1; } }
/* the admin Assistant page */
.bar-cell { width: 45%; } .bar { display: block; height: 8px; min-width: 2px; border-radius: 4px; background: var(--accent); }
.stats-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; } .stats-list li { padding-bottom: 8px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
/* the dock's starter chips: what to say on this page (they only fill the box) */
.assist-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.assist-chips button { border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text-2); font-size: 12.5px; padding: 6px 12px; font-weight: 500; }
.assist-chips button:hover { border-color: var(--accent); color: var(--text); }
/* the assistant button steps behind the open nav drawer (and its scrim), so it never covers the drawer's own controls */
body.nav-open .assist-dock { z-index: 40; }

/* Attach (static/attach.js): a drop target for reference images - dashed while a file is over it */
[data-attach] { position: relative; }
[data-attach].attach-over { outline: 2px dashed var(--accent, #e0492b); outline-offset: 2px; background: color-mix(in srgb, var(--accent, #e0492b) 8%, transparent); }
[data-attach].attach-busy { opacity: .7; cursor: progress; }
.attach-status { font-size: .8rem; color: var(--muted, #6b7280); min-height: 1.1em; }
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.attach-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px 2px 2px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font-size: .75rem; max-width: 100%; }
.attach-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.attach-drop { border: 1px dashed var(--border, #d1d5db); border-radius: 10px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* version marks (api/version.py): small print under the user box */
.ver { margin: 2px 10px 8px; font-size: 10px; color: var(--muted); opacity: .65; letter-spacing: .02em; font-variant-numeric: tabular-nums; user-select: all; }
