/* PreLegal web app — implemented 1:1 from design/PreLegal-Web-App.dc.html.
   Extension token sheet grown to desktop: paper ground, pine ink, mint fills,
   signal-green accents, aged-editorial severity inks, Newsreader display. */

@font-face { font-family: 'Newsreader'; font-weight: 400 700; font-display: swap; src: url('/fonts/newsreader-var.woff2') format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 300 800; font-display: swap; src: url('/fonts/hanken-var.woff2') format('woff2'); }

:root {
  --paper: #F4FAF6;
  --card: #ffffff;
  --card-line: #D9E7DE;
  --hairline: #EDF3EE;
  --mid-line: #E4EAE5;
  --pine: #0B2B21;
  --pine-hover: #0A241C;
  --ink: #22332B;
  --ink-2: #47554E;
  --slate: #5C6862;
  --faint: #8FA398;
  --ghost: #C6CFC9;
  --chip-line: #C8DACE;
  --chip-line-2: #BFDCCB;
  --dash: #9DBFAC;
  --mint: #E4F2EA;
  --signal: #12A66B;
  --signal-bright: #46C78C;
  --signal-bright-hover: #5BD49D;
  --on-pine: #F4FAF6;
  --on-pine-dim: #9DBFAC;
  --pine-card: #10382B;
  --pine-line: #24473A;
  --fail: #C0442B;
  --fail-bg: #FBF1EE;
  --sev-critical: #93321F; --sev-critical-bg: #F9ECE8; --sev-critical-line: #ECD5CD;
  --sev-high: #8F6300;     --sev-high-bg: #F6EFDC;     --sev-high-line: #E7DBBB;
  --sev-medium: #66702E;   --sev-medium-bg: #EFF1DF;   --sev-medium-line: #DDE2C4;
  --sev-low: #5C6862;      --sev-low-bg: #EDF1EF;      --sev-low-line: #D9E1DD;
  --del-ink: #7A4033;
  --shadow-1: 0 1px 3px rgba(11,43,33,.07);
  --shadow-2: 0 4px 16px rgba(11,43,33,.12);
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Hanken Grotesk', -apple-system, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, monospace;

  /* The drafted letter is paper in BOTH themes — the one light surface in
     dispute mode (d1j/d2j), because it is the document that gets sent. These
     four never appear in the dark block: that is the point of them. */
  --letter-paper: #ffffff;
  --letter-ink: #22332B;
  --letter-ink-dim: #5C6862;
  --letter-quote-bg: #E4F2EA;
  --letter-quote-line: #12A66B;
  --letter-dim: #F4FAF6;
  --letter-pin: #0B2B21;
  --letter-pin-ink: #F4FAF6;
  --letter-well: #E9F0EA;
}

[data-theme="dark"] {
  /* The well the paper page sits in is the only part that re-inks. */
  --letter-well: #0F3226;
  --paper: #0B2B21;
  --card: #10382B;
  --card-line: #24473A;
  --hairline: #24473A;
  --mid-line: #24473A;
  --pine: #F4FAF6;
  --pine-hover: #ffffff;
  --ink: #C7D8CE;
  --ink-2: #C7D8CE;
  --slate: #9DBFAC;
  --faint: #9DBFAC;
  --ghost: #3A5C4D;
  --chip-line: #3A5C4D;
  --chip-line-2: #3A5C4D;
  --dash: #3A5C4D;
  --mint: #16402F;
  --signal: #46C78C;
  --on-pine: #0B2B21;
  --on-pine-dim: #47554E;
  --pine-card: #F4FAF6;
  --pine-line: #D9E7DE;
  --fail: #E08A76;
  --fail-bg: #3D251D;
  --sev-critical: #E8A18D; --sev-critical-bg: #3D251D; --sev-critical-line: #5C382C;
  --sev-high: #DDB56E;     --sev-high-bg: #3D351D;     --sev-high-line: #5A4E2A;
  --sev-medium: #C3CB82;   --sev-medium-bg: #363C22;   --sev-medium-line: #4E5630;
  --sev-low: #9DBFAC;      --sev-low-bg: #16402F;      --sev-low-line: #24473A;
  --del-ink: #E8A18D;
  --shadow-1: 0 1px 3px rgba(0,0,0,.25);
  --shadow-2: 0 8px 28px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 400 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; padding: 0; cursor: pointer; color: inherit; }
input, textarea { font: inherit; color: var(--ink); }
::placeholder { color: var(--faint); }

/* --- layout ------------------------------------------------------------- */

