/* ============================================================================
   nl-veil — the chat
   Built out of the tokens and components in ../css/theme.css (palette, type,
   geometry, .btn, .chip, .panel, .tag) and the top bar in ../css/site.css.
   Nothing here names a colour of its own. Motion is short, eases out, and is
   switched off for readers who ask for less of it.
   ========================================================================= */

:root { --ease: cubic-bezier(.2, .7, .2, 1); --quick: .16s; --calm: .28s; }

body.chat-page { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* the app fills the window, so its top bar does too (the site's is held to its reading width) */
.chat-page .topbar-inner { max-width: none; }
.chat-page .topbar .nav { flex: 0 1 auto; min-width: 0; overflow: hidden; }
/* A link that does not fit beside the chat's own controls goes whole, never cut mid-word: the links wrap, and only
   their first row shows. */
.chat-page .topbar .nav { flex-wrap: wrap; font-size: var(--fs-ui); max-height: 34px; max-height: calc(1lh + 14px); }
.chat-page .topbar .nav a { white-space: nowrap; }
/* In the chat itself the bar is the brand and the chat's own controls; the site's pages are under Links in the chats list. */
.chat-page.chat-on .topbar .nav { display: none; }
.bar-slot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-slot select { min-height: 30px; max-width: 30ch; padding: 0 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: var(--fs-small); transition: border-color var(--quick); }
.bar-slot select:hover { border-color: var(--accent); }
.chip.warn { cursor: pointer; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.chip.warn .chip-dot { background: var(--warn); }
.only-narrow { display: none; }

textarea, select, input[type=url], input[type=password], input[type=number] {
  width: 100%; min-height: var(--field-h); padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font: inherit; transition: border-color var(--quick), box-shadow var(--quick);
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tonal); }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible, [role=button]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-btn); }
button:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: default; pointer-events: none; }
.btn { transition: background var(--quick), color var(--quick), filter var(--quick), transform .08s; }
.btn-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- the gate and the harness setup: one centred card ---- */
.gate { flex: 1; overflow: auto; display: grid; place-items: start center; padding: clamp(24px, 7vh, 72px) var(--pad) 40px; }
.gate-card { width: min(640px, 100%); padding: 28px 30px; animation: rise var(--calm) var(--ease) both; }
.gate-card .section-eyebrow { margin-bottom: 9px; }
.gate-card h1 { font-size: clamp(23px, 3.2vw, 30px); line-height: 1.2; letter-spacing: -.015em; margin-bottom: 10px; }
.gate-card p { color: var(--text-secondary); margin-bottom: 12px; max-width: var(--measure); }
.gate-card ul { margin: 0 0 16px 18px; color: var(--text-secondary); }
.gate-card li { margin-bottom: 5px; }
.gate-acts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.gate-field { display: flex; gap: 8px; margin-top: 6px; }
.gate-field input { font-family: var(--font-mono); font-size: var(--fs-ui); }
.gate-sep { border: 0; border-top: 1px solid var(--border); margin: 20px 0 16px; }
.gate-links { margin: 14px 0 0 !important; }
.err { color: var(--danger); font-size: var(--fs-ui); margin-top: 10px; min-height: 1.4em; }
.fine { font-size: var(--fs-small); color: var(--text-muted); }

/* ---- the dashboard: three panes ---- */
/* The side pane is as wide as the reader dragged it (--side-w), but never so wide that the chat beside it drops
   under 260px: a width set in a large window still fits after the window is made smaller. */
