/* ============================================================================
   OTPP Watch — app.css   (component system; reads design-tokens.css only)
   Semantic, documented class names. Mobile breakpoint 768px.
   Honesty + hierarchy are load-bearing: coverage gauge, facts-before-AI,
   attributed sources, "of disclosed holdings" stamp.
   ============================================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--signal); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
::selection { background: var(--signal); color: var(--ink-on-signal); }

.num, .figure { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }
.serif { font-family: var(--font-display); }

:where(button, a, input):focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }

/* View routing — :not(.active) outranks .login's display:grid (same-specificity trap) */
.view:not(.active) { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-small);
  letter-spacing: .01em; line-height: 1;
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--r-s);
  cursor: pointer; background: none; color: var(--ink);
  transition: background var(--dur-1) var(--ease), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--signal); color: var(--ink-on-signal); }
.btn-primary:hover { background: var(--signal-2); text-decoration: none; }
.btn-ghost { border-color: var(--rule-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); background: var(--paper-3); text-decoration: none; }
.btn-quiet { color: var(--ink-2); padding: 8px 10px; }
.btn-quiet:hover { background: var(--paper-3); text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; flex: 0 0 auto; }

/* ── Nameplate / masthead (signature element) ────────────────────────────── */
.nameplate { display: flex; align-items: baseline; gap: 10px; }
.nameplate .seal { width: 30px; height: 30px; flex: 0 0 auto; align-self: center; }
.nameplate .seal img { width: 100%; height: 100%; object-fit: contain; }
.nameplate .word {
  font-family: var(--font-display); color: var(--nameplate-color);
  font-weight: 800; font-size: 1.32rem; line-height: 1; letter-spacing: -.01em;
}
[data-direction="ledger"] .nameplate .word {
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700; font-size: 1.18rem;
}
.nameplate .watch { font-style: italic; font-weight: 500; }
[data-direction="ledger"] .nameplate .watch { font-style: normal; color: var(--signal); }

/* ── App shell: section rail + content ───────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-5) var(--s-4);
  background: var(--paper-2); border-right: 1px solid var(--rule);
}
.rail .brand { padding: 2px 6px var(--s-4); border-bottom: 1px solid var(--rule); margin-bottom: var(--s-3); }
.rail .brand .tagline {
  font-size: var(--fs-tiny); color: var(--ink-3); margin-top: 8px; line-height: 1.4;
  font-family: var(--font-body);
}
.rail .brand .tagline .endorse { color: var(--ink-2); font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; padding: var(--s-3) 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-s); cursor: pointer;
  color: var(--ink-2); font-weight: 500; font-size: var(--fs-small);
  border: 1px solid transparent; background: none; text-align: left;
  transition: background var(--dur-1), color var(--dur-1);
}
.nav-item .ic { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--paper-3); color: var(--ink); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent-line); }
.nav-item .soon { margin-left: auto; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); border: 1px solid var(--rule-2); border-radius: 999px; padding: 1px 6px; }
.nav-item .count { margin-left: auto; font-family: var(--font-figure); font-size: var(--fs-tiny); color: var(--ink-on-signal); background: var(--signal); border-radius: 999px; padding: 1px 7px; }

.rail .foot { margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--rule); font-size: var(--fs-tiny); color: var(--ink-3); line-height: 1.5; }
.rail .foot .who { color: var(--ink-2); font-weight: 600; }

/* content */
.content { min-width: 0; }
.content-inner { max-width: var(--maxw); margin: 0 auto; padding: var(--s-6) var(--s-6) var(--s-8); }

/* top utility bar (mode switch + direction switch + signout) */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px var(--s-6); background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px); border-bottom: 1px solid var(--rule);
}
.topbar .crumb { font-size: var(--fs-small); color: var(--ink-3); }
.topbar .crumb b { color: var(--ink); font-weight: 700; }
.topbar .spacer { flex: 1; }

