:root {
  --bg: #0e1013;
  --bg-2: #15181d;
  --bg-3: #1d2128;
  --fg: #d7dae0;
  --fg-dim: #8a919c;
  --fg-faint: #555c66;
  --line: #262b33;
  --accent: #7aa2f7;
  /* OS/A's blue: the o of every OS/A name (oTerminal, oEdit), as the ring of OS/A's own icon */
  --osa: #58a6ff;
  --ok: #73c991;
  --bad: #f7768e;
  --warn: #e0af68;
  --sel: #2b3a55;
  /* the names OS/A's pages use, for the Deslopifier's box and menu on the page (the Writer's panel takes the editor's) */
  --text-primary: var(--fg); --text-secondary: var(--fg-dim); --border: var(--line); --bg-primary: var(--bg);
  --bg-secondary: var(--bg-2); --destructive: var(--bad); --success: var(--ok); --status-busy: var(--warn);
  --go: var(--accent); --go-border: var(--accent);
  /* The sixteen terminal colours: the lookup table SGR 30–37 and 90–97 index. */
  --c0: #3b4048; --c1: #f7768e; --c2: #9ece6a; --c3: #e0af68; --c4: #7aa2f7; --c5: #bb9af7; --c6: #7dcfff; --c7: #c0caf5;
  --c8: #5c6370; --c9: #ff8fa3; --c10: #b5e88a; --c11: #f5c98a; --c12: #9bb8ff; --c13: #d0b5ff; --c14: #a6e0ff; --c15: #ffffff;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --size: 13.5px;
  --lh: 1.45;
  --head-h: 44px;
  --bar-h: 0px;   /* the bar above the header when this page is another machine's (lib/machines.js, lib/remoteAccess.js) */
  --foot-h: 30px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbfbfa; --bg-2: #f2f2f0; --bg-3: #e8e8e5; --fg: #1f2328; --fg-dim: #616872; --fg-faint: #9aa0a8; --line: #e1e2e0;
    --accent: #2f5fd0; --ok: #1f8a4c; --bad: #c9284a; --warn: #a86a00; --sel: #d6e2fb;
    --c0: #1f2328; --c1: #c9284a; --c2: #2f7d32; --c3: #9a6700; --c4: #2f5fd0; --c5: #8250df; --c6: #0e7c86; --c7: #6e7781;
    --c8: #57606a; --c9: #e5534b; --c10: #3fa33f; --c11: #bf8700; --c12: #4a7be0; --c13: #a371f7; --c14: #1b9aa5; --c15: #8c959f;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: var(--size)/var(--lh) var(--mono);
  /* the viewport's units grow with the page's zoom (⌘=); divided by it, the page still fits the window */
  width: calc(100vw / var(--zoom, 1)); height: calc(100vh / var(--zoom, 1)); height: calc(100dvh / var(--zoom, 1)); overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
::selection { background: var(--sel); }
button { font: inherit; color: inherit; }
kbd { font: inherit; font-size: .9em; color: var(--fg-dim); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: var(--bg); }

/* ── Header ── */
/* One row, everything on the same centre line: tabs and buttons are all
   30px and centre their own content. */
#head, #foot { display: flex; align-items: center; background: var(--bg-2); color: var(--fg-dim); font-size: .85em; white-space: nowrap; min-width: 0; }
#head { height: var(--head-h); border-bottom: 1px solid var(--line); gap: 6px; padding: 0 10px; }
#foot { height: var(--foot-h); border-top: 1px solid var(--line); gap: 14px; padding: 0 16px; overflow: hidden; }
.spacer { flex: 1; }
.sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; flex: none; }
svg.i { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Every scrollbar thin, in the theme's colours. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 22%, transparent) transparent; }
*:hover { scrollbar-color: color-mix(in srgb, var(--fg) 38%, transparent) transparent; }
#tabs { display: flex; align-items: center; gap: 4px; height: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 12px; max-width: 230px; flex: none;
  border: 1px solid transparent; border-radius: 7px; color: var(--fg-dim); cursor: pointer; user-select: none;
}
.tab:hover:not(.active) { background: var(--bg-3); color: var(--fg); }
.tab.active { background: var(--bg); border-color: var(--line); color: var(--fg); }
.tab .label { overflow: hidden; text-overflow: ellipsis; outline: none; line-height: 1.4; }
.tab.editing { gap: 2px; padding: 0 3px 0 3px; background: var(--bg); border-color: var(--accent); cursor: default; }
.rename-input {
  width: 18ch; height: 24px; padding: 0 7px; font: inherit; color: var(--fg);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 5px; outline: none;
}
.rename-input:focus { border-color: var(--fg-faint); }
.rename-btn { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--fg-dim); cursor: pointer; flex: none; }
.rename-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rename-btn.ok:hover { color: var(--ok); background: var(--bg-3); }
.rename-btn.no:hover { color: var(--bad); background: var(--bg-3); }
.tab .busy { width: 10px; height: 10px; border-width: 1.5px; }
/* Copies to and from an ssh session's machine: cards at the pane's foot. */
.copies { position: absolute; right: 12px; bottom: 12px; z-index: 6; display: flex; flex-direction: column; gap: 8px; max-width: min(560px, calc(100% - 24px)); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 13px; }
.copy-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .35); color: var(--fg); }
.copy-card.running .copy-text::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--accent); animation: copy-pulse 1s ease-in-out infinite alternate; }
@keyframes copy-pulse { from { opacity: .3; } to { opacity: 1; } }
.copy-card.failed { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.copy-card.exists { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.copy-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.copy-card.plan .copy-text { flex: 0 0 auto; }
.copy-dir { flex: 1 1 180px; height: 28px; font: inherit; font-family: var(--mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; min-width: 0; }
.copy-dir:focus { border-color: var(--accent); outline: none; }
.copy-acts { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tab .attn { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 30%, transparent); flex: none; }
.tab .count { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 4px; background: var(--bg-3); color: var(--fg-dim); font-size: .85em; flex: none; }
.tab-close { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--fg-faint); cursor: pointer; flex: none; visibility: hidden; }
.tab-close svg { width: 9px; height: 9px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.tab:hover .tab-close, .tab.active .tab-close { visibility: visible; }
.tab-close:hover { color: var(--fg); background: var(--bg-3); }

.hbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 10px; flex: none;
  background: none; border: 1px solid transparent; border-radius: 7px; color: var(--fg-dim); cursor: pointer; line-height: 1;
}
.hbtn:hover { color: var(--fg); background: var(--bg-3); }
.hbtn.icon { width: 30px; padding: 0; }
.hbtn svg:not(.i) { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.hbtn svg.material { width: 18px; height: 18px; fill: currentColor; stroke: none; }   /* Material icon: filled, drawn on 24 */
#fullscreen .fs-off, #fullscreen[aria-pressed="true"] .fs-on { display: none; }
#fullscreen[aria-pressed="true"] .fs-off { display: block; }

/* ＋ Tab ▾: one button in two parts. */
.newtab { position: relative; display: flex; flex: none; margin-left: 4px; height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-3); }
.newtab .hbtn { height: 28px; border: 0; color: var(--fg); }
.newtab #new-tab { border-radius: 6px 0 0 6px; padding: 0 10px 0 9px; }
.newtab .caret { width: 26px; padding: 0; border-radius: 0 6px 6px 0; border-left: 1px solid var(--line); color: var(--fg-dim); }
.newtab .hbtn:hover { background: var(--sel); color: var(--fg); }
.dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 210px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / .35);
  display: flex; flex-direction: column;
}
.dropdown[hidden] { display: none; }
.dropdown button { display: flex; justify-content: space-between; align-items: center; gap: 20px; height: 30px; padding: 0 8px; background: none; border: 0; border-radius: 5px; text-align: left; cursor: pointer; color: var(--fg); }
.dropdown button:hover { background: var(--sel); }
.dropdown .mi { display: inline-flex; align-items: center; gap: 8px; }
.dropdown .mi svg.i { color: var(--fg-dim); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.dropdown .check { visibility: hidden; color: var(--accent) !important; }
.dropdown [aria-checked="true"] .check { visibility: visible; }

/* oEdit, Tasks, Projects, History: buttons; a panel's lit while it is open. */
.tbtn {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 9px; flex: none;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 7px; color: var(--fg); cursor: pointer; line-height: 1;
}
.tbtn:hover:not(:disabled) { background: var(--sel); }
.tbtn:active:not(:disabled) { transform: translateY(1px); }
.tbtn:disabled { opacity: .45; cursor: default; }
.tbtn[hidden] { display: none; }
.tbtn .ti { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; color: var(--fg-dim); flex: none; }
.tbtn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 24%, var(--bg-3)); border-color: var(--accent); }
.tbtn[aria-pressed="true"] .ti { color: var(--accent); }
/* A program's own mark (a plugin's icon.svg with class="fill": Claude's, Codex's) is filled, not drawn in lines. */
.tbtn .ti.fill { fill: currentColor; stroke: none; }
/* Something of its running (Tasks, Projects): its icon green, beside its count; the fill is for the panel being open. */
.tbtn.lit .ti { color: var(--ok); }
.tbtn .chev { color: var(--fg-dim); margin-left: -2px; }
/* Settings → Appearance → Toolbar: Icon only. The word goes (its tooltip stays), a count beside it stays. */
.icons-only #head .tbtn > span:not(.count) { display: none; }
/* Commit and push keeps its words: it shows only while an agent runs, and is not known by its icon */
.icons-only #head .tbtn.say-btn > span { display: inline; }
.icons-only #head .tbtn { padding: 0 8px; }
/* The side panels' buttons too (not a chooser's value: the folder, the project); and a row of them that does not fit (fitButtons in app.js marks it .tight) goes to
   icons on its own, whatever the setting. */
.icons-only #side .tbtn > span:not(.count):not(.value), #side .tight .tbtn > span:not(.count):not(.value) { display: none; }
.icons-only #side .tbtn, #side .tight .tbtn { padding: 0 8px; gap: 0; }
/* …but a button asking to be pressed again says what it asks */
.icons-only #side .tbtn.armed > span, #side .tight .tbtn.armed > span { display: inline; }
.icons-only #side .tbtn.armed, #side .tight .tbtn.armed { gap: 5px; }
.hbtn.icon[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 24%, var(--bg-3)); }

/* ── Footer ── */
#status { overflow: hidden; text-overflow: ellipsis; }
#status.running { color: var(--accent); }
#status.exited, #conn.offline { color: var(--bad); }
#cwd { color: var(--c6); overflow: hidden; text-overflow: ellipsis; }
#zoomed { color: var(--warn); }
#hints, #keys-hint { color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; }
#conn::before { content: "●"; margin-right: 5px; color: var(--ok); }
#conn.offline::before { color: var(--bad); }