.shell { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr) 5px min(var(--side-w, clamp(320px, 30vw, 460px)), calc(100% - 505px)); position: relative; }
/* wide screens: the chats list and the chat close; with both closed the code has the whole window */
@media (min-width: 981px) {
  .shell.no-rail { grid-template-columns: minmax(0, 1fr) 5px min(var(--side-w, clamp(320px, 30vw, 460px)), calc(100% - 265px)); }
  .shell.no-chat { grid-template-columns: 240px minmax(0, 1fr); }
  .shell.no-rail.no-chat { grid-template-columns: minmax(0, 1fr); }
  .shell.no-rail .rail, .shell.no-chat .chat, .shell.no-chat .splitter { display: none; }
  .shell.no-chat .side { border-left: 0; }
}
@media (max-width: 980px) { .only-wide { display: none !important; } }
.splitter { cursor: col-resize; background: transparent; position: relative; z-index: 2; touch-action: none; transition: background var(--quick); }
.splitter::after { content: ''; position: absolute; inset: 0 -3px; }
.splitter:hover, .splitter:focus-visible, .shell.dragging .splitter { background: var(--accent); outline: none; }
.shell.dragging { cursor: col-resize; user-select: none; }
.shell.dragging iframe { pointer-events: none; }
.icon-btn.on { color: var(--accent); }
.pane-head .grow { flex: 1; }
/* a file as it is written */
.code.stream .hl { pointer-events: auto; user-select: text; }
.caret { display: inline-block; width: 7px; height: 1.05em; vertical-align: text-bottom; background: var(--accent); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.ide-tab.writing .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: blink 1s steps(2, start) infinite; }
@media (prefers-reduced-motion: reduce) { .caret, .ide-tab.writing .dot { animation: none; } }
.rail, .side { background: var(--surface-raised); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.rail { border-right: 1px solid var(--border); }
.side { border-left: 1px solid var(--border); }
.scrim { display: none; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--pad-in) 6px; font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.pane-head.toggle { width: 100%; background: transparent; border: 0; border-top: 1px solid var(--border); padding-bottom: 8px; }
.pane-head.toggle:hover { color: var(--text); }
.list { overflow: auto; padding: 4px 6px 10px; flex: 1; min-height: 0; }
.item { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: var(--radius-btn); width: 100%; text-align: left; background: transparent; border: 0; color: var(--text); cursor: pointer; font-size: var(--fs-ui); transition: background var(--quick); }
.item:hover { background: var(--surface-hover); text-decoration: none; }
.item.on { background: var(--surface-selected); }
.item.static { cursor: default; }
.item.static:hover { background: transparent; }
.item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--text-muted); font-size: var(--fs-micro); flex: 0 0 auto; }
.item .x { visibility: hidden; background: transparent; border: 0; color: var(--text-muted); padding: 0 4px; }
.item:hover .x, .item:focus-within .x, .item .x.show { visibility: visible; }
.item .x:hover { color: var(--danger); }
.empty { color: var(--text-muted); padding: 10px var(--pad-in); font-size: var(--fs-ui); }
.links { max-height: 42%; overflow: auto; flex: 0 0 auto; }
.link-group { padding: 0 6px 6px; animation: fade var(--calm) both; }
.link-head { padding: 4px 9px 2px; font-size: var(--fs-micro); color: var(--text-muted); }
.links a.item { color: var(--text-secondary); padding: 5px 9px; }
.links a.item:hover { color: var(--accent); }
.who { padding: 10px var(--pad-in); border-top: 1px solid var(--border); font-size: var(--fs-small); color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.who .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The row wraps: in a pane too narrow for the tabs and the pane's own buttons on one line, the buttons take a
   second line (right-aligned) instead of running off the pane's edge. */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); align-items: flex-end; }
.tabs .grow + .widen { margin-left: auto; }
.tabs button { padding: 7px 11px; border: 0; background: transparent; color: var(--text-secondary); border-radius: 0; font-size: var(--fs-ui); transition: background var(--quick), color var(--quick); }
.tabs button:hover { background: var(--surface-hover); color: var(--text); }
.tabs button.on { color: var(--accent); background: var(--tonal); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs button[role=tab] { font-weight: 600; transition: background var(--calm) var(--ease), color var(--calm) var(--ease), box-shadow var(--calm) var(--ease); }
.tabs .widen { margin-bottom: 4px; padding: 3px 8px; border-radius: var(--radius-btn); color: var(--text-muted); }
/* The tabs sit in a .tab-row of their own, and the pane's buttons stay at the right of it, never pushed off. Every tab
   stays in view: a pane too narrow for them all on one line gives the row a second line rather than hiding any. */
.tabs:has(> .tab-row) { flex-wrap: nowrap; }
.tab-row { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; min-width: 0; align-items: flex-end; }
.tab-row > button, .tabs:has(> .tab-row) > .widen { flex: 0 0 auto; white-space: nowrap; }
.tabs:has(> .tab-row) > .widen:first-of-type { margin-left: 6px; }
/* a narrower pane tightens the strip first, so the usual width still holds every tab on one line */
@container (max-width: 520px) {
  .tab-row { gap: 0; }
  .tab-row > button { padding: 7px 7px; }
  .tabs:has(> .tab-row) { padding-left: 4px; padding-right: 4px; }
  .tabs:has(> .tab-row) > .widen { padding: 3px 4px; }
  .tabs:has(> .tab-row) > .widen:first-of-type { margin-left: 2px; }
}
/* The pane's own buttons (the explorer switch, Hide chat, Full screen) in a footer pinned under the pane, so the tab
   strip above holds the tabs alone. The side panel is a column and the pane takes the rest, so it stays at the bottom. */
.side-foot { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 4px 8px max(4px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-raised); }
.side-foot .widen { padding: 4px 9px; border: 0; border-radius: var(--radius-btn); background: transparent; color: var(--text-secondary); font-size: var(--fs-small); white-space: nowrap; transition: background var(--quick), color var(--quick); }
.side-foot .widen:hover { background: var(--surface-hover); color: var(--text); }
.side-foot .widen[aria-pressed=true] { color: var(--accent); }
.side-foot .widen[title=Explorer] { margin-right: auto; }
.pane { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
/* a change of tab eases in; a redraw of the same tab (fresh data) does not move at all */
@keyframes tab-in { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.pane.enter { animation: tab-in var(--calm) var(--ease) both; }
.pane.tab-code { overflow: hidden; }
.block { padding: 12px var(--pad-in); border-bottom: 1px solid var(--border); }
.block.feature { background: var(--tonal); }
.block h3 { font-size: var(--fs-ui); margin-bottom: 6px; }
.block p { font-size: var(--fs-small); color: var(--text-secondary); margin-bottom: 8px; }
.block .steps { margin: 0 0 8px 18px; font-size: var(--fs-small); color: var(--text-secondary); }
.block .steps li { margin-bottom: 4px; }
.block ul:not(.steps) { margin: 0 0 8px 18px; font-size: var(--fs-small); color: var(--text-secondary); }
.block ul:not(.steps) li { margin-bottom: 3px; }
.block .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.block .acts select { width: auto; min-height: 28px; padding: 0 8px; font-size: var(--fs-small); }
.block label { display: block; font-size: var(--fs-micro); color: var(--text-muted); margin: 6px 0 2px; }
.block .more { margin-top: 10px; font-size: var(--fs-small); color: var(--text-secondary); }
.block .more summary { cursor: pointer; margin-bottom: 6px; }
.meter { margin-bottom: 9px; }
.meter .line { display: flex; justify-content: space-between; font-size: var(--fs-small); color: var(--text-secondary); }
.meter .track { height: 6px; border-radius: var(--radius-pill); background: var(--surface-hover); overflow: hidden; margin-top: 3px; }
.meter .fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width var(--calm) var(--ease); }
.meter.hot .fill { background: var(--danger); }
.state { font-family: var(--font-mono); font-size: var(--fs-micro); padding: 1px 6px; border-radius: 4px; background: var(--chip-bg); color: var(--text-secondary); flex: 0 0 auto; }
.state.done { color: var(--success); } .state.failed { color: var(--danger); } .state.running { color: var(--accent); }

/* ---- the Code tab: an editor in the manner of VS Code, in the theme's own colours ---- */
.side { container-type: inline-size; container-name: side; }
.ide {
  --code-size: 13px;
  --code-line: 20px;
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
}
.ide.no-exp { grid-template-columns: minmax(0, 1fr); }
.explorer { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--surface-raised); }
.exp-head { display: flex; align-items: center; gap: 2px; padding: 8px 6px 6px 12px; font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.exp-head span { flex: 1; }
.exp-head .x, .tree-row .x, .ide-tab .x { background: transparent; border: 0; color: var(--text-muted); border-radius: 4px; padding: 1px 5px; font-size: var(--fs-ui); line-height: 1.2; }
.exp-head .x:hover, .tree-row .x:hover, .ide-tab .x:hover { background: var(--surface-hover); color: var(--text); }
.explorer input { margin: 0 8px 6px; width: auto; min-height: 28px; padding: 3px 8px; font-size: var(--fs-small); }
.tree { flex: 1; min-height: 0; overflow: auto; padding-bottom: 8px; }
.tree-row { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 24px; padding: 1px 6px 1px 8px; border: 0; background: transparent; color: var(--text-secondary); font-size: var(--fs-ui); text-align: left; cursor: pointer; white-space: nowrap; }
.tree-row:hover { background: var(--surface-hover); color: var(--text); }
.tree-row.on { background: var(--surface-selected); color: var(--text); }
.tree-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-row .twist { width: 12px; flex: 0 0 auto; color: var(--text-muted); }
.tree-row .x { visibility: hidden; }
.tree-row.hit { align-items: flex-start; white-space: normal; text-align: left; font-family: var(--font-mono); font-size: var(--fs-micro); }
.tree-row.hit .where { color: var(--accent); }
.git { border-top: 1px solid var(--border); font-size: var(--fs-ui); flex: 0 0 auto; max-height: 55%; overflow: auto; }
.git summary { cursor: pointer; padding: 6px 12px; font-size: var(--fs-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.git-body { display: grid; gap: 6px; padding: 2px 10px 10px; }
.git-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.git-who { display: grid; gap: 4px; }
.git .tree-row .badge { font-weight: 700; }
.git-added .badge { color: var(--success); } .git-changed .badge { color: var(--accent); } .git-deleted .badge { color: var(--danger); } .git-deleted .name { text-decoration: line-through; }
dialog.ask { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); color: var(--text); padding: 0; width: min(92vw, 440px); box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
/* the site's reset takes a dialog's own centring away: it is put back, and a tall one scrolls inside the window */
dialog.ask { position: fixed; inset: 0; margin: auto; max-height: calc(100dvh - 32px); overflow: auto; }
dialog.ask::backdrop { background: rgb(0 0 0 / .4); }
.ask-in { display: grid; gap: 10px; padding: 16px; }
.ask-in p { margin: 0; font-size: var(--fs-ui); overflow-wrap: anywhere; }
.ask-in input { width: 100%; }
.ask-acts { display: flex; justify-content: flex-end; gap: 8px; }
.exp-acts { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 6px 6px; }
.exp-acts .btn { padding: 2px 8px; font-size: var(--fs-micro); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.code.windowed .hl { min-height: 0; }
.code.windowed .gutter { box-sizing: border-box; }
.ta[readonly] { cursor: default; }
.code.ta-window .ta { inset: auto 0 auto 0; }
/* a suggestion at the caret */
.ghost { position: absolute; left: 0; right: 0; margin: 0; padding: 8px 14px 0 12px; font: inherit; tab-size: inherit; white-space: pre; pointer-events: none; background: transparent; border: 0; color: var(--text-muted); z-index: 1; }
.ghost:empty { display: none; }
.ghost .pad { visibility: hidden; }
.ghost .g { opacity: .75; font-style: italic; }
.ghost .g.hint { font-style: normal; opacity: .55; font-size: .92em; }
.ta.ghostwriting { caret-color: var(--accent); cursor: progress; }
.ghost .g.more { display: block; width: max-content; max-width: 100%; background: var(--surface-raised); box-shadow: 0 2px 10px rgb(0 0 0 / .18); border-radius: 4px; padding: 0 6px 0 0; }
.status-btn { background: transparent; border: 0; color: inherit; font: inherit; padding: 0 4px; cursor: pointer; border-radius: 3px; }
.status-btn:hover { background: rgb(255 255 255 / .18); }
.status-btn.busy { animation: blink 1s steps(2, start) infinite; }
.tree-row:hover .x, .tree-row:focus-within .x { visibility: visible; }
.badge { flex: 0 0 auto; width: 18px; text-align: center; font: 700 9px/14px var(--font-mono); letter-spacing: -.02em; color: var(--text-muted); }
.badge.lang-js, .badge.lang-ts { color: var(--tok-n); } .badge.lang-html { color: var(--tok-t); } .badge.lang-css { color: var(--tok-f); }
.badge.lang-py { color: var(--tok-s); } .badge.lang-json { color: var(--tok-a); } .badge.lang-md { color: var(--tok-k); }

.ide-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.ide-empty { display: grid; place-content: center; justify-items: center; gap: 8px; padding: 20px; text-align: center; color: var(--text-muted); font-size: var(--fs-ui); background: var(--surface); }
.ide-tabs { display: flex; overflow-x: auto; scrollbar-width: none; background: var(--surface-raised); border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.ide-tab { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-right: 1px solid var(--border); color: var(--text-secondary); font-size: var(--fs-ui); cursor: pointer; white-space: nowrap; border-top: 2px solid transparent; transition: background var(--quick), color var(--quick); }
.ide-tab:hover { background: var(--surface-hover); color: var(--text); }
.ide-tab.on { background: var(--surface); color: var(--text); border-top-color: var(--accent); }
.ide-tab .x { opacity: .5; } .ide-tab:hover .x, .ide-tab.on .x { opacity: 1; }
.ide-bar { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 12px; border-bottom: 1px solid var(--border); flex: 0 0 auto; min-height: 30px; }
.crumbs { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); color: var(--text-muted); }
.crumbs .sep { margin: 0 5px; } .crumbs .here { color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-btn); overflow: hidden; flex: 0 0 auto; }
.seg button { border: 0; background: transparent; color: var(--text-secondary); padding: 2px 9px; font-size: var(--fs-small); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--surface-hover); color: var(--text); }
.seg button.on { background: var(--tonal); color: var(--accent); font-weight: 600; }
.ide-body { flex: 1; min-height: 0; display: flex; min-width: 0; }
.ide-body.split > * { flex: 1 1 50%; min-width: 0; }
.ide-body.split > .preview, .ide-body.split > .doc { border-left: 1px solid var(--border); }
.ide-body > .doc { flex: 1; overflow: auto; padding: 14px 16px; }

/* the source: a gutter of line numbers, the coloured text, and over it a see-through textarea that takes the typing */
.code { flex: 1; min-width: 0; min-height: 0; overflow: auto; display: flex; align-items: flex-start; background: var(--surface); font: var(--code-size)/var(--code-line) var(--code-font); font-variant-ligatures: none; tab-size: 2; }
.gutter { position: sticky; left: 0; z-index: 1; flex: 0 0 auto; min-width: 44px; padding: 8px 10px 8px 8px; text-align: right; white-space: pre; color: var(--text-muted); background: var(--surface); border-right: 1px solid color-mix(in srgb, var(--border) 60%, transparent); user-select: none; opacity: .8; }
.code-inner { position: relative; flex: 1 0 auto; min-width: max-content; min-height: 100%; }
.hl, .ta { margin: 0; padding: 8px 14px 40px 12px; font: inherit; tab-size: inherit; white-space: pre; letter-spacing: 0; border: 0; }
.hl { color: var(--text); pointer-events: none; min-height: 100%; background: transparent; }
.ta { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: var(--text); border-radius: 0; outline: none; }
.ta:focus { box-shadow: none; border: 0; }
.ta::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: transparent; }
.preview { flex: 1; min-height: 0; min-width: 0; width: 100%; border: 0; background: #fff; animation: fade var(--calm) both; }
.ide-status { display: flex; align-items: center; gap: 14px; padding: 2px 12px; min-height: 22px; flex: 0 0 auto; font-size: var(--fs-micro); color: var(--on-accent); background: var(--accent); white-space: nowrap; overflow: hidden; }

/* in a narrow side pane the explorer sits above the editor, not beside it */
@container side (max-width: 520px) {
  .ide { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ide.no-exp { grid-template-rows: minmax(0, 1fr); }
  .explorer { border-right: 0; border-bottom: 1px solid var(--border); max-height: 28vh; }
}

/* the Jobs tab's viewer */
.viewer { border-top: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; flex: 1.5; }
.viewer .vh { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font: var(--fs-small) var(--font-mono); flex-wrap: wrap; }
.viewer .vh .name { flex: 1; min-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .doc { margin: 0; padding: 9px 11px; overflow: auto; flex: 1; background: var(--surface); border-top: 1px solid var(--border); font-size: var(--fs-small); }
.review { margin-top: 6px; font-size: var(--fs-micro); color: var(--text-muted); font-family: var(--font-mono); }
.review.corrected { color: var(--warn); } .review.clear { color: var(--success); }
.check { display: flex; align-items: center; gap: 7px; font-size: var(--fs-small) !important; color: var(--text) !important; cursor: pointer; }
.check input { width: auto; min-height: 0; }

/* ---- the transcript ---- */
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.transcript { flex: 1; overflow: auto; padding: 20px max(var(--pad), calc((100% - 800px) / 2)); scroll-behavior: smooth; }
.msg { margin-bottom: 18px; animation: rise var(--calm) var(--ease) both; }
.msg.settled { animation: none; }
.msg .role { font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase; font-weight: 600; margin-bottom: 3px; }
.msg.user .role { color: var(--role-user); }
.msg.assistant .role { color: var(--role-assistant); }
.msg.error .role, .msg.error .body { color: var(--danger); }
.msg .body { overflow-wrap: anywhere; }
.msg.user .body { white-space: pre-wrap; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin-bottom: 9px; }
.md ul, .md ol { margin-left: 20px; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 6px; line-height: 1.25; }
.md h1 { font-size: var(--fs-h1); } .md h2 { font-size: var(--fs-h2); } .md h3 { font-size: var(--fs-h3); }
.md pre { background: var(--code-bg); padding: 10px 12px; border-radius: var(--radius); overflow: auto; font-family: var(--font-mono); font-size: var(--fs-ui); }
.md code { font-family: var(--font-mono); font-size: .93em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 9px; }
.md th { background: var(--table-head-bg); }
.md blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--text-secondary); }
.plan { list-style: none; margin: 4px 0 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); font-size: var(--fs-ui); }
.plan li { display: flex; gap: 8px; padding: 2px 0; color: var(--text-secondary); transition: color var(--calm) var(--ease); }
.plan li.done { color: var(--text-muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-muted) 50%, transparent); }
.plan .tick { flex: 0 0 auto; width: 1.1em; text-align: center; color: var(--text-muted); }
.plan li.done .tick { color: var(--success); }
.status { color: var(--text-muted); font-size: var(--fs-ui); font-style: italic; display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: blink 1.1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
details.tool { margin: 5px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); transition: border-color var(--quick); }
details.tool:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
details.tool summary { cursor: pointer; padding: 5px 10px; font: var(--fs-small) var(--font-mono); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.tool .mark { display: inline-block; width: 1.1em; margin-right: 4px; color: var(--success); text-align: center; }
details.tool.failed summary, details.tool.failed .mark { color: var(--danger); }
details.tool.running .mark::before { content: ""; display: inline-block; width: .7em; height: .7em; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
details.tool pre { padding: 8px 10px; border-top: 1px solid var(--border); max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--fs-small) var(--font-mono); }

.welcome { color: var(--text-secondary); max-width: 640px; margin: 7vh auto 0; text-align: center; animation: rise var(--calm) var(--ease) both; }
/* a redraw of the view already on screen replays no entrance */
#app.same-view .welcome, #app.same-view .gate-card, #app.same-view .link-group, #app.same-view .preview { animation: none; }
.welcome h1 { color: var(--text); font-size: var(--fs-display); margin-bottom: 8px; letter-spacing: -.015em; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; margin: 18px 0; text-align: left; }
.suggest { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); color: var(--text); font-size: var(--fs-ui); text-align: left; transition: border-color var(--quick), transform var(--quick) var(--ease), background var(--quick); }
.suggest:hover { border-color: var(--accent); background: var(--tonal); transform: translateY(-1px); }
.promo { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; }
.promo p { font-size: var(--fs-small); margin-top: 2px; }
.promo > div { flex: 1; min-width: 0; }

.composer { border-top: 1px solid var(--border); padding: 10px max(var(--pad), calc((100% - 800px) / 2)) max(14px, env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 220px; line-height: 1.4; }

.toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 60; pointer-events: none; width: min(92vw, 460px); }
.toast { background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: var(--radius); font-size: var(--fs-ui); box-shadow: 0 6px 24px rgb(0 0 0 / .25); animation: rise var(--calm) var(--ease) both; transition: opacity var(--calm), transform var(--calm); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---- narrow screens: the rail and the side pane slide over the chat ---- */
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .splitter { display: none; }
  .rail, .side { position: absolute; top: 0; bottom: 0; z-index: 6; width: min(360px, 90vw); box-shadow: 0 8px 30px rgb(0 0 0 / .25); transition: transform var(--calm) var(--ease), visibility var(--calm); visibility: hidden; }
  .side { width: min(560px, 94vw); }
  .rail { left: 0; transform: translateX(-102%); }
  .side { right: 0; transform: translateX(102%); }
  .shell.show-rail .rail, .shell.show-side .side { transform: none; visibility: visible; }
  .scrim { display: block; position: absolute; inset: 0; z-index: 5; background: rgb(0 0 0 / .35); opacity: 0; pointer-events: none; transition: opacity var(--calm); }
  .shell.show-rail .scrim, .shell.show-side .scrim { opacity: 1; pointer-events: auto; }
  .tabs .widen, .side-foot { display: none; }
  .only-narrow { display: grid; }
  .bar-slot .chip:not(.warn) { display: none; }
  .bar-slot select { max-width: 13ch; }
  .brand small { display: none; }
  .promo { flex-direction: column; align-items: flex-start; }
  .welcome { margin-top: 3vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .transcript { scroll-behavior: auto; }
}

/* ---- code: one type face and one palette per theme, the same in the editor and in a file being written ---- */
.ide {
  --code-font: "JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --tok-c: #6b7689; --tok-s: #1f7a37; --tok-r: #b3261e; --tok-n: #a85400; --tok-k: #8a3ffc; --tok-y: #0b7285; --tok-f: #2f6feb; --tok-b: #a85400;
  --tok-v: #b3261e; --tok-d: #8a5a00; --tok-o: #46557a; --tok-u: #5b6784; --tok-t: #c93a4a; --tok-a: #a85400; --tok-p: #0f6f8f; --tok-h: #2f6feb;
  --tok-i: #1f7a37; --tok-x: #c93a4a; --code-fg: var(--text);
}
:root[data-theme="dark"] .ide {
  --tok-c: #6f78a3; --tok-s: #9ece6a; --tok-r: #b4f9f8; --tok-n: #ff9e64; --tok-k: #bb9af7; --tok-y: #2ac3de; --tok-f: #7aa2f7; --tok-b: #ff9e64;
  --tok-v: #e0af68; --tok-d: #e0af68; --tok-o: #89ddff; --tok-u: #8089b3; --tok-t: #f7768e; --tok-a: #e0af68; --tok-p: #73daca; --tok-h: #7aa2f7;
  --tok-i: #9ece6a; --tok-x: #f7768e; --code-fg: #c0caf5;
}
:root[data-theme="matrix"] .ide {
  --tok-c: #4a964a; --tok-s: #90e890; --tok-r: #d7a0e8; --tok-n: #ffcc44; --tok-k: #00ef72; --tok-y: #7eb7ff; --tok-f: #7eb7ff; --tok-b: #00aacc;
  --tok-v: #5fd7c7; --tok-d: #d7a0e8; --tok-o: #16c56b; --tok-u: #88aa88; --tok-t: #00aacc; --tok-a: #5fd7c7; --tok-p: #5fd7c7; --tok-h: #f3f7f1;
  --tok-i: #90e890; --tok-x: #ff2d55; --code-fg: #c8f0c8;
}
.code { font-feature-settings: "liga" 0, "calt" 0; font-kerning: none; -webkit-font-smoothing: antialiased; }
.hl { color: var(--code-fg); }
.tok-c { color: var(--tok-c); font-style: italic; } .tok-s { color: var(--tok-s); } .tok-r { color: var(--tok-r); } .tok-n { color: var(--tok-n); }
.tok-k { color: var(--tok-k); } .tok-y { color: var(--tok-y); } .tok-f { color: var(--tok-f); } .tok-b { color: var(--tok-b); }
.tok-v { color: var(--tok-v); } .tok-d { color: var(--tok-d); } .tok-o { color: var(--tok-o); } .tok-u { color: var(--tok-u); }
.tok-t { color: var(--tok-t); } .tok-a { color: var(--tok-a); } .tok-p { color: var(--tok-p); } .tok-h { color: var(--tok-h); font-weight: 700; }
.tok-i { color: var(--tok-i); } .tok-x { color: var(--tok-x); }
:root[data-theme="matrix"] .tok-k { font-weight: 700; }
.rail-reopen { align-self: flex-start; margin: 6px 0 0 8px; }
.tabs .widen { font-size: var(--fs-micro); white-space: nowrap; }

/* ---- the terminal under the editor ---- */
.ide-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ide-col > .ide-empty { flex: 1; min-height: 0; }
.term { flex: 0 0 auto; display: flex; flex-direction: column; height: 32%; min-height: 150px; max-height: 60vh; border-top: 1px solid var(--border); background: var(--surface); font: var(--code-size)/var(--code-line) var(--code-font); font-feature-settings: "liga" 0, "calt" 0; }
.term.tall { height: 62%; }
.term.shut { height: auto; min-height: 0; }
.term-head { display: flex; align-items: center; flex: 0 0 auto; background: var(--surface-raised); border-bottom: 1px solid var(--border); }
.term.shut .term-head { border-bottom: 0; }
.term-bar { flex: 1; display: flex; align-items: center; gap: 6px; padding: 3px 10px; background: transparent; border: 0; color: var(--text-secondary); font: 600 var(--fs-micro)/1.6 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; text-align: left; cursor: pointer; }
.term-bar:hover { color: var(--text); }
.term-bar .grow { flex: 1; }
.term-bar .fine { text-transform: none; letter-spacing: 0; font-weight: 400; }
.term-size { background: transparent; border: 0; color: var(--text-muted); font-size: var(--fs-micro); padding: 3px 10px; cursor: pointer; }
.term-size:hover { color: var(--text); }
.term-out { flex: 1; min-height: 0; overflow: auto; padding: 6px 12px 2px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--code-fg, var(--text)); user-select: text; }
.term-line.in { color: var(--tok-f, var(--accent)); }
.term-line.err { color: var(--danger); }
.term-line.fine { color: var(--text-muted); }
.term-prompt { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 2px 12px 6px; }
.term-cwd { color: var(--tok-k, var(--accent)); white-space: nowrap; }
.term-in { flex: 1; min-width: 0; background: transparent !important; border: 0 !important; box-shadow: none !important; outline: none; padding: 0; height: var(--code-line); min-height: 0; font: inherit; color: var(--text); border-radius: 0; }

/* ---- the Swarm tab ---- */
#swarmGoal { width: 100%; resize: vertical; min-height: 84px; }
.swarm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin-top: 6px; }
.swarm-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: var(--radius-btn); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.swarm-row:hover { background: var(--surface-hover); }
.swarm-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swarm-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip.swarm-running { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, transparent); }
.chip.swarm-done { color: var(--accent); }
.chip.swarm-failed, .chip.swarm-stopped { color: var(--text-muted); }
.chip.swarm-paused { color: var(--warn); }
.swarm-detail details { border-top: 1px solid var(--border); padding: 6px 0; }
.swarm-detail summary { cursor: pointer; font-weight: 600; font-size: var(--fs-ui); }
.swarm-mind { margin-left: 10px; border-top: 0 !important; }
.swarm-mind summary { font-weight: 400; }
.swarm-summary { margin: 8px 0; }
.swarm-log { font: var(--fs-micro)/1.6 var(--font-mono); max-height: 260px; overflow: auto; }
#swarmSay { flex: 1; min-width: 0; }