/* ── Page header (editorial) ─────────────────────────────────────────────── */
.page-head { margin-bottom: var(--s-5); }
.page-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--signal); }
.page-kicker::before { content: ""; width: 22px; height: 2px; background: var(--accent-line); display: inline-block; }
.page-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: -.01em; margin: 10px 0 6px; }
[data-direction="ledger"] .page-title { font-weight: 700; }
.page-sub { color: var(--ink-2); font-size: var(--fs-body); max-width: 64ch; }
.dateline { font-size: var(--fs-small); color: var(--ink-3); margin-top: 8px; font-family: var(--font-figure); }

/* ── Coverage banner + gauge (P0 honesty · signature data-viz) ────────────── */
.coverage {
  background: var(--paper-2); border: 1px solid var(--rule);
  border-left: 3px solid var(--signal);
  border-radius: var(--r-m); padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
}
.coverage .cov-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.coverage .cov-tag { font-size: var(--fs-tiny); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--signal); }
.coverage .cov-lead { font-size: var(--fs-small); color: var(--ink-2); }
.coverage .cov-lead strong { color: var(--ink); }

.gauge { margin-top: var(--s-3); }
.gauge-bar {
  position: relative; height: 16px; border-radius: 3px; overflow: hidden;
  background:
    repeating-linear-gradient(135deg, var(--gauge-hatch) 0 2px, transparent 2px 7px),
    var(--gauge-track);
  border: 1px solid var(--rule-2);
}
.gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--signal); min-width: 3px; }
.gauge-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.gauge-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: var(--fs-tiny); color: var(--ink-3); font-family: var(--font-figure); }
.gauge-legend { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: 10px; font-size: var(--fs-small); }
.gauge-legend .lg { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.gauge-legend .sw { width: 12px; height: 12px; border-radius: 2px; flex: 0 0 auto; }
.gauge-legend .sw.disc { background: var(--signal); }
.gauge-legend .sw.undisc { background: repeating-linear-gradient(135deg, var(--gauge-hatch) 0 2px, var(--gauge-track) 2px 6px); border: 1px solid var(--rule-2); }
.gauge-legend b { color: var(--ink); font-family: var(--font-figure); }

/* ── Stat row ────────────────────────────────────────────────────────────── */
.statrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; margin-bottom: var(--s-6); }
.stat { background: var(--paper-2); padding: var(--s-4) var(--s-4) var(--s-3); display: flex; flex-direction: column; gap: 6px; }
.stat .v { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1; color: var(--ink); letter-spacing: -.01em; }
[data-direction="ledger"] .stat .v { font-weight: 700; }
.stat .v.flagged { color: var(--signal); }
.stat .l { font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
.stat .sub { font-size: var(--fs-tiny); color: var(--ink-3); margin-top: -2px; }

/* ── Section heading ─────────────────────────────────────────────────────── */
.section { margin: var(--s-7) 0 var(--s-4); display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.section h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h2); margin: 0; letter-spacing: -.01em; }
[data-direction="ledger"] .section h2 { font-weight: 700; }
.section .note { font-size: var(--fs-small); color: var(--ink-3); max-width: 52ch; }
.stamp { font-size: var(--fs-tiny); font-family: var(--font-figure); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; border: 1px dashed var(--rule-2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

/* ── Changes feed (signature editorial surface) ──────────────────────────── */
.changes { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; }
.changes-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.changes-head h3 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h3); margin: 0; }
[data-direction="ledger"] .changes-head h3 { font-weight: 700; }
.changes-head .since { font-size: var(--fs-small); color: var(--ink-3); }
.tallies { display: flex; flex-wrap: wrap; gap: 1px; background: var(--rule); border-bottom: 1px solid var(--rule); }
.tally { background: var(--paper-2); flex: 1 1 0; min-width: 96px; padding: var(--s-3) var(--s-4); }
.tally .n { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; line-height: 1; }
[data-direction="ledger"] .tally .n { font-weight: 700; }
.tally .k { font-size: var(--fs-tiny); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-top: 5px; }
.tally.flag .n { color: var(--t-weapons); }
.tally.clear .n { color: var(--ok); }
.changes-body { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: 10px; }
.change-line { font-size: var(--fs-small); line-height: 1.5; }
.change-line .lead { font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.change-line .lead.flag { color: var(--t-weapons); }
.change-line .lead.clear { color: var(--ok); }
.change-line .names { color: var(--ink-2); }

/* ── Lens filter bar ─────────────────────────────────────────────────────── */
.lensbar { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.lens { font-size: var(--fs-small); font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule-2); display: inline-flex; align-items: center; gap: 7px; transition: all var(--dur-1) var(--ease); }
.lens:hover { border-color: var(--ink-3); color: var(--ink); }
.lens[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lens .dot { width: 8px; height: 8px; border-radius: 50%; }
.lens .ln { font-family: var(--font-figure); font-size: var(--fs-tiny); opacity: .7; }

/* ── Holdings table ──────────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; background: var(--paper-2); }
table.holdings { width: 100%; border-collapse: collapse; }
table.holdings thead th {
  text-align: left; font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--ink-3); padding: 11px 16px; background: var(--paper-3);
  border-bottom: 1px solid var(--rule-2); position: sticky; top: 0;
}
table.holdings thead th.r { text-align: right; }
table.holdings tbody td { padding: 12px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.holdings tbody tr:last-child td { border-bottom: none; }
table.holdings tbody tr { cursor: pointer; transition: background var(--dur-1); }
table.holdings tbody tr:hover td { background: var(--paper-3); }
table.holdings tbody tr:focus-visible { outline: none; }
table.holdings tbody tr:focus-visible td { background: var(--paper-3); box-shadow: inset 0 0 0 2px var(--signal); }
.h-rank { color: var(--ink-3); font-family: var(--font-figure); font-size: var(--fs-small); width: 34px; }
.h-name { font-weight: 700; color: var(--ink); }
.h-meta { font-family: var(--font-mono); font-size: var(--fs-tiny); color: var(--ink-3); margin-top: 3px; }
.h-val { text-align: right; font-family: var(--font-figure); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.h-val .pct { display: block; font-size: var(--fs-tiny); color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.flag-cell { display: flex; flex-wrap: wrap; gap: 5px; }
.go { color: var(--ink-3); width: 16px; height: 16px; }
table.holdings tbody tr:hover .go { color: var(--signal); }

/* ── Flag chips (theme-coded; investigative tag, not solid pill) ─────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-tiny); font-weight: 700; line-height: 1;
  padding: 4px 8px 4px 7px; border-radius: var(--r-xs);
  white-space: nowrap;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; flex: 0 0 auto; }
.chip.climate  { color: var(--t-climate);  background: var(--t-climate-tint);  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-climate) 28%, transparent); }
.chip.climate::before  { background: var(--t-climate); }
.chip.weapons  { color: var(--t-weapons);  background: var(--t-weapons-tint);  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-weapons) 28%, transparent); }
.chip.weapons::before  { background: var(--t-weapons); }
.chip.catholic { color: var(--t-catholic); background: var(--t-catholic-tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-catholic) 28%, transparent); }
.chip.catholic::before { background: var(--t-catholic); }
.chip.labour   { color: var(--t-labour);   background: var(--t-labour-tint);   box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-labour) 28%, transparent); }
.chip.labour::before   { background: var(--t-labour); }
.chip.rights   { color: var(--t-rights);   background: var(--t-rights-tint);   box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-rights) 28%, transparent); }
.chip.rights::before   { background: var(--t-rights); }
.chip.other    { color: var(--t-other);    background: var(--t-other-tint);    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-other) 28%, transparent); }
.chip.other::before    { background: var(--t-other); }
.chip.clean { color: var(--ok); background: transparent; box-shadow: inset 0 0 0 1px var(--rule-2); font-weight: 600; }
.chip.clean::before { background: var(--ok); border-radius: 50%; }
.chip .approx { font-weight: 500; opacity: .8; font-style: italic; }

/* confidence dot */
.conf-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.conf-dot.high { background: var(--ok); }
.conf-dot.low  { background: var(--warn); box-shadow: inset 0 0 0 2px var(--paper-2); outline: 1px solid var(--warn); }

/* ── Cards / panels ──────────────────────────────────────────────────────── */
.panel { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-m); padding: var(--s-5); }
.panel + .panel { margin-top: var(--s-4); }

/* ── Data controls ───────────────────────────────────────────────────────── */
.controls { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-m); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-5); }
.controls .meta { font-size: var(--fs-small); color: var(--ink-2); }
.controls .meta b { color: var(--ink); }
.controls .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ── Trends chart ────────────────────────────────────────────────────────── */
.trends { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-m); padding: var(--s-5); }
.trends-legend { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-bottom: var(--s-4); font-size: var(--fs-small); }
.trends-legend .lg { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.trends-legend .sw { width: 11px; height: 11px; border-radius: 2px; }
.chart { display: grid; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 72px 1fr 110px; align-items: center; gap: var(--s-4); }
.chart-row .ql { font-size: var(--fs-small); color: var(--ink-2); font-family: var(--font-figure); }
.chart-row .qv { text-align: right; font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--fs-small); font-weight: 600; }
.bar { display: flex; height: 22px; border-radius: 3px; overflow: hidden; background: var(--paper-3); }
.bar span { height: 100%; transition: width var(--dur-3) var(--ease); }