/* ── Tabs and splits ── */
#work { position: relative; min-height: 0; }
.tab-body { position: absolute; inset: 0; display: flex; }
.tab-body[hidden] { display: none; }
.tab-body > * { flex: 1 1 0; }
.split { display: flex; min-width: 0; min-height: 0; }
.split.row { flex-direction: row; }
.split.col { flex-direction: column; }
.gutter { flex: 0 0 5px; background: var(--line); background-clip: content-box; position: relative; z-index: 2; }
.split.row > .gutter { cursor: col-resize; padding: 0 2px; }
.split.col > .gutter { cursor: row-resize; padding: 2px 0; }
.gutter:hover { background-color: var(--accent); }
body.dragging-row { cursor: col-resize; user-select: none; }
body.dragging-col { cursor: row-resize; user-select: none; }

/* ── A pane ── */
.pane { position: relative; display: flex; min-width: 0; min-height: 0; outline: none; }
.pane-cover { position: relative; display: flex; min-width: 0; min-height: 0; }
.pane-cover > .pane { position: absolute; inset: 0; }
.pane-cover > .pane:first-child { visibility: hidden; }
.tab-body.many .pane::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-top: 2px solid transparent; z-index: 4; }
.tab-body.many .pane.focused::after { border-top-color: var(--accent); }
.tab-body.many .pane:not(.focused) .term { opacity: .78; }
/* scrollbar-gutter: the scrollbar's room kept whether or not it shows, so its coming does not narrow the terminal
   (a program that redraws on a resize, Claude Code, would draw again over what had scrolled up) */
.term { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; padding: 8px var(--pane-pad, 12px); cursor: text; }
.blocks > .block + .block { margin-top: var(--block-gap, 0px); }
.l, .input { white-space: pre-wrap; word-break: break-all; }
.l { min-height: calc(var(--lh) * 1em); }
/* rows laid out in box lines (tables, rules: fit.js), and a program's live rows when it takes every key (it lays
   them out, and draws them again for a new width): clipped rather than wrapped while the pane is being resized */
.l.box, .pane.direct .live .l { white-space: pre; overflow: hidden; }
/* a line a program wrapped at the width it had, joined (fit.js): wrapped again at words, its hanging indent kept */
.l.flow { word-break: normal; overflow-wrap: anywhere; }

/* What was typed, as the prompt it was typed at. */
.cmdline { position: relative; white-space: pre-wrap; word-break: break-all; }
/* A command laid out on several lines: each under its first word, not under the prompt. */
.cmdline .cmd.laid { display: inline-block; vertical-align: top; }
.p { color: var(--c6); }
.p .g { color: var(--accent); }
.p .p-time { color: var(--fg-faint); }
.p .p-id { color: var(--c2); }
.p .p-root { color: var(--bad); font-weight: 700; }
.p .p-host { color: var(--c5); }
.p .p-id .p-user + .p-host { color: inherit; }
.p .p-took { color: var(--c3); }
.p .p-code { color: var(--bad); }
.p .p-git { color: var(--c3); }
.block.fail + .block .p .g:not(.g-plain), .pane.lastfail .prompt .g:not(.g-plain) { color: var(--bad); }
/* The right-hand side of a command's line: how long it took, how it ended, and
   (on hover) Copy and Edit. One row, evenly spaced, fading in over a long
   command rather than cutting across it. */