/* ---- pictures: waiting in the composer, in the transcript, at full size ---- */
.attached { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px var(--pad-in) 0; }
.attached[hidden] { display: none; }
.attach { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); font-size: var(--fs-micro); color: var(--text-secondary); }
.attach img { width: 34px; height: 34px; object-fit: cover; border-radius: calc(var(--radius) - 2px); }
.attach .name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-btn { flex: 0 0 auto; align-self: flex-end; font-size: 20px; line-height: 1; }
.pics { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.pic { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-raised); cursor: zoom-in; line-height: 0; }
.pic img { display: block; max-width: min(100%, 360px); max-height: 300px; }
.msg.user .pic img { max-width: 180px; max-height: 140px; }
dialog.ask.wide { width: min(96vw, 1100px); }
.pic-full { display: block; max-width: 100%; max-height: calc(100dvh - 150px); margin: 0 auto; border-radius: calc(var(--radius) - 2px); }
.ask-acts .grow { flex: 1; align-self: center; }

/* ---- the Images tab: a studio (prompt, model, shape, settings), a queue and a gallery ---- */
.art-make textarea { resize: vertical; min-height: 92px; line-height: 1.4; }
.art-make input[type=text] { width: 100%; min-height: var(--field-h); padding: 7px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit; }
.art-make .err { margin-bottom: 8px; }
.art-under { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.art-under .grow, .art-bar .grow, .art-queue-top .grow, .art-info-top .grow { flex: 1; }
.art-styles, .art-ratios, .art-sizes { display: flex; flex-wrap: wrap; gap: 4px; }
.art-styles { margin-top: 8px; }
.art-style, .art-ratio { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-secondary); font-size: var(--fs-small); transition: border-color var(--quick), background var(--quick), color var(--quick); }
.art-style:hover, .art-ratio:hover { border-color: var(--accent); color: var(--text); }
.art-style.on, .art-ratio.on { border-color: var(--accent); background: var(--tonal); color: var(--accent); }
.art-ratio i { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.art-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.art-row input[type=number] { width: 9ch; }
.art-row select { width: auto; }
.art-neg { display: flex; gap: 6px; align-items: center; }
.art-neg input { flex: 1; min-width: 0; }
.art-note { margin: 4px 0 2px; }
.art-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 10px; margin-bottom: 6px; }
.art-more > summary { font-weight: 600; }
.block label.check { display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--text-secondary); }
.art-init { display: flex; gap: 10px; align-items: flex-start; }
.art-init .art-pic img { width: 96px; height: 96px; object-fit: cover; }
.art-init-side { flex: 1; min-width: 0; }
.art-init-side input[type=range] { width: 100%; }
.art-drop { width: 100%; padding: 14px 10px; border: 1px dashed var(--border); border-radius: var(--radius); background: transparent; color: var(--text-muted); font-size: var(--fs-small); transition: border-color var(--quick), color var(--quick); }
.art-drop:hover { border-color: var(--accent); color: var(--text); }
.art-drop.small { width: auto; padding: 8px 12px; }
.art-refs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.art-refs .fine { flex-basis: 100%; margin: 0; }
.art-chip { position: relative; display: inline-block; line-height: 0; }
.art-chip .art-pic img { width: 56px; height: 56px; object-fit: cover; }
.art-chip .x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-raised); color: var(--text-secondary); font-size: 10px; line-height: 1; }
.art-pic { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-raised); cursor: zoom-in; line-height: 0; transition: border-color var(--quick), transform var(--quick); }
.art-pic:hover { border-color: var(--accent); }
.art-pic img { display: block; max-width: 100%; height: auto; }