/* ── Commitments tracker ─────────────────────────────────────────────────── */
.commitments { border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; background: var(--paper-2); }
.commit { display: grid; grid-template-columns: 96px 1fr; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--rule); }
.commit:last-child { border-bottom: none; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; height: fit-content; font-size: var(--fs-tiny); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 4px 9px; border-radius: var(--r-xs); white-space: nowrap; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status-badge.met { color: var(--ok); background: var(--ok-tint); }
.status-badge.met::before { background: var(--ok); }
.status-badge.partial { color: var(--warn); background: var(--warn-tint); }
.status-badge.partial::before { background: var(--warn); }
.status-badge.gap { color: var(--gap); background: var(--gap-tint); }
.status-badge.gap::before { background: var(--gap); }
.commit .t { font-weight: 700; color: var(--ink); }
.commit .d { font-size: var(--fs-small); color: var(--ink-2); margin: 3px 0 6px; }
.commit .s { font-size: var(--fs-tiny); color: var(--ink-3); }
.commit .s .cite-mark { color: var(--ink-2); font-weight: 600; }

/* ── Holding detail ──────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--s-5); align-items: start; }
.detail-head { margin-bottom: var(--s-4); }
.detail-head .dname { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h1); letter-spacing: -.01em; line-height: 1.1; }
[data-direction="ledger"] .detail-head .dname { font-weight: 700; }
.detail-head .dmeta { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--ink-3); margin-top: 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: var(--fs-small); margin-top: var(--s-3); }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; font-family: var(--font-figure); font-variant-numeric: tabular-nums; color: var(--ink); }

.evidence-label { display: flex; align-items: center; gap: 10px; font-size: var(--fs-tiny); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: var(--s-2) 0 var(--s-3); }
.evidence-label::after { content: ""; flex: 1; height: 1px; background: var(--rule-2); }
.evidence-label .seq { color: var(--signal); font-family: var(--font-figure); }

.fact { background: var(--paper-2); border: 1px solid var(--rule); border-left: 3px solid var(--ink); border-radius: var(--r-s); padding: var(--s-4); margin-bottom: var(--s-3); }
.fact .fhead { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.fact .fbody { font-size: var(--fs-small); color: var(--ink-2); margin-top: 6px; }
.fact .fsrc { font-size: var(--fs-small); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.fact .fsrc .lbl { color: var(--ink-3); }

/* AI synthesis — visually distinct, clearly labelled, ALWAYS after facts */
.ai { border: 1px solid color-mix(in srgb, var(--ai) 35%, var(--rule)); background: var(--ai-tint); border-radius: var(--r-m); padding: var(--s-4) var(--s-5); margin-top: var(--s-4); position: relative; }
.ai-label { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-tiny); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ai-ink); margin-bottom: var(--s-3); }
.ai-label .ic { width: 14px; height: 14px; }
.ai .summary { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.5; color: var(--ink); margin: 0 0 var(--s-3); }
[data-direction="ledger"] .ai .summary { font-style: italic; }
.ai .claim { font-size: var(--fs-small); color: var(--ink); margin: 0 0 4px; padding-left: 16px; position: relative; }
.ai .claim::before { content: ""; position: absolute; left: 0; top: 9px; width: 7px; height: 1px; background: var(--ai); }
.ai .cites { font-size: var(--fs-tiny); color: var(--ai-ink); margin: 0 0 12px; padding-left: 16px; }
.ai .gov { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px dashed color-mix(in srgb, var(--ai) 30%, transparent); }
.ai .gov b { font-size: var(--fs-small); }
.ai .gov ul { margin: 6px 0 0; padding-left: 18px; }
.ai .gov li { font-size: var(--fs-small); color: var(--ink-2); margin-bottom: 4px; }
.ai .verify { font-size: var(--fs-tiny); color: var(--ai-ink); font-style: italic; margin-top: var(--s-3); opacity: .9; }