.cmdline .meta {
  position: absolute; right: 0; top: 0; height: calc(var(--lh) * 1em);
  display: none; align-items: center; gap: 12px; padding: 0 2px 0 28px;
  background: linear-gradient(to right, transparent, var(--bg) 24px);
  color: var(--fg-faint); font-size: .88em; white-space: nowrap;
}
.block.fail .cmdline .meta, .block.running.long .cmdline .meta, .cmdline:hover .meta { display: flex; }
.block.running.long .cmdline .meta .dur { color: var(--accent); }
.block.running.long .cmdline .meta .dur::before { content: "● "; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.cmdline .meta .act.stop { display: none; }
.block.running.long .cmdline .meta .act.stop { display: inline-flex; }
.block.running .meta-acts { display: none !important; }
.cmdline .meta .code { color: var(--bad); }
.cmdline .meta .code:empty, .cmdline .meta .dur:empty { display: none; }
.meta-acts { display: none; gap: 6px; margin-left: 4px; }
.meta-acts .act { display: inline-flex; }
.cmdline:hover .meta-acts { display: flex; }
.meta-acts .act, .cmdline .meta .act.stop, .cmdline .meta .act.totask, .cmdline .meta .act.fix {
  align-items: center; height: 20px; padding: 0 9px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 5px;
  color: var(--fg-dim); font-size: 1em; line-height: 1;
}
.meta-acts .act:hover { color: var(--fg); background: var(--sel); }
.cmdline .meta .act.stop { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
/* Fix: on a command that failed, always shown, so the way out is beside the failure. */
.cmdline .meta .act.fix { display: none; color: var(--c5); border-color: color-mix(in srgb, var(--c5) 45%, var(--line)); }
.block.fail .cmdline .meta .act.fix { display: inline-flex; }
.cmdline .meta .act.fix:hover { background: color-mix(in srgb, var(--c5) 15%, var(--bg-3)); }
/* Move to Tasks: beside Stop while a command runs; not for a pane that is a task already. */
.cmdline .meta .act.totask { display: none; }
.cmdline .meta .act.totask:hover { color: var(--fg); background: var(--sel); }
.block.running.long .cmdline .meta .act.totask { display: inline-flex; }
.pane.tasked .cmdline .meta .act.totask { display: none; }
.block.own .cmdline .meta .act.totask, .block.own .cmdline .meta .act.stop { display: none; }
.cmdline .meta .ports { display: inline-flex; gap: 6px; }
.cmdline .meta .port { color: var(--ok); text-decoration: none; }
.cmdline .meta .port:hover { text-decoration: underline; }
.task-note { color: var(--fg-dim); display: flex; align-items: center; gap: 8px; }
.cmdline .meta .act.stop:hover { background: color-mix(in srgb, var(--bad) 15%, var(--bg-3)); color: var(--bad); }
.act { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--fg-dim); font-size: .9em; cursor: pointer; }
.act:hover { color: var(--fg); border-color: var(--fg-faint); }
.dropped { color: var(--fg-faint); font-style: italic; }

.s-b { font-weight: 700; } .s-d { opacity: .6; } .s-i { font-style: italic; } .s-u { text-decoration: underline; } .s-x { text-decoration: line-through; }
a.link { color: inherit; text-decoration: underline; text-decoration-color: var(--fg-faint); }
.flink:hover { cursor: pointer; text-decoration: underline; color: var(--accent); }
/* A terminal fills each cell top to bottom: a coloured background is the
   height of the row, not of the letters, so a row painted in colour is one
   solid bar. */
.l > span[style*="background"] { padding-block: var(--cell-pad, calc((var(--lh) - 1.2) * .5em)); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
/* And block letters fill it too, as they do in a terminal: a font's are shorter, which left the
   background showing above and below them, and gaps between rows of them (Claude Code's picture). */
.cell-blocks { display: inline-block; transform: var(--blocks, none); }

/* ── The line being typed: the prompt, then the text, wrapping under the prompt ── */
.line { position: relative; min-height: calc(var(--lh) * 1em); }
.prompt { position: absolute; left: 0; top: 0; pointer-events: none; white-space: pre; }
.pright { position: absolute; right: 0; top: 0; pointer-events: none; white-space: pre; }
.ptop { display: flex; justify-content: space-between; gap: 2ch; white-space: pre; }
.ptop[hidden], .pane.alt .ptop, .pane.direct .ptop, .pane.exited .ptop { display: none; }
.input {
  display: block; width: 100%; box-sizing: border-box; resize: none; border: 0; outline: none; background: transparent; color: var(--fg);
  font: inherit; line-height: inherit; padding: 0; margin: 0; overflow: hidden;
  caret-color: var(--caret, var(--accent)); caret-shape: var(--caret-shape, block);
}
.pane:not(.focused) .input { caret-color: transparent; }
.pane.menu .input { caret-color: transparent; }
.input.secret { -webkit-text-security: disc; }
.pane.alt .line, .pane.direct .line, .pane.exited .input { display: none; }
/* The ghost: an earlier command's rest, faint after the cursor. A copy of the line behind the box,
   its typed part clear, so it wraps exactly as the line does. */
.input { position: relative; z-index: 1; }
.ghost { position: absolute; inset: 0; pointer-events: none; white-space: pre-wrap; word-break: break-all; color: transparent; box-sizing: border-box; }
.ghost[hidden] { display: none; }
.ghost-rest { color: var(--fg-faint); }

.term { position: relative; }
/* The help and the completions float over the output (_float), so nothing moves as they come and go. */
.complete, .sense {
  position: absolute; top: 0; left: var(--pane-pad, 12px); right: var(--pane-pad, 12px); z-index: 5; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / .35); padding: 4px 10px;
}
.complete { display: flex; flex-wrap: wrap; gap: 0 2ch; color: var(--fg-dim); }
.complete[hidden] { display: none; }
/* Intellisense: help for what is being typed, under the line. */
.sense { color: var(--fg-dim); }
.sense[hidden] { display: none; }
.sense-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sense-cmd, .sense-flag { color: var(--accent); }
.sense-more { color: var(--fg-faint); text-decoration: none; }
.sense-more:hover { color: var(--accent); text-decoration: underline; }
.sense-none { color: var(--fg-faint); }
.sense-item {
  display: flex; gap: 2ch; width: calc(100% + 12px); font: inherit; color: var(--fg); background: none;
  border: 0; border-radius: 3px; padding: 0 6px; margin: 0 -6px; cursor: pointer; text-align: left;
  white-space: nowrap; overflow: hidden;
}
.sense-list { max-height: 12lh; overflow-y: auto; padding: 0 6px; margin: 0 -6px; }
.sense-item:hover { background: var(--bg-2); }
.sense-missing { color: var(--warn); }
.sense-order { display: flex; flex-wrap: wrap; gap: 0 1ch; align-items: baseline; border-radius: 3px; padding: 0 6px; margin: 0 -6px; }
.sense-order-btn { font: inherit; color: var(--fg-faint); background: none; border: 0; padding: 0; cursor: pointer; }
.sense-order-btn:hover { color: var(--fg); }
.sense-order-btn.on { color: var(--accent); }
.sense-more.sel { color: var(--accent); background: var(--sel); border-radius: 3px; outline: none; }
.sense-item.sel { background: var(--sel); }
.sense-label { flex: none; overflow: hidden; text-overflow: ellipsis; }
.sense-label .ph { color: var(--c3); }
.sense-kind { color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sense-item.sel .sense-kind { color: var(--fg-dim); }
/* ⌃R: the line is the search; the letters that matched are marked in what was found. */
.pane.searching .search-prompt { color: var(--accent); }
.search-item .sense-label { flex: 0 1 auto; max-width: 75%; }
.search-item mark { background: none; color: var(--accent); font-weight: 600; }
.complete span { cursor: pointer; white-space: pre; }
.complete span.dir { color: var(--c4); }
.complete span[aria-selected="true"] { background: var(--sel); color: var(--fg); }

/* Direct keys and full screen: the program's own cursor. */
.cur, .s-cur { background: var(--cur-bg, var(--accent)); color: var(--cur-fg, var(--bg)); box-shadow: var(--cur-shadow, none); animation: blink 1.1s steps(1) infinite; }
[data-cur-thin="1"] .cur { background: var(--cell-bg, transparent); color: var(--cell-fg, inherit); opacity: var(--cell-o, 1); }   /* a bar or a line under: the letter as it is */
@keyframes blink { 50% { background: var(--cell-bg, transparent); color: var(--cell-fg, inherit); opacity: var(--cell-o, 1); } }
/* a table or rule drawn wider than the pane: shown laid out again for its width (fit.js), the original kept hidden */
.l.fit-src { display: none; }
.r.picked, .l.picked { background: var(--sel); }
.selecting .cur, .selecting .s-cur { background: var(--cell-bg, transparent); color: var(--cell-fg, inherit); opacity: var(--cell-o, 1); box-shadow: none; animation: none; }

/* ── Widgets: a program's menu, as controls ── */
.widget { margin: 2px 0 4px; display: flex; flex-direction: column; gap: 2px; max-width: 70ch; cursor: default; }
.widget.horizontal { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.opt { text-align: left; background: none; border: 1px solid transparent; border-radius: 5px; padding: 0 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.opt:hover { background: var(--bg-2); }
.opt.focus { border-color: var(--accent); background: var(--bg-2); }
.opt.focus::before { content: "❯"; color: var(--accent); margin-left: -2px; }
.opt:not(.focus)::before { content: " "; white-space: pre; }
.opt.on .box { color: var(--accent); }
.opt .box { color: var(--fg-faint); }
.opt .n { color: var(--fg-faint); font-size: .85em; margin-left: auto; padding-left: 2ch; }
.widget .done { align-self: flex-start; background: none; color: var(--accent); border: 1px solid var(--accent); border-radius: 5px; padding: 0 10px; cursor: pointer; margin-top: 2px; }
.widget.pending { opacity: .6; pointer-events: none; }

/* ── Pipeline debugger ── */
.pipe .cmdline .g { color: var(--c5); }
.stages { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; cursor: default; }
.stage { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.stage.running { border-color: var(--accent); }
.stage.done.nonzero { border-color: var(--warn); }
.stage.error { border-color: var(--bad); }
.stage .row { display: flex; gap: 8px; align-items: center; }
.stage .idx { color: var(--fg-faint); width: 1.5em; text-align: right; }
.stage input { flex: 1; min-width: 0; font: inherit; color: var(--fg); background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.stage input:focus { outline: none; border-color: var(--accent); }
.stage .smeta { color: var(--fg-dim); font-size: .85em; white-space: nowrap; }
.stage pre { margin: 4px 0 0 2em; max-height: 16em; overflow: auto; white-space: pre; font: inherit; }
.stage pre.err { color: var(--bad); }
.stage .more { margin-left: 2em; }
.pipe-acts { display: flex; gap: 6px; margin: 4px 0 2px; }

/* ── Full-screen programs: over their own pane ── */
/* The overlay is .alt-screen, never .alt: .alt is the pane's own state while a
   full-screen program runs, and a rule for one must not catch the other. */
.alt-screen { position: absolute; inset: 0; background: var(--bg); z-index: 3; padding: 0 12px; overflow: hidden; }
.alt-screen[hidden] { display: none; }
.alt-grid { margin: 0; font: inherit; line-height: var(--lh); white-space: pre; }
.alt-grid .r { height: calc(var(--lh) * 1em); }
.alt-grid .r > span { display: inline-block; height: calc(var(--lh) * 1em); vertical-align: top; }

/* ── The side panel: History, Tasks or Help, docked on the right; the panes make room ── */
#side {
  position: fixed; top: calc(var(--bar-h) + var(--head-h) + 1px); bottom: calc(var(--foot-h) + 1px); right: 0; width: var(--side-w, 440px); max-width: calc(80vw / var(--zoom, 1)); z-index: 20;
  background: var(--bg-2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
#side[hidden], .side-view[hidden] { display: none; }
body.side-open #work { margin-right: min(var(--side-w, 440px), calc(80vw / var(--zoom, 1))); }
#side-grip { position: absolute; top: 0; bottom: 0; left: -3px; width: 5px; cursor: col-resize; z-index: 1; }
/* A hairline over the panel's border: one screen pixel, even on a Retina screen. */
#side-grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 2.5px; width: 0.5px; }
#side-grip:hover::after, body.dragging-side #side-grip::after { background: var(--accent); }
body.dragging-side { cursor: col-resize; user-select: none; }
.side-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── History ── */
.hhead { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px 14px; }
.hhead > strong, .hhead > span:not(.spacer) { white-space: nowrap; }   /* a count stays on one line: the buttons give way */
.hhead > .spacer { min-width: 0; }
#hcount { color: var(--fg-faint); font-size: .85em; }
#hfilter { margin: 0 10px 6px; }
#ppanel-search { margin: 8px 10px 2px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; outline: none; }
#ppanel-search:focus { border-color: var(--accent); }
#ppanel-search[hidden] { display: none; }
.sn-find { display: flex; gap: 6px; margin: 0 10px 6px; }
.sn-find #snfilter { flex: 1; min-width: 0; margin: 0; }
.sn-find .tbtn { flex: none; max-width: 45%; min-width: 0; }
.sn-find .tbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#flfilter { margin: 0 10px 6px; }
#hfilter, #snfilter, #flfilter { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; outline: none; }
#hfilter:focus, #snfilter:focus, #flfilter:focus { border-color: var(--accent); }
#hlist { list-style: none; margin: 0; padding: 0 6px; overflow-y: auto; flex: 1; }
#hlist li { display: flex; align-items: flex-start; gap: 6px; padding: 2px 4px 2px 8px; border-radius: 5px; cursor: pointer; }
#hlist li .htext { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-all; }
.hdel { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--fg-faint); cursor: pointer; visibility: hidden; }
.hdel svg { width: 9px; height: 9px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
#hlist li:hover .hdel, #hlist li[aria-selected="true"] .hdel { visibility: visible; }
.hdel:hover { color: var(--st-crit); background: var(--bg); }
#hlist li:hover { background: var(--bg-3); }
#hlist li[aria-selected="true"] { background: var(--sel); }
#hlist li.empty { color: var(--fg-faint); cursor: default; }
.hfoot { color: var(--fg-faint); font-size: .8em; padding: 6px 14px; border-top: 1px solid var(--line); }

/* ── The LLM: `= …` and its answers ── */
.pane.asking .prompt .g, .block.ai .cmdline .g { color: var(--c5); }
.ai-body { margin: 2px 0 6px; padding: 6px 12px 8px; border-left: 2px solid color-mix(in srgb, var(--c5) 55%, transparent); background: color-mix(in srgb, var(--c5) 5%, transparent); border-radius: 0 6px 6px 0; cursor: default; }
.block.ai.fail .ai-body { border-left-color: var(--bad); }
.ai-who { color: var(--fg-faint); font-size: .85em; margin-bottom: 2px; }
.ai-memory { margin: 2px 0 6px; font-size: .85em; color: var(--fg-dim); }
.ai-memory[hidden] { display: none; }
.ai-mem-from { color: var(--c5); }
.ai-mem code { color: var(--fg); }
.ai-text p { margin: 4px 0; white-space: pre-wrap; }
.ai-text code { background: var(--bg-3); border-radius: 4px; padding: 0 4px; }
.ai-code { margin: 6px 0; padding: 6px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; word-break: break-all; font: inherit; color: var(--fg); }
.ai-wait { color: var(--fg-faint); }
.ai-wait::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.ai-error { color: var(--bad); margin-top: 4px; }
.offline-note { color: var(--bad); }
.quiet { color: var(--fg-faint); font-style: italic; }
.online-note { color: var(--ok); }
.blocks > .stale { opacity: .5; }
.pane.offline .prompt .g { color: var(--bad); }
.ai-waiting { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.ai-clock { color: var(--fg-faint); font-size: .85em; font-variant-numeric: tabular-nums; }
.ai-acts { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ai-acts[hidden] { display: none; }
.ai-hint { color: var(--fg-faint); font-size: .85em; margin-left: 4px; }
.tbtn.small { height: 26px; padding: 0 9px 0 7px; font-size: .9em; }
.tbtn.primary { background: color-mix(in srgb, var(--accent) 30%, var(--bg-3)); border-color: var(--accent); }
.footlink { background: none; border: 0; padding: 0; color: var(--c5); cursor: pointer; font: inherit; white-space: nowrap; }
.footlink:hover { text-decoration: underline; }
#update-foot { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); }
#update-foot .i { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#update-foot.armed { color: var(--warn); }
#update-now.armed { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
#direct-foot, #enterlock-foot { display: inline-flex; align-items: center; gap: 5px; }
#direct-foot[hidden] { display: none; }
#direct-foot:not(.on) { color: var(--fg-faint); }

/* Settings: the whole window, its sections down the left. */
#settings { position: fixed; inset: 0; z-index: 40; background: var(--bg-2); }
#settings[hidden] { display: none; }
#settings .sheet {
  background: var(--bg-2); width: 100%; height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
}
#settings .help-head { grid-column: 1 / -1; }
.set-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: 1px solid var(--line); overflow-y: auto; }
.set-nav .htab { flex: none; text-align: left; border-radius: 7px; height: 32px; background: transparent; }
.set-nav .htab + .htab { border-left: 0; }
.set-nav .htab[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 24%, var(--bg-3)); }
#settings .set-panel { grid-column: 2; grid-row: 2; }
/* Text and forms keep a width that reads; Appearance takes the whole page for its preview. */
#settings .set-panel:not(#set-look) > * { max-width: 1100px; }
@media (max-width: 720px) {
  #settings .sheet { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .set-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; }
  #settings .set-panel { grid-column: 1; grid-row: 3; }
}
.set-panel { overflow-y: auto; }
.set-panel[hidden] { display: none; }
.set-intro { margin: 0 0 10px; color: var(--fg-dim); }
.set-intro code { font-family: var(--mono); background: var(--bg-3); border-radius: 4px; padding: 0 4px; }
#settings h3 { margin: 6px 0 4px; font-size: 14px; font-weight: 650; }
#settings h4 { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--fg); }
.field-note-block { margin: 0 0 8px; color: var(--fg-faint); font-size: 12.5px; }
#hyper-keys[hidden], #hyper-toggle-row[hidden] { display: none; }
#hyper-keys { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.keygrid { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 6px 10px; align-items: center; }
.key-dir { color: var(--fg-dim); font-size: 13px; text-align: right; }
.keybind {
  height: 30px; min-width: 64px; padding: 0 10px; font: inherit; font-size: 13px; color: var(--fg); cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
}
.keybind:hover { border-color: var(--fg-faint); }
.keybind.capturing { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg-3)); color: var(--fg-dim); }
.set-row { display: flex; align-items: center; gap: 12px; }
.set-row[hidden] { display: none; }
.set-msg { font-size: 12.5px; color: var(--fg-faint); }
.set-msg.bad { color: var(--st-crit); }
#llm-form > .set-intro { padding: 16px 18px 0; margin: 0; }
#llm-form .llm-body { padding-top: 10px; }
.llm-body { padding: 14px 18px 4px; display: flex; flex-direction: column; gap: 8px; }
/* A tab with no footer of its own ends with room under its last button, not on the sheet's edge. */
.set-panel > .llm-body:last-child { padding-bottom: 20px; }
/* Sections apart: a rule above each after the first, so a button ends its section visibly. */
#settings .llm-body > h3:not(:first-child) { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
#settings .llm-body > .set-row { margin-top: 2px; }
.field { display: grid; grid-template-columns: 7em 1fr; align-items: center; gap: 12px; }
.field[hidden] { display: none; }
.field > span, .field > label { color: var(--fg-dim); }
.field > .field-row { display: flex; gap: 6px; min-width: 0; color: var(--fg); }
.field-row input { flex: 1; }
.field-row .tbtn { height: 30px; }
.field input, .field select { height: 30px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; outline: none; min-width: 0; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-note { margin: -2px 0 2px calc(7em + 12px); color: var(--fg-faint); font-size: .85em; }
.field-note:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--fg-dim); margin-top: 4px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.llm-result { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); }
.llm-result.ok { border-color: var(--ok); color: var(--ok); }
.llm-result.bad { border-color: var(--bad); color: var(--bad); }
.llm-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px 16px; }

/* ── Visualisers: a program's output, drawn ──
   Palette roles after the dataviz reference: one blue for amounts (series 1),
   orange for a second measure beside it (series 2), status colours only for a
   threshold crossed, with an icon and a word. */
:root { --s1: #2a78d6; --s2: #eb6834; --st-warn: #fab219; --st-crit: #d03b3b; --vz-grid: #e1e0d9; --vz-track: rgba(11,11,11,.07); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; --vz-grid: #2c2c2a; --vz-track: rgba(255,255,255,.08); } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --vz-grid: #2c2c2a; --vz-track: rgba(255,255,255,.08); }

.viewsw { display: inline-flex; margin-left: 12px; vertical-align: 1px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; font-size: .82em; }
.viewsw[hidden] { display: none; }
.viewsw button { background: var(--bg-2); border: 0; color: var(--fg-dim); padding: 0 9px; line-height: 1.6; cursor: pointer; }
.viewsw button + button { border-left: 1px solid var(--line); }
.viewsw button:hover { color: var(--fg); }
.viewsw button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 24%, var(--bg-3)); color: var(--fg); }
.alt-sw { position: absolute; top: 6px; right: 14px; z-index: 2; margin: 0; }
.viz-out { display: none; }
.block.visual .viz-out { display: block; }
.block.visual .settled, .block.visual .live { display: none; }
.alt-viz { position: absolute; inset: 0; overflow: auto; padding: 38px 14px 16px; background: var(--bg); }
.alt-viz[hidden], .alt-grid[hidden] { display: none; }
.vz-starting { color: var(--fg-faint); font-family: system-ui, -apple-system, sans-serif; padding: 8px 2px; }

.vz { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.4; color: var(--fg); margin: 6px 0 8px; cursor: default; }
.vz-muted { color: var(--fg-faint); }
.vz-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.vz-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 12px; }
.vz-tile { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vz-label { color: var(--fg-dim); font-size: 12px; }
.vz-value { font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vz-value.long { font-size: 15px; white-space: normal; line-height: 1.3; }
.vz-sub { color: var(--fg-faint); font-size: 12px; }
.vz-status.warn { color: var(--st-warn); font-weight: 600; }
.vz-status.crit { color: var(--st-crit); font-weight: 600; }

.vz-bar { display: inline-block; position: relative; height: 8px; width: 100%; min-width: 40px; border-radius: 4px; background: var(--vz-track); overflow: hidden; vertical-align: middle; }
.vz-fill { position: absolute; inset: 0 auto 0 0; background: var(--s1); border-radius: 4px; }
.vz-bar.s2 .vz-fill { background: var(--s2); }
.vz-spark { width: 100%; height: 24px; display: block; }
.vz-core .vz-spark { width: 60px; height: 16px; }
.vz-line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.vz-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; margin-bottom: 14px; }
.vz-core { display: grid; grid-template-columns: 2.2em 1fr 3.6em 60px; align-items: center; gap: 8px; }
.vz-n { color: var(--fg-faint); text-align: right; font-variant-numeric: tabular-nums; }

.vz-table { width: 100%; border-collapse: collapse; }
.vz-table th { text-align: left; color: var(--fg-dim); font-weight: 500; font-size: 12px; padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.vz-table th.sorted { color: var(--fg); }
.vz-table th.num, .vz-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.vz-table td { padding: 3px 8px; border-bottom: 1px solid var(--vz-grid); white-space: nowrap; }
.vz-table tbody tr:hover td { background: var(--bg-2); }
.vz-table td.barcol, .vz-table th.barcol { width: 150px; }
.vz-barcell { display: flex; align-items: center; gap: 8px; }
.vz-barcell .vz-num { min-width: 4.2em; }
.vz-proc { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.vz-pname { font-weight: 600; }
.vz-pcmd { color: var(--fg-faint); }
.vz-foot { margin-top: 10px; color: var(--fg-faint); font-size: 12px; }

.vz-list { display: flex; flex-direction: column; gap: 6px; max-width: 900px; }
.vz-row { display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(120px, 2fr) 7em; grid-template-areas: "name bar num" "detail detail detail"; align-items: center; gap: 2px 12px; }
.vz-row > .vz-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vz-row > .vz-bar { grid-area: bar; }
.vz-row > .vz-num { grid-area: num; }
.vz-row > .vz-detail { grid-area: detail; font-size: 12px; }
.vz-ls { max-width: 980px; }
.vz-ls .vz-fname { width: 100%; }
.vz-ls .vz-dir .vz-fname { color: var(--c4); }
.vz-kind { display: inline-block; width: 1.2em; color: var(--fg-faint); }
.vz-perms { font-family: var(--mono); font-size: 12px; }


/* ── Help ── */
.help-head { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.help-head strong { font-size: 16px; }
.help-sub { color: var(--fg-faint); font-size: 13px; }
#help { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; }
#help .hhead strong { font-size: 15px; }
#help-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 22px; border-top: 1px solid var(--line); }
.help-panel { columns: 2 440px; column-gap: 48px; }
.help-panel[hidden] { display: none; }
/* The help's tabs: a segmented control, as Raw | Charts is, larger. */
.help-tabs { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0 14px 10px; }
.htab { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--bg-2); border: 0; color: var(--fg-dim); padding: 0 10px; height: 30px; font: inherit; font-size: 13px; cursor: pointer; }
.htab + .htab { border-left: 1px solid var(--line); }
.htab:hover { color: var(--fg); }
.htab[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 24%, var(--bg-3)); color: var(--fg); }
.htab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#help section { break-inside: avoid; margin-bottom: 26px; }
#help h3 { margin: 0 0 4px; font-size: 14px; font-weight: 650; color: var(--fg); }
#help p { margin: 0 0 10px; color: var(--fg-dim); max-width: 60ch; }
/* One key column for every section, so every description starts in the same place. */
#help dl { display: grid; grid-template-columns: 9.5rem 1fr; gap: 7px 18px; margin: 0; align-items: baseline; }
#help dt { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#help dd { margin: 0; color: var(--fg); }
#help kbd {
  font-family: system-ui, -apple-system, sans-serif; font-size: 12px; line-height: 1; color: var(--fg);
  min-width: 1.9em; padding: 4px 6px 3px; text-align: center; white-space: nowrap;
  background: var(--bg-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
}
#help .ui { font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--accent); color: var(--fg); background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); white-space: nowrap; }
#help .act-word { font-size: 12.5px; color: var(--fg-dim); font-style: italic; }

#toast { position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%); background: var(--bg-3); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; z-index: 50; max-width: 80vw; }

@media (max-width: 700px) {
  #cwd, #hints, #keys-hint, #new-tab { display: none; }
  .tbtn span { display: none; }
  .tbtn { padding: 0 8px; }
  .newtab .caret { border-left: 1px solid var(--line); border-radius: 6px; }
}

/* Settings → Memory: what is remembered, each with a way to forget it. */
.mem-list { list-style: none; margin: 0; padding: 0; }
.mem-list li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.mem-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mem-text strong { font-weight: 600; }
.mem-when { color: var(--fg-faint); font-size: 12px; }
.mem-text code, .check code { font-family: var(--mono); background: var(--bg-3); border-radius: 4px; padding: 0 4px; }
.mem-x { flex: none; }
/* Settings → Programs */
.prog-terms { display: grid; grid-template-columns: 8em 1fr; gap: 6px 14px; margin: 0 0 6px; color: var(--fg-dim); }
.prog-terms dt { color: var(--fg); font-weight: 600; }
.prog-terms dd { margin: 0; }
.prog-terms code { font-family: var(--mono); background: var(--bg-3); border-radius: 4px; padding: 0 4px; }
.prog-table { width: 100%; border-collapse: collapse; }
.prog-table th, .prog-table td { text-align: left; padding: 6px 8px 6px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.prog-table thead th { border-top: 0; color: var(--fg-faint); font-weight: 500; font-size: 12.5px; }
.prog-table tbody th { font-weight: 600; white-space: nowrap; }
.prog-table code { font-family: var(--mono); }
.prog-note { margin-left: 8px; color: var(--fg-faint); font-size: 12px; font-weight: 400; }
.prog-select { height: 30px; width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; min-width: 0; }
.prog-select:focus { border-color: var(--accent); outline: none; }
.prog-acts { width: 1%; }
.prog-acts > div { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.type-by { color: var(--fg-dim); }
.type-by code, .mono { font-family: var(--mono); }
.type-form { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.vz-rows { max-width: 980px; }
.type-from { margin-left: 0; }
.prog-input { height: 30px; width: 100%; min-width: 9em; font: inherit; font-family: var(--mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.prog-input:focus { border-color: var(--accent); outline: none; }
.prog-new th, .prog-new td { border-top: 1px solid var(--line); padding-top: 10px; }
.prog-ok:not(:disabled) { color: var(--ok); }
.prog-ok:disabled { opacity: .45; cursor: default; }
.prog-input-cell { width: 45%; }
.prog-summary { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 30px; padding: 0 8px; font: inherit; text-align: left; color: var(--fg-dim); background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.prog-summary:hover:not(:disabled) { color: var(--fg); border-color: var(--line); background: var(--bg-3); }
.prog-summary:disabled { cursor: default; color: var(--fg-dim); }
.prog-summary[aria-expanded="true"] { color: var(--fg); }
.prog-caret { color: var(--fg-faint); width: 1em; flex: none; }
.prog-table .prog-detail td { border-top: 0; padding: 2px 0 12px; }
.prog-list { list-style: none; margin: 4px 0 10px; padding: 0; }
.prog-item { border-top: 1px solid var(--line); }
.prog-item:last-child { border-bottom: 1px solid var(--line); }
.prog-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.prog-row .prog-summary { flex: 1; min-width: 0; }
.prog-name { flex: none; width: 9em; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-name code { font-family: var(--mono); }
.prog-what { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-row .prog-acts { display: flex; align-items: center; gap: 6px; flex: none; width: auto; }
.prog-new { margin: 6px 0 4px; }
.plugin-card { padding: 12px 14px; margin: 10px 0; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; }
.plugin-card h4 { margin: 0 0 4px; font-size: 14px; }
.plugin-card h4 code { font-family: var(--mono); }
.plugin-card .set-intro { margin: 0 0 8px; }
.plugin-card .field select { background: var(--bg); }
.plugin-card.off > :not(.plugin-head):not(.set-msg:last-child) { opacity: .5; }
.plugin-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.plugin-head h4 { margin: 0; }
.plugin-program { display: flex; gap: 10px; margin: 0 0 10px; color: var(--fg-dim); font-size: 13px; }
.plugin-label { color: var(--fg); flex: none; }
.prog-new-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.prog-new-head .prog-input { width: 16em; flex: none; }
.prog-fields { display: flex; flex-direction: column; gap: 2px; padding: 6px 0 12px 28px; }
.prog-field { display: grid; grid-template-columns: 8.5em 18em 1fr; align-items: center; gap: 14px; padding: 3px 0; }
.prog-field-name { color: var(--fg); }
.prog-hint { color: var(--fg-faint); font-size: 12.5px; line-height: 1.35; }
@media (max-width: 900px) { .prog-field { grid-template-columns: 8.5em 1fr; } .prog-hint { grid-column: 2; } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ── Tasks: servers and long jobs ── */
#tcount { color: var(--fg-faint); font-size: .85em; }
#tlist { list-style: none; margin: 0; padding: 0 10px; overflow-y: auto; overflow-x: hidden; flex: 1; }
#tlist li { padding: 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
#tlist li:first-child { border-top: 0; }
#tlist li.empty { color: var(--fg-faint); border: 0; font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; }
.task-top { display: flex; align-items: center; gap: 8px; }
.task-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--fg-faint); }
.task-dot.running { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.task-dot.failed { background: var(--bad); }
.task-cmd { flex: 1; min-width: 0; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-name { font-weight: 600; }
.task-command { color: var(--fg); font-family: var(--mono); }
.task-top .rename-input { flex: 1; min-width: 0; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--fg-dim); font-size: .85em; padding-left: 16px; }
.task-meta .port { color: var(--ok); text-decoration: none; }
.task-proj { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; }
.task-proj:hover { text-decoration: underline; }
.task-meta .port:hover { text-decoration: underline; }
.task-tail { color: var(--fg-faint); font-size: .85em; padding-left: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-acts { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 16px; padding-top: 2px; }
.task-acts .tbtn.danger:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
/* ── Projects ── */
#plist, #rblist { list-style: none; margin: 0; padding: 0 10px; overflow-y: auto; overflow-x: hidden; flex: 1; }
#plist li, #rblist li { padding: 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
#plist li:first-child, #rblist li:first-child { border-top: 0; }
#rblist li.empty { color: var(--fg-faint); border: 0; font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; }
#rblist .rb-update { color: var(--accent); }
/* Snippets: each row the text kept, clipped to a few lines until clicked, then where it came from and its buttons. */
#snlist { list-style: none; margin: 0; padding: 0 10px; overflow-y: auto; overflow-x: hidden; flex: 1; }
#snlist li { padding: 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
#snlist li:first-child, #snlist li.sn-group + li, #snlist li.sn-day + li { border-top: 0; }
#snlist li.sn-day { color: var(--fg-dim); font-size: 12px; font-weight: 600; padding: 10px 4px 0; font-family: system-ui, -apple-system, sans-serif; }
/* Each snippet is a card, so where one ends and the next starts is plain. */
#snlist li.sn-row { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 10px 12px; margin: 8px 0 0; }
#snlist li.sn-day + li.sn-row { margin-top: 6px; }
/* A heading inside a snippet stays smaller than the panel's own. */
.sn-md h1, .sn-md h2, .sn-md h3, .sn-md h4, .sn-md h5, .sn-md h6 { font-size: 14px; font-weight: 650; margin: .6em 0 .3em; }
#snlist li.sn-row.done .sn-text { text-decoration: line-through; color: var(--fg-faint); }
#snlist li.sn-group { color: var(--fg-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 4px 2px; border-top: 0; font-family: system-ui, -apple-system, sans-serif; }
#snlist li.sn-group.sn-project { text-transform: none; letter-spacing: .02em; font-family: var(--mono); }
#snlist li.empty { color: var(--fg-faint); border: 0; font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; }
.sn-text { max-height: calc(var(--lh) * 7em); overflow: hidden; cursor: pointer; overflow-wrap: anywhere; }
.sn-pre { white-space: pre-wrap; }
.sn-md { font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; }
.sn-md > :first-child { margin-top: 0; }
.sn-md > :last-child { margin-bottom: 0; }
.sn-md pre { white-space: pre-wrap; font-family: var(--mono); font-size: .95em; }
.sn-row.clipped .sn-text { -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.sn-row.open .sn-text { max-height: none; cursor: text; }
.sn-row .task-meta, .sn-row .task-acts { padding-left: 0; }
.sn-row.clipped .task-meta::after { content: 'click to unfold'; color: var(--fg-faint); }
.sn-source { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Which folder the focused pane snips into, and the folders: a row to open or close, its snippets indented under it. */
#snippets { position: relative; }
/* Files: a folder's files, one row each: tick, icon, name, when and size, Use. */
.fl-place .tbtn#flplace { flex: 1; justify-content: space-between; }
#fllist { list-style: none; margin: 0; padding: 0 10px; overflow-y: auto; overflow-x: hidden; flex: 1; }
#fllist li.fl-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 4px; border-top: 1px solid var(--line); }
#fllist li.fl-row:first-child { border-top: 0; }
#fllist li.fl-row.ticked { background: color-mix(in srgb, var(--accent) 10%, transparent); }
#fllist li.empty { color: var(--fg-faint); font-family: system-ui, -apple-system, sans-serif; font-size: 13px; padding: 10px 4px; }
#fllist input[type=checkbox] { margin: 0; accent-color: var(--accent); }
.fl-icon { display: inline-flex; color: var(--fg-dim); }
.fl-dir .fl-icon { color: var(--accent); }
.fl-icon .ti { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.fl-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.fl-name { overflow-wrap: break-word; word-break: normal; min-width: 0; }
#fllist li.fl-row.stack { grid-template-columns: auto auto minmax(0, 1fr); }
#fllist li.fl-row.stack .fl-acts { grid-column: 3; }
button.fl-name { background: none; border: 0; padding: 0; font: inherit; color: var(--fg); cursor: pointer; text-align: left; }
button.fl-name:hover { color: var(--accent); text-decoration: underline; }
.fl-meta { color: var(--fg-faint); font-size: .85em; white-space: nowrap; }
.fl-acts { display: flex; gap: 4px; align-items: center; }
.tbtn.icon-only { padding-left: 6px; padding-right: 6px; }
#fllist .tbtn.danger:hover, #fllist .tbtn.danger.armed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
#fllist .tbtn.danger.armed { background: color-mix(in srgb, var(--bad) 12%, var(--bg-3)); }
/* View: the file over the page; a click closes it. */
.fl-view { position: fixed; inset: 0; z-index: 100; background: rgb(0 0 0 / .6); display: flex; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; }
.fl-view-card { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.fl-view-head { color: #fff; font-size: 13px; text-shadow: 0 1px 2px rgb(0 0 0 / .6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-view img, .fl-view video { max-width: calc(100vw - 64px); max-height: calc(100vh - 100px); object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgb(0 0 0 / .5); background: var(--bg); }
.fl-view iframe { width: min(1000px, calc(100vw - 64px)); height: calc(100vh - 100px); border: 0; border-radius: 6px; background: #fff; }
.fl-view audio { width: min(500px, calc(100vw - 64px)); }
.fl-view pre { margin: 0; width: min(1000px, calc(100vw - 64px)); max-height: calc(100vh - 100px); overflow: auto; padding: 14px 16px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; cursor: zoom-out; }
.fl-view-none { color: #fff; background: rgb(0 0 0 / .4); padding: 14px 16px; border-radius: 6px; }
#snippets .hhead strong { white-space: nowrap; }
.sn-note { position: absolute; top: 44px; left: 10px; right: 10px; z-index: 25; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / .35); }
.sn-note[hidden] { display: none; }
.sn-note .sn-into { margin: 0; }
.sn-note textarea { min-height: 160px; max-height: 60vh; resize: vertical; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; outline: none; }
.sn-note textarea:focus { border-color: var(--accent); }
.sn-note .task-acts { padding-left: 0; align-items: center; }
.sn-note-key { color: var(--fg-faint); font-size: .85em; margin-left: auto; }
.sn-into { display: flex; align-items: center; gap: 8px; margin: 0 10px 8px; color: var(--fg-dim); font-size: .9em; }
.sn-into .tbtn { min-width: 0; max-width: 70%; }
.sn-into .tbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#snlist li.sn-folder { gap: 6px; }
#snlist li.sn-folder .task-top { gap: 6px; }
.sn-caret { background: none; border: 0; padding: 0; color: var(--fg-dim); cursor: pointer; display: inline-flex; }
.sn-caret .ti, .sn-folder-icon .ti { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .12s; }
.sn-folder:not(.folded) .sn-caret .ti { transform: rotate(90deg); }
.sn-folder-icon { display: inline-flex; color: var(--fg-dim); }
.sn-folder.mine .sn-folder-icon { color: var(--accent); }
.sn-folder .task-name { cursor: pointer; font-weight: 600; }
.sn-folder-count { color: var(--fg-faint); font-size: .85em; }
.sn-mine { color: var(--accent); font-size: .85em; }
.sn-folder .task-acts { padding-left: 21px; }
#snlist li.sn-in { margin-left: 21px; }
#snlist li.sn-day.sn-in { padding-left: 4px; }
.sn-confirm { margin-left: 21px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--bad) 8%, var(--bg-2)); display: flex; flex-direction: column; gap: 8px; font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.45; }
.sn-confirm .task-acts { padding-left: 0; }
#snlist .tbtn.danger.confirm { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
#snlist li.sn-naming { flex-direction: row; align-items: center; gap: 4px; }
#snlist li.sn-naming .rename-input { flex: 1; min-width: 0; }
#snlist .task-acts .tbtn.danger.armed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
#snlist .task-acts .tbtn.danger:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
#rblist li.rb-group { color: var(--fg-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 4px 2px; border-top: 0; font-family: system-ui, -apple-system, sans-serif; }
#rblist li.rb-naming { flex-direction: row; align-items: center; gap: 4px; }
#rblist li.rb-naming .rename-input { flex: 1; min-width: 0; }
#rblist .task-acts .tbtn.danger.armed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
#rblist .task-acts .tbtn.danger:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
/* The project gone to from a task (Open project, its @name): marked until the panel closes. */
#plist li.chosen { background: var(--sel); border-radius: 6px; }
#plist li.empty { color: var(--fg-faint); border: 0; font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; }
.proj-notes { color: var(--fg-faint); font-size: .85em; padding-left: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-missing { color: var(--warn); }
.task-meta a.link { color: var(--fg-dim); }
#pform { display: flex; flex-direction: column; gap: 8px; padding: 4px 14px 12px; overflow-y: auto; flex: 1; }
#pform[hidden] { display: none; }
#pform h3 { margin: 0 0 4px; font-size: 1em; }
#pform .field { grid-template-columns: 5.5em 1fr; }
#pform .field-note { margin-left: calc(5.5em + 12px); }
#pform textarea { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; outline: none; min-width: 0; resize: vertical; }
#pform textarea:not(.mono) { font-family: system-ui, -apple-system, sans-serif; font-size: 13px; }
#pform textarea:focus { border-color: var(--accent); }
.form-error { margin: 0; color: var(--bad); font-size: .85em; }
.form-error:empty { display: none; }
.pform-acts { display: flex; gap: 6px; align-items: center; padding-top: 4px; }
.pform-acts .tbtn.danger:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.tbtn.primary { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 24%, var(--bg-3)); }

/* Folders in a side panel: a breadcrumb, and rows to open and drop on. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 0 10px 6px 10px; font-size: .85em; }
.crumbs[hidden] { display: none; }
.crumb { padding: 2px 6px; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--fg-dim); cursor: pointer; font: inherit; }
.crumb:hover { background: var(--bg-3); color: var(--fg); }
.crumb[aria-current] { color: var(--fg); font-weight: 600; }
.crumb-sep { color: var(--fg-faint); }
.folder-row { cursor: pointer; }
.folder-row .task-top { gap: 8px; }
.folder-row .ti, .ctx-menu .ti { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; color: var(--fg-dim); }
.folder-row:hover { background: var(--bg-3); }
.folder-count { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-faint); font-size: .85em; }
.folder-chev { color: var(--fg-faint); }
.drop-on { outline: 1px solid var(--accent); outline-offset: -1px; background: color-mix(in srgb, var(--accent) 14%, transparent) !important; border-radius: 5px; }
li.dragged { opacity: .45; }
.pop-at { position: fixed; top: 0; left: 0; z-index: 60; max-height: calc(100vh - 8px); overflow-y: auto; }
.ctx-menu { min-width: 190px; }
/* A panel at the pointer (right-click): the prompt's options, oTerminal's details. */
.pop { padding: 10px 12px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / .35); color: var(--fg); font-family: system-ui, -apple-system, sans-serif; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 2px; }
.prompt-pop { width: min(470px, calc(100vw - 8px)); }
.prompt-pop .look-row { grid-template-columns: 7.5em 1fr; }
/* The prompt's Directory choices, each with what it shows here. */
.look-row:has(.dir-choices) { align-items: start; }
.look-row:has(.dir-choices) > .look-name { padding-top: 4px; }
.dir-choices { display: flex; flex-direction: column; width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.dir-choices button { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 4px 10px; font: inherit; font-size: 13px; text-align: left; color: var(--fg-dim); background: var(--bg-2); border: 0; border-top: 1px solid var(--line); cursor: pointer; }
.dir-choices button:first-child { border-top: 0; }
.dir-choices button:hover { color: var(--fg); background: var(--bg-3); }
.dir-choices button[aria-checked="true"] { color: var(--fg); background: var(--sel); }
.dc-ex { font-family: var(--mono); font-size: 12px; color: var(--fg-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-choices button[aria-checked="true"] .dc-ex { color: var(--accent); }
.about-pop { min-width: 240px; }
.about-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.about-pop dt { color: var(--fg-dim); }
.about-pop dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }
.about-pop .tbtn { align-self: flex-start; }
.ctx-menu button:disabled { color: var(--fg-faint); cursor: default; background: none; }
.ctx-menu button.danger:hover { color: var(--bad); }
.menu-head { padding: 4px 8px 2px; color: var(--fg-faint); font-size: .8em; }
#tasks-btn .count { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ok); color: var(--bg); font-size: 11px; line-height: 16px; text-align: center; }
#tasks-btn .count[hidden] { display: none; }
#tasks-btn .count.bad { background: var(--bad); color: #fff; }
/* Runbooks: how many have a newer version to run. */
#runbooks-btn .count { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--bg); font-size: 11px; line-height: 16px; text-align: center; }
#runbooks-btn .count[hidden] { display: none; }
#rbcount { color: var(--fg-faint); font-size: .85em; }
#tasks-btn.broken { border-color: var(--bad); }
#tasks-btn.broken .ti { color: var(--bad); }

/* The footer's version; the page while oTerminal restarts. */
#version { color: var(--fg-faint); }
#restarting { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgb(0 0 0 / .45); }
#restarting[hidden] { display: none; }
#restarting .sheet { display: flex; flex-direction: column; gap: 6px; padding: 18px 22px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
  font-family: system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.5; max-width: 360px; }
#restarting-msg { color: var(--fg-dim); }
#restarting .update-tail { margin: 4px 0 0; padding: 8px 10px; max-height: 40vh; overflow: auto; border-radius: 6px; background: var(--bg); border: 1px solid var(--line);
  font: 12px/1.45 var(--mono, ui-monospace, monospace); white-space: pre-wrap; color: var(--fg); }
#restarting .update-close { align-self: flex-end; margin-top: 6px; }
#restarting:has(.update-tail) .sheet, #restarting:has(.update-close) .sheet { max-width: min(640px, calc(100vw - 32px)); }

/* ── The manual: over one pane, never the others ── */
/* Its type grows with the pane it covers (cqi: the manual's own width): 15px in a
   narrow pane, about 16.5px across a 14-inch MacBook Pro, 19px across a large
   display, never over 20px. Everything else is sized from that, so it all scales
   together, and the text keeps a line length that reads (about 80 characters). */
.manual {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; background: var(--bg);
  container-type: inline-size; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.6; color: var(--fg);
}
.man-head, .man-main { font-size: clamp(15px, 10.5px + 0.4cqi, 20px); }
.man-head { display: flex; align-items: center; gap: 0.7em; padding: 0.55em 0.7em 0.55em 1.1em; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.man-title { font-size: 1em; font-weight: 600; }
.man-search { flex: 0 1 20em; min-width: 0; height: 2em; font: inherit; font-size: 0.93em; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 0.6em; outline: none; }
.man-search:focus { border-color: var(--accent); }
.man-found { color: var(--fg-faint); font-size: 0.88em; flex: 1; }
.man-close { margin-left: auto; }
.man-main { flex: 1; min-height: 0; display: flex; }
.man-nav { flex: none; width: 15em; overflow-y: auto; padding: 0.9em 0.6em; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.man-nav a { color: var(--fg-dim); text-decoration: none; padding: 0.25em 0.7em; border-radius: 5px; font-size: 0.93em; line-height: 1.4; }
.man-nav a:hover { background: var(--bg-2); color: var(--fg); }
.man-nav a[aria-current] { background: var(--sel); color: var(--fg); }
.man-nav a.hit::after { content: " •"; color: var(--warn); }
.man-body { flex: 1; min-width: 0; overflow-y: auto; padding: 0.5em clamp(1em, 4cqi, 4em) 40vh; }
.man-sec { max-width: 48em; margin: 0 auto; padding-top: 1.1em; }
.man-sec + .man-sec { border-top: 1px solid var(--line); margin-top: 1.3em; }
.man-sec h3 { font-size: 1.4em; margin: 0 0 0.5em; }
.man-sec h4 { font-size: 1.05em; margin: 1.2em 0 0.3em; }
.man-sec p, .man-sec ul { margin: 0 0 0.75em; color: var(--fg-dim); }
.man-sec ul { padding-left: 1.4em; }
.man-sec li + li { margin-top: 0.2em; }
.man-sec b, .man-sec strong { color: var(--fg); font-weight: 600; }
.man-sec a { color: var(--accent); }
.man-sec code { font-family: var(--mono); font-size: 0.88em; color: var(--fg); background: var(--bg-3); border-radius: 4px; padding: 0 0.3em; }
.man-sec pre { font-family: var(--mono); font-size: 0.86em; line-height: 1.5; color: var(--fg); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.6em 0.9em; margin: 0 0 0.75em; overflow-x: auto; }
.man-sec kbd { font-family: var(--mono); font-size: 0.85em; color: var(--fg); background: var(--bg-3); border-bottom-width: 2px; }
.man-sec table { border-collapse: collapse; margin: 0 0 0.9em; width: 100%; }
.man-sec td, .man-sec th { border-top: 1px solid var(--line); padding: 0.45em 0.7em 0.45em 0; vertical-align: top; color: var(--fg-dim); text-align: left; }
.man-sec th { color: var(--fg); font-weight: 600; padding-top: 1em; }
.man-sec td:first-child { white-space: nowrap; width: 1%; padding-right: 1.1em; }
::highlight(man-hit) { background: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--fg); }
/* A narrow pane: the text only; the search still finds any section. */
@container (max-width: 620px) {
  .man-nav { display: none; }
  .man-body { padding: 0.5em 1em 40vh; }
}

/* A key or password in output or a command: dots until clicked. */
.secret { color: var(--warn); cursor: pointer; border-radius: 3px; background: color-mix(in srgb, var(--warn) 12%, transparent); }
.secret.shown { color: var(--fg); }

/* A command typed inside ssh: a header over its output, like a block's own line. */
/* Marked once Enter is pressed, on a line already on the screen: nothing that changes its height, so nothing moves. */
.l.subcmd { position: relative; font-weight: 600; }
.l.subcmd .sub-acts { position: absolute; right: 0; top: 3px; display: none; gap: 6px; font-weight: 400; }
.l.subcmd:hover .sub-acts { display: flex; }
.l.subcmd .sub-acts .act { height: 20px; padding: 0 9px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 5px; color: var(--fg-dim); font-size: 1em; line-height: 1; }
.l.subcmd .sub-acts .act:hover { color: var(--fg); background: var(--sel); }

/* ── The palette (⌃⇧P) and saving a command ── */
#palette { position: fixed; inset: 0; z-index: 45; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgb(0 0 0 / .35); }
#palette[hidden], #save-cmd[hidden] { display: none; }
#palette .sheet {
  width: min(640px, 92vw); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 60px rgb(0 0 0 / .45);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45;
}
#pal-input { font: inherit; font-size: 15px; color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; outline: none; }
#pal-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
#pal-list li { padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--fg); }
#pal-list li[aria-selected="true"] { background: var(--sel); }
#pal-list li.pal-empty { color: var(--fg-faint); cursor: default; }
.pal-top { display: flex; align-items: center; gap: 10px; }
.pal-name { font-weight: 600; }
.pal-desc { color: var(--fg-dim); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-top .pal-btn { margin-left: auto; }
.pal-top .pal-btn + .pal-btn { margin-left: 0; }
.pal-btn { height: 22px; padding: 0 8px; font: inherit; font-size: 12px; color: var(--fg-dim); background: var(--bg-3); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; visibility: hidden; }
#pal-list li:hover .pal-btn, #pal-list li[aria-selected="true"] .pal-btn { visibility: visible; }
.pal-btn:hover { color: var(--fg); }
.pal-cmd { display: block; margin-top: 2px; font-family: var(--mono); font-size: 12.5px; color: var(--fg-dim); white-space: pre-wrap; word-break: break-all; }
.pal-action { color: var(--fg); display: flex; justify-content: space-between; align-items: center; }
.pal-action kbd { font-size: 12px; color: var(--fg-dim); }
#pal-fill { padding: 12px 16px 4px; display: flex; flex-direction: column; gap: 8px; }
#pal-fill[hidden] { display: none; }
#pal-fields { display: flex; flex-direction: column; gap: 8px; }
#pal-preview { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; word-break: break-all; }
.pal-foot { color: var(--fg-faint); font-size: 12px; padding: 8px 16px; border-top: 1px solid var(--line); }
#save-cmd { position: fixed; inset: 0; z-index: 46; display: grid; place-items: center; background: rgb(0 0 0 / .35); }
#save-cmd .sheet {
  width: min(560px, 92vw); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 60px rgb(0 0 0 / .45);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5;
}
#save-cmd textarea { font-family: var(--mono); font-size: 13px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; outline: none; resize: vertical; min-width: 0; }
#save-cmd textarea:focus { border-color: var(--accent); }
.field.field-top { align-items: start; }
.field.field-top > span { padding-top: 6px; }
.save-hint { margin: -4px 0 0; color: var(--fg-faint); font-size: 12.5px; }
.save-hint code { font-family: var(--mono); }

/* ── Which window: the list on opening the plain address ── */
#windows { position: fixed; inset: 0; z-index: 47; display: grid; place-items: center; background: var(--bg); }
#windows[hidden] { display: none; }
#windows .sheet {
  width: min(620px, 92vw); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 60px rgb(0 0 0 / .45);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45;
}
.win-intro { margin: 12px 22px 4px; color: var(--fg-dim); }
#win-list { list-style: none; margin: 0; padding: 4px 12px; overflow-y: auto; }
#win-list .win { display: flex; align-items: center; gap: 12px; padding: 10px; border-top: 1px solid var(--line); }
#win-list .win:first-child { border-top: 0; }
#win-list .win.shown { opacity: .55; }
.win-main { flex: 1; min-width: 0; }
.win-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-meta { color: var(--fg-dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-acts { display: flex; gap: 6px; flex: none; }
.win-acts .tbtn.danger:hover, .win-acts .tbtn.danger.armed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
#win-list .win-none { color: var(--fg-faint); padding: 10px; }
#win-list .win-ended { border-top: 1px solid var(--line); padding: 8px 10px; }
#win-list .win-ended summary { cursor: pointer; color: var(--fg-dim); display: flex; align-items: center; gap: 10px; }
#win-list .win-ended summary .tbtn { margin-left: auto; }
#win-list .win-ended ul { list-style: none; margin: 6px 0 0; padding: 0; }
#win-list .win-ended .win { padding: 8px 0; }
#win-close[hidden] { display: none; }
#win-list .win-ended summary { list-style: none; }
#win-list .win-ended summary::-webkit-details-marker { display: none; }
#win-list .win-ended summary::before { content: "▸"; color: var(--fg-faint); transition: transform .12s; }
#win-list .win-ended details[open] summary::before { transform: rotate(90deg); }
.task-holder { color: var(--warn); font-size: .85em; padding-left: 16px; }

/* ── Settings → Appearance: the controls, and a pane drawn with them ── */
#set-look:not([hidden]) { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.look-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; }
.look-controls { overflow-y: auto; border-right: 1px solid var(--line); outline: none; }
.look-preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 14px 18px; gap: 8px; background: var(--bg); }
.look-label-top { color: var(--fg-faint); font-size: 12px; }
#look-sample { flex: 1; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: var(--size)/var(--lh) var(--mono); }
#look-sample .term { height: 100%; }
.look-row { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 10px; }
.look-row > .look-name { color: var(--fg-dim); }
.look-ctl { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-width: 0; }
.look-ctl > .check { margin-top: 0; }
.look-note { margin: 0; font-size: 12px; color: var(--fg-faint); }
.look-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit; padding: 7px 10px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 7px; color: var(--fg); cursor: pointer; }
.preset:hover { background: var(--sel); }
.preset b { font-size: 13px; font-weight: 600; }
.preset span { font-size: 11.5px; color: var(--fg-dim); line-height: 1.3; }
.preset[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-3)); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; color: var(--fg-dim); background: var(--bg-2); border: 0; border-left: 1px solid var(--line); padding: 4px 10px; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:disabled { opacity: .45; cursor: default; }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--fg); }
#look-themes { flex: none; list-style: none; margin: 0; padding: 0; max-height: 216px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
#look-themes li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer; }
#look-themes li[aria-selected="true"] { background: var(--sel); }
#look-themes li:hover { background: var(--bg-3); }
.swatch { display: inline-flex; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.swatch span { width: 10px; height: 16px; }
.look-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.look-colors label, .look-ansi label { display: flex; align-items: center; gap: 8px; color: var(--fg-dim); font-size: 13px; }
.look-ansi { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.look-ansi label { flex-direction: column; gap: 2px; font-size: 11px; }
input[type="color"].pick { width: 28px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; }
.look-warn { color: var(--warn); font-size: 12.5px; margin: 0; }
.look-num { width: 64px; height: 28px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.look-text { height: 28px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; min-width: 0; }
/* A slider: a thin track filled with the accent up to the thumb (--at, set as it moves). */
input[type="range"].look-range { -webkit-appearance: none; appearance: none; flex: 1; min-width: 90px; height: 20px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"].look-range:focus { outline: none; }
.look-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--at, 0%), var(--line) var(--at, 0%)); }
.look-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.look-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.look-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); transition: transform .1s; }
.look-range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.look-range:hover::-webkit-slider-thumb, .look-range:active::-webkit-slider-thumb { transform: scale(1.15); }
.look-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.look-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.look-val { color: var(--fg-faint); font-size: 12px; min-width: 3.5em; }
.look-name-top { color: var(--fg-dim); font-size: 12.5px; }

/* A file in the editor (editor.js): oEditor fills the pane; its own styles are its own (.oeditor) */
.editor-pane { flex-direction: column; background: var(--bg); }
.editor-pane > .mdEditorPanel { flex: 1; min-height: 0; }
.editor-note { margin: auto; color: var(--fg-dim); font-family: var(--sans, system-ui); }

/* An OS/A name: its o in OS/A's blue, a little larger than the letters beside it (a monospace o is small beside a capital) */
.o-mark { color: var(--osa); font-size: 1.18em; line-height: 0; font-weight: 500; }
/* Reload, lit: the file changed on disk since it was read */
.editor-pane .md-btn[data-tool="reload"].changed { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 18%, var(--bg-3)); }
.editor-pane .md-btn[data-tool="reload"].changed .material-symbols-outlined { color: var(--warn); }
/* A panel beside the document not built yet (editor.js PANELS): what it will be */
/* The editor's Writing and Reading panels (panels.js), at the document's right */
.side-writing { display: flex; flex-direction: column; min-height: 0; height: 100%; font-family: var(--sans, system-ui); font-size: 13px; color: var(--fg); }
.side-writing [hidden] { display: none !important; }
.sw-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.sw-title { font-weight: 600; }
.sw-subject { color: var(--fg-dim); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.sw-gap { flex: 1; }
.sw-views { display: flex; gap: 4px; }
.side-writing .tbtn.small { gap: 5px; }
.sw-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.sw-empty p { margin: 0 0 12px; color: var(--fg-dim); line-height: 1.5; }
.sw-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.sw-msg { line-height: 1.5; overflow-wrap: anywhere; }
.sw-msg.user { align-self: flex-end; max-width: 88%; padding: 7px 10px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; }
.sw-msg.assistant { display: flex; flex-direction: column; gap: 8px; }
.sw-wait { color: var(--fg-faint); font-style: italic; }
.sw-error { color: var(--bad); font-size: 12.5px; }
.sw-draft { border: 1px solid var(--line); border-left: 3px solid var(--osa); border-radius: 6px; background: var(--bg); }
.sw-draft > .sw-md { padding: 8px 12px; }
.sw-draft > .sw-acts { padding: 6px 8px; border-top: 1px solid var(--line); }
.sw-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.sw-md > :first-child { margin-top: 0; }
.sw-md > :last-child { margin-bottom: 0; }
.sw-md p, .sw-md ul, .sw-md ol, .sw-md blockquote, .sw-md pre { margin: 0 0 8px; }
.sw-md ul, .sw-md ol { padding-left: 20px; }
.sw-md h1, .sw-md h2, .sw-md h3, .sw-md h4 { margin: 10px 0 6px; font-size: 13.5px; }
.sw-md code { font-family: var(--mono); font-size: 12px; background: var(--bg-3); padding: 1px 4px; border-radius: 4px; }
.sw-md pre { padding: 8px; background: var(--bg-3); border-radius: 6px; overflow-x: auto; }
.sw-md pre code { padding: 0; background: none; }
.sw-md blockquote { padding-left: 10px; border-left: 2px solid var(--line); color: var(--fg-dim); }
.sw-md a { color: var(--accent); }
.sw-compose { flex: none; padding: 8px 12px 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.sw-compose textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 56px; max-height: 40vh; padding: 7px 9px;
  background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; font: inherit; line-height: 1.45; outline: none;
}
.sw-compose textarea:focus { border-color: var(--accent); }
.sw-compose-bar { display: flex; align-items: center; gap: 8px; }
.sw-note { flex: 1; min-width: 0; color: var(--fg-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow-y: auto; }
.sw-bar { display: flex; align-items: center; gap: 8px; flex: none; }
.sw-out { line-height: 1.5; overflow-wrap: anywhere; }
.sw-picture svg { max-width: 100%; height: auto; }
.sw-source { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; color: var(--fg-dim); }
.sw-view[data-view="notes"] { overflow: hidden; }
.sw-notes { flex: 1; min-height: 160px; display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.sw-notes > .oeditor { flex: 1; min-width: 0; }

/* Find in a terminal pane (find.js): a bar at its top right, the matches marked over the text */
.pane-find {
  position: absolute; top: 6px; right: calc(var(--pane-pad, 12px) + 6px); z-index: 20; display: flex; align-items: center; gap: 4px;
  padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .3);
}
.pane-find[hidden] { display: none; }
.pane-find input {
  width: 200px; height: 26px; padding: 0 8px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-family: var(--mono); font-size: 12.5px; outline: none;
}
.pane-find input:focus { border-color: var(--accent); }
.pane-find-count { min-width: 64px; color: var(--fg-faint); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.pane-find .tbtn.icon { width: 26px; padding: 0; justify-content: center; }
.pane-find-opt { font-family: var(--mono); font-size: 12px; }
::highlight(pane-find) { background-color: color-mix(in srgb, var(--warn) 35%, transparent); }
::highlight(pane-find-current) { background-color: color-mix(in srgb, var(--warn) 75%, transparent); color: var(--bg); }
.sw-notes .pageFooter { display: none; }
.sw-picture svg { cursor: zoom-in; }
.sw-full {
  position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg); cursor: zoom-out; outline: none;
}
.sw-full svg { width: 100%; height: 100%; max-width: none !important; }

/* The one dropdown (dropdown.js). A split button: one box in two parts, a divider between the action and its
   chevron (as ＋ Tab ▾ and the editor's toolbar). A choice: a button showing it, with the chevron. */
.splitbtn { display: inline-flex; flex: none; }
.splitbtn .sb-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.splitbtn .sb-caret { width: 24px; padding: 0; justify-content: center; margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.splitbtn .tbtn:active:not(:disabled) { transform: none; }
.splitbtn .sb-caret svg.i, .dd-select svg.i { width: 12px; height: 12px; fill: none; stroke: var(--fg-dim); stroke-width: 1.4; flex: none; }
.splitbtn .sb-caret[aria-expanded="true"], .dd-select[aria-expanded="true"] { background: var(--sel); }
.dd-select {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: 30px; padding: 0 9px 0 10px;
  min-width: 0; width: auto; background: var(--bg-3); border: 1px solid var(--line); border-radius: 7px;
  color: var(--fg); font: inherit; text-align: left; cursor: pointer;
}
.dd-select:hover:not(:disabled) { background: var(--sel); }
.dd-select:disabled { opacity: .45; cursor: default; }
.dd-select .dd-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-select + .dd-select { width: 100%; }
.dd-list { z-index: 1000; max-height: min(60vh, 420px); overflow-y: auto; font-size: 13px; }
.dd-list > * { flex: none; }
.dd-list .mi { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-list button:focus { background: var(--sel); outline: none; }
.dd-list svg.check { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; }
.dd-head { margin: 6px 8px 2px; color: var(--fg-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.dd-menu { min-width: 200px; }
.dd-menu hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--line); }
.dd-menu button:disabled { opacity: .45; cursor: default; }
.dd-menu button:disabled:hover { background: none; }
.dd-key { color: var(--fg-faint); font-size: 12px; }

/* ── Locked: this browser does not have oTerminal's key yet (public/key.js) ── */
/* A browser asking to be let in: Allow or Deny, at the top of every window open */
.letin-card { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 90; max-width: min(520px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; background: var(--bg-2); border: 1px solid color-mix(in srgb, var(--warn) 60%, var(--line)); border-radius: 9px; box-shadow: 0 12px 36px rgb(0 0 0 / .45); color: var(--fg); font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.45; }
.letin-text { display: flex; flex-direction: column; gap: 3px; }
.letin-text span { color: var(--fg-dim); }
.letin-card .task-acts { padding-left: 0; justify-content: flex-end; }
.locked .letin-status { color: var(--fg); min-height: 1.4em; }
.locked { grid-row: 1 / -1; align-self: center; justify-self: center; max-width: 34em; padding: 0 16px; }
.locked h1 { font-size: 1.25em; font-weight: 600; margin: 0 0 .8em; }
.locked .o { color: var(--osa); }
.locked p { color: var(--fg-dim); margin: 0 0 1.2em; }
.locked code { color: var(--fg); }
.locked form { display: flex; gap: 8px; }
.locked input { flex: 1; min-width: 0; height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); font: inherit; }
.locked input:focus { outline: none; border-color: var(--accent); }
.locked .why { color: var(--bad); margin-top: 1em; min-height: 1.4em; }

/* ── A runbook (public/runbook.js): the whole of it over the page, then docked beside its pane while it runs ── */
#runbook { position: fixed; inset: 0; z-index: 48; overflow-y: auto; background: var(--bg); }
#runbook[hidden] { display: none; }
#runbook .rb-sheet { max-width: 860px; margin: 0 auto; padding: 22px 24px 60px; }
#runbook .rb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: sticky; top: 0; padding: 10px 0; background: var(--bg); z-index: 1; }
#runbook .rb-head .spacer { flex: 1; }
#runbook .rb-acts { display: contents; }
#runbook .rb-kind { color: var(--fg-dim); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
#runbook h1 { margin: 6px 0 4px; font-size: 26px; font-weight: 650; }
#runbook .rb-facts { margin: 0 0 10px; color: var(--fg-dim); }
#runbook .rb-facts a { color: var(--accent); }
#runbook .rb-desc { margin: 0 0 14px; font-size: 15px; }
#runbook .rb-trust { margin: 0 0 14px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--warn) 8%, var(--bg-2)); }
#runbook .rb-error, #runbook .rb-note.bad { padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--bad) 50%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--bad) 8%, var(--bg-2)); }
#runbook .rb-note.ok { color: var(--ok); }
#runbook .rb-note { margin: 0 0 12px; }
#runbook .rb-changed { margin: 0 0 14px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--accent) 8%, var(--bg-2)); }
#runbook .rb-change { font-size: 11px; font-weight: 500; color: var(--accent); }
#runbook .rb-steps .rb-change { order: 1; }
#runbook .rb-loading { color: var(--fg-dim); }
#runbook .rb-steps { margin: 0 0 18px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); }
#runbook .rb-steps li { display: flex; gap: 10px; align-items: baseline; padding: 7px 12px; counter-increment: rb; }
#runbook .rb-steps li + li { border-top: 1px solid var(--line); }
#runbook .rb-steps .rb-title { flex: 1; }
#runbook .rb-steps .rb-state { order: 2; color: var(--fg-dim); font-size: 12px; }
#runbook [data-state="running"] > .rb-state, #runbook [data-state="running"] h2 .rb-state { color: var(--accent); }
#runbook [data-state="done"] > .rb-state, #runbook [data-state="done"] h2 .rb-state { color: var(--ok); }
#runbook [data-state="failed"] > .rb-state, #runbook [data-state="failed"] h2 .rb-state { color: var(--bad); }
#runbook .rb-steps [data-state="running"] { background: color-mix(in srgb, var(--accent) 10%, var(--bg-2)); }
#runbook .rb-section h2 { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 8px; font-size: 18px; font-weight: 650; }
#runbook .rb-section h2 .rb-state { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--fg-dim); }
#runbook .rb-num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--line); font-size: 12px; color: var(--fg-dim); }
#runbook .rb-body { line-height: 1.55; font-size: 14px; }
#runbook .rb-body a { color: var(--accent); }
#runbook .rb-body code { font-family: var(--mono); font-size: .92em; }
#runbook .rb-body pre { margin: 0 0 12px; padding: 10px 12px; overflow-x: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; }
#runbook .rb-body pre.rb-other { opacity: .5; }
#runbook .rb-where { margin: 10px 0 4px; font-size: 12px; color: var(--fg-dim); }
#runbook .rb-where.here { color: var(--ok); }
#runbook .rb-body table { border-collapse: collapse; }
#runbook .rb-body th, #runbook .rb-body td { padding: 4px 10px; border: 1px solid var(--line); }
#runbook .rb-only-docked, #runbook.docked .rb-only-full, #runbook:not(.ran) .rb-when-ran { display: none; }
#runbook.docked .rb-only-docked { display: inline-flex; }
/* Docked: the steps and their buttons, beside the pane running them. */
#runbook.docked { inset: calc(var(--bar-h) + var(--head-h) + 1px) 0 calc(var(--foot-h) + 1px) auto; width: min(360px, 90vw); z-index: 21; border-left: 1px solid var(--line); background: var(--bg-2); }
/* The panes make room, as for the side panel. */
body.rb-docked #work { margin-right: min(360px, 90vw); }
/* With the side panel open too: docked beside it, and the panes make room for both. */
body.side-open #runbook.docked { right: min(var(--side-w, 440px), 80vw); }
body.side-open.rb-docked #work { margin-right: calc(min(var(--side-w, 440px), 80vw) + min(360px, 90vw)); }
#runbook.docked .rb-sheet { padding: 4px 14px 20px; }
#runbook.docked .rb-head { background: var(--bg-2); }
#runbook.docked .rb-head .tbtn span { display: none; }
#runbook.docked h1 { font-size: 17px; }
#runbook.docked .rb-desc, #runbook.docked .rb-trust, #runbook.docked .rb-body, #runbook.docked .rb-facts { display: none; }
@media (max-width: 600px) { #runbook .rb-sheet { padding: 12px 16px 40px; } }

/* A plugin's side panel (app.js drawPluginPanel) */
#plugin-btns { display: contents; }
.ppanel-at { color: var(--fg-faint); font-size: .85em; margin-left: 8px; }
#ppanel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 14px; }
.ppanel-sec { padding: 0 0 6px; }
.ppanel-sec h4 { position: sticky; top: -4px; z-index: 1; margin: 6px -14px 10px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--fg); background: var(--bg-3); border-block: 1px solid var(--line); }
.ppanel-rows { margin: 0; }
.ppanel-row { margin: 0 0 10px; }
.ppanel-top { display: flex; align-items: baseline; gap: 10px; }
.ppanel-top dt { flex: 1; min-width: 0; color: var(--fg); }
.ppanel-value { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--fg); }
.ppanel-rnote { margin: 2px 0 0; color: var(--fg-faint); font-size: .85em; overflow-wrap: anywhere; }
.ppanel-meter { height: 6px; margin-top: 5px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.ppanel-meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ppanel-meter.mid > span { background: var(--warn); }
.ppanel-meter.high > span { background: var(--bad); }
.ppanel-note { margin: 0 0 10px; color: var(--fg-dim); font-size: .9em; }
.ppanel-meter.quiet > span { background: var(--fg-faint); }
.ppanel-loading { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--fg-dim); font-size: .9em; }
.spinner { width: 12px; height: 12px; flex: none; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: turn .8s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
#ppanel-refresh.turning .ti { animation: turn .8s linear infinite; }
#ppanel-refresh.turning { opacity: 1; cursor: default; }
.ppanel-who { color: var(--fg-dim); margin-bottom: 3px; overflow-wrap: anywhere; }
#ppanel-tabs[hidden] { display: none; }
/* A row's buttons (a session's Open, Stop, Delete), and the tab's own above its sections (New session) */
.ppanel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.ppanel-actions.top { margin: 6px 0 4px; }
.ppanel-actions .tbtn { gap: 5px; }
.ppanel-actions .tbtn.danger:hover, .ppanel-actions .tbtn.danger.armed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.ppanel-row.current { border-left: 2px solid var(--accent); padding-left: 8px; margin-left: -10px; }
.ppanel-row.current .ppanel-value { color: var(--accent); font-family: inherit; }

/* ── Machines (app.js drawMachines) ── */
#mlist { list-style: none; margin: 0; padding: 0 10px; overflow-y: auto; overflow-x: hidden; flex: 1; }
#mlist li { padding: 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
#mlist li:first-child { border-top: 0; }
#mlist li.empty { color: var(--fg-faint); border: 0; font-family: system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; }
.m-here { margin: 0 10px 8px; padding: 0 4px 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.m-row { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.m-name { font-weight: 600; }
.m-dim { color: var(--fg-dim); font-size: .9em; }
.m-code { font-size: 1.3em; font-weight: 600; letter-spacing: .08em; color: var(--accent); }
.m-note { font-size: .9em; color: var(--fg-dim); }
.m-note.bad { color: var(--bad); }
.m-note.warn { color: var(--warn); line-height: 1.45; user-select: text; }
.m-code-input { width: 7em; height: 26px; box-sizing: border-box; padding: 0 8px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 7px; font: inherit; letter-spacing: .08em; }
.m-code-input:focus { outline: none; border-color: var(--accent); }
