:root {
  --ground: #EDF0F1; --sheet: #FFFFFF; --surface: #F7F9F9;
  --ink: #1B2126; --ink-soft: #56616A; --ink-faint: #86909A; --rule: #D6DCE0;
  --accent: #5F8A1B; --accent-strong: #4A6F12; --accent-ink: #FFFFFF; --accent-wash: #EAF1DE;
  --pencil: #2F7FA6; --pencil-wash: #E2EFF6;
  --ok: #2E7D4F; --ok-wash: #E2F2E8; --no: #B3402B; --no-wash: #F8E4DF; --inc: #946812; --inc-wash: #F6EDD6;
  --code-bg: #F1F4F5;
  --shadow: 0 1px 2px rgba(27,33,38,.06), 0 14px 34px -20px rgba(27,33,38,.32);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #111518; --sheet: #1A2024; --surface: #161B1F;
    --ink: #E5EAEE; --ink-soft: #A4AEB6; --ink-faint: #76818A; --rule: #2A3237;
    --accent: #A6CE39; --accent-strong: #A6CE39; --accent-ink: #141A0A; --accent-wash: #222B16;
    --pencil: #71B8DA; --pencil-wash: #15303D;
    --ok: #6CC990; --ok-wash: #173024; --no: #EE8A73; --no-wash: #3A1D17; --inc: #E2B455; --inc-wash: #33290F;
    --code-bg: #14191C;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 34px -20px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
  --ground: #111518; --sheet: #1A2024; --surface: #161B1F;
  --ink: #E5EAEE; --ink-soft: #A4AEB6; --ink-faint: #76818A; --rule: #2A3237;
  --accent: #A6CE39; --accent-strong: #A6CE39; --accent-ink: #141A0A; --accent-wash: #222B16;
  --pencil: #71B8DA; --pencil-wash: #15303D;
  --ok: #6CC990; --ok-wash: #173024; --no: #EE8A73; --no-wash: #3A1D17; --inc: #E2B455; --inc-wash: #33290F;
  --code-bg: #14191C;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 34px -20px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.55 "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 clamp(16px, 3vw, 32px); padding-block: 22px 104px;
}
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 500 .78em "IBM Plex Mono", ui-monospace, monospace; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: var(--sheet); }

/* ── head ── */
.head { max-width: 1360px; margin: 0 auto 16px; display: flex; flex-direction: column; gap: 6px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.name { font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 1.95rem; line-height: 1.1; letter-spacing: -.01em; margin: 0; }
.name i { color: var(--accent); }
.chip { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--pencil); border: 1.5px solid var(--pencil); border-radius: 3px; padding: 2px 7px; transform: rotate(-3deg); }
.tour-btn { margin-left: auto; }
.lede { margin: 0; color: var(--ink-soft); max-width: 78ch; }
.lede b { color: var(--ink); font-weight: 600; }

/* ── buttons ── */
.ghost { background: transparent; border: 1px solid var(--rule); border-radius: 4px; padding: 5px 11px; cursor: pointer; font-size: .82rem; color: var(--ink); }
.ghost:hover { border-color: var(--ink-faint); }
.ghost.danger { color: var(--no); }
.primary { background: var(--accent-strong); color: var(--accent-ink); border: 1px solid var(--accent-strong); border-radius: 4px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: .86rem; }
.get-btn { text-decoration: none; display: inline-block; }
.linkish { background: transparent; border: 0; padding: 5px 4px; cursor: pointer; font-size: .8rem; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }
.linkish:hover { color: var(--ink); }
.mini { font: 500 .74rem "IBM Plex Sans", ui-sans-serif, sans-serif; background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 2px 8px; cursor: pointer; color: var(--ink-soft); }
.mini:hover { border-color: var(--accent); color: var(--ink); }
.mini.rm:hover { border-color: var(--no); color: var(--no); }
.mini.seg[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); }