.aside-card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-m); padding: var(--s-4) var(--s-5); }
.aside-card h4 { font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 var(--s-3); font-weight: 700; }
.aside-card .legend-item { display: flex; gap: 9px; align-items: flex-start; font-size: var(--fs-small); color: var(--ink-2); margin-bottom: 10px; }

.back-link { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-weight: 600; font-size: var(--fs-small); cursor: pointer; background: none; border: none; padding: 6px 0; margin-bottom: var(--s-4); }
.back-link:hover { color: var(--signal); }

/* ── Placeholder (sections still on the roadmap) ─────────────────────────── */
.placeholder { border: 1px dashed var(--rule-2); border-radius: var(--r-l); padding: var(--s-8) var(--s-6); text-align: center; background: var(--paper-2); }
.placeholder .ic { width: 40px; height: 40px; color: var(--ink-3); margin: 0 auto var(--s-4); }
.placeholder h3 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h2); margin: 0 0 8px; }
[data-direction="ledger"] .placeholder h3 { font-weight: 700; }
.placeholder p { color: var(--ink-2); max-width: 50ch; margin: 0 auto; font-size: var(--fs-small); }
.roadmap-flag { display: inline-block; margin-top: var(--s-4); font-size: var(--fs-tiny); font-family: var(--font-figure); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--rule-2); border-radius: 999px; padding: 4px 12px; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-aside { background: var(--paper-2); border-right: 1px solid var(--rule); padding: var(--s-8) var(--s-7); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-aside .lp-name { margin-bottom: var(--s-6); }
.login-aside .lp-lead { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-mega); line-height: 1.05; letter-spacing: -.015em; max-width: 14ch; }
[data-direction="ledger"] .login-aside .lp-lead { font-weight: 600; }
.login-aside .lp-lead .em { color: var(--signal); font-style: italic; }
.login-aside .lp-sub { color: var(--ink-2); margin-top: var(--s-4); max-width: 42ch; font-size: var(--fs-body); }
.login-aside .lp-gauge { margin-top: var(--s-6); max-width: 440px; }
.login-aside .lp-foot { font-size: var(--fs-tiny); color: var(--ink-3); line-height: 1.6; }
.login-main { display: grid; place-items: center; padding: var(--s-7) var(--s-6); }
.login-card { width: 100%; max-width: 380px; }
.login-card .lc-seal { width: 48px; height: 48px; margin-bottom: var(--s-4); }
.login-card .lc-seal img { width: 100%; height: 100%; object-fit: contain; }
.login-card h1 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h1); margin: 0 0 6px; }
[data-direction="ledger"] .login-card h1 { font-weight: 700; }
.login-card .lc-sub { color: var(--ink-2); font-size: var(--fs-small); margin: 0 0 var(--s-6); }
.field { margin-bottom: var(--s-4); }
.field label { display: block; font-size: var(--fs-small); font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.field input { width: 100%; padding: 12px 14px; font-size: var(--fs-body); font-family: var(--font-body); background: var(--paper); border: 1px solid var(--rule-2); border-radius: var(--r-s); color: var(--ink); transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.field input::placeholder { color: var(--ink-3); }
.field input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); }
.error-msg { color: var(--gap); font-size: var(--fs-small); min-height: 1.2em; margin: 2px 0 var(--s-2); }
.login-card .lc-foot { margin-top: var(--s-5); font-size: var(--fs-tiny); color: var(--ink-3); line-height: 1.6; padding-top: var(--s-4); border-top: 1px solid var(--rule); }

