/* Hearth: a Material 3–style shell in forgd's palette (from the surveillance POC). Navy and slate structure, one orange accent,
   tonal surfaces instead of heavy borders, 40 px table rows, tabular figures. Light by default, dark on request. */
:root {
  --bg: #F3F5F9; --surface: #FFFFFF; --surface-1: #F8F9FC; --surface-2: #EEF1F6; --surface-3: #E4E8F0;
  --ink: #07152A; --body: #2E3747; --muted: #5A6577; --faint: #8090A3; --struct: #506880;
  --line: rgba(7, 21, 42, 0.08); --line-strong: rgba(7, 21, 42, 0.16);
  --nav: #07152A; --nav-ink: #E9EEF5; --nav-muted: #8FA0B4; --nav-active: rgba(217, 119, 87, 0.16);
  --accent: #D97757; --accent-text: #A6553A; --accent-soft: #FBEEE8; --on-accent: #FFFFFF;
  --good: #2F7A4A; --good-soft: #E5F2EA; --bad: #B03A3A; --bad-soft: #FBE9E9; --warn: #9A6200; --warn-soft: #FFF3DC;
  --info: #2F5F99; --info-soft: #E5EEF9; --neutral-soft: #EDF0F4;
  --chart-line: #2F5F99; --chart-proj: #D97757; --chart-threshold: #B03A3A; --chart-grid: rgba(7, 21, 42, 0.08);
  --shadow-1: 0 1px 2px rgba(7, 21, 42, 0.06), 0 1px 3px rgba(7, 21, 42, 0.05);
  --shadow-2: 0 8px 28px rgba(7, 21, 42, 0.14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "Roboto Mono", ui-monospace, Menlo, monospace;
  --rail: 88px; --top: 60px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #050E1C; --surface: #0B1A30; --surface-1: #0E1F38; --surface-2: #132845; --surface-3: #1A3355;
  --ink: #F0F4F8; --body: #D9E0EA; --muted: #93A3B6; --faint: #6F8196; --struct: #A6B8CC;
  --line: rgba(160, 180, 200, 0.10); --line-strong: rgba(160, 180, 200, 0.22);
  --nav: #030A15; --accent-text: #E58C6E; --accent-soft: #2E1E1C;
  --good: #6DBE8A; --good-soft: #13301F; --bad: #EE8A8A; --bad-soft: #3A1A1E; --warn: #E8B45A; --warn-soft: #33270F;
  --info: #8DB4E6; --info-soft: #132C4C; --neutral-soft: #16273F;
  --chart-line: #8DB4E6; --chart-threshold: #EE8A8A; --chart-grid: rgba(160, 180, 200, 0.12);
  --shadow-1: none; --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.5); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #050E1C; --surface: #0B1A30; --surface-1: #0E1F38; --surface-2: #132845; --surface-3: #1A3355;
  --ink: #F0F4F8; --body: #D9E0EA; --muted: #93A3B6; --faint: #6F8196; --struct: #A6B8CC;
  --line: rgba(160, 180, 200, 0.10); --line-strong: rgba(160, 180, 200, 0.22);
  --nav: #030A15; --accent-text: #E58C6E; --accent-soft: #2E1E1C;
  --good: #6DBE8A; --good-soft: #13301F; --bad: #EE8A8A; --bad-soft: #3A1A1E; --warn: #E8B45A; --warn-soft: #33270F;
  --info: #8DB4E6; --info-soft: #132C4C; --neutral-soft: #16273F;
  --chart-line: #8DB4E6; --chart-threshold: #EE8A8A; --chart-grid: rgba(160, 180, 200, 0.12);
  --shadow-1: none; --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.5); color-scheme: dark }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--body); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.icon { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20; -webkit-font-smoothing: antialiased; user-select: none; }