/* blue-pencil review marks */
.pm { display: inline-grid; place-items: center; flex: none; width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--pencil); color: var(--pencil); background: transparent; font: 600 .66rem/1 "IBM Plex Mono", ui-monospace, monospace; transform: rotate(-6deg); cursor: pointer; padding: 0; }
.pm:hover { background: var(--pencil-wash); }
.pm.done { background: var(--pencil); color: var(--sheet); }
.ping { box-shadow: 0 0 0 4px var(--pencil-wash), 0 0 0 5px var(--pencil) !important; transition: box-shadow .2s; }

/* ── workspace ── (bundled build: no review sheet, single column) */
.work { max-width: 1000px; margin: 0 auto; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (max-width: 1080px) { .work { grid-template-columns: minmax(0, 1fr); } }
.app { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow); min-width: 0; }

.docbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; padding: 12px 14px 10px; border-bottom: 1px solid var(--rule); background: var(--sheet); border-radius: 6px 6px 0 0; }
.fld { display: flex; flex-direction: column; gap: 3px; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.fld select { text-transform: none; letter-spacing: 0; font-size: .86rem; font-weight: 500; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 5px 8px; min-width: 190px; max-width: 100%; }
.type-note { font-size: .78rem; color: var(--ink-soft); padding-bottom: 6px; }
.type-note.proposal { color: var(--pencil); }
.outline-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; background: var(--pencil-wash); border-bottom: 1px solid var(--rule); }
.outline-ask p { margin: 0; flex: 1 1 320px; font-size: .86rem; }
.ask-btns { display: flex; gap: 6px; }

.appbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 14px; border-bottom: 1px solid var(--rule); }
.crumb { display: flex; align-items: baseline; gap: 6px; font-size: .86rem; color: var(--ink-soft); margin-right: auto; }
.crumb b { color: var(--ink); font-weight: 600; }
.save, .rebuild { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--ink-soft); }
.save .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.save.busy .dot { background: var(--ink-faint); }
.save.warn .dot { background: var(--inc); }
.rebuild { color: var(--ink-faint); }
.rebuild::before { content: "↻"; font-size: .9rem; line-height: 1; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 12px; border-bottom: 1px solid var(--rule); background: var(--surface); position: sticky; top: 0; z-index: 6; }
.grp { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.grp + .grp { padding-left: 8px; border-left: 1px solid var(--rule); }
.tool { display: inline-flex; align-items: center; gap: 6px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 5px 9px; cursor: pointer; font-size: .82rem; color: var(--ink); }
.tool svg { width: 16px; height: 16px; flex: none; }
.tool:hover { border-color: var(--accent); }
.tool:active { background: var(--accent-wash); }
.tool-ai { border-color: var(--accent); }
.slash-hint { font-size: .76rem; color: var(--ink-soft); padding: 0 2px 0 6px; }

.beside { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 7px 14px; border-bottom: 1px solid var(--rule); }
.beside-l { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-right: 4px; }
.seg-btn { background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 3px 11px; font-size: .8rem; cursor: pointer; color: var(--ink-soft); }
.seg-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.seg-btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); font-weight: 500; }

.panes { display: grid; grid-template-columns: minmax(0, 1fr); }
.panes.split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
@media (max-width: 820px) { .panes.split { grid-template-columns: minmax(0, 1fr); } }

/* ── the page ── */
.sheet-wrap { padding: 22px clamp(10px, 3vw, 30px) 34px; background: var(--ground); min-width: 0; }
.sheet { background: var(--sheet); color: var(--ink); max-width: 760px; margin: 0 auto; padding: clamp(20px, 4vw, 46px) clamp(18px, 5vw, 56px); border: 1px solid var(--rule); border-radius: 2px; font-family: Newsreader, Georgia, serif; font-size: 1.1rem; line-height: 1.62; outline: none; min-height: 420px; }
.sheet:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sheet > * { max-width: 66ch; }
.sheet h1 { font-weight: 500; font-size: 1.9rem; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .6rem; text-wrap: balance; }
.sheet h2 { font-weight: 600; font-size: 1.25rem; line-height: 1.25; margin: 1.5rem 0 .3rem; text-wrap: balance; }
.sheet h3 { font-weight: 600; font-size: 1.05rem; margin: 1.1rem 0 .25rem; }
.sheet p { margin: 0 0 .7rem; }
.sheet ul, .sheet ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.sheet b, .sheet strong { font-weight: 600; }
.sheet p.is-empty[data-guide]::before { content: attr(data-guide); color: var(--ink-faint); font-style: italic; pointer-events: none; }
.cite { font-family: "IBM Plex Sans", ui-sans-serif, sans-serif; font-size: .8em; background: var(--accent-wash); color: var(--accent-strong); border-radius: 3px; padding: 1px 6px; white-space: nowrap; }
/* The pending-cite marker must be unmistakably NOT done: loud, dashed, red. */
.cite.pending { background: var(--no-wash); color: var(--no); outline: 1px dashed var(--no); font-weight: 600; }
.ieq { font-style: italic; }
.eq-empty { font-style: normal; color: var(--ink-faint); }