/* not-official footer */
.disclaimer { margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid var(--rule); font-size: var(--fs-tiny); color: var(--ink-3); line-height: 1.6; }
.disclaimer b { color: var(--ink-2); }

/* ── Switcher (prototype-only chrome) ────────────────────────────────────── */
.seg { display: inline-flex; background: var(--paper-3); border: 1px solid var(--rule-2); border-radius: 999px; padding: 2px; gap: 2px; }
.seg button { font-size: var(--fs-tiny); font-weight: 700; padding: 5px 11px; border-radius: 999px; border: none; background: none; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--paper-2); color: var(--ink); box-shadow: var(--sh-2); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-s); border: 1px solid var(--rule-2); background: var(--paper-2); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn .ic { width: 17px; height: 17px; }

/* spinner + toast */
.spinner { width: 15px; height: 15px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 999px; box-shadow: var(--sh-pop); font-size: var(--fs-small); z-index: 100; opacity: 0; transition: opacity var(--dur-2), transform var(--dur-2); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Entrance motion (respects reduced-motion) ───────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(8px); animation: reveal var(--dur-3) var(--ease) forwards; }
  .reveal.d1 { animation-delay: .04s; } .reveal.d2 { animation-delay: .09s; }
  .reveal.d3 { animation-delay: .14s; } .reveal.d4 { animation-delay: .19s; }
  .reveal.d5 { animation-delay: .24s; } .reveal.d6 { animation-delay: .29s; }
  @keyframes reveal { to { opacity: 1; transform: none; } }
  .bar span { animation: grow var(--dur-3) var(--ease) both; }
  @keyframes grow { from { width: 0 !important; } }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .detail-grid { grid-template-columns: 1fr; }
  .statrow { grid-template-columns: repeat(2, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}
@media (max-width: 768px) {
  :root { --rail: 0px; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 40;
    flex-direction: row; align-items: center; gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--rule-2); overflow-x: auto;
  }
  .rail .brand, .rail .foot, .nav-label { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 10px; font-size: 10px; white-space: nowrap; }
  .nav-item .ic { width: 19px; height: 19px; }
  .nav-item .soon, .nav-item .count { display: none; }
  .nav-item[aria-current="page"] { box-shadow: inset 0 2px 0 var(--accent-line); }
  .content-inner { padding: var(--s-5) var(--s-4) calc(86px + var(--s-5)); }
  .topbar { padding: 10px var(--s-4); }
  .statrow { grid-template-columns: repeat(2, 1fr); }
  .controls .actions { width: 100%; }
  .controls .actions .btn { flex: 1; }
  .chart-row { grid-template-columns: 58px 1fr; }
  .chart-row .qv { display: none; }
  table.holdings .col-meta { display: none; }
}