.num, td.num, .figure { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: var(--top) 1fr; height: 100vh; }
.rail { grid-row: 1 / 3; background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; align-items: center; padding: 14px 0 16px; gap: 4px; overflow-y: auto; }
.rail .mark { width: 44px; height: auto; margin: 2px 0 18px; }
.rail a { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 8px; color: var(--nav-muted); text-decoration: none; font-size: 11.5px; font-weight: 500; border-radius: 14px; position: relative; }
.rail a .pill { width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background 0.15s; }
.rail a:hover .pill { background: rgba(255, 255, 255, 0.06); }
.rail a[aria-current="page"] { color: var(--nav-ink); }
.rail a[aria-current="page"] .pill { background: var(--nav-active); color: var(--accent); }
.rail a[aria-current="page"] .icon { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20; }
.rail .badge { position: absolute; top: 2px; left: 44px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font: 600 10.5px/18px var(--font); text-align: center; }
.rail .spacer { flex: 1; }

.topbar { grid-column: 2; display: flex; align-items: center; gap: 16px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.topbar .product { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar .product b { color: var(--ink); font-size: 15px; font-weight: 600; white-space: nowrap; }
.topbar .product span { font: 500 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); }
.topbar .grow { flex: 1; }
.workspace { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.workspace button { border: 0; background: transparent; color: var(--struct); padding: 6px 12px; border-radius: 8px; font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.workspace button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.asof { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.asof b { color: var(--ink); font-weight: 600; }
.user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--info-soft); color: var(--info); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user .who { display: flex; flex-direction: column; line-height: 1.2; font-size: 12.5px; }
.user .who b { color: var(--ink); font-weight: 600; }
.iconbtn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--struct); cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }

.content { grid-column: 2; overflow-y: auto; min-width: 0; }
.page { max-width: 1280px; margin: 0 auto; padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.25; color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 72ch; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-1); border: 1px solid var(--line); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 14.5px; color: var(--ink); font-weight: 600; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 14px 18px 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); }
@media (max-width: 1100px) { .grid.cols-3, .grid.main-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid.cols-2 { grid-template-columns: minmax(0, 1fr); } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-1); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 24px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.tight .v { font-size: 20px; }

