/* Abascaler look "H": white paper, hairlines, underlined tabs, a dotted work area; sky blue as the one colour,
   amber for attention. Type: Sora (headings), Instrument Sans (text), IBM Plex Mono (code, labels),
   Abascaler Wordmark (the logo). Chosen on the design canvas 18 Nov 2026 (design/2026-11-18-alternate). */
@font-face { font-family: "Instrument Sans"; src: url(/fonts/instrument-sans-400-600.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Sora"; src: url(/fonts/sora-500-700.ttf) format("truetype"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/ibm-plex-mono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/ibm-plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Abascaler Wordmark"; src: url(/fonts/abascaler-wordmark-400.ttf) format("truetype"); font-weight: 400; font-display: swap; }

:root {
  /* colours: sky blue for selection, links and state; amber (--sky, --warn, --bad) for what needs attention */
  --paper: #ffffff; --sunk: #f3f5f8; --raised: #edf3f8; --line: #e3e8ee; --line-strong: #d1d9e2; --line-soft: #ecf0f4;
  --ink: #1b2129; --ink-soft: #364150; --muted: #5d6877; --faint: #7d8896;
  --accent: #2b8fcf; --accent-edge: #1c6fa6; --accent-text: #1c6fa6; --accent-soft: #e3f2fb; --accent-line: #c4e2f5; --sky: #c27216;
  --ok: #2b8fcf; --ok-soft: #e3f2fb; --ok-text: #1c6fa6; --warn: #c27216; --warn-soft: #fcf0e1; --bad: #b8640f; --bad-soft: #fcf0e1;
  --dark: #121211; --dark-2: #1c1c1a; --dark-line: #2c2c29; --dark-text: #ecebe6; --dark-muted: #9a9a92;
  --cool: #8fb0dc; --lilac: #b7a1e0; --mint: #6fbf8e; --sand: #e8b04a;
  /* code */
  --t-c: #87919d; --t-s: #2f7d5c; --t-n: #b8640f; --t-k: #5560c4; --t-b: #1c6fa6; --t-f: #1b2129; --t-d: #7a55b8; --t-t: #1c6fa6; --t-e: #b8640f;
  --canvas: #ffffff; --dots: #d0d8e1; --hero: #a6dcfa; --hero-ink: #0b1218;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --display: "Sora", var(--sans);
  --word: "Abascaler Wordmark", var(--sans);
  --r-card: 12px; --r-chip: 6px; --r-btn: 8px;
  --edge: none;
  --chat-w: 400px; --side-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141a20; --sunk: #0e1317; --raised: #1a242d; --line: #25303a; --line-strong: #32404c; --line-soft: #1f2932;
    --ink: #e3eaf1; --ink-soft: #c3ced9; --muted: #9caab8; --faint: #798796;
    --accent: #6cc4f5; --accent-edge: #2b8fcf; --accent-text: #9ad7fa; --accent-soft: #12303f; --accent-line: #1d4a62; --sky: #f0a95a;
    --ok: #6cc4f5; --ok-soft: #12303f; --ok-text: #9ad7fa; --warn: #f0a95a; --warn-soft: #33240f; --bad: #f0a95a; --bad-soft: #33240f;
    --dark: #0d0d0c; --dark-2: #161615; --dark-line: #2c2c29;
    --t-c: #768492; --t-s: #8fd0ad; --t-n: #f0a95a; --t-k: #a3acf5; --t-b: #6cc4f5; --t-f: #e3eaf1; --t-d: #c1a6ec; --t-t: #6cc4f5; --t-e: #f0a95a;
    --canvas: #f3f5f8; --dots: #26313b; --hero: #a6dcfa; --hero-ink: #0b1218;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #141a20; --sunk: #0e1317; --raised: #1a242d; --line: #25303a; --line-strong: #32404c; --line-soft: #1f2932;
    --ink: #e3eaf1; --ink-soft: #c3ced9; --muted: #9caab8; --faint: #798796;
    --accent: #6cc4f5; --accent-edge: #2b8fcf; --accent-text: #9ad7fa; --accent-soft: #12303f; --accent-line: #1d4a62; --sky: #f0a95a;
    --ok: #6cc4f5; --ok-soft: #12303f; --ok-text: #9ad7fa; --warn: #f0a95a; --warn-soft: #33240f; --bad: #f0a95a; --bad-soft: #33240f;
    --dark: #0d0d0c; --dark-2: #161615; --dark-line: #2c2c29;
    --t-c: #768492; --t-s: #8fd0ad; --t-n: #f0a95a; --t-k: #a3acf5; --t-b: #6cc4f5; --t-f: #e3eaf1; --t-d: #c1a6ec; --t-t: #6cc4f5; --t-e: #f0a95a;
    --canvas: #f3f5f8; --dots: #26313b; --hero: #a6dcfa; --hero-ink: #0b1218;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sunk); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.i.fill { fill: currentColor; stroke: none; }

/* buttons: paper with a bottom edge; primary is ink, like abacos "Check for updates" */
button { background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--r-btn); padding: 5px 12px; cursor: pointer; box-shadow: var(--edge); transition: transform .06s, background .12s, border-color .12s; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
button:hover { background: var(--raised); }
button:active { transform: translateY(1px); box-shadow: none; }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; box-shadow: 0 2px 0 #000; }
button.primary:hover { background: var(--ink-soft); }
button.accent { background: var(--accent); border-color: var(--accent-edge); color: #fff; font-weight: 600; box-shadow: 0 2px 0 var(--accent-edge); }
button.small { font-size: 12.5px; padding: 2px 9px; border-radius: 8px; }
button.icon, label.icon { border: none; background: none; box-shadow: none; padding: 5px; border-radius: 8px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button.icon:hover, label.icon:hover { color: var(--ink); background: var(--raised); }
button.icon.on { color: var(--ink); background: var(--raised); }
button.link { border: none; background: none; box-shadow: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; padding: 0; }
input, select, textarea { background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--r-btn); padding: 6px 10px; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--ink) 10%, transparent); border-color: var(--ink-soft); }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }

/* ---------- top bar ---------- */
.top { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { font: 400 16px/1 var(--word); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 9px; margin-right: 6px; }
.logo { display: inline-block; width: 22px; height: 26px; background: var(--ink); -webkit-mask: url(/vendor/brand/abascaler-icon.svg) center / contain no-repeat; mask: url(/vendor/brand/abascaler-icon.svg) center / contain no-repeat; }
.crumb { color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12.5px; }
.nav { display: flex; gap: 2px; padding: 3px; background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; }
.nav button { border: none; background: none; box-shadow: none; color: var(--muted); padding: 4px 14px; border-radius: 9px; font-weight: 500; }
.nav button:hover { color: var(--ink); background: none; }
.nav button.on { color: var(--ink); background: var(--paper); box-shadow: 0 1px 0 var(--line-strong), 0 0 0 1px var(--line); }

/* ---------- shell: named areas, so hiding a pane never shifts the others ---------- */
.shell { display: grid; height: calc(100% - 52px); grid-template-areas: "side center rz chat"; grid-template-columns: var(--side-w) minmax(0, 1fr) 5px min(var(--chat-w), 46vw); }
.shell > .side { grid-area: side; } .shell > .center { grid-area: center; } .shell > .resizer { grid-area: rz; } .shell > .chat { grid-area: chat; }
.shell.noside { grid-template-areas: "center rz chat"; grid-template-columns: minmax(0, 1fr) 5px min(var(--chat-w), 46vw); }
.shell.wide, .shell.nochat { grid-template-areas: "side center"; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.shell.noside.wide, .shell.noside.nochat { grid-template-areas: "center"; grid-template-columns: minmax(0, 1fr); }
.shell.noside > .side, .shell.wide > .chat, .shell.wide > .resizer, .shell.nochat > .chat, .shell.nochat > .resizer { display: none; }

/* ---------- side: projects and files ---------- */
.side { border-right: 1px solid var(--line); background: var(--sunk); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.side section { padding: 12px 0 8px; }
.side section + section { border-top: 1px solid var(--line); }
.side section.grow { flex: 1; overflow: auto; }
.side-h { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 6px 16px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--faint); }
.side-h > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.side-h > span:last-child { display: flex; gap: 0; }
.list { list-style: none; margin: 0; padding: 0 8px; max-height: 30vh; overflow: auto; }
.list li { padding: 6px 10px; border-radius: 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.list li:hover { background: var(--raised); }
.list li.on { background: var(--ink); color: var(--paper); box-shadow: 0 2px 0 #000; }
.tree { font-size: 13px; padding: 0 8px; }
.tree .d, .tree .f { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tree .d { color: var(--muted); user-select: none; }
.tree .d .dn { flex: 1; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.tree .d .dn svg.i { width: 14px; height: 14px; }
.tree .f > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.tree .d:hover, .tree .f:hover { background: var(--raised); color: var(--ink); }
.tree .f.on { background: var(--raised); color: var(--ink); font-weight: 500; box-shadow: inset 2px 0 0 var(--ink); border-radius: 0 8px 8px 0; }
.tree .kind { display: inline-flex; color: var(--faint); }
.tree .kind svg.i { width: 15px; height: 15px; }
.tree .f.on .kind { color: var(--ink-soft); }
.tree .d .zip { visibility: hidden; border: 0; background: none; box-shadow: none; padding: 1px 3px; color: var(--muted); }
.tree .d .zip svg.i { width: 14px; height: 14px; }
.tree .d:hover .zip { visibility: visible; }
.tree .d.drop { background: var(--raised); color: var(--ink); outline: 1px dashed var(--ink-soft); }
body.dropping .tree { outline: 2px dashed var(--ink-soft); outline-offset: -4px; background: var(--accent-soft); border-radius: 12px; }
.empty { color: var(--muted); padding: 6px 10px; font-size: 13px; }

/* ---------- center: tabs and views ---------- */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; min-height: 41px; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 6px; padding: 5px 8px 6px 12px; border: 1px solid transparent; border-bottom: none; border-radius: 10px 10px 0 0; cursor: pointer; color: var(--muted); white-space: nowrap; font-size: 13px; }
.tab:hover { color: var(--ink); background: var(--sunk); }
.tab.on { background: var(--paper); border-color: var(--line); color: var(--ink); margin-bottom: -1px; font-weight: 500; box-shadow: inset 0 2px 0 var(--ink); }
.tab .kind { display: inline-flex; color: var(--faint); } .tab .kind svg.i { width: 14px; height: 14px; }
.tab .x { display: inline-flex; opacity: .45; border-radius: 6px; padding: 1px; } .tab .x:hover { opacity: 1; background: var(--raised); }
.tab .x svg.i { width: 13px; height: 13px; }
.tab .dirty::after { content: " ●"; color: var(--muted); }
.view { flex: 1; overflow: auto; min-height: 0; }
.pad { padding: 24px 28px; max-width: 1120px; }
.editor { display: flex; height: 100%; }
.editor .gutter { padding: 12px 10px; text-align: right; color: var(--faint); background: var(--sunk); user-select: none; font: 12.5px/1.6 var(--mono); white-space: pre; overflow: hidden; border-right: 1px solid var(--line); }
.editor textarea { flex: 1; border: none; border-radius: 0; resize: none; padding: 12px 14px; font: 12.5px/1.6 var(--mono); background: var(--paper); white-space: pre; overflow: auto; tab-size: 4; }
.editor textarea:focus { outline: none; }
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; background: var(--paper); flex-wrap: wrap; }
.bar .grow { flex: 1; }
.bar > .mono { color: var(--ink-soft); }
.imgview { padding: 24px; text-align: center; } .imgview img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
iframe.pdfview { flex: 1; width: 100%; min-height: 70vh; border: 0; background: var(--sunk); }

/* ---------- markdown and tables ---------- */
.md h1 { font-size: 26px; margin: 4px 0 14px; } .md h2 { font-size: 19px; margin: 26px 0 8px; } .md h3 { font-size: 16px; margin: 18px 0 6px; }
.md p { margin: 8px 0; } .md img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.md a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.md pre { background: var(--sunk); padding: 12px 14px; border-radius: 10px; overflow: auto; border: 1px solid var(--line-soft); }
.md code { background: var(--sunk); padding: 1px 5px; border-radius: 5px; }
.md pre code { background: none; padding: 0; }
.md table, table.t { border-collapse: separate; border-spacing: 0; margin: 10px 0; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.md th, .md td, table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 6px 12px; text-align: left; }
.md tr:last-child td, table.t tr:last-child td { border-bottom: none; }
.md th, table.t th { background: var(--sunk); font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.md blockquote { margin: 10px 0; padding: 4px 14px; border-left: 3px solid var(--line-strong); color: var(--muted); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- outputs gallery, tiles, cards ---------- */
.phead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.phead h1 { margin: 2px 0 4px; font-size: 30px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 22px; }
.chip { font-size: 12.5px; padding: 4px 11px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-strong); box-shadow: 0 1px 0 var(--line-strong); }
.chip:hover { background: var(--raised); }
.chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; justify-content: flex-start; }
.chip.ghost { background: none; color: var(--muted); border-style: dashed; box-shadow: none; }
.group { margin: 0 0 28px; }
.gh { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.gh .what { font: 600 15px/1.3 var(--display); }
.gh .what::first-letter { text-transform: uppercase; }
.gh .hint { font-family: var(--mono); font-size: 11.5px; }
.gh .grow { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.thumb { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; cursor: pointer; background: var(--paper); box-shadow: 0 3px 0 var(--line); transition: transform .1s, box-shadow .1s; }
.thumb:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--line-strong); }
.thumb img, .thumb canvas.mini { width: 100%; height: 130px; object-fit: contain; background: var(--canvas); display: block; border-bottom: 1px solid var(--line-soft); }
.thumb > div:last-child { padding: 8px 10px; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.thumb.file .fi { height: 130px; display: grid; place-items: center; color: var(--faint); background: var(--sunk); padding: 0; border-bottom: 1px solid var(--line-soft); }
.thumb pre.peek { margin: 0; height: 130px; overflow: hidden; padding: 10px 12px; font: 10.5px/1.5 var(--mono); color: var(--ink-soft); background: var(--sunk); border-bottom: 1px solid var(--line-soft); white-space: pre; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.thumb.file .fi svg.i { width: 34px; height: 34px; stroke-width: 1.4; }
.emptystate { border: 1px dashed var(--line-strong); border-radius: var(--r-card); padding: 34px 24px; text-align: center; color: var(--muted); background: var(--sunk); }
.emptystate h2 { color: var(--ink); margin: 0 0 6px; font-size: 19px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin: 14px 0 24px; }
.tile { border: 1px solid var(--dark-line); border-radius: var(--r-card); padding: 14px 16px; background: var(--dark); color: var(--dark-text); }
.tile .v { font: 700 26px/1.15 var(--display); font-variant-numeric: tabular-nums; color: var(--mint); }
.tile:nth-child(4n+2) .v { color: var(--cool); } .tile:nth-child(4n+3) .v { color: var(--sand); } .tile:nth-child(4n+4) .v { color: var(--lilac); }
.tile .k { font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--dark-muted); margin-top: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.tcard { border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 3px 0 var(--line); }
.tcard h3 { margin: 0; font-size: 17px; } .tcard .meta { color: var(--muted); font-size: 12px; }
.tcard p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); font: 500 11px/1.6 var(--mono); margin-right: 4px; }
.pill.ok { color: var(--ok-text); background: var(--ok-soft); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.search { width: 100%; max-width: 520px; margin: 6px 0 18px; padding: 9px 14px; border-radius: 12px; }
.hbar { height: 8px; background: var(--ink-soft); border-radius: 4px; min-width: 2px; }
canvas.plot { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--canvas); }

/* ---------- chat ---------- */
.resizer { cursor: col-resize; background: var(--line); border-left: 2px solid var(--paper); border-right: 2px solid var(--paper); }
.resizer:hover { background: var(--line-strong); }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--sunk); }
.chat-h { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; background: var(--paper); }
.chat-h .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-h .title { font: 600 16px/1.2 var(--display); flex: 1; }
.chat-h .row.hint { font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.ready { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.starting { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: pulse 1.2s infinite; }
.dot.failed { background: var(--bad); } .dot.paused { background: var(--faint); }
@keyframes pulse { 50% { opacity: .35; } }
.msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); padding: 8px 13px; border-radius: 14px 14px 4px 14px; max-width: 88%; white-space: pre-wrap; }
.msg.agent { max-width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 13px; }
.msg.agent.md p:first-child { margin-top: 0; } .msg.agent.md p:last-child { margin-bottom: 0; }
.msg.sys { color: var(--faint); font: 11.5px var(--mono); text-align: center; }
.msg.err { color: var(--bad); font-size: 13px; background: var(--bad-soft); border-radius: 10px; padding: 6px 10px; }
.call { border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; background: var(--paper); box-shadow: 0 2px 0 var(--line); }
.call summary { padding: 6px 10px; cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; }
.call summary::-webkit-details-marker { display: none; }
.call .nm { font-family: var(--mono); font-weight: 500; color: var(--ink); } .call .sm { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-family: var(--mono); font-size: 11.5px; }
.call pre { margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--sunk); border-radius: 0 0 10px 10px; }
.outs { display: flex; gap: 8px; flex-wrap: wrap; }
.outs .o { border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--canvas); overflow: hidden; box-shadow: 0 2px 0 var(--line); }
.outs .o img { height: 92px; display: block; }
.outs .o.file { padding: 4px 10px; background: var(--paper); font-size: 12px; font-family: var(--mono); }
.composer { padding: 10px 12px 12px; background: var(--sunk); }
.composer textarea { width: 100%; resize: vertical; min-height: 64px; border-radius: 14px; padding: 10px 12px; background: var(--paper); box-shadow: 0 2px 0 var(--line); }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.composer-row .keys { margin-left: auto; font-family: var(--mono); font-size: 11px; }
.hint { color: var(--muted); font-size: 12px; }
.starter { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; }
.starter .chip { color: var(--ink); text-align: left; }
.msg.user.pending { opacity: .7; }
.msgtools { display: flex; justify-content: flex-end; margin-top: 2px; }
.addnb { border: none; background: none; box-shadow: none; color: var(--muted); font-size: 11.5px; padding: 1px 4px; visibility: hidden; }
.msg.agent:hover .addnb, .call:hover .addnb, .bar .addnb { visibility: visible; }
.addnb:hover { color: var(--ink); background: none; }
.bar .addnb { border: 1px solid var(--line-strong); padding: 5px 12px; font-size: 13px; color: var(--ink); background: var(--paper); box-shadow: var(--edge); border-radius: var(--r-btn); }