/* ============================================================================
   Humanist-sans micro-UI (legibility) — body & headings stay serif.
   ============================================================================ */
.btn, .nav-item, .nav-label, .lens, .chip, .status-badge, .stamp,
.stat .l, .tally .k, .page-kicker, .cov-tag, .evidence-label, .ai-label,
table.holdings thead th, .field label, .topbar .crumb, .h-meta, .dmeta,
.gauge-scale, .gauge-legend, .roadmap-flag, .seg button, .trends-legend,
.aside-card h4, .maggie-tab, .src-item .src-meta, .studio-tab {
  font-family: var(--font-ui);
}

/* ============================================================================
   STATIC MOCK SHELL — renders a full page comp inside a fixed-width board frame
   (overrides the live-app sticky/100vh shell). Placed last so it wins.
   ============================================================================ */
.mock-app {
  display: grid; grid-template-columns: var(--rail) 1fr;
  min-height: unset; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); border-radius: inherit; overflow: hidden;
}
.mock-app .rail { position: static; height: auto; min-height: 100%; }
.mock-app .topbar { position: static; backdrop-filter: none; background: var(--paper); }
.mock-app table.holdings thead th { position: static; }
.mock-app .content-inner { padding: var(--s-5) var(--s-6) var(--s-7); }
.mock-app.compact { height: 860px; }
.mock-app.compact > .content { height: 100%; min-height: 0; }