.metric { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.metric .big { font-size: 34px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.1; }
.metric .vs { color: var(--muted); font-size: 13px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

/* ---------- chips and buttons ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px 0 7px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--neutral-soft); color: var(--struct); }
.chip .icon { font-size: 15px; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.outline { background: transparent; border: 1px solid var(--line-strong); }
.id { font: 500 12px var(--mono); color: var(--struct); background: var(--surface-2); border-radius: 6px; padding: 2px 6px; white-space: nowrap; border: 0; cursor: default; }
button.id { cursor: pointer; color: var(--info); text-decoration: underline dotted; text-underline-offset: 3px; }
button.id:hover { background: var(--surface-3); color: var(--ink); }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 18px; border: 0; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn .icon { font-size: 18px; }
.btn.filled { background: var(--ink); color: var(--surface); }
.btn.filled:hover { filter: brightness(1.15); }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.tonal { background: var(--surface-2); color: var(--ink); }
.btn.tonal:hover { background: var(--surface-3); }
.btn.text { background: transparent; color: var(--info); padding: 0 10px; }
.btn.text:hover { background: var(--info-soft); text-decoration: none; }
.btn.outlined { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); }
.btn.outlined:hover { background: var(--surface-1); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 15px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 18px; overflow: hidden; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; font-size: 13px; font-weight: 500; color: var(--struct); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--info-soft); color: var(--ink); }
.seg button .icon { font-size: 16px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 6px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 12px 14px 11px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { background: var(--surface-2); color: var(--struct); border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 600; line-height: 19px; }
.tabs button[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent-text); }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.input, select.input { height: 36px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 12px; background: var(--surface); color: var(--ink); font-size: 13.5px; min-width: 0; }
.input:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--faint); font-size: 18px; pointer-events: none; }
.search .input { padding-left: 34px; width: 280px; max-width: 100%; }
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.combo { position: relative; max-width: 100%; }
.combo-input { width: 100%; padding-left: 34px; padding-right: 34px; }
.combo-search { position: absolute; left: 10px; top: 8px; color: var(--faint); pointer-events: none; }
.combo-clear { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.combo-clear:hover { background: var(--surface-2); color: var(--ink); }
.combo-clear .icon { font-size: 18px; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-2); }
.combo-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.combo-opt:hover, .combo-opt.active { background: var(--surface-2); }
.combo-opt[aria-selected="true"] { font-weight: 600; }
.combo-opt .icon { font-size: 18px; color: var(--info); }
.combo-opt mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.combo-count, .combo-none { padding: 4px 10px 6px; font-size: 12px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.data th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; z-index: 1; }
table.data td { height: 44px; padding: 6px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--body); }
table.data th.num, table.data td.num { text-align: right; }
table.data td.quote { min-width: 280px; max-width: 520px; white-space: normal; padding-block: 10px; line-height: 1.45; }
table.data td .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.compare { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.cmp-col { min-width: 0; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.cmp-col h4 { margin: 0; font-size: 13.5px; }
.cmp-col .answer-text { font-size: 13px; line-height: 1.5; }
.drivers { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.drivers .vlabel { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 6px; }
.drivers .seg { align-self: flex-start; }
.leases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.leases .lease { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.leases .quote { margin: 4px 0 0 0; line-height: 1.45; }
.leases .quote .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.grid > p.sub { font-size: 12.5px; color: var(--muted); max-width: 80ch; margin: 0; }
table.data tbody tr { cursor: default; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--surface-1); }
table.data tbody tr[aria-selected="true"] td { background: var(--info-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.strong { color: var(--ink); font-weight: 500; }
table.data .sub { display: block; color: var(--muted); font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state .icon { font-size: 32px; color: var(--faint); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager > div { display: flex; gap: 4px; }

/* ---------- side sheet ---------- */
.with-sheet { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.with-sheet.open { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
@media (max-width: 1180px) { .with-sheet.open { grid-template-columns: minmax(0, 1fr); } }
.sheet { position: sticky; top: 0; max-height: calc(100vh - var(--top) - 48px); overflow-y: auto; }
.sheet .sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.sheet .sheet-head h2 { margin: 0; font-size: 17px; color: var(--ink); font-weight: 600; }
.section { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.section h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line-strong); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--struct); }
.timeline .dot .icon { font-size: 14px; }
.timeline .dot.done { background: var(--info-soft); color: var(--info); }
.timeline .dot.decided { background: var(--accent-soft); color: var(--accent-text); }
.timeline .dot.bad { background: var(--bad-soft); color: var(--bad); }
.timeline .t { font-size: 13px; color: var(--ink); font-weight: 500; }
.timeline .d { font-size: 12px; color: var(--muted); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--body); }
.notice .icon { color: var(--struct); margin-top: 1px; }
.notice.info { background: var(--info-soft); } .notice.info .icon { color: var(--info); }
.notice.warn { background: var(--warn-soft); } .notice.warn .icon { color: var(--warn); }
.notice.bad { background: var(--bad-soft); } .notice.bad .icon { color: var(--bad); }
.notice.accent { background: var(--accent-soft); } .notice.accent .icon { color: var(--accent-text); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--muted); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .zero-line { stroke: var(--muted); stroke-width: 1; }
.chart .threshold { stroke: var(--chart-threshold); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .series { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series.proj { stroke: var(--chart-proj); stroke-dasharray: 4 3; }
.chart .pt { fill: var(--surface); stroke: var(--chart-line); stroke-width: 2; }
.chart .pt.proj { stroke: var(--chart-proj); }
.chart .pt.breach { fill: var(--chart-threshold); stroke: var(--chart-threshold); }
.chart .label-threshold { fill: var(--chart-threshold); font-weight: 600; }
.chart .hit { fill: transparent; cursor: default; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--chart-line); vertical-align: middle; margin-right: 6px; }
.legend i.proj { border-top: 2px dashed var(--chart-proj); }
.legend i.thr { border-top: 2px dashed var(--chart-threshold); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12px; padding: 6px 9px; border-radius: 8px; box-shadow: var(--shadow-2); white-space: nowrap; }
svg.spark { display: block; }
svg.spark .series { fill: none; stroke: var(--chart-proj); stroke-width: 1.75; }
svg.spark .threshold { stroke: var(--chart-threshold); stroke-width: 1; stroke-dasharray: 3 2; }
svg.spark .pt.breach { fill: var(--chart-threshold); }

/* ---------- ask ---------- */
.ask-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ask-layout { grid-template-columns: minmax(0, 1fr); } }
.history { display: flex; flex-direction: column; }
.history button { text-align: left; border: 0; background: transparent; padding: 10px 14px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--body); }
.history button:hover { background: var(--surface-1); }
.history button[aria-current="true"] { background: var(--info-soft); }
.history .q { font-size: 13px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history .m { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.composer { display: flex; flex-direction: column; gap: 10px; }
.composer textarea { width: 100%; min-height: 92px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; background: var(--surface); color: var(--ink); font-size: 14.5px; line-height: 1.5; }
.composer textarea:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.composer .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.answer-text { font-size: 15.5px; line-height: 1.65; color: var(--ink); margin: 0; max-width: 78ch; }
.answer-text > * { margin: 0 0 10px; }
.answer-text > :last-child { margin-bottom: 0; }
.answer-text ul, .answer-text ol { padding-left: 22px; }
.answer-text li { margin: 4px 0; }
.answer-text li::marker { color: var(--muted); }
.answer-text h3 { font-size: 15.5px; font-weight: 650; margin-top: 14px; }
.answer-text strong { font-weight: 650; }
.answer-text code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border-radius: 4px; padding: 1px 4px; }
.progress { height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 30%; background: var(--accent); border-radius: 2px; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .progress i { animation: none; width: 100%; opacity: 0.4; } }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.step:last-child { border-bottom: 0; }
.step > .icon { font-size: 20px; color: var(--good); flex: none; }
.step .label { flex: 1; min-width: 0; color: var(--ink); }
.step .meta { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.step.running > .icon { color: var(--accent); animation: spin 1s linear infinite; }
.step.running .label { color: var(--body); }
.step.info > .icon { color: var(--info); }
.step.warn > .icon { color: var(--warn); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .step.running > .icon { animation: none; } }
details.source { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-1); }
details.source summary { list-style: none; cursor: pointer; padding: 9px 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink); }
details.source summary::-webkit-details-marker { display: none; }
details.source summary .icon { color: var(--struct); font-size: 18px; }
details.source[open] summary .chev { transform: rotate(180deg); }
details.source pre { margin: 0; padding: 10px 12px 12px; font: 11.5px/1.5 var(--mono); color: var(--struct); white-space: pre-wrap; word-break: break-word; border-top: 1px solid var(--line); max-height: 260px; overflow: auto; }