#app { display: flex; height: 100vh; }
.nav { width: 220px; flex-shrink: 0; border-right: 1px solid var(--card-line); padding: 18px 10px 14px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
/* Collapsible nav — same closable-strip grammar as the chat rail (a2f). The
   toggle flips a class in place; content stays mounted. */
.nav-hd { display: flex; align-items: center; justify-content: space-between; }
.nav-collapse { border: none; background: none; color: var(--faint); cursor: pointer; padding: 4px; margin: 0 4px 14px 0; border-radius: 6px; display: inline-flex; }
.nav-collapse:hover { background: var(--hairline); color: var(--pine); }
.nav-collapse svg { width: 15px; height: 15px; }
.nav.min { width: 52px; padding: 18px 8px 14px; }
.nav.min .nav-hd { flex-direction: column; align-items: center; gap: 10px; }
.nav.min .nav-collapse { margin: 0; transform: scaleX(-1); }
.nav.min .nav-logo { padding: 0 0 10px; }
.nav.min .nav-logo .word, .nav.min .nav-item, .nav.min .nav-divider, .nav.min .nav-sub-label, .nav.min .nav-folder, .nav.min .nav-foot { display: none; }
.content { flex: 1; min-width: 0; overflow-y: auto; display: flex; justify-content: center; }
.page { width: 1080px; max-width: 100%; padding: 34px 40px; display: flex; flex-direction: column; gap: 22px; }

/* --- pilcrow mark --------------------------------------------------------- */

.mark { position: relative; display: inline-block; width: 12px; height: 16px; flex-shrink: 0; }
.mark i { position: absolute; display: block; }
.mark .bowl { left: 0; top: 0; width: 12px; height: 9px; background: var(--signal); border-radius: 4.5px 0 0 4.5px; }
.mark .s1 { left: 6px; top: 0; width: 2px; height: 16px; background: var(--pine); }
.mark .s2 { left: 10px; top: 0; width: 2px; height: 16px; background: var(--pine); }
.mark.lg { width: 15px; height: 20px; }
.mark.lg .bowl { width: 15px; height: 11px; border-radius: 5.5px 0 0 5.5px; }
.mark.lg .s1 { left: 7.5px; width: 2.5px; height: 20px; }
.mark.lg .s2 { left: 12.5px; width: 2.5px; height: 20px; }
.mark.ghosted { opacity: .3; }
.mark.ghosted .bowl { background: var(--dash); }
.mark.ghosted .s1, .mark.ghosted .s2 { background: var(--slate); }

/* --- nav ------------------------------------------------------------------ */

.nav-logo { display: flex; align-items: center; gap: 8px; padding: 0 10px 16px; }
.nav-logo .word { font: 600 17px var(--serif); letter-spacing: -0.01em; color: var(--pine); }
.nav-item { height: 34px; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; cursor: pointer; }
.nav-item:hover { background: var(--hairline); color: var(--pine); }
[data-theme="dark"] .nav-item:hover { background: var(--pine-card); }
.nav-item.active { background: var(--mint); color: var(--pine); font-weight: 600; }
[data-theme="dark"] .nav-item.active { background: #16402F; color: #F4FAF6; }
.nav-badge { font-size: 10px; font-weight: 700; background: var(--mint); color: var(--pine); border-radius: 99px; padding: 1px 6px; }
.nav-item.active .nav-badge { background: var(--card); }
.nav-divider { border-top: 1px solid var(--card-line); margin: 12px 10px; }
.nav-sub-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); padding: 0 10px 6px; }
.nav-folder { height: 30px; border-radius: 7px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; cursor: pointer; }
.nav-folder:hover { background: var(--hairline); }
[data-theme="dark"] .nav-folder:hover { background: var(--pine-card); }
.nav-folder.active { background: var(--card); border: 1px solid var(--card-line); color: var(--pine); font-weight: 600; }
.nav-folder .n { font: 500 10.5px var(--mono); color: var(--faint); }
.nav-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--card-line); display: flex; flex-direction: column; gap: 5px; }
.credits-row { display: flex; justify-content: space-between; align-items: baseline; }
.credits-row .l { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.credits-row .r { font: 500 10.5px var(--mono); color: var(--slate); }
.credits-bar { height: 4px; border-radius: 2px; background: var(--mint); overflow: hidden; }
.credits-bar > div { height: 4px; background: var(--pine); border-radius: 2px; }
[data-theme="dark"] .credits-bar > div { background: var(--signal-bright); }
.credits-note { font-size: 10.5px; color: var(--faint); }
.nav-account { display: flex; align-items: center; gap: 8px; padding: 8px 0 2px; min-width: 0; }
.nav-account img, .nav-avatar { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.nav-avatar { background: var(--pine); color: var(--on-pine); font-size: 9.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-name { font-size: 11.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-tools { display: flex; gap: 8px; padding-top: 6px; font-size: 11px; color: var(--faint); }
.nav-tools button:hover, .nav-tools a:hover { color: var(--pine); }

/* --- type + common pieces -------------------------------------------------- */

.h-serif { font-family: var(--serif); font-weight: 600; color: var(--pine); line-height: 1.1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { font: 600 30px var(--serif); color: var(--pine); line-height: 1.1; }
.page-sub { font-size: 13px; color: var(--slate); margin-top: 4px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--slate); flex-wrap: wrap; }
.crumbs .link { font-weight: 600; color: var(--pine); border-bottom: 1.5px solid var(--signal); padding-bottom: 1px; cursor: pointer; }
.crumbs .here { color: var(--pine); font-weight: 600; }
.text-link { font-size: 12px; font-weight: 600; color: var(--pine); border-bottom: 1.5px solid var(--signal); padding-bottom: 1px; cursor: pointer; display: inline-block; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--slate); }
.kicker-sm { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.card { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; }
.disclaimer { font-size: 10.5px; color: var(--faint); }

.btn { height: 40px; padding: 0 18px; border-radius: 8px; background: var(--pine); color: var(--on-pine); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.btn:hover { background: var(--pine-hover); }
[data-theme="dark"] .btn { background: var(--signal-bright); color: #0B2B21; }
[data-theme="dark"] .btn:hover { background: var(--signal-bright-hover); }
.btn.sm { height: 34px; padding: 0 15px; font-size: 12.5px; }
.btn-ghost { height: 36px; padding: 0 15px; border-radius: 8px; background: var(--card); border: 1px solid var(--chip-line); color: var(--pine); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.btn-ghost:hover { background: var(--paper); }
.btn-signal { height: 34px; padding: 0 15px; border-radius: 8px; background: var(--signal-bright); color: #0B2B21; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; cursor: pointer; }
.btn-signal:hover { background: var(--signal-bright-hover); }

.badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; border-radius: 4px; padding: 2.5px 6px; display: inline-flex; align-items: center; gap: 4px; }
.badge.mint { background: var(--mint); color: var(--pine); }
.badge.deep { background: var(--pine); color: var(--on-pine); }
.badge.deep .star { color: var(--signal-bright); }
[data-theme="dark"] .badge.deep { background: none; border: 1px solid var(--signal-bright); color: var(--signal-bright); }
.badge.plain { background: var(--sev-low-bg); color: var(--slate); }
.badge.dashed { background: none; border: 1.5px dashed var(--chip-line); color: var(--faint); letter-spacing: .1em; }
.badge.outline { background: var(--card); border: 1px solid var(--chip-line); color: var(--pine); }
.badge.mint-line { background: var(--mint); border: 1px solid var(--chip-line-2); color: var(--pine); }

.score-chip { font: 600 12px var(--mono); border-radius: 4px; padding: 2px 7px; border: 1px solid; display: inline-block; }
.sev-critical { color: var(--sev-critical); background: var(--sev-critical-bg); border-color: var(--sev-critical-line); }
.sev-high { color: var(--sev-high); background: var(--sev-high-bg); border-color: var(--sev-high-line); }
.sev-medium { color: var(--sev-medium); background: var(--sev-medium-bg); border-color: var(--sev-medium-line); }
.sev-low { color: var(--sev-low); background: var(--sev-low-bg); border-color: var(--sev-low-line); }

/* --- tables ---------------------------------------------------------------- */

.tbl { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; overflow: hidden; }
.tbl-head, .tbl-row { display: grid; align-items: center; gap: 12px; padding: 0 18px; }
.tbl-head { padding: 10px 18px; border-bottom: 1px solid var(--hairline); }
.tbl-head span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.tbl-row { height: 46px; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.tbl-row:last-of-type { border-bottom: none; }
.tbl-row:hover { background: var(--paper); }
[data-theme="dark"] .tbl-row:hover { background: #0F3327; }
.tbl-row .t { font-size: 13px; font-weight: 600; color: var(--pine); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-row .d { font-size: 12px; color: var(--slate); }
.tbl-foot { padding: 9px 18px; border-top: 1px solid var(--hairline); background: var(--paper); }
[data-theme="dark"] .tbl-foot { background: #0F3327; }

/* --- skill card (the instrument) ------------------------------------------- */

.skill-card { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; overflow: hidden; }
.skill-card .toprule { height: 4px; background: var(--pine); }
[data-theme="dark"] .skill-card .toprule { background: var(--signal-bright); }
.skill-card .inner { padding: 18px 24px 20px; display: flex; flex-direction: column; gap: 13px; }
.skill-name { font: 600 25px/1.15 var(--serif); color: var(--pine); }
.purpose { background: var(--mint); border-radius: 8px; padding: 9px 12px; }
.purpose .q { font-size: 12.5px; line-height: 1.5; color: var(--pine); display: block; }
[data-theme="dark"] .purpose { background: #0F3327; border: 1px solid var(--pine-line); }
[data-theme="dark"] .purpose .q { color: #C7D8CE; }
.purpose .cap { font-size: 10.5px; color: var(--ink-2); margin-top: 2px; display: block; }
.rule-row { display: flex; gap: 9px; }
.rule-row .no { font: 600 12px var(--mono); color: var(--signal); width: 20px; flex-shrink: 0; }
.rule-row .txt { font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.rule-row.ghost .no { color: var(--ghost); }
.rule-ghost-bar { height: 9px; border-radius: 3px; background: var(--hairline); }
.rule-new { background: var(--paper); border: 1px solid var(--chip-line-2); border-radius: 8px; padding: 8px 10px; margin: 0 -10px; display: flex; flex-direction: column; gap: 4px; }
[data-theme="dark"] .rule-new { background: #16402F; border-color: #3A5C4D; }
.rule-new .note { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--signal); padding-left: 29px; }
.rule-new .note .edit { color: var(--pine); border-bottom: 1px solid var(--signal); cursor: pointer; }
.k-chip { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--pine); background: var(--mint); border-radius: 4px; padding: 3px 7px; }
[data-theme="dark"] .k-chip { color: #C7D8CE; background: #16402F; }
.k-chip.pending { color: var(--faint); background: none; border: 1.5px dashed var(--chip-line); padding: 2px 6px; }
.rwr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; border-top: 1px solid var(--mid-line); padding-top: 12px; }
.rwr .cell { display: flex; flex-direction: column; gap: 2px; }
.rwr .v { font-size: 12px; font-weight: 600; color: var(--pine); }
.rwr .s { font-size: 11px; color: var(--slate); }

/* condensed card (workflows list) */
.wf-card { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; overflow: hidden; cursor: pointer; }
.wf-card:hover { box-shadow: var(--shadow-2); }
.wf-card .toprule { height: 3px; background: var(--pine); }
[data-theme="dark"] .wf-card .toprule { background: var(--signal-bright); }
.wf-card .inner { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.wf-card .nm { font: 600 19px/1.2 var(--serif); color: var(--pine); }
.wf-card .pq { font-size: 12px; line-height: 1.5; color: var(--slate); }
.wf-card .meta { font: 500 11px var(--mono); color: var(--slate); }
.wf-card .foot { border-top: 1px solid var(--hairline); padding-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-ok { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--pine); }
.run-ok .tick { color: var(--signal); }
.run-fail { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--fail); }
.run-side { font-size: 11.5px; color: var(--slate); }

/* --- chat (builder) --------------------------------------------------------- */

.builder-stage { flex: 1; min-width: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; }
.builder-top { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 20px 36px 0; }
.builder-mid { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 0; overflow-y: auto; padding: 18px 0; }
.builder-chat { width: 720px; max-width: 92%; padding-bottom: 24px; display: flex; flex-direction: column; gap: 11px; max-height: 44vh; overflow-y: auto; flex-shrink: 0; }
.bubble-user { align-self: flex-end; max-width: 70%; background: var(--pine); color: var(--on-pine); border-radius: 12px 12px 3px 12px; padding: 9px 13px; font-size: 13px; line-height: 1.5; }
[data-theme="dark"] .bubble-user { background: var(--signal-bright); color: #0B2B21; font-weight: 500; }
.bubble-ai-wrap { align-self: flex-start; max-width: 86%; display: flex; gap: 10px; }
.bubble-ai-wrap .mark { margin-top: 4px; }
.bubble-ai { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px 12px 12px 3px; padding: 10px 14px; font-size: 13px; line-height: 1.55; color: var(--ink); box-shadow: var(--shadow-1); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { height: 30px; display: inline-flex; align-items: center; padding: 0 13px; border-radius: 99px; background: var(--card); border: 1px solid var(--chip-line); font-size: 12.5px; font-weight: 600; color: var(--pine); cursor: pointer; }
.chip:hover { background: var(--mint); border-color: var(--chip-line-2); }
.composer { background: var(--card); border: 1px solid var(--chip-line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { border: none; outline: none; background: none; resize: none; font-size: 13px; min-height: 34px; max-height: 120px; width: 100%; }
.composer .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer .tools { display: flex; align-items: center; gap: 2px; }
.tool-btn { height: 30px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.tool-btn:hover { background: var(--paper); }
[data-theme="dark"] .tool-btn:hover { background: #16402F; }
.tool-btn svg { stroke: var(--slate); }
.tool-sep { width: 1px; height: 16px; background: var(--mid-line); margin: 0 5px; }
.q-count { font: 500 11px var(--mono); color: var(--faint); }
.send-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 99px; background: var(--pine); cursor: pointer; flex-shrink: 0; }
.send-btn:hover { background: var(--pine-hover); }
.send-btn svg { stroke: var(--on-pine); }
[data-theme="dark"] .send-btn { background: var(--signal-bright); }
[data-theme="dark"] .send-btn svg { stroke: #0B2B21; }
.send-btn:disabled { opacity: .5; cursor: default; }

/* ghost instrument (builder empty) */
.ghost-card { width: 520px; max-width: 92%; border: 1.5px dashed var(--chip-line); border-radius: 12px; padding: 26px 30px; display: flex; flex-direction: column; gap: 14px; background: rgba(255,255,255,.5); }
[data-theme="dark"] .ghost-card { background: rgba(255,255,255,.03); }
.ghost-card .nm { font: 500 24px var(--serif); color: var(--faint); }
.ghost-bar { border-radius: 8px; background: var(--mint); opacity: .55; height: 44px; }
[data-theme="dark"] .ghost-bar { background: #16402F; }

/* activate footer */
.activate-foot { background: #0B2B21; border-radius: 0 0 12px 12px; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.activate-foot .strip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.activate-foot .k { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #9DBFAC; }
.activate-foot .v { font-size: 12px; font-weight: 600; color: #F4FAF6; }
.activate-foot .arrow { color: #3A5C4D; }
.activate-foot .note { font-size: 11px; color: #9DBFAC; display: block; margin-top: 3px; }
.activate-btn { height: 40px; padding: 0 18px; border-radius: 8px; background: #0B2B21; border: 1px solid #0B2B21; color: #F4FAF6; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 0 0 1.5px #46C78C; }
.activate-btn.on { background: #E4F2EA; border: 1px solid #BFDCCB; color: #0B2B21; }

/* --- library detail --------------------------------------------------------- */

.doc-head { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px 12px 0 0; border-bottom: none; padding: 18px 24px 0; display: flex; flex-direction: column; gap: 14px; }
.score-serif { font: 600 46px/1 var(--serif); color: var(--pine); }
.score-under { width: 56px; height: 4px; border-radius: 2px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--mid-line); }
.tab { padding: 0 2px 11px; font-size: 13px; font-weight: 500; color: var(--slate); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--pine); }
.tab.active { font-weight: 600; color: var(--pine); border-bottom: 2px solid var(--pine); margin-bottom: -1px; padding-bottom: 9px; }
[data-theme="dark"] .tab.active { border-color: var(--signal-bright); }
.tab .pill { font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 1px 6px; }
.doc-body { background: var(--paper); border: 1px solid var(--card-line); border-top: none; border-radius: 0 0 12px 12px; display: flex; min-height: 380px; }
[data-theme="dark"] .doc-body { background: #0F3327; }
.finding-rail { width: 340px; flex-shrink: 0; border-right: 1px solid var(--mid-line); padding: 14px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.finding-item { background: var(--card); border: 1px solid var(--mid-line); border-radius: 10px; padding: 11px 13px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.finding-item:hover { border-color: var(--chip-line-2); }
.finding-item.active { border-color: var(--chip-line-2); }
.finding-item .sev-bar { width: 3px; height: 30px; border-radius: 2px; flex-shrink: 0; }
.finding-item .fi-t { font-size: 12.5px; font-weight: 600; color: var(--pine); }
.finding-item .fi-s { font-size: 11px; color: var(--slate); }
.finding-detail { flex: 1; min-width: 0; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.fd-card { background: var(--card); border: 1px solid var(--card-line); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.redline-del { border-left: 3px solid #C0442B; background: var(--fail-bg); border-radius: 0 6px 6px 0; padding: 8px 11px; font-size: 12px; line-height: 1.55; color: var(--del-ink); text-decoration: line-through; text-decoration-color: #C0442B; }
.redline-add { border-left: 3px solid var(--signal); background: var(--mint); border-radius: 0 6px 6px 0; padding: 8px 11px; font-size: 12px; line-height: 1.55; color: var(--pine); }
[data-theme="dark"] .redline-add { background: #16402F; color: #C7D8CE; }

/* --- playbook editor -------------------------------------------------------- */

.field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field-input { height: 40px; border: 1px solid var(--chip-line); border-radius: 8px; padding: 0 13px; font-size: 13.5px; background: var(--card); width: 100%; outline: none; }
.field-input:focus { outline: 2px solid var(--signal); outline-offset: 2px; }
.field-area { border: 1px solid var(--chip-line); border-radius: 8px; padding: 11px 13px; font-size: 12.5px; line-height: 1.6; background: var(--card); width: 100%; outline: none; resize: vertical; min-height: 80px; }
.field-area:focus { outline: 2px solid var(--signal); outline-offset: 2px; }
.kw-box { min-height: 40px; border: 1px solid var(--chip-line); border-radius: 8px; padding: 6px 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--card); cursor: text; }
.kw-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--mint); border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--pine); }
.kw-chip b { color: var(--ink-2); cursor: pointer; font-weight: 600; }
.kw-box input { border: none; outline: none; background: none; font-size: 12.5px; flex: 1; min-width: 90px; }
.check-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--mid-line); border-radius: 8px; padding: 9px 12px; background: var(--card); }
.check-row:hover { border-color: var(--chip-line-2); }
.check-row.dragging { border: 1.5px solid var(--signal); box-shadow: var(--shadow-2); }
.check-row .grip { font-size: 12px; color: var(--ghost); cursor: grab; letter-spacing: 1px; user-select: none; }
.check-row .no { font: 600 11px var(--mono); color: var(--signal); }
.check-row input { flex: 1; border: none; outline: none; background: none; font-size: 12.5px; color: var(--ink); }
.check-row .x { font-size: 12px; color: var(--faint); cursor: pointer; }
.check-row .x:hover { color: var(--fail); }
.check-add { display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--chip-line); border-radius: 8px; padding: 9px 12px; color: var(--faint); font-size: 12.5px; cursor: pointer; }
.check-add:hover { border-color: var(--signal); color: var(--pine); }
.side-mint { background: var(--mint); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
[data-theme="dark"] .side-mint { background: #16402F; }
.side-mint .t { font-size: 12.5px; font-weight: 700; color: var(--pine); }
.side-mint .b { font-size: 12px; line-height: 1.55; color: var(--ink); }
.sync-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--pine); margin-top: 2px; }
.sync-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); display: inline-block; }

/* --- run history ------------------------------------------------------------- */

.run-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--hairline); }
.run-row:last-of-type { border-bottom: none; }
.run-row.failed { background: var(--fail-bg); }
.run-row .when { font: 500 11px var(--mono); color: var(--slate); width: 96px; flex-shrink: 0; padding-top: 1px; }
.run-row .st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; width: 70px; flex-shrink: 0; }
.run-row .body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.run-row .line { font-size: 12.5px; color: var(--ink); }
.run-row .sub { font-size: 11px; color: var(--faint); }
.run-row .sub .lnk { font-weight: 600; color: var(--pine); border-bottom: 1px solid var(--signal); cursor: pointer; }

/* --- home ---------------------------------------------------------------------- */

.trend-bars { display: flex; align-items: flex-end; gap: 5px; height: 72px; }
.trend-bars > div { flex: 1; background: var(--card-line); border-radius: 3px 3px 0 0; min-height: 4px; }
[data-theme="dark"] .trend-bars > div { background: #24473A; }
.trend-bars > div.now { background: var(--pine); }
[data-theme="dark"] .trend-bars > div.now { background: var(--signal-bright); }
.pine-card-cta { background: #0B2B21; border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
[data-theme="dark"] .pine-card-cta { background: var(--card); border: 1px solid var(--card-line); }
.pine-card-cta .t { font-size: 13.5px; font-weight: 600; color: #F4FAF6; }
[data-theme="dark"] .pine-card-cta .t { color: var(--pine); }
.pine-card-cta .b { font-size: 12px; line-height: 1.55; color: #9DBFAC; }

/* --- empty states ----------------------------------------------------------------- */

.empty-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 40px; text-align: center; }
.empty-title { font: 600 22px var(--serif); color: var(--pine); }
.empty-sub { font-size: 12.5px; line-height: 1.6; color: var(--slate); max-width: 360px; }
.big-mark { position: relative; width: 38px; height: 49px; opacity: .35; }
.big-mark .bowl { position: absolute; left: 0; top: 0; width: 38px; height: 26px; background: var(--dash); border-radius: 13px 0 0 13px; }
.big-mark .s1 { position: absolute; left: 19px; top: 0; width: 6px; height: 49px; background: var(--slate); border-radius: 0 0 4px 4px; }
.big-mark .s2 { position: absolute; left: 31.5px; top: 0; width: 6px; height: 49px; background: var(--slate); border-radius: 0 0 4px 4px; }

/* --- gate (signed out / pending) --------------------------------------------------- */

.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; }
.gate .word { font: 600 34px var(--serif); color: var(--pine); letter-spacing: -0.01em; }
.gbtn { height: 44px; padding: 0 22px; border-radius: 8px; background: var(--pine); color: var(--on-pine); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.gbtn:hover { background: var(--pine-hover); }
[data-theme="dark"] .gbtn { background: var(--signal-bright); color: #0B2B21; }

/* --- misc ---------------------------------------------------------------------------- */

.banner { padding: 9px 16px; text-align: center; font-size: 12.5px; font-weight: 600; background: var(--mint); color: var(--pine); }
.banner.warning { background: var(--sev-high-bg); color: var(--sev-high); }
.banner.ann { position: relative; padding-right: 42px; }
.banner .ann-x { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: none; background: none; border-radius: 6px; color: inherit; opacity: .6; cursor: pointer; font-size: 12px; line-height: 1; }
.banner .ann-x:hover { opacity: 1; background: rgba(11,43,33,.08); }
.md { font-size: 13px; line-height: 1.65; color: var(--ink); }
.md h1, .md h2, .md h3 { font-family: var(--serif); color: var(--pine); line-height: 1.25; margin: 14px 0 6px; }
.md h1 { font-size: 22px; } .md h2 { font-size: 18px; } .md h3 { font-size: 15px; }
.md p { margin: 6px 0; }
.md li { margin: 3px 0; }
.md code { font: 500 12px var(--mono); background: var(--hairline); border-radius: 4px; padding: 1px 5px; }
.md strong { color: var(--pine); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--chip-line); border-top-color: var(--signal); border-radius: 50%; animation: sp 0.7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--pine); color: var(--on-pine); font-size: 12.5px; font-weight: 600; border-radius: 8px; padding: 10px 16px; box-shadow: var(--shadow-2); z-index: 50; }
dialog { border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: var(--shadow-2); padding: 22px; }
dialog::backdrop { background: rgba(11,43,33,.35); }

/* --- assistant (chat workspace) ---------------------------------------------- */
.a-stage { flex: 1; min-width: 0; display: flex; overflow: hidden; }

/* chat rail (264px → 44px collapsed) */
.a-rail { width: 264px; flex-shrink: 0; border-right: 1px solid var(--card-line); background: var(--card); display: flex; flex-direction: column; box-sizing: border-box; }
.a-rail.collapsed { width: 44px; }
.a-railexp { margin: 12px auto; width: 28px; height: 28px; border-radius: 7px; background: none; border: none; color: var(--faint); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.a-railexp:hover { background: var(--paper); }
.a-railexp svg, .a-railcol svg { width: 15px; height: 15px; }
.a-rail-top { padding: 14px 14px 10px; }
.a-newchat { width: 100%; height: 34px; border-radius: 8px; background: var(--pine); color: var(--on-pine); border: none; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; }
.a-newchat:hover { background: var(--pine-hover); }
.a-newchat svg { width: 12px; height: 12px; }
.a-rail-lbl { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 4px 18px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.a-railcol { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--faint); }
.a-railcol:hover { background: var(--paper); }
.a-rail-list { flex: 1; overflow-y: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.a-chat { display: flex; align-items: center; gap: 8px; border-radius: 8px; padding: 9px 10px; cursor: pointer; }
.a-chat:hover { background: var(--paper); }
.a-chat.on { background: var(--mint); }
.a-chat-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-chat-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-chat.on .a-chat-name { color: var(--pine); }
.a-chat-sub { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-chat-del { flex-shrink: 0; width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); visibility: hidden; }
.a-chat-del svg { width: 13px; height: 13px; }
.a-chat:hover .a-chat-del { visibility: visible; }
.a-chat-del:hover { color: var(--fail); background: var(--card); }
.a-rail-empty { padding: 10px 12px; font-size: 12px; color: var(--faint); }
.a-rail-foot { padding: 12px 18px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--hairline); }

/* main column */
.a-main { flex: 1; min-width: 0; display: flex; flex-direction: column; box-sizing: border-box; }

/* empty state */
.a-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; overflow-y: auto; }
.a-empty-col { width: 620px; max-width: 100%; display: flex; flex-direction: column; align-items: center; }
.mark.xl { width: 27px; height: 36px; margin-bottom: 20px; }
.mark.xl .bowl { width: 27px; height: 20px; border-radius: 10px 0 0 10px; }
.mark.xl .s1 { left: 13.5px; width: 4.5px; height: 36px; }
.mark.xl .s2 { left: 22.5px; width: 4.5px; height: 36px; }
.a-empty-title { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.01em; color: var(--pine); margin-bottom: 10px; }
.a-empty-sub { font-size: 14px; line-height: 1.6; color: var(--slate); text-align: center; max-width: 460px; margin-bottom: 24px; }
.a-drop { width: 100%; border: 1.5px dashed var(--dash); border-radius: 14px; background: var(--card); padding: 20px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; cursor: pointer; color: var(--ink-2); font-size: 13px; box-sizing: border-box; }
.a-drop svg { width: 16px; height: 16px; color: var(--slate); }
.a-drop b { color: var(--pine); }
.a-drop:hover, .a-drop.over { border-color: var(--signal); background: var(--paper); }
.a-quickstarts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.a-qs { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.a-qs svg { width: 14px; height: 14px; color: var(--slate); }
.a-qs:hover { border-color: var(--signal); background: var(--paper); color: var(--pine); }
/* width: max-content beats abspos shrink-to-fit (else the tooltip collapses
   to its ~140px chip and wraps into a tall column) */
.a-qs-tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 300px; background: var(--pine); color: var(--on-pine); font-size: 11.5px; font-weight: 500; line-height: 1.45; padding: 7px 11px; border-radius: 8px; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 6; text-align: left; }
.a-qs:hover .a-qs-tip { opacity: 1; }
.a-empty-disc { margin-top: 22px; font-size: 11px; color: var(--faint); text-align: center; }

/* conversation */
.a-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 36px; border-bottom: 1px solid var(--card-line); flex-shrink: 0; }
.a-topbar-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.a-doctitle { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--pine); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Click-to-rename: the pencil rides the title, shown on hover; the inline
   input swaps in place of the span (no dialogs on any surface). */
.a-doctitle.can-edit { cursor: text; display: inline-flex; align-items: center; gap: 7px; border-radius: 6px; padding: 2px 6px; margin-left: -6px; }
.a-doctitle.can-edit svg { width: 12px; height: 12px; color: var(--faint); flex-shrink: 0; visibility: hidden; }
.a-doctitle.can-edit:hover { background: var(--paper); }
.a-doctitle.can-edit:hover svg { visibility: visible; }
.a-doctitle-in { font: 600 18px var(--serif); color: var(--pine); background: var(--card); border: 1px solid var(--signal); border-radius: 6px; padding: 1px 6px; margin-left: -6px; outline: none; min-width: 220px; max-width: 420px; }
.a-chat-ren:hover { color: var(--pine); }
.a-chat-renamein { width: 100%; font: 600 12.5px var(--sans); color: var(--ink); background: var(--card); border: 1px solid var(--signal); border-radius: 6px; padding: 4px 7px; outline: none; box-sizing: border-box; }
.a-jchip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--card-line); border-radius: 99px; padding: 3px 9px; background: var(--card); }
.a-jchip svg { width: 11px; height: 11px; color: var(--slate); }
.a-dlwrap { position: relative; flex-shrink: 0; }
.a-dlbtn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--card-line); background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--pine); cursor: pointer; }
.a-dlbtn svg { width: 13px; height: 13px; }
.a-dlbtn svg:last-child { width: 10px; height: 10px; color: var(--faint); }
.a-dlbtn:hover { background: var(--hairline); }
/* The topbar menu opens DOWNWARD (the composer menus open upward). Compound
   selector on purpose: .a-menu's base rule appears LATER in this sheet, so a
   single-class .a-dlmenu lost every property both declare and the menu took
   the composer menus' bottom-left anchoring, overflowing the clipped .a-stage
   edge (the "white pill / cut-off label" bug). Two classes out-specify it
   regardless of rule order. */
.a-menu.a-dlmenu { bottom: auto; top: calc(100% + 8px); left: auto; right: 0; width: 280px; }
.a-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; justify-content: center; padding: 18px 36px 0; }
.a-thread-col { width: 720px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.a-foot { padding: 10px 36px; display: flex; justify-content: center; flex-shrink: 0; }
.a-foot-col { width: 720px; max-width: 100%; display: flex; flex-direction: column; gap: 6px; }
.a-foot-disc { text-align: center; font-size: 11px; color: var(--faint); }

/* turns */
.a-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.a-filechip { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--card-line); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.a-filechip svg { width: 13px; height: 15px; color: var(--slate); }
.a-filechip b { font-weight: 600; color: var(--pine); }
.a-turn.a-user { display: flex; justify-content: flex-end; }
.a-userbubble { max-width: 440px; background: var(--mint); color: var(--pine); border-radius: 14px 14px 4px 14px; padding: 10px 14px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.a-turn.a-ai { display: flex; }
.a-reply { min-width: 0; width: 100%; display: flex; flex-direction: column; gap: 11px; }
.a-reply .md { font-size: 13.5px; line-height: 1.6; }
.a-reply .md > :first-child { margin-top: 0; }
.a-reply .md > :last-child { margin-bottom: 0; }

/* reply grammar: issue-table chips, numbered redlines, bottom-line band */
.a-reply .md th { background: #FBFDFC; text-transform: none; letter-spacing: .06em; }
.a-pchip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.chip-strong { background: var(--mint); color: var(--pine); }
.chip-partial { padding: 2px 8px; border: 1.5px dashed var(--dash); color: var(--ink-2); }
.chip-weak { background: rgba(192,68,43,.1); color: var(--fail); }
.a-reply .md ol { list-style: none; padding-left: 0; margin: 6px 0; counter-reset: rl; display: flex; flex-direction: column; gap: 9px; }
.a-reply .md ol > li { counter-increment: rl; position: relative; padding-left: 34px; margin: 0; line-height: 1.6; }
.a-reply .md ol > li::before { content: counter(rl); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 99px; background: var(--mint); color: var(--pine); font: 700 11px var(--mono); display: inline-flex; align-items: center; justify-content: center; }
.a-bl { position: relative; background: var(--paper); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.a-bl-num { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--pine); line-height: 1; flex-shrink: 0; white-space: nowrap; }
.a-bl-den { font-size: 14px; color: var(--faint); font-weight: 400; }
.a-bl-rule { width: 1px; align-self: stretch; background: var(--card-line); }
.a-bl-text { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.a-bl-text strong { color: var(--pine); }
.a-bl-copy { position: absolute; top: 10px; right: 10px; display: none; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--card-line); border-radius: 99px; padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--pine); cursor: pointer; box-shadow: var(--shadow-1); }
.a-bl-copy svg { width: 11px; height: 11px; color: var(--slate); }
.a-bl:hover .a-bl-copy { display: inline-flex; }

/* reply footer */
.a-replyfoot { display: flex; align-items: center; gap: 6px; }
.a-src { font-size: 11.5px; color: var(--faint); margin-right: 2px; }
.a-src b { font-weight: 700; color: var(--slate); }
.a-icobtn { width: 26px; height: 26px; border-radius: 7px; border: none; background: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--slate); }
.a-icobtn svg { width: 13px; height: 13px; }
.a-icobtn:hover { background: var(--hairline); }
.a-mockb { margin-left: 2px; }
.a-time { margin-left: auto; font-size: 11px; color: var(--faint); }

/* thinking / uploading status (verbs, not spinners) */
.a-status { display: flex; align-items: center; gap: 10px; color: var(--slate); font-size: 12.5px; }
.a-dots { display: inline-flex; gap: 3px; }
.a-dots i { width: 4px; height: 4px; border-radius: 99px; background: var(--signal); animation: plgDot 1.2s infinite; }
.a-dots i:nth-child(2) { animation-delay: .2s; }
.a-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes plgDot { 0%, 65%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* inline file error */
.a-fileerr { display: flex; align-items: flex-start; gap: 10px; background: var(--card); border: 1px solid var(--sev-critical-line); border-radius: 10px; padding: 10px 12px; }
.a-fileerr-ic { flex-shrink: 0; width: 24px; height: 24px; border-radius: 99px; background: rgba(192,68,43,.1); display: inline-flex; align-items: center; justify-content: center; color: var(--fail); }
.a-fileerr-ic svg { width: 12px; height: 12px; }
.a-fileerr-b { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; }
.a-fileerr-b b { font-size: 12.5px; font-weight: 600; color: var(--pine); }
.a-fileerr-b span { color: var(--slate); line-height: 1.5; }
.a-fileerr-retry { align-self: flex-start; margin-top: 3px; background: none; border: none; padding: 0 0 1px; font-size: 12px; font-weight: 600; color: var(--pine); border-bottom: 1.5px solid var(--signal); cursor: pointer; }

/* composer (shared by empty + conversation) */
.a-comp { position: relative; background: var(--card); border: 1px solid var(--card-line); border-radius: 14px; box-shadow: var(--shadow-2); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 10px; box-sizing: border-box; }
.a-comp textarea { border: none; outline: none; background: none; resize: none; width: 100%; font: 400 13.5px var(--sans); color: var(--ink); min-height: 22px; max-height: 140px; }
.a-comp textarea::placeholder { color: var(--faint); }
/* The toolbar wraps instead of spilling: chips are nowrap and can't shrink,
   so on narrow columns (dock open) they overflowed the card and the send
   button. Send pins to the last row's end. */
.a-comp-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.a-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; row-gap: 5px; min-width: 0; }
.a-tool { height: 30px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.a-tool svg { width: 15px; height: 15px; color: var(--slate); }
.a-tool:hover { background: var(--paper); }
.a-toolsep { width: 1px; height: 16px; background: var(--mid-line); margin: 0 5px; flex-shrink: 0; }
.a-jurpill svg:last-child { width: 10px; height: 10px; color: var(--faint); }
.a-grounded { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; padding: 4px 9px; border: 1.5px dashed var(--dash); border-radius: 99px; font-size: 11px; font-weight: 600; color: var(--slate); cursor: pointer; white-space: nowrap; }
.a-gdot { width: 7px; height: 7px; border-radius: 99px; background: var(--signal); flex-shrink: 0; }
.a-grounded.g-part .a-gdot { background: linear-gradient(90deg, var(--signal) 0 50%, var(--ghost) 50% 100%); }
.a-grounded.g-none .a-gdot, .a-grounded.g-gen .a-gdot { background: var(--ghost); }
.a-send { width: 32px; height: 32px; flex-shrink: 0; border: none; border-radius: 99px; background: var(--pine); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.a-send svg { width: 15px; height: 15px; color: var(--on-pine); }
.a-send:hover { background: var(--pine-hover); }
.a-stopsq { width: 9px; height: 9px; border-radius: 2px; background: var(--on-pine); }

/* Drive-link paste detection: a dismissible offer-to-import chip per unique
   drive.google.com/docs.google.com URL found in the draft. */
.a-drivechips { display: flex; flex-wrap: wrap; gap: 6px; }
.a-drivechips[hidden] { display: none; }
.a-drivechip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 6px 5px 9px; border: 1.5px dashed var(--dash); border-radius: 99px; background: var(--mint); font-size: 12px; color: var(--pine); }
.a-drivechip svg { width: 13px; height: 13px; color: var(--pine); flex-shrink: 0; }
.a-drivechip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-drivechip-t b { font-weight: 600; }
.a-drivechip-x { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 99px; color: var(--pine); cursor: pointer; }
.a-drivechip-x svg { width: 9px; height: 9px; }
.a-drivechip-x:hover { background: var(--card); }

/* popovers: jurisdiction menu + disclosure legend */
.a-menu { position: absolute; bottom: calc(100% + 8px); left: 8px; z-index: 20; background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; display: flex; flex-direction: column; }
.a-menu[hidden] { display: none; }
.a-jurmenu { width: 240px; max-height: 300px; overflow-y: auto; }
.a-menu-h { padding: 6px 10px 2px; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.a-menu-sub { padding: 0 10px 6px; font-size: 11px; color: var(--faint); border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
.a-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; padding: 5px 10px; border-radius: 6px; font-size: 12.5px; line-height: 1.35; color: var(--ink); cursor: pointer; }
.a-menu-item svg { width: 12px; height: 12px; color: var(--pine); flex-shrink: 0; }
.a-menu-item:hover { background: var(--paper); }
.a-menu-item.on { background: var(--mint); color: var(--pine); font-weight: 600; }
.a-menu.a-drivemenu { width: 360px; max-width: calc(100vw - 48px); }
.a-driverow { display: flex; gap: 6px; padding: 8px 10px 6px; }
.a-driverow input { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--card-line); border-radius: 8px; padding: 0 10px; font: 400 12.5px var(--sans); background: var(--paper); color: var(--ink); }
.a-driverow input:focus { outline: none; border-color: var(--pine); }
.a-driverow input::placeholder { color: var(--faint); }
.a-drivego { height: 32px; padding: 0 14px; flex-shrink: 0; border: none; border-radius: 8px; background: var(--pine); color: var(--on-pine); font: 600 12.5px var(--sans); cursor: pointer; }
.a-drivego:hover { background: var(--pine-hover); }
[data-theme="dark"] .a-drivego { background: var(--signal-bright); color: #0B2B21; }
.a-legend { width: 300px; padding: 12px 14px; }
.a-lg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.a-lg-title { font-size: 13px; font-weight: 700; color: var(--pine); }
.a-lg-jur { font-family: var(--serif); font-size: 14px; color: var(--slate); }
.a-lg-sub { font-size: 11px; color: var(--faint); margin: 3px 0 9px; }
.a-lg-keys { display: flex; flex-wrap: wrap; gap: 10px 14px; padding-bottom: 9px; border-bottom: 1px solid var(--hairline); }
.a-lg-key, .a-lg-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--slate); }
.a-lg-key i, .a-lg-state i { width: 9px; height: 9px; border-radius: 99px; flex-shrink: 0; box-sizing: border-box; }
.st-full i { background: var(--signal); }
.st-cite i { border: 1.5px solid var(--signal); background: linear-gradient(90deg, var(--signal) 0 50%, transparent 50% 100%); }
.st-none i { border: 1.5px solid var(--ghost); }
.a-lg-rows { display: flex; flex-direction: column; padding: 8px 0 0; }
.a-lg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 26px; font-size: 12px; }
.a-lg-cat { color: var(--ink); }
.a-lg-state { font-weight: 600; color: var(--ink-2); }
.a-lg-jurnote { margin-top: 8px; padding: 8px 10px; background: var(--paper); border-radius: 7px; font-size: 11px; line-height: 1.45; color: var(--slate); }
.a-lg-general { padding: 10px 0 2px; font-size: 12px; line-height: 1.5; color: var(--slate); }
.a-lg-foot { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--hairline); font-size: 11px; color: var(--faint); }

.md ul { padding-left: 20px; } .md ul li { margin: 3px 0; }

/* dark: chips retune, tables on deep, send flips to signal green */
[data-theme="dark"] .a-reply .md th { background: #0F3327; }
[data-theme="dark"] .chip-strong { background: #16402F; color: var(--signal-bright); }
[data-theme="dark"] .chip-weak { background: rgba(214,110,90,.16); color: #E7A594; }
[data-theme="dark"] .a-bl { background: var(--card); border: 1px solid var(--card-line); }
[data-theme="dark"] .a-send { background: var(--signal-bright); }
[data-theme="dark"] .a-send svg { color: #0B2B21; }
[data-theme="dark"] .a-stopsq { background: #0B2B21; }
[data-theme="dark"] .a-reply .md th { color: var(--slate); }

/* markdown tables (assistant + reports) */
.md-tblwrap { overflow-x: auto; margin: 10px 0; border: 1px solid var(--card-line); border-radius: 8px; }
.md table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.md th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); background: var(--hairline); padding: 8px 12px; }
.md td { padding: 8px 12px; border-top: 1px solid var(--hairline); vertical-align: top; line-height: 1.55; }
.md ol { padding-left: 20px; } .md ol li { margin: 6px 0; }

/* Failed-turn retry card + queued-message bubble (chat robustness, 2026-07-28) */
.a-sendfail { display: flex; align-items: center; gap: 10px; background: var(--fail-bg); border: 1px solid var(--sev-critical-line); border-radius: 12px; padding: 10px 14px; font-size: 12.5px; line-height: 1.5; color: var(--ink); max-width: 560px; }
.a-sendfail svg { width: 15px; height: 15px; color: var(--fail); flex-shrink: 0; }
.a-sendfail b { color: var(--fail); }
.a-retrybtn { margin-left: auto; flex-shrink: 0; height: 28px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--sev-critical-line); background: var(--card); color: var(--fail); font-size: 12px; font-weight: 700; cursor: pointer; }
.a-retrybtn:hover { background: var(--fail-bg); }
.a-userbubble.a-pending { opacity: .55; }

/* Assistant mode pill + menu (review analyst vs dispute counsel, 2026-07-28) */
.a-modepill.dispute { color: var(--sev-critical); border-color: var(--sev-critical-line); background: var(--sev-critical-bg); border: 1px solid var(--sev-critical-line); border-radius: 99px; padding: 3px 9px; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; }
.a-modepill.dispute svg { color: var(--sev-critical); width: 11px; height: 11px; }
.a-menu.a-modemenu { width: 320px; }
.a-modemenu .a-menu-item { min-height: 44px; align-items: flex-start; padding: 8px 10px; }
.a-modemenu .a-menu-item > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.a-mode-sub { font-size: 11px; color: var(--faint); font-weight: 400; line-height: 1.4; }

/* Dispute run card (M0) — stage list + readiness gate, embedded at the top of
   the thread when a dispute-mode chat has (or could start) an active run.
   Patched in place by app.js's renderRunCard(); never routed through the
   page-wide paint(), so a poll tick never steals composer focus. */
.a-run { border: 1px solid var(--card-line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-1); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.a-run-hd { display: flex; align-items: center; gap: 10px; }
.a-run-title { font-size: 14px; font-weight: 700; color: var(--pine); }
.a-run-status { font-size: 12px; font-weight: 600; color: var(--slate); }
.a-run-credits { margin-left: auto; font: 500 11.5px var(--mono); color: var(--slate); }
.a-run-cancel { font-size: 11.5px; font-weight: 600; color: var(--faint); border-bottom: 1px solid transparent; cursor: pointer; }
.a-run-cancel:hover { color: var(--fail); border-color: var(--fail); }

.a-run-lede { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.a-run-startbtn { align-self: flex-start; height: 34px; padding: 0 16px; border-radius: 8px; border: none; background: var(--pine); color: var(--on-pine); font-size: 13px; font-weight: 700; cursor: pointer; }
.a-run-startbtn:hover { background: var(--pine-hover); }
.a-run-startbtn:disabled { opacity: .6; cursor: default; }

.a-run-stages { display: flex; flex-direction: column; gap: 8px; }
.a-run-stage { border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.a-run-stage-row { display: flex; align-items: center; gap: 12px; }
.a-run-stage-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.a-run-stage-title { font-size: 13px; font-weight: 600; color: var(--pine); }
.a-run-stage-sub { font-size: 11.5px; color: var(--slate); }
.a-run-stage-trail { flex-shrink: 0; font: 500 11px var(--mono); color: var(--faint); }

.a-run-ic { flex-shrink: 0; width: 24px; height: 24px; border-radius: 99px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
.a-run-ic svg { width: 12px; height: 12px; }
.a-run-ic.ok { background: var(--mint); color: var(--signal); }
/* Running = a rotating arc (prototype), never a static dot: this is the only
   signal the agent is alive during a long model call with no item counters. */
.a-run-ic.running { border: 2.5px solid var(--mint); border-top-color: var(--signal); animation: sp .9s linear infinite; }
.a-run-ic.pending, .a-run-ic.skipped { border: 1.5px dashed var(--ghost); color: var(--faint); }
.a-run-ic.fail { background: var(--fail-bg); color: var(--fail); }

.a-run-stage.s-running { border-color: var(--signal); box-shadow: var(--shadow-1); }
.a-run-stage.s-running .a-run-stage-sub { color: var(--signal); font-weight: 600; }
.a-run-stage.s-pending { background: var(--paper); border-color: var(--hairline); }
.a-run-stage.s-pending .a-run-stage-title { color: var(--ink-2); }
.a-run-stage.s-skipped { background: var(--paper); border-color: var(--hairline); opacity: .75; }
.a-run-stage.s-failed, .a-run-stage.s-interrupted { border-color: var(--fail); background: var(--fail-bg); }
.a-run-stage.s-failed .a-run-stage-sub, .a-run-stage.s-interrupted .a-run-stage-sub { color: var(--fail); }

.a-run-bar { height: 4px; border-radius: 2px; background: var(--mint); overflow: hidden; margin-left: 36px; }
.a-run-bar-fill { height: 4px; border-radius: 2px; background: var(--signal); }

/* Readiness gate — ONE card, hairline-separated rows, resolved rows lead,
   open gaps on the High-ink tint, the draft footer inside (d2g/d2h). */
.a-run-gaps { display: flex; flex-direction: column; border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); overflow: hidden; }
.a-gap { display: flex; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--hairline); }
.a-gap-missing { background: var(--sev-high-bg); }
.a-gap-done, .a-gap-waived { align-items: center; }
.a-gap-ic { flex-shrink: 0; margin-top: 1px; width: 20px; height: 20px; border-radius: 99px; border: 1.5px dashed var(--sev-high); box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; font: 700 11px var(--sans); color: var(--sev-high); }
.a-gap-done .a-gap-ic { margin-top: 0; border: none; background: var(--mint); }
.a-gap-done .a-gap-ic svg { width: 11px; height: 11px; }
.a-gap-waived .a-gap-ic { margin-top: 0; border-color: var(--ghost); color: var(--faint); }
.a-gap-waived .a-gap-ic svg { width: 9px; height: 9px; }
.a-gap-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-gap-label { font-size: 13px; font-weight: 600; color: var(--pine); }
.a-gap-why { font-size: 11.5px; line-height: 1.5; color: var(--slate); }
.a-gap-actions { margin-top: 7px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.a-gap-waive, .a-gap-supply { height: 30px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--card-line); background: var(--card); color: var(--pine); font-size: 11.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.a-gap-waive:hover { background: var(--paper); }
.a-gap-supply { border: none; background: var(--pine); color: var(--on-pine); }
.a-gap-supply:hover { background: var(--pine-hover); }
.a-gap-waive svg, .a-gap-supply svg { width: 12px; height: 12px; flex-shrink: 0; }
.a-gap-opnote { margin-top: 5px; font-size: 11.5px; line-height: 1.5; color: var(--pine); background: var(--mint); border-radius: 7px; padding: 5px 9px; align-self: flex-start; }
.a-gap-opnote .a-gap-undo { margin-left: 6px; }
.a-gap-opnote-sub { display: block; margin-top: 2px; font-size: 10.5px; color: var(--slate); }
/* Optional gaps: visible, never blocking — quieter than the High-ink rows. */
.a-gap-optional { background: var(--paper); }
.a-gap-ic.opt { border-color: var(--ghost); color: var(--faint); }
.a-gap-optpill { font-size: 10px; font-weight: 600; color: var(--faint); border: 1px dashed var(--chip-line); border-radius: 99px; padding: 2px 8px; margin-left: 7px; vertical-align: 1px; white-space: nowrap; }
.a-run-gaps .a-run-foot { padding: 12px 18px; border-top: 1px solid var(--hairline); }
.a-gap-undo { align-self: center; font-size: 11px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--card-line); cursor: pointer; }

.a-run-foot { display: flex; align-items: center; gap: 12px; }
.a-run-draftbtn { height: 34px; padding: 0 16px; border-radius: 8px; border: none; background: var(--pine); color: var(--on-pine); font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; }
.a-run-draftbtn svg { width: 12px; height: 12px; }
.a-run-draftbtn:hover { background: var(--pine-hover); }
.a-run-draftbtn.locked { background: var(--mint); color: var(--faint); cursor: not-allowed; }
.a-run-foot-note { font-size: 11.5px; color: var(--slate); }

.a-run-src { border: 1px solid var(--card-line); border-radius: 10px; overflow: hidden; }
.a-run-src-head, .a-run-src-row { display: grid; grid-template-columns: 1fr 80px 80px; gap: 8px; padding: 8px 12px; font-size: 12px; }
.a-run-src-head { background: var(--paper); font-weight: 700; color: var(--slate); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
.a-run-src-row { border-top: 1px solid var(--hairline); color: var(--ink); }
.a-run-src-n { text-align: right; font: 500 12px var(--mono); color: var(--ink-2); }
.a-run-src-warn { padding: 6px 12px; font-size: 11px; color: var(--sev-high); background: var(--sev-high-bg); }

.a-run-caption { font-size: 11px; color: var(--faint); }

/* Letter review + verification (d1j/d2j) and the scoped redraft (d1k/d2k).
   The paper page keeps its own tokens in both themes: it is the document that
   gets sent, so it is ink on white wherever you read it. Everything around it
   re-inks with the app. */
.lt-stage { flex: 1; min-width: 0; display: flex; overflow: hidden; }
.lt-doc { flex: 1.2; min-width: 0; border-right: 1px solid var(--card-line); display: flex; flex-direction: column; background: var(--letter-well); }
.lt-dochd { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 22px; background: var(--card); border-bottom: 1px solid var(--card-line); }
.lt-dochd-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lt-back { flex-shrink: 0; height: 28px; padding: 0 11px 0 8px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--chip-line); border-radius: 8px; background: var(--paper); color: var(--pine); font-size: 12px; font-weight: 600; cursor: pointer; }
.lt-back:hover { background: var(--mint); border-color: var(--chip-line-2); }
.lt-back svg { width: 12px; height: 12px; }
.lt-ver { font-size: 12.5px; font-weight: 600; color: var(--pine); }
.lt-lstatus { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 99px; padding: 3px 9px; border: 1px solid var(--chip-line); color: var(--slate); }
.lt-lstatus.s-verified, .lt-lstatus.s-final { color: var(--signal); border-color: var(--signal); }
.lt-lstatus.s-blocked { color: var(--fail); border-color: var(--fail); background: var(--fail-bg); }
.lt-changenote { font-size: 11px; color: var(--faint); flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* min-width: 0 is load-bearing: without it the fixed-width paper refuses to
   shrink and PUSHES the review rail off the viewport on laptop widths (the
   stage then clips it — a cut-off rail, live find 2026-08-18). */
.lt-well { flex: 1; min-width: 0; overflow-y: auto; display: flex; justify-content: center; padding: 22px 30px 40px; position: relative; }
/* Select-to-comment (d2j): the chip rides the highlight, the panel replaces it. */
.lt-selchip { position: absolute; z-index: 6; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border: none; border-radius: 8px; background: var(--pine); color: var(--on-pine); font-size: 11.5px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-2); }
.lt-selchip:hover { background: var(--pine-hover); }
.lt-selchip svg { width: 12px; height: 12px; }
.lt-selpanel { position: absolute; z-index: 6; width: 380px; max-width: calc(100% - 32px); background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 12px; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box; }
.lt-selquote { font-family: var(--serif, Georgia, serif); font-style: italic; font-size: 12px; line-height: 1.55; color: var(--slate); border-left: 2px solid var(--signal); padding-left: 9px; }
.lt-selpanel textarea { border: 1px solid var(--card-line); border-radius: 8px; background: var(--card); color: var(--ink); font: 400 12.5px var(--sans); padding: 8px 10px; resize: vertical; outline: none; }
.lt-selpanel textarea:focus { border-color: var(--signal); }
.lt-selrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lt-selnote { font-size: 10.5px; color: var(--faint); flex-basis: 100%; }
.lt-redraft.lt-blocked { background: var(--sev-high-bg); border-color: var(--sev-high-line); }
.lt-redraft.lt-blocked .lt-redraft-t b { color: var(--sev-high); }
.lt-paper { width: 600px; max-width: 100%; flex-shrink: 0; align-self: flex-start; background: var(--letter-paper); border-radius: 3px; box-shadow: var(--shadow-2); padding: 40px 54px 34px; box-sizing: border-box; font-family: var(--serif); color: var(--letter-ink); }
/* The .md tree is themed for the app's surfaces; on paper every one of those
   inks has to be re-stated, or the dark theme writes white text on white. */
.lt-paper .md { font-size: 12.5px; line-height: 1.68; color: var(--letter-ink); }
.lt-paper .md h1, .lt-paper .md h2, .lt-paper .md h3, .lt-paper .md strong { color: var(--letter-ink); }
.lt-paper .md h1 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.lt-paper .md h2, .lt-paper .md h3 { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; margin: 0 0 8px; }
.lt-paper .md p { margin: 0 0 14px; }
.lt-paper .md code { background: var(--letter-quote-bg); color: var(--letter-ink); }
.lt-paper .md table { font-size: 11.5px; }
.lt-paper .md th { background: var(--letter-quote-bg); color: var(--letter-ink); }
.lt-paper .md td, .lt-paper .md th { border-color: var(--letter-quote-bg); }
.lt-paper .md-tblwrap { border-color: var(--letter-quote-bg); }
/* Verbatim evidence: their words, or the contract's, reproduced exactly. It
   reads differently from our prose because it IS different in kind. */
.lt-q { background: var(--letter-quote-bg); box-shadow: 0 0 0 1px var(--letter-quote-line) inset; border-radius: 4px; padding: 1px 4px; }

.lt-sec { position: relative; }
.lt-sec.redrafting { opacity: .55; background: var(--letter-dim); border-radius: 6px; margin: 0 -14px 14px; padding: 8px 14px; }
.lt-redraft-badge { position: absolute; top: -9px; right: 10px; font: 700 9.5px var(--sans); letter-spacing: .05em; background: var(--letter-pin); color: var(--letter-pin-ink); border-radius: 99px; padding: 3px 9px; }
.lt-pins { position: absolute; left: -38px; top: 2px; display: flex; flex-direction: column; gap: 5px; }
.lt-pin { width: 22px; height: 22px; border-radius: 99px; background: var(--letter-pin); color: var(--letter-pin-ink); display: inline-flex; align-items: center; justify-content: center; font: 700 11px var(--mono); box-shadow: 0 4px 10px rgba(11,43,33,.3); cursor: pointer; }
.lt-pin:hover { background: var(--letter-quote-line); }
.lt-pin.settled { background: var(--letter-quote-bg); color: var(--letter-ink-dim); box-shadow: 0 0 0 1px var(--letter-quote-line) inset; }

.lt-redraft { display: flex; align-items: center; gap: 12px; padding: 11px 22px; background: var(--card); border-bottom: 1px solid var(--card-line); }
.lt-redraft-t { font-size: 12.5px; color: var(--ink); }
.lt-redraft-t b { color: var(--pine); }
.lt-redraft-v { margin-left: auto; flex-shrink: 0; font: 500 11px var(--mono); color: var(--faint); }
.lt-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 380px; font-size: 12.5px; color: var(--slate); }
.lt-empty b { font-size: 15px; color: var(--pine); }

.lt-rail { width: clamp(340px, 32vw, 470px); flex-shrink: 0; display: flex; flex-direction: column; background: var(--paper); box-sizing: border-box; }
.lt-rail-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 20px; border-bottom: 1px solid var(--card-line); }
.lt-rail-title { font: 600 16px var(--serif); color: var(--pine); }
.lt-vchip { font-size: 11.5px; font-weight: 600; border-radius: 99px; padding: 3px 9px; border: 1.5px dashed var(--dash); color: var(--slate); }
.lt-vchip.pass { color: var(--signal); border-style: solid; border-color: var(--signal); }
.lt-vchip.fail { color: var(--sev-high); border-color: var(--sev-high); }
.lt-rail-body { flex: 1; overflow-y: auto; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.lt-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.lt-none { font-size: 12px; line-height: 1.55; color: var(--slate); }

.lt-flag { border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.lt-flag.settled { background: var(--paper); }
.lt-flag.lit { border-color: var(--signal); box-shadow: var(--shadow-2); }
.lt-flag-top { display: flex; gap: 10px; align-items: flex-start; }
.lt-flag-n { flex-shrink: 0; width: 20px; height: 20px; border-radius: 99px; background: var(--mint); color: var(--signal); display: inline-flex; align-items: center; justify-content: center; font: 700 10px var(--mono); }
.lt-flag-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lt-flag-title { font-size: 13px; font-weight: 600; color: var(--pine); }
.lt-flag-detail { font-size: 11.5px; line-height: 1.55; color: var(--slate); white-space: pre-wrap; }
.lt-flag-q { font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.lt-flag-note { padding-left: 30px; font-size: 10.5px; line-height: 1.45; color: var(--faint); }
.lt-kind { flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 99px; padding: 3px 8px; border: 1px solid var(--chip-line); color: var(--slate); }
.lt-kind.redrafts { color: var(--signal); border-color: var(--chip-line-2); background: var(--mint); }

/* The agent's recommended answer: offered as its own act, above the free-text
   line, so accepting it is a decision the operator makes rather than a default
   they fail to notice. */
.lt-rec { margin-left: 30px; border: 1px solid var(--chip-line-2); border-left: 3px solid var(--signal); border-radius: 8px; background: var(--mint); padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; }
.lt-rec-lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--signal); }
.lt-rec-t { font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.lt-rec .lt-btn { align-self: flex-start; }
.lt-rec .lt-btn.primary:hover { background: var(--signal-bright-hover); }

.lt-answer { display: flex; gap: 8px; padding-left: 30px; }
.lt-answer-in { flex: 1; min-width: 0; height: 28px; padding: 0 10px; border: 1px solid var(--mid-line); border-radius: 8px; background: var(--paper); font-size: 12px; color: var(--ink); outline: none; }
.lt-answer-in:focus { border-color: var(--signal); }
.lt-settled { display: flex; align-items: baseline; gap: 8px; padding-left: 30px; }
.lt-settled-t { flex: 1; font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.lt-btn { flex-shrink: 0; height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--chip-line); background: var(--card); color: var(--pine); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.lt-btn:hover { background: var(--mint); }
.lt-btn.primary { border-color: var(--signal); background: var(--signal); color: var(--on-pine); font-weight: 700; }
.lt-btn.primary:hover { background: var(--signal-bright-hover); }
.lt-btn.wide { height: 34px; width: 100%; font-size: 12.5px; }
.lt-btn.locked { background: var(--mint); border-color: var(--mint); color: var(--faint); cursor: not-allowed; }

.lt-prop { margin-left: 30px; border: 1px dashed var(--chip-line-2); border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 5px; background: var(--paper); }
.lt-prop-n { font: 600 11px var(--mono); color: var(--signal); }
.lt-prop-t { font-size: 12px; line-height: 1.5; color: var(--ink); }
.lt-prop-a { font-size: 10.5px; color: var(--faint); }
.lt-prop .lt-btn { align-self: flex-start; }

.lt-redraftfoot { display: flex; flex-direction: column; gap: 6px; }
.lt-foot-note { font-size: 10.5px; line-height: 1.5; color: var(--slate); }

.lt-vbox { border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); overflow: hidden; }
.lt-vrow { display: flex; align-items: flex-start; gap: 9px; padding: 9px 14px; border-top: 1px solid var(--hairline); }
.lt-vrow:first-child { border-top: none; }
.lt-vic { flex-shrink: 0; margin-top: 2px; }
.lt-vic svg { width: 12px; height: 12px; }
.lt-vrow.ok .lt-vic { color: var(--signal); }
.lt-vrow.pending .lt-vic { color: var(--faint); }
.lt-vrow.warn { background: var(--sev-high-bg); }
.lt-vrow.warn .lt-vic { color: var(--sev-high); }
.lt-vrow.block { background: var(--fail-bg); }
.lt-vrow.block .lt-vic { color: var(--fail); }
.lt-vtxt { font-size: 12px; line-height: 1.5; color: var(--ink); }
.lt-vrow.block .lt-vtxt b { color: var(--fail); }
.lt-vrow.warn .lt-vtxt b { color: var(--sev-high); }
.lt-vmatch { display: block; margin-top: 3px; font: 500 11px var(--mono); color: var(--slate); word-break: break-word; }

.lt-export { padding: 14px 20px 16px; border-top: 1px solid var(--card-line); display: flex; flex-direction: column; gap: 7px; }
.lt-exportbtn { height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 9px; background: var(--signal); color: var(--on-pine); font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; }
.lt-exportbtn:hover { background: var(--signal-bright-hover); }
.lt-exportbtn.locked { background: var(--mint); color: var(--faint); cursor: not-allowed; }
.lt-exportbtn svg { width: 13px; height: 13px; }
.lt-export-note { text-align: center; font-size: 10.5px; line-height: 1.5; color: var(--slate); }

/* Below 1180 the rail stops being a column and stacks under the letter, so
   the paper page never narrows past a readable measure. */
@media (max-width: 1180px) {
  .lt-stage { flex-direction: column; overflow-y: auto; }
  .lt-doc { border-right: none; border-bottom: 1px solid var(--card-line); }
  .lt-rail { width: 100%; }
  .lt-well { padding: 18px 16px 24px; }
  .lt-pins { left: 6px; top: -10px; flex-direction: row; }
}

/* Doctrines tab under Playbooks (d1l/d2l) — same rows, same editing grammar as
   the playbook checklist. */
.pb-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--card-line); margin-top: -8px; }
.pb-tab { padding: 8px 14px; font-size: 12.5px; font-weight: 600; color: var(--slate); cursor: pointer; border-bottom: 2px solid transparent; }
.pb-tab:hover { color: var(--pine); }
.pb-tab.on { font-weight: 700; color: var(--pine); border-bottom-color: var(--signal); }

.dc-wrap { max-width: 860px; display: flex; flex-direction: column; gap: 10px; }
.dc-lede { font-size: 12px; line-height: 1.55; color: var(--slate); }
.dc-ro { font-size: 11.5px; color: var(--sev-high); background: var(--sev-high-bg); border: 1px solid var(--sev-high-line); border-radius: 8px; padding: 8px 12px; }
.dc-packs { display: flex; gap: 6px; flex-wrap: wrap; }
.dc-pack { font-size: 12px; font-weight: 600; color: var(--slate); border: 1px solid var(--chip-line); border-radius: 99px; padding: 5px 12px; cursor: pointer; }
.dc-pack.on { color: var(--pine); border-color: var(--signal); background: var(--mint); }
.dc-pack b { font: 700 9px var(--sans); letter-spacing: .04em; color: var(--faint); }

.dc-createbar { max-width: 860px; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); }
.dc-createname { flex: 1; min-width: 0; border: none; outline: none; background: none; font-size: 13.5px; font-weight: 600; color: var(--pine); font-family: var(--sans); }
.dc-createname::placeholder { font-weight: 400; color: var(--faint); }
.dc-createname:focus { border-bottom: 1px solid var(--signal); }

.dc-box { border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); overflow: hidden; }
.dc-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--hairline); }
.dc-row:first-child { border-top: none; }
.dc-row.off { opacity: .6; }
.dc-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dc-name { border: none; outline: none; background: none; font-size: 13.5px; font-weight: 600; color: var(--pine); }
.dc-rule { border: none; outline: none; background: none; font-size: 11.5px; color: var(--slate); }
.dc-name:focus, .dc-rule:focus { border-bottom: 1px solid var(--signal); }
.dc-where { width: 190px; flex-shrink: 0; font-size: 10.5px; line-height: 1.4; color: var(--faint); }
.dc-aud { flex-shrink: 0; height: 26px; border: 1px solid var(--mid-line); border-radius: 7px; background: var(--card); color: var(--ink); font-size: 11.5px; font-family: var(--sans); }
.dc-toggle { flex-shrink: 0; width: 34px; height: 20px; border-radius: 99px; background: var(--mint); border: 1px solid var(--chip-line); box-sizing: border-box; position: relative; cursor: pointer; }
.dc-toggle i { position: absolute; left: 2px; top: 1.5px; width: 15px; height: 15px; border-radius: 99px; background: var(--faint); transition: left .12s, background .12s; }
.dc-toggle.on { background: var(--signal); border-color: var(--signal); }
.dc-toggle.ro { cursor: default; opacity: .55; }
.dc-toggle.on i { left: 16px; background: var(--on-pine); }
.dc-row .x { flex-shrink: 0; font-size: 12px; color: var(--faint); cursor: pointer; }
.dc-row .x:hover { color: var(--fail); }
.dc-none { border: 1px dashed var(--chip-line); border-radius: 12px; padding: 18px; font-size: 12.5px; color: var(--slate); }
.dc-foot { display: flex; align-items: center; gap: 12px; }
.dc-cap { flex: 1; font-size: 11px; line-height: 1.5; color: var(--faint); }

/* Inline confirm/input replacements for the native browser dialogs
   (ratified UX 2026-08-17: no prompt()/confirm() on product surfaces). */
.a-run-confirm { display: inline-flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--slate); }
.a-run-cancel.danger { color: var(--fail); border-color: var(--fail); }
.a-gap-waiverow { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.a-gap-notein { flex: 1; min-width: 120px; border: none; outline: none; background: none; font-size: 11.5px; color: var(--ink); border-bottom: 1px solid var(--mid-line); padding: 2px 0; font-family: var(--sans); }
.a-gap-notein:focus { border-bottom-color: var(--signal); }
.a-chat-delconfirm { flex-shrink: 0; font-size: 10.5px; color: var(--slate); display: inline-flex; gap: 6px; align-items: center; }
.a-chat-delconfirm b { cursor: pointer; font-weight: 700; }
.a-chat-delconfirm b:first-of-type { color: var(--fail); }
.dc-removeconfirm { flex-shrink: 0; font-size: 10.5px; display: inline-flex; gap: 6px; }
.dc-removeconfirm b { cursor: pointer; font-weight: 700; color: var(--slate); }
.dc-removeconfirm b:first-of-type { color: var(--fail); }
.lt-prop-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; color: var(--slate); }

/* Letter-page view tabs + reserve annex (ratified trigger deployment 2026-08-17). */
.lt-viewtabs { display: inline-flex; gap: 2px; border: 1px solid var(--chip-line); border-radius: 8px; padding: 2px; }
.lt-viewtab { border: none; background: none; font: 600 11.5px var(--sans); color: var(--slate); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.lt-viewtab.on { background: var(--mint); color: var(--pine); }
.lt-annexpaper { font-size: 13px; }
.lt-invbanner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--sev-high-line); background: var(--sev-high-bg); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; font-size: 12px; color: var(--ink); }
.lt-invchip { font: 700 10.5px var(--sans); letter-spacing: .02em; color: var(--sev-high); border: 1px solid var(--sev-high-line); border-radius: 99px; padding: 3px 10px; background: var(--card); }
.lt-invnote { flex-basis: 100%; font-size: 11px; color: var(--slate); }

/* Design parity round (d1d/d1e/d1f/d1g/d1i/d1m), 2026-08-17. */
.a-est { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--hairline); }
.a-est-hd { display: flex; align-items: baseline; gap: 8px; }
.a-est-total { font: 600 26px var(--serif, Georgia, serif); color: var(--pine); }
.a-est-cap { font-size: 11.5px; color: var(--slate); }
.a-est-row { display: flex; align-items: center; gap: 10px; }
.a-est-name { width: 160px; flex-shrink: 0; font-size: 12px; color: var(--ink); }
.a-est-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--mint); overflow: hidden; }
.a-est-bar i { display: block; height: 100%; background: var(--signal); border-radius: 99px; }
.a-est-n { width: 44px; text-align: right; font: 600 11px ui-monospace, Menlo, monospace; color: var(--slate); }
.a-est-note { font-size: 11px; color: var(--faint); margin: 4px 0 2px; }
.a-dpick { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px; border-top: 1px solid var(--hairline); }
.a-dpick-hd { font-weight: 600; font-size: 13px; color: var(--pine); }
.a-dpick-sub { font-size: 11px; color: var(--slate); margin-bottom: 4px; }
.a-dpick-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; cursor: pointer; }
.a-dpick-row.off .a-dpick-name { color: var(--faint); }
.a-dpick-meta { font-size: 11px; color: var(--faint); }
.a-gate-hd { display: flex; align-items: center; gap: 8px; padding: 12px 18px 8px; font-weight: 600; font-size: 12.5px; color: var(--pine); }
.a-gate-hd > span { white-space: nowrap; }
.a-gate-count { font-size: 11px; color: var(--slate); font-weight: 500; }
.a-gate-meter { display: flex; gap: 3px; margin-left: auto; min-width: 0; flex-shrink: 1; }
.a-gate-meter i { flex: 0 1 18px; min-width: 4px; height: 5px; border-radius: 99px; background: var(--mint); }
.a-gate-meter i.on { background: var(--signal); }
.a-run-failfoot .a-run-foot-note { color: var(--sev-high); }
.a-run-matrixlink { margin: 4px 18px 8px; align-self: flex-start; border: none; background: none; font: 600 12px var(--sans); color: var(--signal); cursor: pointer; border-bottom: 1px solid transparent; padding: 0; }
.a-run-matrixlink:hover { border-color: var(--signal); }
.mx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 14px; }
.mx-chip { border: 1px solid var(--chip-line); background: var(--card); border-radius: 99px; padding: 5px 12px; font: 600 12px var(--sans); color: var(--slate); cursor: pointer; }
.mx-chip b { font-weight: 700; color: var(--faint); margin-left: 3px; }
.mx-chip.on { background: var(--pine); color: #fff; border-color: var(--pine); }
.mx-chip.on b { color: rgba(255,255,255,.7); }
.mx-chip.internal { border-style: dashed; border-color: var(--sev-high-line); color: var(--sev-high); }
.mx-chip.internal.on { background: var(--sev-high-bg); color: var(--sev-high); }
.mx-intmark { font-size: 11px; color: var(--sev-high); }
.mx-viewnote { flex-basis: 100%; font-size: 11px; color: var(--faint); }
.mx-tablewrap { overflow-x: auto; border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); }
.mx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mx-table th { text-align: left; font: 600 10.5px var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
.mx-table td { padding: 10px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.mx-table tr:last-child td { border-bottom: none; }
.mx-quote { font-family: var(--serif, Georgia, serif); font-style: italic; border-left: 2px solid var(--chip-line); padding-left: 10px !important; max-width: 420px; }
.mx-internal { background: var(--sev-high-bg); }
.mx-internal .mx-quote { border-left-color: var(--sev-high); }
.mx-pill { display: inline-flex; align-items: center; gap: 4px; font: 600 10.5px var(--sans); border-radius: 99px; padding: 3px 9px; background: var(--mint); color: var(--pine); white-space: nowrap; }
.mx-pill.internal { background: var(--sev-high-bg); color: var(--sev-high); border: 1px dashed var(--sev-high-line); }
.mx-pill.demand { background: var(--sev-high-bg); color: var(--sev-high); }
.mx-src { font-size: 11.5px; color: var(--slate); }
.mx-meta { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.mx-us { color: var(--sev-high); }
.mx-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 11.5px; color: var(--slate); }
.dc-starter { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 460px; }
.dc-starter-row { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--card-line); border-radius: 9px; padding: 8px 12px; text-align: left; background: var(--card); }
.dc-starter-row b { font-size: 12.5px; color: var(--pine); }
.dc-starter-row span { font-size: 11px; color: var(--slate); }
.mx-foot svg { width: 15px; height: 15px; flex-shrink: 0; }
.a-gate-hd svg { width: 13px; height: 13px; flex-shrink: 0; }

/* One-to-one parity round 2 (d2a dock + case chips, d2e telemetry, d2f
   failure card, d2g outcomes, d2j checklist), 2026-08-18. */
.a-hdpill { margin-left: 10px; }
.a-casechips { display: flex; align-items: center; gap: 8px; margin-left: auto; margin-right: 12px; }
.a-evchip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--chip-line); border-radius: 99px; padding: 5px 12px; background: var(--card); font: 600 12px var(--sans); color: var(--ink); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.a-evdot { width: 9px; height: 9px; border-radius: 99px; border: 1.5px solid var(--signal); background: linear-gradient(90deg, var(--signal) 50%, transparent 50%); }
.a-evdot.full { background: var(--signal); }
.a-runchip { border: 1px dashed var(--chip-line); border-radius: 99px; padding: 5px 12px; font: 600 11.5px var(--sans); color: var(--slate); background: none; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.a-runchip:hover { background: var(--paper); }
/* Laptop widths: the case chips collapse behind ONE "Case" chip with a menu
   (Tyron, 2026-08-18 — the crowded topbar wrapped chips into blobs). */
.a-casemenu-wrap { display: none; position: relative; }
.a-casemenu { top: calc(100% + 6px); bottom: auto; right: 0; left: auto; min-width: 250px; }
.a-hdpill, .a-modepill { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 1500px) {
  .a-casechips > .a-evchip:not(.a-casemenu-btn), .a-casechips > .a-runchip { display: none; }
  .a-casemenu-wrap { display: block; }
  .a-jchip { display: none; }
}
/* With the evidence dock open the topbar loses 302px, so the chips collapse
   earlier — a viewport-only breakpoint can't see the dock. */
@media (max-width: 1800px) {
  .a-stage:has(.a-dock) .a-casechips > .a-evchip:not(.a-casemenu-btn),
  .a-stage:has(.a-dock) .a-casechips > .a-runchip,
  .a-stage:has(.a-dock) .a-jchip { display: none; }
  .a-stage:has(.a-dock) .a-casemenu-wrap { display: block; }
}
@media (max-width: 1200px) {
  .a-dlbtn-t { display: none; }
}
/* Header admissions-matrix chip (prototype showMatrixChip): the matrix is one
   click away from anywhere in the case once findings exist. */
.a-mxchip { color: var(--signal); font-weight: 700; }
.a-mxchip svg { width: 11px; height: 11px; flex-shrink: 0; }
.a-mxchip:hover { background: var(--mint); }
.a-dock { width: 302px; flex-shrink: 0; border-left: 1px solid var(--hairline); background: var(--paper, var(--bg)); display: flex; flex-direction: column; overflow-y: auto; }
.a-dock-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px; font: 600 14px var(--serif, Georgia, serif); color: var(--pine); }
.a-dock-collapse { border: none; background: none; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 6px; }
.a-dock-collapse:hover { background: var(--mint); color: var(--pine); }
.a-dock-sub { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px 10px; font-size: 11px; color: var(--faint); border-bottom: 1px solid var(--hairline); }
.a-dock-sub b { font: 600 11px ui-monospace, Menlo, monospace; color: var(--slate); }
.a-dock-rows { flex: 1; display: flex; flex-direction: column; }
.a-dock-row { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--hairline); align-items: flex-start; }
.a-dock-row.warn { background: var(--sev-high-bg); }
.a-dock-row.warn .a-dock-cap { color: var(--sev-high); }
.a-dockdot { flex-shrink: 0; width: 9px; height: 9px; margin-top: 4px; border-radius: 99px; }
.a-dockdot.full { background: var(--signal); }
.a-dockdot.half { border: 1.5px solid var(--signal); background: linear-gradient(90deg, var(--signal) 50%, transparent 50%); }
.a-dockdot.dashed { border: 1.5px dashed var(--faint); background: transparent; }
.a-dock-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.a-dock-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.a-dock-cap { font-size: 11px; color: var(--faint); }
.a-dock-foot { padding: 12px 16px; font-size: 10.5px; line-height: 1.45; color: var(--faint); border-top: 1px solid var(--hairline); }
.a-doctchip { border: 1px dashed var(--chip-line); border-radius: 99px; padding-left: 10px; padding-right: 10px; }
.a-resumed { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--chip-line); border-radius: 99px; padding: 4px 10px; font-size: 10.5px; color: var(--slate); }
.a-failcard { margin: 8px 18px; border: 1px solid var(--sev-crit-line, #C0442B); background: var(--sev-crit-bg, rgba(192,68,43,.06)); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.a-failx { color: #C0442B; font-weight: 700; margin-right: 6px; }
.a-failcard-top b { font-size: 13px; color: var(--ink); }
.a-failcard-reason { font-size: 12px; color: #C0442B; }
.a-failcard-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.a-failcard-cost { font-size: 11px; color: var(--slate); }
.a-failcard-note { font-size: 10.5px; color: var(--faint); }
.a-gap-outcome { flex-shrink: 1; min-width: 0; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-size: 11.5px; font-weight: 500; color: var(--slate); align-self: center; }
.a-gap-outcome.muted { color: var(--faint); }
.a-gap-done .a-gap-ic.ok { color: var(--signal); }
.a-gate-count.ok { color: var(--signal); font-weight: 700; }
.a-gate-okic { display: inline-flex; color: var(--signal); }
@media (max-width: 1180px) { .a-dock { display: none; } }
.a-dock-derived { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.a-dock-sub b { white-space: nowrap; margin-left: 8px; }