/* ============================================================================
   MAGGIE — NotebookLM-style window (sources · chat · studio)
   ============================================================================ */
.maggie { display: grid; grid-template-rows: auto 1fr; height: 100%; min-height: 0; background: var(--paper); }
.m-pane .chat, .m-pane .m-pane-body { flex: 1 1 auto; min-height: 0; }
.maggie-bar { display: flex; align-items: center; gap: var(--s-3); padding: 12px var(--s-5); border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.maggie-bar .m-name { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h3); }
[data-direction="ledger"] .maggie-bar .m-name, [data-direction="broadsheet"] .maggie-bar .m-name { font-weight: 700; }
.maggie-bar .m-tag { font-size: var(--fs-tiny); color: var(--ink-3); font-family: var(--font-ui); }
.maggie-cols { display: grid; grid-template-columns: 248px 1fr 290px; min-height: 0; }
.m-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.m-pane + .m-pane { border-left: 1px solid var(--rule); }
.m-pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--s-4); border-bottom: 1px solid var(--rule); font-family: var(--font-ui); font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-3); }
.m-pane-head .add { color: var(--signal); cursor: pointer; }
.m-pane-body { padding: var(--s-3) var(--s-4); overflow: auto; }

.src-item { display: flex; gap: 9px; align-items: flex-start; padding: 9px 8px; border-radius: var(--r-s); }
.src-item:hover { background: var(--paper-3); }
.src-item .ck { width: 15px; height: 15px; border: 1px solid var(--rule-2); border-radius: 3px; flex: 0 0 auto; margin-top: 2px; display: grid; place-items: center; background: var(--signal); color: var(--ink-on-signal); }
.src-item .ck.off { background: transparent; color: transparent; }
.src-item .src-t { font-size: var(--fs-small); font-weight: 600; color: var(--ink); line-height: 1.3; }
.src-item .src-meta { font-size: 10px; color: var(--ink-3); margin-top: 2px; }

.chat { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-4) var(--s-5); overflow: auto; }
.msg { max-width: 92%; }
.msg.user { align-self: flex-end; background: var(--paper-3); border: 1px solid var(--rule); border-radius: var(--r-m) var(--r-m) 2px var(--r-m); padding: 10px 14px; font-size: var(--fs-small); color: var(--ink); }
.msg.bot { align-self: flex-start; }
.msg.bot .bubble { font-size: var(--fs-small); line-height: 1.6; color: var(--ink); }
.msg.bot .cite-pill { display: inline-flex; align-items: center; vertical-align: baseline; font-family: var(--font-ui); font-size: 10px; font-weight: 700; color: var(--ai-ink); background: var(--ai-tint); border: 1px solid color-mix(in srgb, var(--ai) 30%, transparent); border-radius: 999px; padding: 0 6px; margin: 0 1px; line-height: 1.5; }
.msg.bot .grounded { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--ai-ink); margin-bottom: 6px; }
.chat-input { margin-top: auto; display: flex; gap: 8px; align-items: center; border: 1px solid var(--rule-2); border-radius: 999px; padding: 6px 6px 6px 14px; background: var(--paper-2); }
.chat-input .ph { flex: 1; font-size: var(--fs-small); color: var(--ink-3); }
.chat-input .send { width: 30px; height: 30px; border-radius: 50%; background: var(--signal); color: var(--ink-on-signal); display: grid; place-items: center; }