figure.blk { margin: 1.1rem 0 1.3rem; max-width: 100%; }
figcaption { font-family: "IBM Plex Sans", ui-sans-serif, sans-serif; font-size: .82rem; color: var(--ink-soft); margin-top: .45rem; line-height: 1.45; }
.tbl figcaption { margin: 0 0 .45rem; }
figcaption .lbl { font-weight: 600; color: var(--ink); }
figcaption .cap { outline: none; border-bottom: 1px dashed transparent; }
figcaption .cap:hover { border-bottom-color: var(--rule); }
figcaption .cap:focus { border-bottom-color: var(--accent); }
figcaption .cap:empty::before { content: "Type a caption"; color: var(--ink-faint); font-style: italic; }
.as-card code, .side-foot code { font: 500 .74rem "IBM Plex Mono", ui-monospace, monospace; }
.blk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-family: "IBM Plex Sans", ui-sans-serif, sans-serif; }
.seg-l { font-size: .74rem; color: var(--ink-soft); margin-right: 2px; }
.blk-tools .rm { margin-left: 10px; }

/* tables: Astrolaby pattern, a delete icon on every row and column, add on the last */
.tbl-scroll { overflow-x: auto; }
.tbl table { border-collapse: collapse; font-family: "IBM Plex Sans", ui-sans-serif, sans-serif; font-size: .88rem; font-variant-numeric: tabular-nums; outline: none; }
.tbl th, .tbl td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; min-width: 76px; height: 2.3em; vertical-align: top; }
.tbl thead th { background: var(--code-bg); font-weight: 600; }
.tbl td.ctl { border: 0; padding: 2px 4px; min-width: 0; height: auto; white-space: nowrap; vertical-align: middle; background: transparent; }
.tbl tr.ctl-row td.ctl { text-align: center; padding-bottom: 3px; }
.ico { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-faint); cursor: pointer; vertical-align: middle; }
.ico svg { width: 15px; height: 15px; }
.ico:hover { color: var(--no); background: var(--no-wash); }
.ico.add { color: var(--accent); }
.ico.add:hover { color: var(--accent-strong); background: var(--accent-wash); }

