/* Self-hosted fonts (SIL Open Font License, see fonts/OFL-*): no request leaves the firm's network.
   Both files are variable fonts; the UI uses weights 400, 500 and 600 only. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/source-serif-4-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/source-serif-4-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Tokens (contrast computed in the redesign brief, 2026-10-26). --border is for decorative hairlines only;
   --control (>= 3:1) outlines inputs. One accent; brand navy fills the primary button and the wordmark only. */
:root {
  --bg: #F5F5F2; --surface: #FCFCFA; --surface-2: #EEEEEA; --selected: #E8ECF3;
  --text: #15181E; --text-2: #3D434D; --muted: #636975;
  --border: #E2E1DB; --control: #8D8A80;
  --brand: #14213D; --on-brand: #FCFCFA;
  --accent: #A34A16; --accent-soft: #F7E9DE;
  --ok: #2A6B50; --ok-soft: #E3EFE8; --warn: #7D560D; --warn-soft: #F6ECD5; --bad: #A13631; --bad-soft: #F7E3E1;
  --focus: #2F5FA7;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --overlay-shadow: 0 8px 24px rgba(21, 24, 30, .14), 0 1px 3px rgba(21, 24, 30, .08);
  --ease: cubic-bezier(.2, .7, .3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mark { fill: var(--brand); stroke: none; }
.mark .mark-a { fill: var(--accent); }
.i { width: 14px; height: 14px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { display: block; font-size: 12px; line-height: 16px; color: var(--muted); overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack-only { display: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: fixed; left: 8px; top: 8px; z-index: 30; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-weight: 600; transform: translateY(-200%); }
.skip:focus { transform: none; }

/* ---------- controls ---------- */
input, select, textarea { height: 32px; padding: 0 8px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 14px; line-height: 20px; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--brand); }
::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); color: var(--text); font-weight: 500; white-space: nowrap; cursor: pointer; transition: background-color .15s var(--ease); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 86%, var(--on-brand)); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--on-brand); }
.btn.wide { width: 100%; height: 40px; }
.btn:disabled { opacity: .6; cursor: default; }
.textbtn { display: inline-flex; align-items: center; min-height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background-color .15s var(--ease); }
.textbtn:hover { background: var(--surface-2); color: var(--text); }
.link { display: inline-flex; align-items: center; min-height: 24px; padding: 0; border: 0; background: none; color: var(--text-2); font-size: 13px; line-height: 20px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--text); text-decoration-color: currentColor; }
a.link { color: var(--accent); text-decoration-color: currentColor; }
.link.danger { color: var(--bad); text-decoration-color: currentColor; }
.external-link { white-space: nowrap; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.field { display: grid; gap: 4px; font-size: 13px; font-weight: 500; color: var(--text); }
.hint { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted); }
.flag { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.flag .i { align-self: center; }
.flag.warn { color: var(--warn); }
.flag.bad { color: var(--bad); }
.flag.ok { color: var(--ok); }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; place-items: start center; padding: 15vh 16px 48px; }
.login-form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.wordmark { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 600; }
.login-form h1 { font-size: 20px; line-height: 28px; font-weight: 600; margin-bottom: 8px; }
.login-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
.login-form input { height: 40px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 20px; }
.fine { font-size: 12px; line-height: 16px; color: var(--muted); }