.studio-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px var(--s-4) 0; }
.studio-tab { font-family: var(--font-ui); font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: var(--r-s) var(--r-s) 0 0; color: var(--ink-3); cursor: pointer; border: 1px solid transparent; border-bottom: none; }
.studio-tab[aria-selected="true"] { color: var(--ink); background: var(--paper-2); border-color: var(--rule); }
.studio-body { border-top: 1px solid var(--rule); padding: var(--s-4); }
.studio-art { border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--paper-2); padding: var(--s-4); }
.studio-art h5 { font-family: var(--font-display); font-weight: 700; margin: 0 0 8px; font-size: var(--fs-small); }
.studio-art .ln { height: 7px; border-radius: 3px; background: var(--paper-3); margin-bottom: 7px; }
.studio-art .ln.s { width: 60%; }
.studio-art .pull { font-family: var(--font-display); font-style: italic; font-size: var(--fs-small); color: var(--ink-2); border-left: 2px solid var(--accent-line); padding-left: 10px; margin-top: 10px; }

/* ============================================================================
   PER-DIRECTION TREATMENTS
   ============================================================================ */
/* Anchored — ochre underline under the nameplate; serif pull on AI summary */
[data-direction="anchored"] .nameplate .word { letter-spacing: -.01em; }
[data-direction="anchored"] .page-title { font-weight: 700; }
[data-direction="anchored"] .ai .summary { font-style: italic; }

/* Ledger — uppercase nameplate, vermilion "Watch", boxed stamp already handled */

/* Broadsheet — heavy black rules, dramatic masthead, ruled section heads */
[data-direction="broadsheet"] .nameplate .word { text-transform: uppercase; letter-spacing: -.01em; font-weight: 900; font-size: 1.34rem; }
[data-direction="broadsheet"] .nameplate .watch { font-weight: 900; color: var(--signal); font-style: normal; }
[data-direction="broadsheet"] .rail { border-right: 2px solid var(--rule-2); }
[data-direction="broadsheet"] .rail .brand { border-bottom: 2px solid var(--rule-2); }
[data-direction="broadsheet"] .section { border-top: 2px solid var(--rule-2); padding-top: 10px; }
[data-direction="broadsheet"] .section h2 { font-weight: 900; text-transform: uppercase; letter-spacing: .01em; }
[data-direction="broadsheet"] .page-title { font-weight: 900; }
[data-direction="broadsheet"] .coverage { border: 2px solid var(--rule-2); border-left: 6px solid var(--signal); }
[data-direction="broadsheet"] table.holdings thead th { border-bottom: 2px solid var(--rule-2); color: var(--ink); }
[data-direction="broadsheet"] .stat .v, [data-direction="broadsheet"] .tally .n { font-weight: 900; }
[data-direction="broadsheet"] .ai .summary { font-style: italic; }

/* a "lead story" frame for the broadsheet Overview top finding */
.leadstory { border-top: 3px solid var(--ink); border-bottom: 1px solid var(--rule-2); padding: var(--s-4) 0; margin-bottom: var(--s-5); display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s-5); }
.leadstory .ls-kicker { font-family: var(--font-ui); font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--signal); }
.leadstory h3 { font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; line-height: 1.08; margin: 8px 0; letter-spacing: -.01em; }
.leadstory p { font-size: var(--fs-small); color: var(--ink-2); margin: 0; }
.leadstory .ls-fig { text-align: right; }
.leadstory .ls-fig .big { font-family: var(--font-figure); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--signal); }
.leadstory .ls-fig .cap { font-family: var(--font-ui); font-size: var(--fs-tiny); color: var(--ink-3); margin-top: 6px; }