/* figures: 1 to 3 panels */
.panels { display: grid; gap: 10px; }
.panels.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panels.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .panels.n2, .panels.n3 { grid-template-columns: minmax(0, 1fr); } }
.panel { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.panel .sub { font: 500 .78rem "IBM Plex Sans", ui-sans-serif, sans-serif; color: var(--ink-soft); }
.drop { width: 100%; border: 1.5px dashed var(--rule); border-radius: 4px; background: var(--code-bg); display: grid; place-items: center; text-align: center; cursor: pointer; min-height: 140px; padding: 10px; color: var(--ink-soft); font: 500 .8rem "IBM Plex Sans", ui-sans-serif, sans-serif; }
.drop.filled { border-color: transparent; background: transparent; min-height: 0; padding: 4px; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.over { background: var(--accent-wash); }
.drop img { max-width: 100%; max-height: 360px; display: block; border-radius: 2px; }
.drop svg { width: 100%; height: auto; display: block; }
.plan .wall { fill: none; stroke: var(--ink-soft); stroke-width: 2.2; }
.plan .room, .chart .room { fill: var(--ink-soft); font: 500 10.5px "IBM Plex Sans", sans-serif; text-anchor: middle; }
.plan .sensor { fill: var(--accent); stroke: var(--sheet); stroke-width: 2; }
.chart .bar { fill: var(--accent); }
.chart .val { fill: var(--ink); font: 600 10.5px "IBM Plex Sans", sans-serif; text-anchor: middle; }
.chart .axis { stroke: var(--rule); stroke-width: 1.5; }

.eq { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin: .8rem 0 1rem; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.eq:hover { background: var(--code-bg); }
.eq-body { text-align: center; font-style: italic; font-size: 1.12rem; }
.eq-body .op, .eq-preview .op { font-style: normal; padding: 0 .12em; }
.eq-no { font-family: "IBM Plex Sans", ui-sans-serif, sans-serif; font-size: .85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ── beside the page ── */
.side { border-left: 1px solid var(--rule); background: var(--sheet); min-width: 0; display: flex; flex-direction: column; }
@media (max-width: 820px) { .side { border-left: 0; border-top: 1px solid var(--rule); } }
.side-sec { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.side-head { padding: 12px 16px 8px; }
.side-head h2 { margin: 0; font: 600 .95rem "IBM Plex Mono", ui-monospace, monospace; }
.side-head p { margin: 3px 0 0; font-size: .8rem; color: var(--ink-soft); }
.tabs { display: flex; gap: 4px; padding: 2px 12px 0; flex-wrap: wrap; }
.tab { font: 500 .74rem "IBM Plex Mono", ui-monospace, monospace; cursor: pointer; background: transparent; border: 1px solid var(--rule); border-bottom: 0; border-radius: 4px 4px 0 0; padding: 4px 9px; color: var(--ink-soft); }
.tab[aria-selected="true"] { background: var(--code-bg); color: var(--ink); }
#txtEdit, .side pre { margin: 0; width: 100%; border: 0; border-top: 1px solid var(--rule); border-radius: 0; padding: 14px 16px; background: var(--code-bg); color: var(--ink); font: 400 .8rem/1.65 "IBM Plex Mono", ui-monospace, monospace; resize: vertical; min-height: 520px; flex: 1; }
.side pre { white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; max-height: 760px; }
#txtEdit:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-foot { margin: 0; padding: 8px 16px 12px; font-size: .76rem; color: var(--ink-soft); }
.side-foot.warn { color: var(--inc); }

/* assistant */
.as-head { padding: 12px 16px 6px; display: flex; flex-direction: column; gap: 3px; }
.as-head h2 { margin: 0; font-size: .98rem; font-weight: 600; }
.as-head p { margin: 0; font-size: .78rem; color: var(--ink-soft); }
.as-where { font-size: .8rem !important; color: var(--ink) !important; }
.as-where b { font-weight: 600; }
.as-body { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 10px; overflow: auto; max-height: 820px; }
.as-card { border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; background: var(--sheet); }
.as-card h3 { margin: 0; font-size: .86rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.as-card p { margin: 0; font-size: .8rem; color: var(--ink-soft); }
.as-card ul { margin: 0; padding-left: 1.1rem; font-size: .8rem; }
.as-card.ready { border-color: var(--accent); }
.as-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kw { font: 500 .74rem "IBM Plex Mono", ui-monospace, monospace; background: var(--accent-wash); color: var(--accent-strong); border-radius: 3px; padding: 1px 6px; }
.check { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 3px; }
.check li::before { display: inline-block; width: 1.2em; font-weight: 600; }
.check li.yes::before { content: "✓"; color: var(--ok); }
.check li.no::before { content: "–"; color: var(--inc); }
.as-ask { display: flex; gap: 6px; }
.as-ask input { flex: 1; min-width: 0; border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; background: var(--sheet); font-size: .84rem; }
.as-reply { font-size: .8rem; border-left: 2px solid var(--accent); padding: 2px 0 2px 8px; }
.proposal-box { background: var(--code-bg); border-radius: 4px; padding: 8px 10px; font-size: .8rem; }
.proposal-box ol { margin: 0; padding-left: 1.2rem; }

/* screening badges */
.badge { font: 600 .66rem "IBM Plex Sans", ui-sans-serif, sans-serif; letter-spacing: .04em; text-transform: uppercase; border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
.badge.Include { background: var(--ok-wash); color: var(--ok); }
.badge.Maybe { background: var(--inc-wash); color: var(--inc); }
.badge.Exclude { background: var(--no-wash); color: var(--no); }
.badge.grade { background: var(--pencil-wash); color: var(--pencil); }

/* ── pop-ups ── */
.pop { position: absolute; z-index: 20; width: min(380px, calc(100% - 24px)); background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pop-wide { width: min(470px, calc(100% - 24px)); }
.pop label { font-size: .8rem; font-weight: 600; }
.pop input { width: 100%; border: 1px solid var(--rule); border-radius: 4px; padding: 7px 9px; background: var(--sheet); }
.pop input.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .86rem; }
.eq-preview { min-height: 46px; display: grid; place-items: center; border-radius: 4px; background: var(--code-bg); font-family: Newsreader, Georgia, serif; font-style: italic; font-size: 1.2rem; padding: 6px; text-align: center; }
.pop-hint { margin: 0; font-size: .74rem; color: var(--ink-faint); }
.pop-btns { display: flex; justify-content: flex-end; gap: 6px; }
#eqRemove { margin-right: auto; }
.helper { border-top: 1px dashed var(--rule); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sugg { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow: auto; }
.sugg button, .ref { width: 100%; text-align: left; background: transparent; border: 0; border-radius: 4px; padding: 6px 8px; cursor: pointer; display: grid; gap: 1px; }
.sugg button:hover, .sugg button:focus-visible, .ref:hover, .ref:focus-visible { background: var(--accent-wash); }
.sugg .n { font-size: .8rem; font-weight: 600; }
.sugg .f { font-family: Newsreader, Georgia, serif; font-style: italic; font-size: .95rem; }
.refs { max-height: 330px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.refs h4 { margin: 8px 0 2px; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.refs h4:first-child { margin-top: 0; }
.ref .t { font-size: .84rem; line-height: 1.35; }
.ref .m { font-size: .72rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.refs .none { font-size: .8rem; color: var(--ink-soft); margin: 4px 0; }

/* quick harvest (inside the cite pop-up) */
.qh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.qh-btn { border-color: var(--accent); font-weight: 500; }
.qh { border: 1px solid var(--rule); border-radius: 6px; padding: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 7px; max-height: 380px; overflow: auto; }
.qh h4 { margin: 0; font-size: .82rem; font-weight: 600; }
.qh p { margin: 0; font-size: .76rem; color: var(--ink-soft); }
.qh .dbs { font-size: .74rem; color: var(--ink-soft); line-height: 1.5; }
.qh .dbs b { color: var(--ink); font-weight: 600; }
.qh .skip { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--rule); }
.qh ol { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 6px; }
.qh li { font-size: .8rem; }
.qh .qt { display: block; line-height: 1.35; }
.qh .qm { display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; font-size: .7rem; color: var(--ink-faint); }
.qh .qa { display: flex; gap: 6px; margin-top: 3px; }
.qh .busy::after { content: " …"; animation: none; }

.slash { position: absolute; z-index: 25; width: 250px; max-height: 300px; overflow: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow); padding: 4px; }
.slash button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 4px; padding: 6px 8px; cursor: pointer; font-size: .84rem; }
.slash button[aria-selected="true"] { background: var(--accent-wash); }
.slash .none { font-size: .8rem; color: var(--ink-soft); padding: 6px 8px; margin: 0; }

/* ── guided demo ── */
.tour { position: absolute; z-index: 40; width: min(340px, calc(100vw - 32px)); background: var(--sheet); border: 2px solid var(--pencil); border-radius: 8px; box-shadow: var(--shadow); padding: 14px 16px; }
.tour-step { margin: 0; font: 600 .7rem "IBM Plex Mono", ui-monospace, monospace; color: var(--pencil); letter-spacing: .06em; }
.tour h2 { margin: 2px 0 4px; font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 1.2rem; }
.tour p { margin: 0; font-size: .86rem; color: var(--ink-soft); }
.tour-btns { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }

/* ── review sheet ── */
.review { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (min-width: 1081px) { .review { position: sticky; top: 12px; max-height: calc(100vh - 112px); overflow: auto; padding: 0 4px 4px 0; } }
.rev-head { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.rev-head h2 { margin: 0; font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 1.4rem; line-height: 1.2; }
.rev-head p { margin: 0; font-size: .82rem; color: var(--ink-soft); }
.field-l { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }
.rev-head input, .idea textarea, .card textarea { width: 100%; border: 1px solid var(--rule); border-radius: 4px; padding: 7px 9px; background: var(--sheet); }
.store { display: flex; align-items: flex-start; gap: 7px; font-size: .78rem !important; }
.store::before { content: ""; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--accent); }
.store.warn::before { background: var(--inc); }
.changes { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 14px; }
.changes summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.changes ol { margin: 8px 0 2px; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; font-size: .8rem; }
.changes .was { color: var(--ink-faint); display: block; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--rule); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card.v-ok { border-left-color: var(--ok); }
.card.v-no { border-left-color: var(--no); }
.card.v-inc { border-left-color: var(--inc); }
.card.flash { box-shadow: 0 0 0 2px var(--pencil); }
.card.over { background: var(--pencil-wash); }
.card-h { display: flex; align-items: center; gap: 9px; }
.card-h h3 { margin: 0; font-size: .95rem; font-weight: 600; }
.try { margin: 0; font-size: .84rem; color: var(--ink-soft); }
.hint { margin: 0; font-size: .76rem; color: var(--pencil); }
.verdict { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.v { border: 1px solid var(--rule); background: var(--sheet); border-radius: 4px; padding: 5px 4px; cursor: pointer; font-size: .8rem; font-weight: 500; }
.v:hover { border-color: var(--ink-faint); }
.v.ok[aria-pressed="true"] { background: var(--ok-wash); border-color: var(--ok); color: var(--ok); }
.v.no[aria-pressed="true"] { background: var(--no-wash); border-color: var(--no); color: var(--no); }
.v.inc[aria-pressed="true"] { background: var(--inc-wash); border-color: var(--inc); color: var(--inc); }
.card textarea { resize: vertical; min-height: 44px; font-size: .86rem; }
.att { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.attach { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 0; color: var(--pencil); font-size: .8rem; font-weight: 500; cursor: pointer; padding: 2px 0; }
.attach:disabled { color: var(--ink-faint); cursor: default; }
.attach svg { width: 14px; height: 14px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; }
.thumb img { width: 46px; height: 46px; object-fit: cover; border-radius: 3px; border: 1px solid var(--rule); display: block; }
.thumb button { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--rule); background: var(--sheet); font-size: .72rem; line-height: 1; cursor: pointer; padding: 0; }
.idea { background: var(--sheet); border: 1.5px dashed var(--pencil); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.idea label { font-size: .95rem; font-weight: 600; }
.idea p { margin: 0; font-size: .8rem; color: var(--ink-soft); }
.idea textarea { resize: vertical; font-size: .86rem; }

.finbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--sheet); border-top: 2px solid var(--pencil); padding: 10px clamp(16px, 3vw, 32px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.counts { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .84rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.counts b { font-weight: 600; }
.counts .c-ok b { color: var(--ok); }
.counts .c-no b { color: var(--no); }
.counts .c-inc b { color: var(--inc); }
dialog { border: 1px solid var(--rule); border-radius: 8px; padding: 18px; width: min(720px, calc(100vw - 32px)); background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 14, 17, .55); }
dialog h2 { margin: 0 0 4px; font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 1.4rem; }
dialog p { margin: 0 0 10px; font-size: .86rem; color: var(--ink-soft); }
dialog textarea { width: 100%; height: min(340px, 50vh); border: 1px solid var(--rule); border-radius: 4px; background: var(--code-bg); padding: 12px; font: .8rem/1.55 "IBM Plex Mono", ui-monospace, monospace; resize: vertical; }
.dlg-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 10px; }