/* ---------- app chrome ---------- */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar, .tabbar { display: none; }
.side { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 12px 8px; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; border-radius: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.nav { display: grid; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background-color .15s var(--ease); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--accent); }
.who { margin-top: auto; display: flex; align-items: flex-start; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.nav-foot { margin-top: auto; }
.nav-foot + .who { margin-top: 0; }
.avatar { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: 12px; line-height: 16px; font-weight: 600; }
.who-txt { display: grid; min-width: 0; font-size: 13px; }
.who-txt b { font-weight: 600; color: var(--text); overflow-wrap: break-word; }
.who-txt span { font-size: 12px; line-height: 16px; color: var(--muted); }
.who-txt .textbtn { justify-self: start; margin: 4px 0 0 -8px; }
.main { min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.main:focus { outline: none; }
.view { height: 100%; overflow-y: auto; }

/* view header: one 56px toolbar row */
.toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 56px; padding: 8px 32px; background: var(--bg); border-bottom: 1px solid var(--border); }
.toolbar h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
.tb-meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tb-actions { margin-left: auto; display: flex; gap: 8px; }
.content { padding: 24px 32px 48px; max-width: 1280px; }
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 32px; border-bottom: 1px solid var(--border); }
.f { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.f input:not([type=checkbox]) { width: 160px; }
.f.grow { flex: 1 1 240px; }
.f.grow input { flex: 1; width: auto; min-width: 0; }
.f.check { gap: 8px; cursor: pointer; }

/* ---------- ask ---------- */
.ask-content { max-width: 1160px; }
.askfield { max-width: 720px; }
.askbox { display: flex; align-items: flex-end; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); }
.askbox:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.askbox textarea { flex: 1; min-width: 0; height: auto; min-height: 32px; max-height: 180px; padding: 6px 0; border: 0; background: transparent; font-size: 15px; line-height: 22px; resize: none; display: block; }
.askbox textarea:focus-visible { outline: none; }   /* the ring is drawn on .askbox */
.disclose { margin-top: 8px; font-size: 12px; line-height: 16px; color: var(--muted); }
.disclose:empty { display: none; }
.ask-start { max-width: 720px; margin-top: 32px; }
.try-h { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.try { display: grid; grid-template-columns: 112px minmax(0, 1fr); }
.try-g { grid-column: 1; padding: 10px 0; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--border); }
.try ul { grid-column: 2; list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--border); }
.try-q { display: block; width: 100%; min-height: 36px; padding: 8px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; cursor: pointer; transition: background-color .15s var(--ease); }
.try-q:hover, .try-q:focus-visible { background: var(--surface-2); }
.try-q:focus-visible { outline-offset: -2px; }
.facts { margin-top: 16px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.facts:empty { display: none; }

/* Answer context and private rules reuse the desk's native fields and editorial spacing. */
.context-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 16px; max-width: 720px; margin-bottom: 24px; }
.context-controls .field { min-width: 0; }
.context-controls input, .context-controls select { width: 100%; min-width: 0; }
.context-help { grid-column: 1 / -1; }
.context-help:empty { display: none; }
.rules-content { max-width: 1160px; }
.rules-intro { max-width: 72ch; color: var(--text-2); margin-bottom: 24px; }
.rules-scope { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); max-width: none; margin-bottom: 16px; }
.rules-inheritance { color: var(--text-2); margin-bottom: 24px; max-width: 80ch; }
.rules-file { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 8px; }
.rules-file label { font-weight: 500; }
.rules-editor { display: block; width: 100%; height: auto; min-height: 360px; padding: 12px; resize: vertical; line-height: 24px; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.rules-editor[aria-invalid="true"] { border-color: var(--bad); }
#rulesMarkdownHelp { margin-top: 8px; max-width: 88ch; }
.rules-count { margin-top: 8px; font-variant-numeric: tabular-nums; }
#rulesError { margin: 8px 0; }

/* answered turn = memo with evidence in the margin */
.thread > .turn:last-child { margin-bottom: 24px; }
.turn { padding: 8px 0 32px; border-bottom: 1px solid var(--border); scroll-margin-top: 72px; }
.turn + .turn { padding-top: 32px; }
.memo-title { font: 600 22px/28px var(--serif); color: var(--text); max-width: 720px; overflow-wrap: anywhere; white-space: pre-wrap; }
.memo-meta { margin: 4px 0 16px; font-size: 13px; color: var(--muted); }
.memo-meta:has(.foot:empty):has(.steps:empty) { display: none; }
.steps { display: grid; gap: 4px; }
.step { display: flex; align-items: center; gap: 8px; }
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.step.ok .dot { background: var(--ok); }
.step.live .dot { background: var(--accent); animation: pulse 1s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .3; } }
.foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.memo { display: grid; grid-template-columns: minmax(0, 1fr); }
.memo-body { min-width: 0; }
.answer { max-width: 68ch; font: 400 16px/26px var(--serif); color: var(--text); overflow-wrap: break-word; }
.answer > :first-child { margin-top: 0; }
.answer p { margin: 0 0 16px; }
.answer ul, .answer ol { margin: 0 0 16px; padding-left: 24px; }
.answer li { margin: 4px 0; }
.answer h4 { margin: 24px 0 8px; font: 600 14px/20px var(--sans); }
.answer strong { font-weight: 600; }
.answer code, .answer pre.code { font: inherit; font-size: 14px; background: var(--surface-2); padding: 0 4px; }
.answer pre.code { padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tbl-scroll { overflow-x: auto; margin: 4px 0 16px; }
.answer table, .note-body table { border-collapse: collapse; width: 100%; font: 13px/20px var(--sans); font-variant-numeric: tabular-nums; }
.answer th, .answer td, .note-body th, .note-body td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.answer th, .note-body th { font-weight: 600; color: var(--text-2); }
.caret::after { content: ""; display: inline-block; width: 7px; height: 16px; background: var(--accent); margin-left: 2px; vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px; margin: 0 1px; border: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 600 12px/16px var(--sans); font-variant-numeric: tabular-nums; vertical-align: 2px; cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.cite:hover, .cite.linked { background: var(--accent); color: var(--on-brand); }
.notices:empty { display: none; }
.notice { display: flex; align-items: flex-start; gap: 8px; max-width: 720px; padding: 8px 12px; font-size: 14px; }
.notice .i { margin-top: 3px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.chart { margin: 8px 0 16px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-family: var(--sans); }
.chart figcaption { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.crow { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) 80px; gap: 12px; align-items: center; font-size: 13px; padding: 2px 0; }
.cl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ct { height: 12px; background: var(--surface-2); }
.cf { display: block; height: 100%; width: 0; background: var(--text-2); transition: width .2s var(--ease); }
.crow:first-of-type .cf { background: var(--accent); }
.cv { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* margin notes (the rail on wide screens, a Sources list after the prose below 1100px) */
.rail { min-width: 0; }
.rail:empty { display: none; }
.rail { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.rail-h { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.notes { list-style: none; margin: 0; padding: 0; }
.note { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 0 8px; padding: 12px 8px; border-top: 1px solid var(--border); scroll-margin: 72px 0 16px; transition: background-color .15s var(--ease); }
.notes > .note:first-child { border-top: 0; }
.note.active, .note.linked { background: var(--accent-soft); }
.note:focus-visible { outline-offset: -2px; }
.note-n { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.note.cited .note-n { color: var(--accent); }
.note-main { min-width: 0; }
.note-t { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.note-m { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.note-w { display: flex; gap: 4px; align-items: flex-start; font-size: 12px; line-height: 16px; color: var(--warn); margin-top: 2px; }
.note-w .i { width: 12px; height: 12px; margin-top: 2px; }
.note-acts { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 4px; }
.note-body { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.note-body .txt { white-space: pre-wrap; max-height: 320px; overflow: auto; overflow-wrap: anywhere; }
.note-body .kv { margin: 0; }
.note-body th, .note-body td { min-width: 96px; overflow-wrap: break-word; white-space: normal; }
.more { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.more > summary { cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 500; color: var(--text-2); }
.trans { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--border); font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.trans b { display: block; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
@media (min-width: 1100px) {
  .memo { grid-template-columns: minmax(0, 640px) minmax(260px, 340px); column-gap: 48px; }
  .rail { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); max-height: calc(100dvh - 88px); overflow-y: auto; margin-top: 0; padding: 0 4px 0 16px; border-top: 0; border-left: 1px solid var(--border); }
  .turn.sources-only .memo { grid-template-columns: minmax(0, 720px); }
  .turn.sources-only .rail { position: static; max-height: none; overflow: visible; margin-top: 16px; padding: 0; border-left: 0; }
}

/* ---------- search ---------- */
.searchfield { display: flex; gap: 8px; max-width: 840px; }
.searchfield input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; font-size: 15px; }
.searchfield .btn { height: 40px; }
.helper { margin: 8px 0 16px; font-size: 12px; line-height: 16px; color: var(--muted); }
.seg-wrap { position: relative; border-bottom: 1px solid var(--border); }
.seg { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg-btn { flex: none; height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.seg-btn:focus-visible { outline-offset: -2px; }
.seg-wrap::before, .seg-wrap::after { content: ""; position: absolute; top: 0; bottom: 8px; width: 32px; pointer-events: none; opacity: 0; transition: opacity .15s var(--ease); }
.seg-wrap::before { left: 0; background: linear-gradient(to left, transparent, var(--bg)); }
.seg-wrap::after { right: 0; background: linear-gradient(to right, transparent, var(--bg)); }
.seg-wrap.more-l::before, .seg-wrap.more-r::after { opacity: 1; }
.hits { list-style: none; margin: 0; padding: 0; max-width: 840px; }
.hit { padding: 16px 0; border-bottom: 1px solid var(--border); }
.hit-title { font-size: 15px; line-height: 22px; font-weight: 600; overflow-wrap: anywhere; }
.hit-meta { margin: 2px 0 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.hit-meta .flag { display: inline; }
.hit-meta .flag .i { vertical-align: -2px; margin-right: 4px; }
.hit-text { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.hit.open .hit-text { display: block; -webkit-line-clamp: unset; line-clamp: none; }
.hit-acts { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 8px; }
.list-empty { padding: 24px 0; color: var(--muted); }
.list-empty.bad { display: flex; gap: 8px; align-items: flex-start; color: var(--bad); }
.list-empty .i { margin-top: 3px; }

/* ---------- tables, stats ---------- */
.stats { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 24px; padding: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stats:empty { display: none; }
.stats li { padding: 8px 16px; border-left: 1px solid var(--border); min-width: 0; }
.stats li:first-child { border-left: 0; padding-left: 0; }
.stats b { display: block; font-size: 20px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats span { display: block; font-size: 12px; line-height: 16px; color: var(--muted); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 56px; z-index: 1; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tbl td { padding: 12px 12px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl .r { text-align: right; }
.tbl tbody tr[data-client] { cursor: pointer; }
.tbl tbody tr[data-client]:hover td { background: var(--surface-2); }
.msg-row td { padding: 24px 0 !important; color: var(--muted); }
.row-link { display: inline; padding: 0; border: 0; background: none; color: var(--text); font-weight: 600; text-align: left; cursor: pointer; }
.row-link:hover { text-decoration: underline; }
.t-main { min-width: 160px; }
.doc-t { display: block; font-weight: 600; overflow-wrap: anywhere; }
.t-wide { overflow-wrap: anywhere; min-width: 200px; }
.t-status .flag { display: flex; white-space: nowrap; }
.t-acts > * { display: flex; width: max-content; }
.docs .t-acts { padding-right: 0; }
.t-acts .link.danger { color: var(--muted); text-decoration-color: currentColor; }
.t-acts .link.danger:hover, .t-acts .link.danger:focus-visible { color: var(--bad); }
.docs .t-added { white-space: nowrap; }
.detail-row td { padding: 0 0 16px !important; }
.docedit { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; max-width: 840px; }
.docedit input, .docedit select { width: 100%; }
.row-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.confirm { display: grid; gap: 8px; max-width: 840px; padding: 12px; background: var(--bad-soft); color: var(--text); }
.tbl.mini td { padding: 8px 12px 7px 0; }

/* ---------- documents ---------- */
.dropzone { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; margin-bottom: 24px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.drop-target { display: grid; align-content: center; gap: 4px; padding: 24px; border: 1px dashed var(--control); border-radius: 6px; text-align: center; transition: background-color .15s var(--ease); }
.drop-target.over { background: var(--selected); border-color: var(--focus); }
.drop-main { font-weight: 500; }
.drop-sub { font-size: 13px; color: var(--muted); }
.link-like { display: inline; min-height: 0; padding: 0; font-size: inherit; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.link-like:hover { background: none; }
.drop-fields { display: grid; gap: 12px; align-content: start; }
.drop-fields input { width: 100%; }
.imports { margin-bottom: 24px; }
.imports-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.imports-head h2 { font-size: 13px; font-weight: 600; }
.imports-head .textbtn { margin-left: auto; }
.jobs { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--border); }
.job { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 0 16px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.job-state { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; }
.job .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--control); flex: none; }
.job.ok .dot { background: var(--ok); }
.job.warn .dot { background: var(--warn); }
.job.bad .dot { background: var(--bad); }
.job-file { font-weight: 500; overflow-wrap: anywhere; }
.job-msg { grid-column: 2; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- connect Claude ---------- */
.connect { max-width: 840px; }
.connect > .helper { margin: 0 0 16px; }
.c-sec { padding: 16px 0 24px; border-top: 1px solid var(--border); }
.c-sec h2 { margin-bottom: 12px; font-size: 13px; line-height: 20px; font-weight: 600; }
.c-text { margin-bottom: 8px; color: var(--text-2); }
.c-sec > .hint { display: block; margin-top: 8px; }
.seg-pick { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; padding: 0; border: 0; }
.seg-pick label { position: relative; display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg-pick label:hover { color: var(--text); }
.seg-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-pick label:has(input:checked) { background: var(--surface-2); color: var(--text); }
.seg-pick label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.guide { max-width: 840px; }
.guide > .hint { display: block; margin-top: 8px; }
.steps { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 16px; }
.steps li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.steps .hint { display: block; margin-top: 4px; }
.guide code { font-size: 13px; padding: 1px 4px; border-radius: 4px; background: var(--surface-2); }
.c-form { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 12px 16px; align-items: start; }
.c-form input, .c-form select { width: 100%; }
.c-submit { padding-top: 24px; }
.c-result { display: grid; gap: 4px; margin-top: 8px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.c-result .field:not(:first-child) { margin-top: 12px; }
.copyrow { display: flex; gap: 8px; align-items: flex-start; }
.copyrow .code { flex: 1; min-width: 0; }
.code { font-size: 13px; line-height: 20px; color: var(--text); background: var(--surface); }
textarea.code { height: auto; padding: 6px 8px; resize: none; white-space: pre-wrap; overflow-wrap: anywhere; field-sizing: content; }
.c-warn { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--warn); }

/* ---------- overlays: drawer, More sheet, menu, toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(21, 24, 30, .28); opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
.scrim.on { opacity: 1; pointer-events: auto; }
/* closed: off-screen AND hidden, so nothing in it can be focused or read */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 11; width: min(520px, 100vw); overflow-y: auto; background: var(--surface); border-radius: 8px 0 0 8px; box-shadow: var(--overlay-shadow); transform: translateX(100%); visibility: hidden; transition: transform .2s var(--ease), visibility 0s linear .2s; }
.drawer.on { transform: none; visibility: visible; transition: transform .2s var(--ease); }
.drawer h2 { font-size: 20px; line-height: 28px; font-weight: 600; overflow-wrap: anywhere; }
.drawer h2:focus { outline: none; }
.drawer h2:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.d-head { position: sticky; top: 0; z-index: 1; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.d-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.d-row > div { min-width: 0; }
.d-id { font-size: 12px; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-sub { font-size: 13px; color: var(--muted); }
.d-flags { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--text-2); }
.d-sec { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.d-sec h3 { margin-bottom: 8px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; gap: 12px; align-items: center; font-size: 13px; }
.bar .track { height: 6px; background: var(--surface-2); }
.bar .fill { display: block; height: 100%; width: 0; background: var(--text-2); transition: width .2s var(--ease); }
.bar .v { text-align: right; font-variant-numeric: tabular-nums; }
.chks { list-style: none; margin: 0; padding: 0; }
.chk { display: flex; gap: 8px; padding: 4px 0; font-size: 13px; }
.chk .i { margin-top: 3px; }
.chk.pass .i { color: var(--ok); }
.chk.fail { color: var(--bad); }
.chk .sub { color: var(--muted); }
.d-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 24px 24px; }
.usermenu { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: 240px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--overlay-shadow); }
.menu-name { padding: 4px 8px 0; font-weight: 600; overflow-wrap: break-word; }
.menu-scope { padding: 0 8px 8px; font-size: 12px; line-height: 16px; color: var(--muted); border-bottom: 1px solid var(--border); }
.menu-item { display: flex; align-items: center; width: 100%; min-height: 44px; margin-top: 4px; padding: 0 8px; border: 0; border-radius: 6px; background: none; font-weight: 500; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 8px 8px 0 0; box-shadow: var(--overlay-shadow); transform: translateY(100%); visibility: hidden; transition: transform .2s var(--ease), visibility 0s linear .2s; }
.sheet.on { transform: none; visibility: visible; transition: transform .2s var(--ease); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 8px; }
.sheet-head h2 { font-size: 14px; font-weight: 600; }
.sheet-nav a, .sheet-nav button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 12px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.sheet-nav svg { width: 20px; height: 20px; color: var(--text-2); }
.sheet-nav a[aria-current="page"] { background: var(--surface-2); }
.sheet-nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; width: max-content; max-width: calc(100vw - 32px); padding: 8px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--overlay-shadow); transform: translate(-50%, 8px); opacity: 0; pointer-events: none; transition: opacity .15s var(--ease), transform .15s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phones and tablets: top bar + bottom tab bar, 44px targets ---------- */
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 4px 0 8px; border-bottom: 1px solid var(--border); }
  .topbar .brand { min-height: 44px; }
  .avatar-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 4px 2px; border: 0; background: none; color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 500; text-decoration: none; cursor: pointer; }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar a[aria-current="page"], .tabbar button.on { color: var(--text); }
  .tabbar a[aria-current="page"]::before, .tabbar button.on::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: var(--accent); }
  .tabbar :focus-visible { outline-offset: -2px; }
  .toolbar { padding: 6px 16px; }
  .content { padding: 16px 16px 32px; }
  .filterbar { padding: 8px 16px; gap: 4px 16px; }
  /* 44px targets; 16px text in fields stops mobile browsers zooming on focus */
  input, select, .btn, .searchfield input, .searchfield .btn, .login-form input, .btn.wide { height: 44px; }
  input, select, textarea, .askbox textarea, .searchfield input { font-size: 16px; }
  input[type=checkbox] { width: 20px; height: 20px; }
  .textbtn, .link, .seg-btn, .icon-btn, .row-link, .try-q, .seg-pick label { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .seg-btn { height: 44px; }
  .row-link { display: inline-flex; align-items: center; }
  .f { min-height: 44px; }
  .askbox { padding-left: 12px; }
  .askbox textarea { min-height: 44px; padding: 10px 0; line-height: 24px; }
  .toast { bottom: 80px; }
  .dropzone { grid-template-columns: minmax(0, 1fr); }
  .note-acts, .hit-acts { gap: 0 16px; }
  .more > summary { display: flex; align-items: center; min-height: 44px; }
  /* tables become two-line list items */
  .tbl.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl.stack, .tbl.stack tbody { display: block; }
  .tbl.stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .tbl.stack td { display: block; padding: 0 !important; border: 0; color: var(--text-2); }
  .tbl.stack td.t-main, .tbl.stack .t-wide, .tbl.stack .t-acts, .tbl.stack .msg-row td { flex: 1 0 100%; min-width: 0; color: var(--text); }
  .tbl.stack .t-wide { color: var(--muted); }
  .tbl.stack td[data-label]:not([data-label=""])::before { content: attr(data-label) " "; color: var(--muted); }
  .tbl.stack td.r { text-align: left; }
  .tbl.stack td:not(.t-main) .sub { display: inline; margin-left: 4px; }
  .tbl.stack .t-acts { display: flex; flex-wrap: wrap; gap: 0 16px; }
  .tbl.stack .detail-row { border-bottom: 1px solid var(--border); }
  .tbl.stack .msg-row td { padding: 16px 0 !important; color: var(--muted); }
  .tbl.stack td:empty { display: none; }
  .stack-only { display: inline; }
}
@media (max-width: 699px) {
  .context-controls { grid-template-columns: minmax(0, 1fr); }
  .try { grid-template-columns: minmax(0, 1fr); }
  .try-g { padding: 12px 0 4px; border-bottom: 0; }
  .try ul { grid-column: 1; }
  .filterbar .f { flex: 1 1 150px; }
  .filterbar .f input:not([type=checkbox]), .filterbar .f select { flex: 1; width: auto; min-width: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--border); }
  .job { grid-template-columns: minmax(0, 1fr); }
  .job-msg { grid-column: 1; }
  .c-form { grid-template-columns: minmax(0, 1fr); }
  .c-submit { padding-top: 0; }
  .copyrow { flex-direction: column; align-items: stretch; }
  .copyrow .code { flex: none; }
  .kv { grid-template-columns: 112px minmax(0, 1fr); }
  .bar { grid-template-columns: minmax(0, 1fr) 80px 40px; }
  .d-head, .d-sec { padding-left: 16px; padding-right: 16px; }
  .d-acts { padding: 16px; }
  .drawer { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .drawer, .sheet, .toast, .toast.on { transform: none; }
  .toast { left: 16px; right: 16px; max-width: none; text-align: center; }
}