.art-queue { margin-bottom: 10px; }
.art-queue.none { display: none; }
.art-queue-top { display: flex; align-items: center; gap: 6px; font-size: var(--fs-ui); margin-bottom: 4px; }
.art-q { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: var(--fs-small); color: var(--text-secondary); }
.art-q .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-q .err { flex: 0 1 50%; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-q .mark { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); }
.art-q.making .mark { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.art-q.failed .mark { border-color: var(--danger); background: var(--danger); }
.art-q .x { border: 0; background: transparent; color: var(--text-muted); padding: 2px 4px; }

.art-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.art-bar h3 { margin: 0; white-space: nowrap; }
.art-bar input { width: 14ch; min-height: 28px; padding: 3px 9px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit; font-size: var(--fs-small); }
.btn.on { color: var(--accent); background: var(--tonal); }
.art-bulk { margin: 0 0 8px; }
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-bottom: 8px; }
.art-cell { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-raised); cursor: zoom-in; transition: border-color var(--quick), transform var(--quick); animation: fade var(--calm) var(--ease) both; }
.art-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.art-cell.picked { outline: 3px solid var(--accent); outline-offset: -3px; }
.art-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-cell .fav { position: absolute; top: 4px; right: 6px; color: var(--warn); text-shadow: 0 1px 3px rgb(0 0 0 / .6); }
.art-cell .kind { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: var(--radius-pill); background: rgb(0 0 0 / .62); color: #fff; font-size: 10px; line-height: 1.5; }

/* pictures under a message, and waiting beside the composer */
.art-strip { display: grid; gap: 8px; margin: 8px 0; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; }
.art-strip.n1 { grid-template-columns: minmax(0, 1fr); max-width: 440px; }
.art-strip .art-pic img { width: 100%; }
.art-gone { padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: var(--fs-small); line-height: 1.4; }

/* the viewer: the picture beside everything known about it */
dialog.ask.art-view { width: min(96vw, 1240px); height: min(94dvh, 900px); }
dialog.art-view .ask-in { padding: 0; height: 100%; display: block; }
.art-view-in { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100%; }
.art-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: color-mix(in srgb, var(--fg) 8%, var(--surface)); overflow: auto; }
.art-full { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; display: block; flex: 0 1 auto; min-height: 0; }
.art-full.actual { max-width: none; max-height: none; cursor: zoom-out; flex: none; }
.art-sibs { display: flex; gap: 4px; padding: 6px; overflow-x: auto; flex: 0 0 auto; background: var(--surface-raised); border-top: 1px solid var(--border); }
.art-sib { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; line-height: 0; background: transparent; }
.art-sib.on { border-color: var(--accent); }
.art-sib img { width: 52px; height: 52px; object-fit: cover; display: block; }
.art-info { padding: 12px 14px; overflow-y: auto; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.art-info-top { display: flex; align-items: center; gap: 2px; }
.art-info-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-prompt p { font-size: var(--fs-ui); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 220px; overflow-y: auto; margin: 0 0 4px; }
.art-info .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.art-info .fact { display: flex; flex-direction: column; font-size: var(--fs-small); min-width: 0; }
.art-info .fact span { color: var(--text-muted); font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .08em; }
.art-info .fact b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-info .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.art-said { font-size: var(--fs-ui); overflow-wrap: anywhere; }
.art-said .err { margin: 0; }

dialog.ask.art-mask { width: min(96vw, 720px); }
.art-mask-canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; cursor: crosshair; }
.art-mask-bar { display: flex; align-items: center; gap: 10px; }
.art-mask-bar input[type=range] { flex: 1; }