/* ---------- loading ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-block { height: 160px; }

/* ---------- sign-in ---------- */
.signin-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.signin-page .left { background: var(--nav); color: var(--nav-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.signin-page .left img { height: 30px; width: auto; align-self: flex-start; }
.signin-page .left h1 { font-size: 34px; line-height: 1.15; margin: 0 0 14px; font-weight: 600; letter-spacing: -0.01em; max-width: 16ch; }
.signin-page .left p { color: var(--nav-muted); max-width: 46ch; margin: 0; font-size: 15px; }
.signin-page .left ul { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; color: var(--nav-ink); font-size: 14px; }
.signin-page .left li { display: flex; gap: 10px; align-items: center; }
.signin-page .left li .icon { color: var(--accent); }
.signin-page .right { display: grid; place-items: center; padding: 32px; }
.signin-page .box { max-width: 380px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.signin-page .box h2 { margin: 0; font-size: 22px; color: var(--ink); font-weight: 600; }
@media (max-width: 820px) { .signin-page { grid-template-columns: 1fr; } .signin-page .left { padding: 32px 24px; } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-2); font-size: 13px; z-index: 60; display: flex; gap: 8px; align-items: center; }
.footnote { font-size: 12px; color: var(--faint); text-align: center; padding-top: 8px; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: var(--top) 1fr 64px; }
  .rail { grid-row: 3; grid-column: 1; flex-direction: row; justify-content: space-around; padding: 4px 0; overflow-x: auto; }
  .rail .mark, .rail .spacer { display: none; }
  .topbar, .content { grid-column: 1; }
  .topbar { padding: 0 12px; gap: 10px; } .topbar .asof, .user .who { display: none; }
  .page { padding: 16px 16px 40px; }
}

.answer-text mark.fig { background: var(--info-soft); color: var(--ink); border-radius: 4px; padding: 0 3px; font-weight: 600; }
table.data td { white-space: nowrap; }
table.data td.wrap { white-space: normal; }
.grid { align-content: start; align-items: start; }

.verify { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.verify h3 { margin: 0; font-size: 15px; }
.verify .vlabel { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks .dot { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--surface-2, var(--surface)); color: var(--muted); }
.checks .dot .icon { font-size: 14px; }
.checks .dot.ok { background: var(--good-soft); color: var(--good); }
.checks .dot.bad { background: var(--bad-soft); color: var(--bad); }
.attests { display: flex; flex-direction: column; gap: 6px; }
.attest { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.attest input { margin-top: 3px; }
.notice.good { background: var(--good-soft); } .notice.good .icon { color: var(--good); }

/* Calculation modal */
dialog.calc { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--body); box-shadow: var(--shadow-2); }
dialog.calc::backdrop { background: rgba(7, 21, 42, 0.45); }
.calc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.calc-head h2 { margin: 0 0 4px; font-size: 16px; color: var(--ink); }
.calc-body { padding: 14px 20px 20px; display: grid; gap: 14px; }
.calc-def { margin: 0; color: var(--body); }
.calc-warn { margin: 0; display: flex; gap: 6px; align-items: flex-start; color: var(--warn); }
table.calc-steps { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.calc-steps td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.calc-steps td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 16px; }
table.calc-steps td.text { padding-left: 16px; overflow-wrap: anywhere; }
table.calc-steps tr.total td { font-weight: 600; color: var(--ink); border-bottom-color: var(--line-strong); }
table.calc-steps th { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 0 4px; text-align: left; }
table.calc-steps th.num { text-align: right; padding-left: 16px; }
table.calc-steps tr.differs td { background: var(--warn-soft); }
.calc-src { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.calc-src dt { color: var(--muted); }
.calc-src dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
div.calc-src { display: block; }
.calc-ok { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 16px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.chip-btn { cursor: pointer; font: inherit; font-size: 12px; font-weight: 500; }
.chip-btn:hover { background: var(--surface-2); color: var(--ink); }
.calc-body h3 { margin: 4px 0 0; font-size: 13.5px; color: var(--ink); }
ol.policy-rules, ul.policy-rules { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; }

/* ---------- Agreements: one real public filing, names invented, synthetic figures ---------- */
h2.vlabel { font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 0 -4px; }
table.data.agr td { height: 34px; padding-block: 4px; }
table.data.agr td.num { white-space: nowrap; }
table.data.agr tr.total td { font-weight: 600; color: var(--ink); background: var(--surface-1); }
.agr-rungs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; }
dialog.calc.wide { width: min(960px, calc(100vw - 32px)); }
.clause-crop { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.crop-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.pdf-img { background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; overflow: auto; }
.pdf-img img { display: block; max-width: 100%; height: auto; }
table.data.agr td:first-child { white-space: normal; min-width: 280px; }
table.data.agr .step-detail { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; max-width: 760px; }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.agr-lede { margin: -4px 0 0; font-size: 13.5px; max-width: 820px; }
.agr-facts { display: grid; gap: 0; padding: 4px 16px; }
.agr-fact { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 10px 0; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.agr-fact:last-child { border-bottom: 0; }
.agr-fact .k { color: var(--muted); font-weight: 600; }
.agr-fact .agr-rungs { display: inline-flex; margin-top: 4px; }
details.agr-more summary { justify-content: space-between; }
details.agr-more .table-wrap { border-top: 1px solid var(--line); }
@media (max-width: 640px) { .kpis.two { grid-template-columns: 1fr; } .agr-fact { grid-template-columns: 1fr; gap: 2px; } }
.chip-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.chip-link .chip { text-decoration: underline; text-underline-offset: 2px; }
.pdf-img.page { padding: 0; max-height: 70vh; overflow: auto; background: #f3f4f6; }
.pdf-img.page.several { max-height: 46vh; }
.pdf-img.page .pdf-sheet { position: relative; width: max-content; margin: 0 auto; background: #fff; }
.pdf-img.page img { max-width: none; width: auto; }
.pdf-focus { position: absolute; background: rgba(255, 212, 0, 0.32); mix-blend-mode: multiply; outline: 2px solid #E8A33D; outline-offset: 2px; border-radius: 3px; pointer-events: none; }
.agr-key { margin: 0 16px 8px; font-size: 12.5px; }
table.calc-table tr.section td { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 14px; height: auto; border-bottom: 0; }
table.calc-table tr.working { display: none; }
table.calc-table.show-working tr.working { display: table-row; }
table.calc-table tr.working td { font-size: 12px; color: var(--muted); padding-top: 0; height: auto; overflow-wrap: anywhere; }
table.calc-table tr.result td { font-size: 15px; }
.chip.interp { font-size: 11px; cursor: help; }
.calc-sub { display: grid; gap: 8px; margin-top: 8px; }
.calc-sub .fold-body { padding: 10px 12px; border-top: 1px solid var(--line); }
.interp { display: inline-flex; vertical-align: middle; color: var(--struct); cursor: help; }
.interp .icon { font-size: 16px; }
table.calc-table tr.lead td { font-weight: 500; color: var(--ink); }
.calc-sub { display: grid; gap: 8px; margin: 4px 0 12px; }
.calc-sub-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calc-sub-head h3 { margin: 0 4px 0 0; }
.calc-sub-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.calc-sub-after { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.support-box { max-height: 46vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 8px; }
.pdf-img.page.short { max-height: 46vh; }
.pdf-img.page .pdf-sheet { margin: 0 auto 10px; }
.pdf-pagelabel { font-size: 11.5px; text-align: center; padding: 6px 0 4px; }
@media (max-width: 760px) { .calc-sub-grid { grid-template-columns: 1fr; } }
.pdf-mark { position: absolute; background: rgba(255, 221, 51, 0.55); mix-blend-mode: multiply; border-radius: 2px; pointer-events: none; }
table.calc-table td.src-cell { white-space: nowrap; }
table.src-doc tr.hit td { background: rgba(255, 221, 51, 0.32); }
table.src-doc tr.hit td:first-child { box-shadow: inset 3px 0 0 #E8A33D; }
.cite-split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; align-items: start; }
.cite-list { display: grid; gap: 6px; max-height: 72vh; overflow: auto; }
.cite { text-align: left; font: inherit; background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--body); }
.cite:hover { border-color: var(--line-strong); }
.cite.on { border-color: #E8A33D; box-shadow: inset 3px 0 0 #E8A33D; background: var(--surface-2); }
.cite-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.cite-quote { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: Georgia, serif; }
.cite-viewer { display: grid; gap: 6px; min-width: 0; }
@media (max-width: 760px) { .cite-split { grid-template-columns: 1fr; } .cite-list { max-height: 30vh; } }
.pdf-img.page.fit .pdf-sheet { width: 100%; }
.pdf-img.page.fit img { width: 100%; max-width: 100%; height: auto; }
.pdf-img.page.fit.short { max-height: 60vh; }
.dl-bar { display: flex; gap: 4px; }
/* pages always fit their viewer's width: no sideways scrolling, highlights stay on their words */
.pdf-img.page .pdf-sheet { width: 100%; }
.pdf-img.page img { width: 100%; max-width: 100%; height: auto; }
dialog.calc.xwide { width: min(1280px, calc(100vw - 32px)); }
table.calc-table td .basis { font-size: 12px; color: var(--muted); margin-top: 2px; }
table.calc-table td .basis.judgment { color: #8a5a00; }