/* ---------- forms, modal, toast ---------- */
.form { display: grid; grid-template-columns: 96px 1fr; gap: 10px 12px; align-items: center; font-size: 13px; }
.form label { color: var(--muted); }
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; background: rgba(28, 26, 20, .38); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 10; }
.modal .card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px; width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 4px 0 var(--line-strong), 0 24px 60px rgba(0, 0, 0, .18); }
.modal .card h3 { margin: 0; font-size: 20px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 12px; z-index: 20; font-size: 13px; box-shadow: 0 3px 0 #000, 0 10px 30px rgba(0, 0, 0, .2); }
.fns summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.fns ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.switch { font-size: 13px; display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.switch input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; }
.month { border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; background: var(--paper); display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-width: 660px; box-shadow: 0 3px 0 var(--line); }
.month .big { font: 700 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.meter { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.meter div { height: 100%; background: var(--ok); }
.meter div.warn { background: var(--warn); }
.budget { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.budget .hint:last-child { width: 100%; }

/* ---------- notebook ---------- */
.nbwrap { display: flex; flex-direction: column; min-height: 100%; }
.nbbar { position: sticky; top: 0; z-index: 2; }
.seg { display: inline-flex; padding: 2px; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; }
.seg button { border: none; box-shadow: none; border-radius: 8px; padding: 3px 12px; background: none; color: var(--muted); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 var(--line-strong), 0 0 0 1px var(--line); }
.nb { padding: 20px 28px 90px; max-width: 1000px; width: 100%; }
.nbtitle { width: 100%; font: 600 26px/1.2 var(--display); border: none; background: none; padding: 4px 0; margin-bottom: 10px; border-radius: 0; }
.nbtitle:focus { outline: none; border-bottom: 2px solid var(--line-strong); }
.cell { position: relative; border: 1px solid transparent; border-radius: 12px; padding: 8px 12px 8px 68px; margin: 6px 0; transition: border-color .12s, background .12s; }
.cell:hover, .cell:focus-within { border-color: var(--line); background: var(--paper); }
.cell.running { border-color: var(--ink-soft); background: var(--paper); }
.cell.running::after { content: "running…"; position: absolute; right: 12px; top: 8px; color: var(--muted); font: 11.5px var(--mono); }
.ctools { position: absolute; left: 6px; top: 8px; width: 58px; display: flex; flex-wrap: wrap; gap: 0; align-items: center; }
.ctools .ck { font: 500 10.5px var(--mono); color: var(--faint); width: 100%; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.ctools button.icon { padding: 2px; visibility: hidden; } .ctools button.icon svg.i { width: 13px; height: 13px; }
.cell:hover .ctools button.icon, .cell:focus-within .ctools button.icon { visibility: visible; }
.ctools button.icon[title^="Run"] { visibility: visible; color: var(--ink); }
.cell .md p:first-child, .cell .md h1:first-child { margin-top: 2px; }
.mdedit, .cell textarea.code { width: 100%; resize: vertical; font: 12.5px/1.6 var(--mono); }
.cell textarea.code { background: var(--sunk); border-color: var(--line-soft); white-space: pre; tab-size: 4; border-radius: 10px; }
.toolin { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 2px 0 var(--line); overflow: hidden; }
.toolsum { display: flex; gap: 8px; align-items: center; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.toolsum .mono { color: var(--ink); font-weight: 500; }
.toolsum svg.i { width: 14px; height: 14px; color: var(--faint); }
.toolhead { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--sunk); flex-wrap: wrap; }
.toolhead .grow { flex: 1; }
.toolhead .fdesc { max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnpick { max-width: 260px; }
.toolargs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 14px; padding: 10px 12px 12px; background: var(--sunk); }
.toolargs > textarea, .toolargs > .fielderr, .toolargs > p { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.field:has(textarea) { grid-column: 1 / -1; }
.field .fk { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.fielderr { color: var(--bad); font-size: 12.5px; }
.outputs { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.outputs:empty { display: none; }
.outputs .stream { margin: 0; padding: 9px 12px; background: var(--dark); color: var(--dark-text); border-radius: 10px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--dark-line); }
.outputs .stream.stderr { color: #f0a097; }
.outputs .stream.json { max-height: 420px; }
.outputs .imgout { max-width: 100%; max-height: 460px; object-fit: contain; align-self: flex-start; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.outputs canvas.cellplot { height: 340px; }
.outputs table.meas { margin: 2px 0; align-self: flex-start; }
.htmlout { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.details { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.addrow { display: flex; gap: 8px; margin: 14px 0 0 68px; }
.addrow button { color: var(--ink-soft); }
.rtitle { margin-bottom: 14px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.rtitle h1 { margin: 0; font-size: 30px; }
/* report theme: prose and results only */
.nb.report .cell { padding-left: 0; border-color: transparent !important; background: none !important; }
.nb.report .ctools, .nb.report .input, .nb.report .toolin, .nb.report .details, .nb.report .addrow, .nb.report .outputs .stream.json, .nb.report .outputs .stream.toolres { display: none; }
.nb.report .outputs .stream:not(.stderr) { background: none; padding: 0 0 0 12px; border: none; border-left: 2px solid var(--line-strong); border-radius: 0; }
.nb.report .cell.markdown .hint { display: none; }

/* ---------- narrow screens ---------- */
.panes { display: none; }
@media (max-width: 1100px) { :root { --side-w: 210px; } }
/* ---- H: hairlines, underlined tabs, flat colour (no gradients); dotted pages for cards, plain pages for writing ---- */
button, button.primary, button.accent { box-shadow: none; }
button:active { transform: none; }
.top { background: var(--paper); border-bottom-color: var(--line); }
.brand { gap: 10px; }
.nav { background: none; border: 0; padding: 0; gap: 22px; border-radius: 0; align-self: stretch; }
.nav button { border-radius: 0; padding: 0 2px; font-weight: 400; color: var(--muted); background: none; box-shadow: none; }
.nav button:hover { color: var(--ink); background: none; }
.nav button.on { background: none; box-shadow: inset 0 -2px 0 var(--accent); color: var(--ink); font-weight: 600; }
.side { background: var(--paper); }
.side-h { font: 600 10px/1 var(--sans); letter-spacing: .08em; color: var(--faint); }
.list li { border-radius: 8px; font-weight: 400; padding: 6px 10px; }
.list li.on { background: var(--accent-soft); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; }
.tree .d, .tree .f { border-radius: 6px; }
.tree .f.on { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); border-radius: 0 6px 6px 0; }
.tree .f.on .kind { color: var(--accent); }
.tabs { gap: 22px; padding: 0 18px; min-height: 40px; align-items: stretch; background: var(--paper); }
.tab { border: 0; border-radius: 0; padding: 0 2px; background: none; font-size: 13px; }
.tab:hover { background: none; color: var(--ink); }
.tab.on { border: 0; margin: 0; background: none; box-shadow: inset 0 -2px 0 var(--accent); font-weight: 600; color: var(--ink); }
.center, .center .view { background-color: var(--paper); }
.center .view[data-paper="dots"] { background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 14px 14px; }
.bar { background: var(--paper); }
.editor .gutter, .editor textarea { background: var(--paper); }
.phead h1, .pad > h1 { font-size: 26px; font-weight: 600; letter-spacing: -.025em; }
.phead .hint { font-family: var(--mono); font-size: 11.5px; }
.chip { border-radius: 999px; box-shadow: none; border-color: var(--line-strong); background: var(--paper); font-family: var(--mono); font-size: 11.5px; padding: 3px 11px; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip.ghost { border-style: dashed; background: transparent; }
.group { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 18px; overflow: hidden; }
.gh { margin: 0; padding: 9px 12px; align-items: center; border-bottom: 1px solid var(--line-soft); }
.gh .what { font: 600 13px/1.3 var(--mono); }
.gh .what::first-letter { text-transform: none; }
.gh .runtag { padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font: 600 10px/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.grid { padding: 12px; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.thumb { border-radius: 8px; box-shadow: none; border-color: var(--line); }
.thumb:hover { transform: none; box-shadow: none; border-color: var(--accent); }
.thumb img, .thumb img.mini, .thumb pre.peek { height: 110px; }
.thumb img.mini { width: 100%; object-fit: contain; display: block; background: var(--canvas); border-bottom: 1px solid var(--line-soft); }
.thumb > div:last-child { font-family: var(--mono); font-size: 11.5px; font-weight: 400; padding: 7px 9px; }
.resizer { background: var(--line); border-left: 2px solid var(--paper); border-right: 2px solid var(--paper); }
.chat, .msgs { background: var(--paper); }
.chat-h { background: var(--hero); color: var(--hero-ink); border-bottom: 0; }
.chat-h .title { font: 600 14px/1.2 var(--sans); color: var(--hero-ink); }
.chat-h .row.hint, .chat-h .hint { color: rgba(11,18,24,.82); }
.chat-h button.small { background: var(--hero-ink); border-color: var(--hero-ink); color: #ffffff; font-weight: 600; }
.chat-h button.small:hover { background: #26303a; }
.chat-h button.icon { color: var(--hero-ink); }
.chat-h button.icon:hover { background: rgba(255,255,255,.45); }
.chat-h .dot.ready { background: #12a150; box-shadow: 0 0 0 3px rgba(18,161,80,.22); }
.chat-h .dot.paused { background: rgba(11,18,24,.45); }
.msg.user { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px 12px 4px 12px; }
.msg.agent { border-radius: 12px 12px 12px 4px; border-color: var(--line); }
.msg.sys { font-size: 10.5px; }
.call { border-radius: 10px; box-shadow: none; border-color: var(--line); }
.call summary { padding: 6px 10px; }
.call summary svg.i { color: var(--accent); }
.call pre { border-radius: 0 0 10px 10px; }
.pill { border-radius: 999px; font: 600 10px/1.7 var(--sans); letter-spacing: .03em; padding: 0 8px; border: 0; }
.pill.ok::after { content: " \2713"; }
.callerr { border-left: 2px solid var(--bad); color: var(--bad); }
.outs .o { border-radius: 8px; box-shadow: none; }
.md pre { border-radius: 10px; }
.composer { background: var(--paper); border-top: 1px solid var(--line); }
.composer textarea { border-radius: 12px; box-shadow: none; border-color: var(--line-strong); }
.nbbar { background: var(--paper); }
.seg { border-radius: 999px; background: var(--sunk); }
.seg button { border-radius: 999px; }
.seg button.on { box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.nb .cell:hover, .nb .cell:focus-within { background: var(--paper); border-color: var(--line); }
.toolin { border-radius: 12px; box-shadow: none; border-color: var(--line); }
.outputs .stream, .outputs .imgout { border-radius: 10px; }
.search { border-radius: 999px; }
.tcard { border-radius: 12px; box-shadow: none; border-color: var(--line); }
.tile { background: var(--paper); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; }
.tile .v, .tile:nth-child(4n+2) .v, .tile:nth-child(4n+3) .v, .tile:nth-child(4n+4) .v { color: var(--ink); }
.tile:nth-child(odd) .v { color: var(--accent); } .tile:nth-child(3n) .v { color: var(--sky); }
.tile .k { color: var(--muted); }
.month { border-radius: 12px; box-shadow: none; border-color: var(--line); }
.meter { border-radius: 999px; background: var(--raised); }
.meter div, .hbar { background: var(--accent); }
.md table, table.t { border-radius: 12px; background: var(--paper); border-color: var(--line); }
.md th, table.t th { background: var(--raised); }

@media (max-width: 760px) {
  .shell, .shell.wide, .shell.noside, .shell.nochat { display: block; height: calc(100% - 52px - 54px); }
  .shell > .side, .shell > .center, .shell > .chat { display: none !important; height: 100%; max-height: none; }
  .shell[data-pane="files"] > .side, .shell[data-pane="work"] > .center, .shell[data-pane="chat"] > .chat { display: flex !important; }
  .shell.wide > .center { display: flex !important; }
  .resizer, #toggleSide, #toggleChat, .crumb, .composer-row .keys { display: none !important; }
  .brand { font-size: 15px; margin-right: auto; }
  .nav button { padding: 4px 10px; }
  .panes { display: flex; gap: 4px; height: 54px; padding: 6px 8px; border-top: 1px solid var(--line); background: var(--paper); }
  .panes button { flex: 1; border: none; box-shadow: none; border-radius: 10px; background: none; color: var(--muted); font-weight: 500; }
  .panes button.on { color: var(--paper); background: var(--ink); }
  .pad, .nb { padding: 16px 16px 60px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .thumb img, .thumb canvas.mini, .thumb pre.peek, .thumb.file .fi { height: 100px; }
  .phead h1 { font-size: 24px; }
  .cell { padding-left: 10px; padding-top: 26px; }
  .ctools { flex-wrap: nowrap; width: auto; top: 4px; left: 10px; gap: 4px; }
  .ctools .ck { width: auto; margin: 0 4px 0 0; }
  .ctools button.icon { visibility: visible; }
  .cell textarea.code, .mdedit, .toolargs, .addrow, .nbbar .seg + button, .nbtitle { display: none; }
  .top { gap: 8px; }
}
@media print {
  body.printing .top, body.printing .side, body.printing .chat, body.printing .resizer, body.printing .tabs, body.printing .nbbar, body.printing .panes, body.printing .toast { display: none !important; }
  body.printing .shell { display: block; height: auto; }
  body.printing .view { overflow: visible; }
  body.printing .nb { max-width: none; padding: 0; }
  body.printing .cell { break-inside: avoid; }
  body.printing, body.printing html { background: #fff; color: #000; }
}
.shell.wide .tabs { display: none; }

/* ---------- code highlighting and the overlay editor ---------- */
.t-c { color: var(--t-c); font-style: italic; } .t-s { color: var(--t-s); } .t-n { color: var(--t-n); } .t-k { color: var(--t-k); font-weight: 500; }
.t-b { color: var(--t-b); } .t-f { color: var(--t-f); font-weight: 500; } .t-d { color: var(--t-d); } .t-t { color: var(--t-t); font-weight: 500; } .t-e { color: var(--t-e); }
.hlwrap { position: relative; display: block; }
.editor .hlwrap { flex: 1; min-width: 0; height: 100%; }
.hlpre { position: absolute; inset: 0; margin: 0; overflow: hidden; pointer-events: none; white-space: pre; tab-size: 4; border: 1px solid transparent; }
.hlpre code { font: inherit; background: none; padding: 0; }
textarea.hlta { position: relative; z-index: 1; background: transparent !important; color: transparent; caret-color: var(--ink); }
textarea.hlta::selection { background: color-mix(in srgb, var(--cool) 40%, transparent); color: transparent; }
textarea.hlta::placeholder { color: var(--faint); }
/* the overlay copies its textarea's box exactly */
.editor .hlpre { padding: 12px 14px; font: 12.5px/1.6 var(--mono); border: none; }
.editor .hlwrap textarea { width: 100%; height: 100%; }
.cell .hlwrap, .toolargs .hlwrap, .field .hlwrap { background: var(--sunk); border-radius: 10px; }
.cell .hlpre, .toolargs .hlpre, .field .hlpre { padding: 6px 10px; font: 12.5px/1.6 var(--mono); border-radius: 10px; }
.cell .hlwrap textarea.code, .toolargs .hlwrap textarea, .field .hlwrap textarea { width: 100%; display: block; padding: 6px 10px; font: 12.5px/1.6 var(--mono); }
.md pre[data-lang] { position: relative; }
.md pre[data-lang]::after { content: attr(data-lang); position: absolute; top: 6px; right: 10px; font: 10.5px var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
/* ---------- equations ---------- */
.math { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.md .katex-display { margin: 10px 0; }
.katex { font-size: 1.08em; }
code.tex { color: var(--t-d); }
.mmd { margin: 12px 0; overflow-x: auto; text-align: center; }
.mmd svg { max-width: 100%; height: auto; }
.mmd:not(.mmd-ok):not(.mmd-err) { min-height: 40px; }
.mmd.mmd-err { text-align: left; } .mmd.mmd-err pre { background: var(--sunk); padding: 8px 10px; border-radius: 8px; }
.call summary svg.i { width: 14px; height: 14px; color: var(--faint); }
.call pre.args { color: var(--muted); }
.callerr { margin: -6px 0 0 12px; padding: 3px 0 3px 10px; border-left: 2px solid var(--bad); color: var(--bad); font: 11.5px/1.5 var(--mono); }

/* problems from abacheck: marked line numbers and a list under the editor */
.editor .gutter .g-err, .editor .gutter .g-warn { border-radius: 3px; padding: 0 3px; margin-right: -3px; cursor: help; }
.editor .gutter .g-err { color: #ffffff; background: var(--bad); font-weight: 600; }
.editor .gutter .g-warn { color: var(--warn); background: var(--warn-soft); font-weight: 600; }
.problems { max-height: 132px; overflow: auto; border-top: 1px solid var(--line); background: var(--paper); font: 12px/1.5 var(--mono); padding: 4px 0; }
.problems .prob { display: grid; grid-template-columns: 64px minmax(0, auto) minmax(0, 1fr); gap: 10px; padding: 2px 14px; cursor: pointer; align-items: baseline; }
.problems .prob:hover { background: var(--sunk); }
.problems .prob .where { color: var(--faint); text-align: right; }
.problems .prob.error .where { color: var(--bad); font-weight: 600; }
.problems .prob.warning .where { color: var(--warn); }
.problems .prob .msg { color: var(--ink); }
.problems .prob .fixh { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.problems .prob .fixh::before { content: "fix: "; color: var(--faint); }

/* ---------- Cursor-study pass: views, search, problems, status bar, palette, steps, composer, settings ---------- */
:root { --code-size: 12.5px; }
.editor .gutter, .editor textarea, .editor .hlpre { font-size: var(--code-size); }
.views { display: inline-flex; gap: 2px; }
.views button { border: none; background: none; box-shadow: none; padding: 4px 7px; border-radius: 6px; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--faint); }
.views button:hover { color: var(--ink-soft); }
.views button.on { color: var(--ink); background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.sview { flex: 1; overflow: auto; min-height: 0; padding: 0 6px 12px; font-size: 13px; }
.sbar { display: flex; gap: 4px; align-items: center; padding: 2px 2px 6px; }
.sbar input { flex: 1; min-width: 0; padding: 5px 8px; font-size: 13px; }
.sbar .opt { padding: 3px 6px; font: 500 11px/1.2 var(--mono); box-shadow: none; color: var(--muted); }
.sbar .opt[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.sbar .hint { margin-left: 4px; font-size: 12px; }
.shead { color: var(--muted); font-size: 12px; padding: 4px 6px 6px; }
.sgroup { margin-bottom: 2px; }
.sfile { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.sfile:hover { background: var(--raised); }
.sfile svg { width: 12px; height: 12px; color: var(--faint); flex: none; }
.sgroup.shut .sfile svg { transform: rotate(-90deg); }
.sgroup.shut .srows { display: none; }
.sfile .nm { font-weight: 500; }
.sfile .nm.err { color: var(--bad); }
.sfile .dir { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.sfile .n { margin-left: auto; font: 500 11px/1 var(--mono); background: var(--line); color: var(--ink-soft); padding: 2px 6px; border-radius: 8px; }
.sfile .n.err, .sfile .n.warn { background: var(--warn-soft); color: var(--warn); }
.srow { display: flex; gap: 8px; padding: 2px 6px 2px 24px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.srow:hover { background: var(--raised); }
.srow .ln { color: var(--faint); font: 11.5px/1.6 var(--mono); flex: none; min-width: 22px; text-align: right; }
.srow .tx { font: 12px/1.6 var(--mono); white-space: pre; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.srow mark { background: var(--warn-soft); color: var(--ink); border-radius: 2px; box-shadow: 0 0 0 1px var(--warn); }
.prow .tx { font-family: var(--sans); white-space: normal; }
.prow.error .ln { color: var(--bad); }
.prow .fixh { display: block; color: var(--muted); font-size: 11.5px; }
.tree .f .pcount { margin-left: auto; font: 500 10.5px/1 var(--mono); padding: 2px 5px; border-radius: 7px; background: var(--warn-soft); color: var(--warn); flex: none; }
.tree .f.has-err .fname { color: var(--bad); text-decoration: underline wavy var(--bad); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tree .f.has-warn .fname { color: var(--warn); }
.tree .d.flash { background: var(--accent-soft); }

/* status bar under the editor */
.status { display: flex; align-items: center; gap: 2px; height: 26px; padding: 0 8px; border-top: 1px solid var(--line); background: var(--sunk); font: 11.5px/1 var(--mono); color: var(--muted); flex: none; }
.status .grow { flex: 1; }
.status .st { border: none; background: none; box-shadow: none; padding: 3px 7px; border-radius: 5px; font: inherit; color: inherit; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.status button.st:hover { background: var(--raised); color: var(--ink); }
.status .st.err { color: var(--bad); }
.status .st.warn { color: var(--warn); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.status .dot.ready { background: var(--ok); } .status .dot.starting { background: var(--warn); } .status .dot.paused { background: var(--faint); }

/* breadcrumbs above a file */
.crumbs { display: inline-flex; align-items: center; gap: 1px; font: 12px/1 var(--mono); color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs .sep svg { width: 10px; height: 10px; color: var(--faint); }
.crumbs .crumb-dir { border: none; background: none; box-shadow: none; padding: 3px 4px; border-radius: 5px; font: inherit; color: inherit; }
.crumbs .crumb-dir:hover { background: var(--raised); color: var(--ink); }
.crumbs .crumb-file { color: var(--ink); font-weight: 500; padding: 3px 4px; }

/* quick open and commands */
.palette { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(20, 26, 32, .18); }
.palette[hidden] { display: none; }
.pbox { width: min(620px, calc(100vw - 32px)); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); overflow: hidden; }
.pbox input { width: 100%; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 14px; font-size: 14px; }
.pbox input:focus { outline: none; }
.plist { max-height: 50vh; overflow: auto; padding: 4px; }
.pitem { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.pitem.on { background: var(--accent-soft); }
.pitem .kind { color: var(--muted); display: inline-flex; }
.pitem .pl { overflow: hidden; text-overflow: ellipsis; }
.pitem .ps { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.pitem .pk { margin-left: auto; color: var(--faint); font: 11px/1 var(--mono); }
.pitem .ps:last-child { margin-left: auto; }
.pitem .pl + .ps:not(:last-child) { margin-left: 0; }
.pempty { color: var(--muted); padding: 10px; font-size: 13px; }

/* chat: folded steps and the turn's files */
.steps { margin: 4px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.steps .shead2 { width: 100%; justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 6px 10px; font-size: 12.5px; color: var(--muted); }
.steps .shead2 svg { width: 12px; height: 12px; transition: transform .12s; }
.steps.open .shead2 svg { transform: rotate(90deg); }
.steps.running .shead2 { color: var(--ink-soft); }
.steps.bad .shead2 .sl { color: var(--bad); }
.steps .slist { display: none; padding: 0 6px 6px; }
.steps.open .slist { display: block; }
.turnfiles { margin: 6px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 6px; }
.turnfiles .tfh { display: flex; align-items: center; gap: 6px; padding: 2px 4px 6px; font-weight: 500; font-size: 12.5px; }
.turnfiles .tfh .grow { flex: 1; }
.turnfiles .tf { display: flex; width: 100%; justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 3px 6px; border-radius: 6px; font-size: 12.5px; gap: 6px; }
.turnfiles .tf:hover { background: var(--raised); }
.turnfiles .tf .dir { color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }

/* composer: modes and @ files */
.composer { position: relative; }
.modes { display: flex; gap: 4px; margin-bottom: 6px; }
.modes .mode { padding: 2px 9px; font-size: 12px; box-shadow: none; color: var(--muted); border-color: var(--line); border-radius: 999px; }
.modes .mode.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 500; }
.modes .mode.at { margin-left: auto; font-family: var(--mono); }
.mention { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; z-index: 20; }
.mention[hidden] { display: none; }
.msg.user .modetag { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); }
.msg .mention { position: static; display: inline; border: none; box-shadow: none; padding: 0 2px; background: var(--accent-soft); color: var(--accent-text); font: 12px var(--mono); border-radius: 4px; }
button.mention { position: static; display: inline; border: none; box-shadow: none; padding: 0 3px; background: var(--accent-soft); color: var(--accent-text); font: 12px var(--mono); border-radius: 4px; }

/* settings page */
.settings { max-width: 760px; }
.settings h2 { font-size: 15px; margin: 26px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.srow-set { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.srow-set .st-t { font-weight: 500; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; cursor: pointer; transition: background .12s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .12s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.row-end { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.lt { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.lt td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.lt.keys td:first-child { width: 140px; }
#fileActions[hidden], .status[hidden] { display: none; }

/* ---------- CodeMirror editor ---------- */
.cmwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor.cm { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.editor.cm .cm-editor { flex: 1; min-height: 0; height: 100%; background: var(--paper); color: var(--ink); }
.editor.cm .cm-editor.cm-focused { outline: none; }
.editor.cm .cm-scroller { font: var(--code-size)/1.6 var(--mono); }
.editor.cm .cm-content { padding: 12px 0; caret-color: var(--ink); }
.editor.cm .cm-line { padding: 0 14px 0 6px; }
.editor.cm .cm-gutters { background: var(--paper); border-right: 1px solid var(--line); color: var(--faint); }
.editor.cm .cm-activeLine { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.editor.cm .cm-activeLineGutter { background: transparent; color: var(--ink); }
.editor.cm .cm-selectionBackground, .editor.cm .cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground { background: var(--accent-line) !important; }
.editor.cm .cm-cursor { border-left-color: var(--ink); }
.editor.cm .cm-matchingBracket { background: var(--accent-soft); outline: 1px solid var(--accent-line); }
.editor.cm .cm-selectionMatch { background: var(--warn-soft); }
.editor.cm .cm-foldGutter .cm-gutterElement { padding: 0 4px; cursor: pointer; color: var(--faint); }
.editor.cm .cm-foldGutter .cm-gutterElement:hover { color: var(--ink); }
.editor.cm .cm-foldPlaceholder { background: var(--sunk); border: 1px solid var(--line-strong); color: var(--muted); border-radius: 4px; padding: 0 5px; margin: 0 4px; }
/* change bars */
.editor.cm .cm-ghost { color: var(--faint); white-space: pre; cursor: pointer; }
.editor.cm .cm-changes { width: 4px; }
.editor.cm .cm-changes .cm-gutterElement { padding: 0; }
.cbar { width: 3px; height: 100%; margin-left: 1px; }
.cbar.add { background: #2e9a5a; }
.cbar.mod { background: var(--accent); }
.cbar.del { height: 0; width: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 5px solid #c4422b; margin-top: -4px; }
/* problems: squiggles, gutter dots, hover */
.editor.cm .cm-lintRange-error { background-image: none; text-decoration: underline wavy var(--bad); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.editor.cm .cm-lintRange-warning, .editor.cm .cm-lintRange-info { background-image: none; text-decoration: underline wavy var(--warn); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cm-tooltip { background: var(--paper) !important; border: 1px solid var(--line-strong) !important; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); color: var(--ink); font-size: 12.5px; overflow: hidden; }
.cm-tooltip-lint { padding: 0; }
.cm-diagnostic { padding: 6px 10px; white-space: pre-wrap; font-family: var(--sans); border-left-width: 3px; }
.cm-diagnostic-error { border-left-color: var(--bad); }
.cm-diagnostic-warning { border-left-color: var(--warn); }
.cm-diagnosticSource { color: var(--faint); font: 11px var(--mono); }
.cm-tooltip-autocomplete > ul { font: 12.5px var(--mono) !important; max-height: 14em; }
.cm-tooltip-autocomplete > ul > li[aria-selected] { background: var(--accent-soft) !important; color: var(--ink) !important; }
.cm-completionIcon { opacity: .5; }
/* find and replace */
.cm-panels { background: var(--sunk) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.cm-panel.cm-search { padding: 6px 8px !important; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cm-panel.cm-search input, .cm-panel.cm-search button { margin: 0 !important; font-size: 12.5px; }
.cm-panel.cm-search input[type=checkbox] { margin-right: 3px !important; }
.cm-panel.cm-search label { font-size: 12px; color: var(--muted); }
.cm-panel.cm-search button[name=close] { position: static !important; margin-left: auto !important; }
.cm-searchMatch { background: var(--warn-soft); outline: 1px solid var(--warn); }
.cm-searchMatch-selected { background: var(--accent-line); }
/* review: deleted lines red, inserted lines green, accept / reject per change */
.cm-deletedChunk { background: #fde8e4 !important; }
.cm-changedLine, .cm-insertedLine { background: #e5f5ea !important; }
.cm-changedText, .cm-insertedText { background: #c4ecd2 !important; }
.cm-deletedText, .cm-deletedChunk del { background: #f8c9c0 !important; text-decoration: none; }
.cm-chunkButtons button { font-size: 11px; padding: 1px 8px; margin-left: 4px; }
.cm-chunkButtons button[name=accept] { background: #2e9a5a; border-color: #237a47; color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cm-deletedChunk { background: #3a1f1a !important; }
  :root:not([data-theme="light"]) .cm-changedLine, :root:not([data-theme="light"]) .cm-insertedLine { background: #17301f !important; }
  :root:not([data-theme="light"]) .cm-changedText, :root:not([data-theme="light"]) .cm-insertedText { background: #1f4a2e !important; }
  :root:not([data-theme="light"]) .cm-deletedText { background: #5a2a22 !important; }
}
.reviewbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--accent-soft); border-bottom: 1px solid var(--accent-line); font-size: 12.5px; }
.reviewbar[hidden] { display: none; }
.reviewbar .rl { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reviewbar .grow { flex: 1; }
/* Ask / Edit on a selection */
.seltip { display: flex; gap: 2px; padding: 2px; }
.seltip button { border: none; box-shadow: none; padding: 3px 8px; font-size: 12px; border-radius: 6px; background: none; }
.seltip button:hover { background: var(--accent-soft); }
.seltip .k { color: var(--faint); font: 10.5px var(--mono); margin-left: 4px; }
.editbox { position: absolute; left: 56px; right: 24px; z-index: 30; display: flex; gap: 6px; padding: 6px; background: var(--paper); border: 1px solid var(--accent-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.editbox input { flex: 1; min-width: 0; font-size: 13px; }
.attach { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.attach[hidden] { display: none; }
/* messages queued while a turn runs, and the Stop button */
.queue { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.queue[hidden] { display: none; }
.qmsg { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 8px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 12.5px; }
.qmsg .ql { color: var(--faint); font: 10.5px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.qmsg .qt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qmsg .qx { border: none; background: none; box-shadow: none; padding: 2px 4px; color: var(--faint); }
.qmsg .qx:hover { color: var(--ink); }
.qmsg .qx svg { width: 12px; height: 12px; }
#send { display: inline-flex; align-items: center; gap: 6px; }
#send.stopping svg { width: 12px; height: 12px; }
.achip { display: inline-flex; align-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 6px; font: 12px var(--mono); }
.achip button { border: none; background: none; box-shadow: none; padding: 2px 6px; color: var(--accent-text); font: inherit; }
.achip .ax { padding: 2px 4px; }
.achip .ax svg { width: 11px; height: 11px; }
.uchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ---------- settings with pages, account menu, getting started ---------- */
.settings2 { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 32px; padding: 24px 28px; }
.settings2 aside h1 { font-size: 20px; margin: 0 0 12px; }
.settings2 .setq { width: 100%; margin-bottom: 10px; }
.setnav { display: flex; flex-direction: column; gap: 1px; }
.setnav button { justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 6px 10px; border-radius: 7px; color: var(--muted); }
.setnav button:hover { background: var(--raised); color: var(--ink); }
.setnav button.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.setbody h1 { font-size: 20px; margin: 0 0 8px; }
.setbody h2 { font-size: 15px; margin: 26px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.setbody .form { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin: 12px 0; }
.gitform input { width: 100%; }
.plancard { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--sunk); margin: 8px 0; }
.plancard .pn { font: 600 17px var(--display); }
.btnlink { border: 1px solid var(--line-strong); border-radius: var(--r-btn); padding: 4px 12px; color: var(--ink); text-decoration: none; font-size: 13px; }
button.danger { color: #fff; background: #c4422b; border-color: #a3341f; }
@media (max-width: 760px) { .settings2 { grid-template-columns: 1fr; padding: 16px; } }
.account { width: 30px; height: 30px; border-radius: 50%; padding: 0; font: 600 12px var(--sans); background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); box-shadow: none; }
.acctmenu { position: fixed; top: 48px; right: 12px; z-index: 50; width: 240px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 6px; display: flex; flex-direction: column; }
.acctmenu[hidden] { display: none; }
.acctmenu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acctmenu button { justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 6px 10px; border-radius: 7px; }
.acctmenu button:hover { background: var(--raised); }
.started { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin: 12px 0 18px; display: flex; flex-direction: column; gap: 2px; max-width: 560px; }
.started .sh { display: flex; align-items: center; margin-bottom: 4px; }
.started .grow { flex: 1; }
.sstep { justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 4px 6px; gap: 8px; }
.sstep:hover:not(:disabled) { background: var(--paper); }
.sstep.done { color: var(--muted); text-decoration: line-through; opacity: 1; }
.sstep .ck { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; }
.sstep.done .ck { background: var(--accent); }
.tree .f .zip { visibility: hidden; border: 0; background: none; box-shadow: none; padding: 1px 3px; color: var(--muted); margin-left: auto; }
.tree .f:hover .zip { visibility: visible; }
.tree .f .pcount + .zip { margin-left: 4px; }
:root[data-theme="dark"] .cm-deletedChunk { background: #3a1f1a !important; }
:root[data-theme="dark"] .cm-changedLine, :root[data-theme="dark"] .cm-insertedLine { background: #17301f !important; }
:root[data-theme="dark"] .cm-changedText, :root[data-theme="dark"] .cm-insertedText { background: #1f4a2e !important; }
:root[data-theme="dark"] .cm-deletedText { background: #5a2a22 !important; }
#side .side-h { flex-wrap: wrap; row-gap: 6px; }

/* ---------- chats ---------- */
.chat { position: relative; }
.chatrow { display: flex; align-items: center; gap: 4px; }
.chatpick { flex: 1; min-width: 0; justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 2px 4px; margin-left: -4px; color: inherit; font: 600 14px var(--display); gap: 4px; }
.chatpick .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatpick svg { width: 14px; height: 14px; flex: none; opacity: .7; }
.chatpick:hover { background: rgba(0,0,0,.06); }
.chatrow .icon { color: inherit; }
.cdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.cdot.busy { background: var(--warn); }
.cdot.none { background: transparent; }
.chatmenu { position: absolute; top: 46px; left: 10px; right: 10px; z-index: 40; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 6px; display: flex; flex-direction: column; max-height: 60vh; }
.chatmenu[hidden] { display: none; }
.chatmenu .cmh { display: flex; gap: 6px; padding: 2px 2px 6px; }
.chatmenu .cmh input { flex: 1; min-width: 0; font-size: 13px; padding: 5px 8px; }
.clist { overflow: auto; }
.citem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.citem:hover { background: var(--raised); }
.citem.on { background: var(--accent-soft); }
.citem.arch .cn { color: var(--muted); font-style: italic; }
.citem .cn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem .hint { font-size: 11.5px; flex: none; }
.citem .cacts { display: none; gap: 0; }
.citem:hover .cacts { display: inline-flex; }
.citem .cacts .icon { padding: 2px 4px; font-size: 13px; color: var(--muted); }
.citem .cacts svg { width: 12px; height: 12px; }
.showarch { align-self: flex-start; margin: 6px 4px 2px; }

/* sign-in by email link, limits, the org page */
#signin { position: fixed; inset: 0; z-index: 60; background: var(--sunk); display: grid; place-items: center; padding: 16px; }
#signin .si-card { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); padding: 28px; display: grid; gap: 12px; }
#signin .si-word { font-family: var(--word); font-size: 22px; color: var(--ink); }
#signin h1 { font: 600 18px/1.3 var(--display); margin: 0; }
#signin input { padding: 9px 10px; font-size: 14px; }
#signin .si-out { display: grid; gap: 8px; }
#signin .si-out p { margin: 0; }
#signin .bad { color: var(--bad); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; justify-self: start; font-size: 12px; }
.lim { margin: 8px 0 12px; }
.lim-h { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.inrow { display: flex; gap: 6px; align-items: center; }
.inrow input:not([type=checkbox]) { flex: 1; min-width: 0; }
input.num { width: 116px; flex: 0 0 116px !important; }
.lt.members th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.toolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; margin: 8px 0; }
.toolck { display: flex; gap: 8px; align-items: baseline; font-size: 13px; padding: 3px 0; }
.toolck .hint { font-size: 11px; }
.tablewrap { overflow-x: auto; max-width: 100%; }
.lt.members { min-width: 640px; }
.setbody .inrow { flex-wrap: wrap; }

/* Settings → Models */
.hint.bad { color: var(--bad); }
.setbody h3 { font-size: 13px; font-weight: 600; margin: 16px 0 2px; }
.srow-set .inrow input:not([type=checkbox]) { min-width: 200px; }
.srow-set > div:last-child { min-width: 0; }
/* ---------- Customize: rules, commands, MCP tools ---------- */
.rulebox { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--paper); padding: 12px 14px; margin: 10px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.rulebox textarea { width: 100%; resize: vertical; font-size: var(--code-size, 12.5px); line-height: 1.5; margin-top: 4px; }
.rulebox .row-end { align-items: center; gap: 8px; margin: 0; }
.rulebox .row-end .hint { margin-right: auto; }
.row-end.lead { align-items: flex-start; gap: 16px; }
.row-end.lead p { margin: 0; flex: 1; }
.lt.cmds td { vertical-align: top; }
.lt.cmds td.acts { white-space: nowrap; text-align: right; }
.lt.cmds td.acts button + button { margin-left: 4px; }
.mcplist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--paper); margin: 8px 0 12px; }
.mcprow { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; }
.mcprow + .mcprow { border-top: 1px solid var(--line-soft); }
.mcprow.off { opacity: .65; }
.mcprow .switch { margin-top: 2px; flex: none; }
.mcpmain { flex: 1; min-width: 0; font-size: 13px; }
.modal .card:has(.cmdform), .modal .card:has(.rulespre) { width: min(640px, calc(100vw - 32px)); }
.cmdform { grid-template-columns: 96px minmax(0, 1fr); }
.cmdform select { min-width: 0; }
.cmdform textarea { width: 100%; resize: vertical; }
.rulespre { white-space: pre-wrap; max-height: 50vh; overflow: auto; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12px; }
/* tags on a user message: the rules it carried, the command it ran */
.msg.user .modetag.cmd { font-family: var(--mono); background: var(--raised); color: var(--ink); }
button.modetag.rules { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--warn-soft); color: var(--warn); border: none; box-shadow: none; vertical-align: 1px; }
.msg.user .cmdbody { margin-top: 4px; }
.msg.user .cmdbody summary { cursor: pointer; color: var(--muted); font-size: 12px; }
/* the / menu */
.mention.slash .pitem .pl { flex: none; }
.mention.slash .pitem .ps { overflow: hidden; text-overflow: ellipsis; }
.mention.slash .pitem .pill { margin-left: auto; }
.mention .pfoot { padding: 6px 10px 4px; border-top: 1px solid var(--line-soft); margin-top: 2px; font-size: 12px; color: var(--muted); cursor: pointer; }
.mention .pfoot:hover { color: var(--ink); }

/* ---------- Usage: spend against limits ---------- */
.spendview { margin: 6px 0 18px; }
.row-end.gap { gap: 8px; }
.spendorg { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 24px; max-width: 760px; }
.lim-h { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.meter.pace { position: relative; overflow: visible; }
.meter.pace > div { border-radius: inherit; }
.meter.pace > i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink-soft); border-radius: 1px; }
.meter div.bad { background: var(--bad); }
.spendt td { vertical-align: middle; }
.spendt td.spendc { min-width: 150px; }
.spendt .meter { height: 6px; }
svg.spark rect { fill: var(--line-strong); }
svg.spark rect.on { fill: var(--accent); }
svg.spark rect.fut { fill: var(--line-soft); }

/* ---------- Appearance: chat text size, density, motion ---------- */
.msgs .msg.user, .msgs .msg.agent { font-size: var(--chat-size, 14px); }
:root[data-density="compact"] .top { height: 44px; }
:root[data-density="compact"] .shell { height: calc(100% - 44px); }
:root[data-density="compact"] .side section { padding: 8px 0 5px; }
:root[data-density="compact"] .tree .d, :root[data-density="compact"] .tree .f { padding: 1px 8px; }
:root[data-density="compact"] .list li { padding: 3px 10px; }
:root[data-density="compact"] .tabs { min-height: 34px; }
:root[data-density="compact"] .msgs { gap: 7px; padding: 10px; }
:root[data-density="compact"] .msg.user, :root[data-density="compact"] .msg.agent { padding: 5px 10px; }
:root[data-density="compact"] .composer { padding: 6px 10px 8px; }
:root[data-density="compact"] .composer textarea { min-height: 48px; padding: 7px 10px; }
:root[data-density="compact"] .md th, :root[data-density="compact"] .md td, :root[data-density="compact"] table.t th, :root[data-density="compact"] table.t td { padding: 3px 10px; }
:root[data-density="compact"] .srow-set { padding: 6px 0; }
:root[data-density="compact"] .pitem { padding: 4px 8px; }
:root[data-density="compact"] .tcard { padding: 10px 12px; gap: 5px; }
:root[data-density="compact"] .settings2 { padding: 16px 20px; }
:root[data-reduce-motion] *, :root[data-reduce-motion] *::before, :root[data-reduce-motion] *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
/* ---------- the terminal dock (app.js "the terminal") ---------- */
.termdock { height: 300px; min-height: 120px; flex: none; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--sunk); position: relative; }
.termdock[hidden] { display: none; }
.term-grip { position: absolute; top: -3px; left: 0; right: 0; height: 6px; cursor: row-resize; z-index: 2; }
.term-grip:hover { background: var(--accent-line); }
.term-bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--line); background: var(--paper); min-height: 34px; }
.term-bar .icon { width: 26px; height: 26px; padding: 0; box-shadow: none; border-color: transparent; background: none; }
.term-bar .icon:hover { background: var(--sunk); }
.term-bar .small { box-shadow: none; }
.term-sp { flex: 1; }
.term-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.term-tab { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 9px; border-radius: 6px; font: 12px var(--mono); color: var(--muted); cursor: pointer; white-space: nowrap; border: 1px solid transparent; }
.term-tab .i { width: 14px; height: 14px; }
.term-tab:hover { background: var(--sunk); }
.term-tab.on { background: var(--sunk); color: var(--ink); border-color: var(--line); }
.term-tab.dead span { text-decoration: line-through; color: var(--faint); }
.term-tab .x { border: none; background: none; box-shadow: none; padding: 0 3px; color: var(--faint); font-size: 14px; line-height: 1; }
.term-tab .x:hover { color: var(--ink); }
.term-body { flex: 1; min-height: 0; position: relative; }
.term-x { position: absolute; inset: 6px 4px 2px 10px; }
.term-x[hidden] { display: none; }
.term-x .xterm-viewport { scrollbar-width: thin; }
.md pre .term-run { position: absolute; bottom: 6px; right: 8px; font: 11px var(--sans, inherit); padding: 2px 8px; gap: 4px; opacity: 0; box-shadow: none; }
.md pre .term-run .i { width: 13px; height: 13px; }
.md pre:hover .term-run, .md pre .term-run:focus { opacity: 1; }
@media (max-width: 760px) { .termdock { height: 45vh; } }

/* Loops: runs of the loop runner */
.loophead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.loophead h1 { margin: 0; }
.loophead .grow { flex: 1; }
.looprun > button.small { margin-bottom: 12px; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td, table.t tr.click:focus-visible td { background: var(--raised); }
table.t tr.best td { background: var(--accent-soft); }
table.t td.small { font-size: 11.5px; max-width: 360px; }
.bestchart { width: 100%; max-width: 760px; height: auto; display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin: 6px 0 18px; }
.bestchart .grid { stroke: var(--line-soft); stroke-width: 1; }
.bestchart .ax { fill: var(--faint); font: 10px var(--mono); }
.bestchart .best { fill: none; stroke: var(--accent); stroke-width: 2; }
.bestchart .cand { fill: var(--paper); stroke: var(--ink-soft); stroke-width: 1.5; }
.bestchart .cand.fail { stroke: var(--warn); }
.bestchart .cand.top { fill: var(--accent); stroke: var(--accent-edge); }
.gates { margin: 10px 0 6px; }
.gate { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; margin: 8px 0; max-width: 760px; display: flex; flex-direction: column; gap: 8px; }
.gate pre.payload { margin: 0; max-height: 220px; overflow: auto; font: 11.5px/1.5 var(--mono); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
details.goal { max-width: 760px; margin: 4px 0 12px; }
details.goal p { white-space: pre-wrap; }
.pill.live { color: var(--accent-text); background: var(--accent-soft); }
.gate ul.checks { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.gate ul.checks li { padding: 1px 0; overflow-wrap: anywhere; }
.gate ul.checks .mk { display: inline-block; width: 1.4em; color: var(--accent-text); }
.gate ul.checks li.no .mk { color: var(--bad); }
.gate p.advice { margin: 0; font-size: 12.5px; color: var(--ink-soft); white-space: pre-wrap; }
.steps { display: inline-flex; gap: 2px; vertical-align: -1px; }
.steps i { width: 8px; height: 8px; border-radius: 2px; border: 1px solid var(--line-strong); background: var(--paper); }
.steps i.done { background: var(--accent); border-color: var(--accent-edge); }
.steps i.run { background: var(--accent-soft); border-color: var(--accent); }
.steps i.fail { background: var(--warn); border-color: var(--warn); }
.steps i.skip { background: var(--line); }
.steps i.go { cursor: pointer; }
.attemptview table { width: 100%; margin: 6px 0; }
.attemptview th { text-align: left; font-weight: 500; padding-right: 12px; white-space: nowrap; }
.attemptview td.mono { word-break: break-all; }
.attemptview h4 { margin: 12px 0 4px; }
table.t td.prov { font-style: italic; color: var(--muted); }
table.t tr.detail td { background: var(--sunk); padding: 10px 14px 14px; }
table.t.checks { margin-top: 8px; font-size: 12px; }
.bestchart .cand.prov { stroke-dasharray: 2 2; }
/* phones: the page nav gets its own full-width row under the brand, so every page shows at 375 px; if it ever
   outgrows the row it scrolls sideways inside it, never widening the page */
@media (max-width: 760px) {
  .top { height: auto; min-height: 52px; flex-wrap: wrap; row-gap: 0; padding-top: 8px; }
  .nav { order: 9; flex: 1 0 100%; min-width: 0; height: 36px; overflow-x: auto; scrollbar-width: none; gap: 6px; justify-content: space-between; }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { flex: none; font-size: 13px; padding: 0 2px; }
  .nav .nybadge { margin-left: 3px; padding: 0 4px; }
  .brand { flex: none; }
  .shell, .shell.wide, .shell.noside, .shell.nochat { height: calc(100% - var(--top-h, 89px) - 54px); }
}
@media (max-width: 760px) { .looprun .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .looprun .tile .v { font-size: 22px; } }
ul.reasons { margin: 6px 0; padding-left: 18px; font-size: 12px; }

/* git: the Changes view (left panel), the Git settings page, a deleted file's diff (git.rs) */
.views { flex-wrap: wrap; min-width: 0; }
.views button { padding: 4px 5px; }
.views button.vicon { position: relative; padding: 3px 6px; }
.views .vbadge { position: absolute; top: -4px; right: -5px; min-width: 14px; padding: 0 3px; border-radius: 7px; background: var(--accent); color: #fff; font: 600 9px/14px var(--sans); letter-spacing: 0; text-align: center; }
.gitbox { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 4px; }
.gitbox textarea { width: 100%; resize: vertical; font: inherit; }
.gitrow { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.gitrow .tx { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gitrow .dir { color: var(--faint); font-size: 11px; }
.gitrow .n { color: var(--faint); font: 11px var(--mono); }
.gitrow .icon { visibility: hidden; padding: 0 4px; }
.gitrow:hover .icon { visibility: visible; }
.gitst { width: 18px; flex: none; text-align: center; font: 600 11px var(--mono); border-radius: 5px; color: var(--muted); }
.gitst.added { color: #2e9a43; } .gitst.deleted { color: #c4422b; } .gitst.modified { color: var(--accent-text); }
.githist { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 10px; }
.gitcommit { padding: 2px 0; }
.gitcommit .link { text-align: left; justify-content: flex-start; border: none; background: none; box-shadow: none; padding: 2px 4px; color: var(--ink); }
.gitdiff { padding: 6px 8px; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; font: 12px/1.45 var(--mono); overflow: auto; max-height: 60vh; white-space: pre; }
.gitdlg { width: min(860px, 92vw); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 12px; }
.setbody .row-end button { white-space: nowrap; }
.gitdlg.sbs { width: min(1400px, 96vw); height: 86vh; display: none; flex-direction: column; gap: 8px; }
.gitdlg.sbs[open] { display: flex; }
.sbs-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sbs-col { min-height: 0; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sbs-col .cm-editor { flex: 1; min-height: 0; font: 12.5px/1.5 var(--mono); }
.sbs-col .cm-scroller { overflow: auto; }
.sbs-h { padding: 4px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--sunk); }
.sbs-del { background: rgba(218, 54, 51, .16); } .sbs-add { background: rgba(46, 160, 67, .16); }
.sbs-pad > div { background: var(--sunk); }
.githist .hint .link { display: block; border: none; background: none; box-shadow: none; padding: 1px 4px; color: var(--ink-soft); text-align: left; }
.sbs-col .cm-gutters { background: var(--paper); border-right: 1px solid var(--line); color: var(--faint); }

/* the loop run's plan strip and KiCad check details */
.planstrip { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0 4px; }
.planstrip li { display: flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-weight: 600; font-size: 13px; min-width: 84px; }
.planstrip li .hint { font-weight: 400; }
.planstrip li.done { border-color: var(--ok); }
.planstrip li.running, .planstrip li.waiting { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.planstrip li.failed { border-color: var(--bad); }
.planstrip li.skipped, .planstrip li.pending { opacity: .65; }
.plan { margin-bottom: 8px; }
.modal .card:has(.kicadform) { width: min(720px, calc(100vw - 32px)); }
.kicadform { min-width: 0; }
.corow input { min-width: 0; }
.kicadform h4 { margin: 14px 0 4px; }
.corows { display: grid; gap: 6px; margin: 6px 0; }
.corow { display: grid; grid-template-columns: 70px 1fr 1fr auto auto; gap: 6px; align-items: center; }
.corow label { white-space: nowrap; }
@media (max-width: 640px) { .corow { grid-template-columns: 70px 1fr auto auto; } .corow input:nth-child(3) { grid-column: 2 / 3; } }
.candpanel { margin-top: 10px; display: grid; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.boardpic { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-width: 520px; }
.boardpic img { width: 100%; height: auto; max-height: 460px; object-fit: contain; display: block; }
ul.files { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; }
.bestbox { border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 16px; margin: 14px 0; background: var(--paper); }
.bestbox h2 { margin-top: 0; }
.coapprove ol { margin: 4px 0 0; padding-left: 20px; }
.coapprove { margin: 6px 0; }
.tile .split { margin-top: 6px; font-size: 12px; line-height: 1.35; color: var(--dark-text); opacity: .8; font-variant-numeric: tabular-nums; }
.candpanel table { width: 100%; table-layout: fixed; }
.candpanel table td { overflow-wrap: anywhere; }
.candpanel table th:first-child, .candpanel table td:first-child { width: 64px; }
.corows.disabled { opacity: .55; }

/* a client job's card and its plan gate */
.jobcard { border: 1px solid var(--line-strong); background: var(--paper); border-radius: 12px; padding: 12px 14px; margin: 12px 0 18px; display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.jobcard .jh { display: flex; align-items: baseline; gap: 8px; }
.jobcard .jt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.jobcard .chips { margin: 4px 0; }
.jobcard .jrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.jobcard .jgate { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.jobcard .jgate.ok .jh b { color: var(--ok, #1a7f37); }
.jobcard .jgate.bad .jh b, .jobcard .jgate.stale .jh b { color: var(--err, #c62828); }
.jobcard .kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 13px; }
.jobcard .kv span { color: var(--muted); }
.cotable { border-collapse: collapse; font-size: 13px; width: 100%; }
.cotable th, .cotable td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cotable tr.human td { background: var(--accent-soft); }
.tag.warn { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-strong); white-space: nowrap; }
.runsec { max-width: 760px; margin: 0 0 18px; }
.runsec h2 { font-size: 14px; margin: 6px 0; }
.rstat { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); }
.rstat.live { border-color: var(--accent); color: var(--accent); }
.rstat.done { color: var(--ok, #1a7f37); }
.rstat.failed, .rstat.cancelled { color: var(--muted); }
.runs td:nth-child(3) { min-width: 220px; }
.runs td:nth-child(4) { white-space: nowrap; }
.capline { display: flex; align-items: center; gap: 8px; }
.capline.reached { color: var(--err, #c62828); }
.capbar { flex: 0 0 70px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.capbar span { display: block; height: 100%; background: var(--accent); }
.capline.reached .capbar span { background: var(--err, #c62828); }

/* a loop run's live activity (activityPanel) and a candidate's trace (traceView) */
.actpanel { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; background: var(--paper); font-size: 12.5px; min-width: 0; }
.actpanel.card, .actpanel.row { background: var(--sunk); }
.acthead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.acthead .grow { flex: 1; }
.actsec { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acth { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 2px; }
.actgrid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
@media (max-width: 900px) { .actgrid { grid-template-columns: minmax(0, 1fr); } }
.actline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.actline .mono { font-family: var(--mono); font-size: 11.5px; }
.actline.more { cursor: pointer; }
.actline.more:hover { background: var(--accent-soft); }
.actline.open { white-space: normal; }
.actline.bad, .actline .bad, .tname.bad { color: var(--bad); }
.actline.say { white-space: normal; }
.tname { font-family: var(--mono); font-size: 11.5px; color: var(--accent-text); white-space: pre; }
.tname.say { color: inherit; }
.actfull { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; background: var(--sunk); border-radius: 6px; padding: 6px 8px; margin: 4px 0; font: 11.5px/1.45 var(--mono); }
.acttable { border-collapse: collapse; font-size: 12px; width: 100%; }
.acttable td { padding: 1px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.acttable td.n { text-align: right; }
.actm { flex-direction: row; flex-wrap: wrap; gap: 12px; }
.actrow > td { background: transparent; padding-top: 0; }
.trace { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.trace .tturn summary { cursor: pointer; font-size: 12.5px; }
.trace details.inl { display: inline; }
.trace details.inl > summary { display: inline; cursor: pointer; list-style: none; }
.trace .plus { color: var(--ok-text); } .trace .minus { color: var(--bad); }
.runbadge { margin-left: 6px; font-size: 10px; padding: 0 6px; border-radius: 999px; color: var(--accent-text); background: var(--accent-soft); vertical-align: 1px; }
.runlink a { color: inherit; text-decoration: underline; font-weight: 600; }
#projects li { display: flex; align-items: center; min-width: 0; }
#projects li .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#projects li .runbadge { flex-shrink: 0; }
.actrow > td { max-width: 0; }
.actrow .actpanel, .jobcard .actpanel { width: 100%; box-sizing: border-box; overflow: hidden; }
.chatspend { display: flex; gap: 6px; align-items: center; }
.chatspend .grow { flex: 1; }
/* the agent's steps: running times, background tasks, hand edits of the board, the cancel */
.sbadge { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sbadge.run { color: var(--accent-text); font-weight: 600; }
.sbadge.bg { color: var(--accent-text); }
.sbadge.bad { color: var(--bad); }
.actline .tm { font-variant-numeric: tabular-nums; }
.actline.st-running { background: var(--accent-soft); border-radius: 4px; }
.actline.waiting { background: var(--accent-soft); border-radius: 4px; padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handtag { font-size: 10.5px; padding: 0 5px; border-radius: 999px; white-space: nowrap; }
.handtag.sure { background: var(--bad); color: #fff; }
.handtag.maybe { border: 1px solid var(--bad); color: var(--bad); }
.actline.handsum { white-space: normal; color: var(--bad); }
.actcancel { font-size: 12.5px; }
.msg.warn { color: var(--warn); font-size: 13px; background: var(--warn-soft); border-radius: 10px; padding: 6px 10px; }

/* a candidate's verdict: one word, one sentence, one square per check grouped by area (board-quality plan #0) */
.verdict { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--paper); }
.verdict .vhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.verdict .vword { font-size: 20px; letter-spacing: -0.01em; }
.verdict.ok .vword { color: var(--ok-text); }
.verdict.bad .vword { color: var(--bad); }
.verdict .vsay { font-size: 13px; }
.verdict .vstrip { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.verdict .vgrp { display: flex; flex-direction: column; gap: 3px; }
.verdict .vname { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.verdict .sqs { display: flex; gap: 3px; }
.verdict .sq { width: 16px; height: 16px; border-radius: 3px; border: 0; padding: 0; cursor: pointer; background: var(--line-strong); }
.verdict .sq.ok { background: var(--ok); }
.verdict .sq.bad { background: var(--bad); }
.verdict .sq:focus-visible { outline: 2px solid var(--accent-edge); outline-offset: 1px; }
.verdict .sq.none { cursor: default; background: transparent; border: 1.5px dashed var(--line-strong); box-sizing: border-box; }
.verdict .vgrp.unchecked .vname { color: var(--muted); }
.verdict .vcovers { margin-top: 6px; font-size: 12.5px; }
.verdict .vcovers p { margin: 4px 0 0; }
tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

/* the board viewer (board-quality plan #1): the board keeps its own colours in both themes */
.bview { margin: 10px 0; }
.bvbar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 6px; }
.bvbar .seg { display: inline-flex; gap: 2px; }
.bvbar button.on { background: var(--accent); color: #fff; border-color: var(--accent-edge); }
.bvbar label { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.bvstage { position: relative; height: min(70vh, 620px); background: #0c1712; border-radius: 10px; overflow: hidden; cursor: grab; user-select: none; }
.bvstage:active { cursor: grabbing; }
.bvsvg { width: 100%; height: 100%; display: block; font-family: var(--sans, sans-serif); }
.bvsvg .bvpin { cursor: help; }
.bvtip { position: absolute; display: none; pointer-events: none; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12px; white-space: pre-line; max-width: 340px; z-index: 2; }
.bvinfo { position: absolute; display: none; right: 10px; top: 10px; background: var(--paper); color: var(--ink); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 320px; }
/* the key sits under the drawing, never over it */
.bvlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 6px 0 2px; color: var(--muted); font-size: 12px; }
.bvlegend:empty { display: none; }
.bvlegend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.findings .callout { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin: 8px 0; }
.findings tr.go { cursor: pointer; }
.findings tr.go:hover td { background: var(--accent-soft); }
.findings td:first-child { white-space: nowrap; width: 1%; }
/* the schematic viewer: kicad-cli's sheet under the computed outlines; net-change pins in the list */
.svstage { background: #e9e7df; }
.findings .ok-text, .findings .bad-text { display: inline-block; margin: 0 6px 2px 0; }
.findings .ok-text { color: var(--ok-text); }
.findings .bad-text { color: var(--bad); }
.findings table.nets { table-layout: auto; }
.findings table.nets td:first-child { white-space: nowrap; width: auto; min-width: 12em; }
/* the fab preview (board-quality plan #3) */
.fab h3 { margin: 16px 0 6px; }
.fab .fnote { margin: 0 0 8px; }
.ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ftile { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.ftile b { font-size: 15px; }
.ftile.fbadtile { border-color: var(--bad); }
/* before and after always side by side, as wide as the view; a click enlarges both */
.frenders { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.frenders figure { margin: 0; cursor: zoom-in; }
.frender { width: 100%; min-height: 240px; max-height: 60vh; background: #0c1712; border-radius: 8px; display: block; object-fit: contain; }
.fzoom { position: fixed; inset: 0; z-index: 50; background: rgba(8, 14, 11, 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; cursor: zoom-out; }
.fzoom-row { display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); gap: 12px; width: 100%; height: calc(100% - 28px); }
.fzoom-row.two { grid-template-columns: 1fr 1fr; }
.fzoom figure { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.fzoom .frender { flex: 1; min-height: 0; max-height: none; height: 100%; }
.fzoom .hint { color: #c9d4cc; }
.flayers { margin-bottom: 6px; }
.flayers .fgroup { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 2px 0; }
.flayers label { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.flayers .fglabel { font-size: 12px; font-weight: 600; color: var(--ink); margin-right: 4px; }
.flayers details.fgroup > summary { cursor: pointer; flex-basis: 100%; }
.flayers details.fgroup:not([open]) { display: block; }
.fsw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.fstage { height: min(60vh, 520px); }
.ftable { max-height: 360px; overflow: auto; }
table.fbom tr.fchanged td { background: color-mix(in srgb, #ffd166 14%, transparent); }
table.fbom tr.fremoved td { color: var(--muted); text-decoration: line-through; }
table.fbom tr.fremoved td:last-child { text-decoration: none; }
/* the candidate comparison (board-quality plan #7) */
.cmp { margin: 8px 0 12px; }
.cmp table { table-layout: auto; }
.cmp table td:first-child { min-width: 18em; }
.cmp table th.n, .cmp table td.n { width: 7em; white-space: nowrap; }
.cmp table td:last-child { white-space: nowrap; }
.cmp tr.cmp-same td { color: var(--muted); }
/* the design report (board-quality plan #6), shown as the page it is */
.report-box { margin: 8px 0 12px; }
.reportframe { width: 100%; min-height: 600px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
/* the board in 3D (views/3d.js) */
.b3stage { height: min(64vh, 560px); touch-action: none; }
.b3canvas { display: block; width: 100%; height: 100%; }
.b3foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-height: 28px; }
.b3pick { display: inline-flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.b3pick:empty { display: none; }
/* the net inspector (views/board.js) */
.bvinfo { max-height: calc(100% - 20px); overflow: auto; width: min(340px, calc(100% - 20px)); }
.bvinfo > div + div { margin-top: 4px; }
.ni-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ni-head b { word-break: break-all; }
.ni-pads { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; }
.ni-pads button.link { border: none; background: none; box-shadow: none; padding: 0; color: var(--accent); cursor: pointer; }
.ni-pair { border-top: 1px solid var(--line); padding-top: 6px; }
.ni-t { margin: 4px 0; }
.ni-t td.mono { white-space: nowrap; }
.ni-list { margin-top: 10px; }
.ni-list table + table { margin-top: 10px; }
.ni-row { cursor: pointer; }
.ni-row:hover td, .ni-row.on td { background: var(--sunk); }
.ni-list table, .ni-t { table-layout: auto; }
.ni-list td.mono { overflow-wrap: anywhere; min-width: 16em; }
/* the views' shared pieces (app.js viewBar, emptyState) */
.bvtitle { margin-right: 2px; }
.empty { color: var(--muted); border: 1px dashed var(--line-strong, var(--line)); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 12.5px; }
.bvstage + .empty, .bvbar + .empty { margin-top: 4px; }
/* Needs you (views/inbox.js) */
.nybadge { display: inline-block; min-width: 16px; margin-left: 5px; padding: 0 5px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.nybadge[hidden] { display: none; }
.inbox { max-width: 860px; }
.nycards { display: grid; gap: 10px; margin: 8px 0; }
.nycard { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 10px 12px; }
.nyhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nyask { margin: 6px 0 8px; font-size: 14px; }
.nyacts { display: flex; flex-wrap: wrap; gap: 6px; }
.nyqueue { margin: 6px 0 14px; }
.nyqlist { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 4px; }
.nyruns h3 { margin: 18px 0 4px; }
.nyrun { border-top: 1px solid var(--line); padding: 8px 0; }
.nyrun ul { margin: 4px 0 6px; padding-left: 20px; }
/* Model key: Settings → Model key and the run page's key card (views/modelkey.js) */
table.t.mkeys { width: 100%; font-size: 12.5px; }
table.t.mkeys tr.mk-left td { background: var(--sunk); }
.mkslot:empty { display: none; }
.mkcard { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); display: flex; flex-direction: column; gap: 3px; }
.mkcard.warn { border-color: #c4422b; }
.mkmig { margin: 6px 0 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); display: flex; flex-direction: column; gap: 2px; }
.mkmig.warn { border-color: #c4422b; }
.mkhead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.srow-set > .inrow.mkin { flex: 0 1 280px; min-width: 180px; justify-content: flex-end; }
.srow-set .inrow.mkin input { flex: 1 1 100%; min-width: 0; }
table.t.mkeys td { padding-left: 6px; padding-right: 6px; }
table.t.mkeys td.mkexp { white-space: nowrap; }
table.t.mkeys td.mkwho a { word-break: break-all; }
/* Freeze: the run page's freeze card (views/inbox.js freezeCard) */
.fzcard { margin: 12px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); display: flex; flex-direction: column; gap: 4px; }
.fzcard.warn { border-color: #c4422b; }
.fzcard h3 { margin: 0 0 2px; font-size: 14px; }
.fzrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fzcard code { word-break: break-all; font-size: 12px; }
.fzcard ul, .nyrun ul.small li.mono { font-size: 12px; }

/* analog run views (views/analog.js): one card per bench, plots drawn in SVG, flat colours */
.anabox { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; min-width: 0; max-width: 100%; }
.anaview { display: flex; flex-direction: column; gap: 12px; min-width: 0; max-width: 100%; }
.anacard { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.anacard > .row-wrap { gap: 8px; align-items: center; }
table.t.anaspecs td, table.t.anagrid td { vertical-align: top; }
table.t.anaspecs, table.t.anagrid, table.t.anarules { table-layout: auto; }
table.t.anaspecs td, table.t.anagrid td, table.t.anarules td { overflow-wrap: normal; }
table.t.anaspecs td:first-child { min-width: 9em; }
table.t.anaspecs .mono.hint, table.t.anaspecs td:nth-child(2), table.t.anagrid td { white-space: nowrap; }
table.t.anagrid tr.bad-row td { opacity: .7; }
.anatiles { margin: 0; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.anatiles .tile .v { font-size: 20px; }
.anatiles .tile .v, .anatiles .tile:nth-child(n) .v { color: inherit; }
.anatiles .tile .v.bad-text, .anatiles .tile:nth-child(n) .v.bad-text { color: var(--bad, #b42318); }
.anaplotbox { width: 100%; max-width: 640px; }
svg.anaplot { width: 100%; height: auto; display: block; color: var(--ink); }
svg.anaplot .grid { stroke: var(--line); stroke-width: 1; }
svg.anaplot .zero { stroke: var(--muted); stroke-dasharray: 3 3; }
svg.anaplot .trace { fill: none; stroke: currentColor; stroke-width: 1.6; }
svg.anaplot .trace.alt { stroke: var(--muted); stroke-dasharray: 4 2; }
svg.anaplot .mark { stroke: var(--bad, #b42318); stroke-dasharray: 4 3; }
svg.anaplot .ax { font: 10px var(--mono); fill: var(--muted); }
svg.anaplot .ax.mk, svg.anaplot .ax.lg { fill: var(--ink); }
svg.anaplot .ax.lg.alt { fill: var(--muted); }
.anamiss { padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.anamiss ul { margin: 4px 0 0 18px; padding: 0; }
@media (max-width: 760px) { .anatiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .anacard { padding: 8px; } table.t.anaspecs td:first-child { min-width: 7em; } }
.anaview .bad-text { color: var(--bad); }
table.t.anarules td:first-child, table.t.anarules th:first-child { width: 100%; }
table.t.anarules td.n, table.t.anarules th.n { width: 1%; white-space: nowrap; }