@media (max-width: 760px) {
  .art-view-in { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 55%) minmax(0, 1fr); }
  .art-info { border-left: 0; border-top: 1px solid var(--border); }
}

/* ---- the Video tab: a player, the film's settings, and its shots ---- */
.vid-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.vid-bar select { flex: 1; min-width: 0; width: auto; }
.vid-bar input[type=range] { flex: 1; min-width: 80px; }
.vid-bar input[type=number] { width: 8ch; }
.vid-stage input[type=text], .tab-video .block input[type=text] { width: 100%; min-height: var(--field-h); padding: 7px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit; }
.vid-stage .vid-title { font-weight: 600; margin-bottom: 8px; }
.vid-canvas { display: block; width: 100%; height: auto; max-height: 52vh; object-fit: contain; background: #000; border-radius: var(--radius); }
.vid-stage .err:empty { display: none; }
#vidIdea { resize: vertical; min-height: 68px; }
.vid-shot { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; margin-bottom: 8px; background: var(--surface-raised); }
.vid-shot-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: var(--fs-ui); flex-wrap: wrap; }
.vid-shot-top .grow { flex: 1; }
.vid-shot-body { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 8px; }
.vid-pics { display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
.vid-pics .art-pic { flex: 1 1 60px; }
.vid-pics .art-pic img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.vid-blank { width: 100%; aspect-ratio: 16 / 10; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: var(--fs-micro); }
.vid-shot-text { display: grid; gap: 5px; min-width: 0; }
.vid-shot-text textarea { resize: vertical; min-height: 44px; line-height: 1.35; font-size: var(--fs-ui); }
.vid-shot-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.vid-shot-row label { margin: 0; }
.vid-shot-row input, .vid-shot-row select { min-height: 28px; padding: 2px 8px; font-size: var(--fs-small); }
dialog.ask.art-pick { width: min(96vw, 860px); }
dialog.art-pick .art-grid { max-height: 60dvh; overflow-y: auto; }
@media (max-width: 520px) { .vid-shot-body { grid-template-columns: minmax(0, 1fr); } }

/* ---- the MCP door (Harness tab) ---- */
.door-url { overflow-wrap: anywhere; }
.door-fresh { border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px; margin: 8px 0; background: var(--tonal); }
.door-key { margin: 6px 0; padding: 8px; background: var(--surface); border-radius: calc(var(--radius) - 2px); font: var(--fs-small)/1.5 var(--font-mono); overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
#doorName { flex: 1; min-width: 0; }
