/* TRD Millennium Intelligence Portal — product deliverable candidate styles. System fonts only; no external requests. */
:root {
  --paper: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #0e1b2a;
  --ink-2: #2a3a4c;
  --muted: #566272;
  --line: #e2e0d8;
  --line-2: #d3d0c5;
  --rail: #0e1b2a;
  --rail-2: #16273b;
  --rail-text: #c9d4e0;
  --accent: #0f6e6a;
  --accent-ink: #0a4f4c;
  --accent-soft: #e2f1ee;
  --focus: #1d6fd6;
  --link: #1257b0;

  --g-great: #0f6e6a;
  --g-good: #1e5fae;
  --g-dev: #8a5a12;
  --g-good-bg: #e6eef9;
  --g-dev-bg: #f8efe0;
  --g-great-bg: #e2f1ee;

  --l1: #0f766e;
  --l2: #4f5fb8;
  --l3: #c07a12;
  --l4: #8792a2;

  --b0: #ebe9e2;
  --b1: #cfe6e2;
  --b2: #8fcac1;
  --b3: #3f9d95;
  --b4: #175c5f;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(14, 27, 42, .05), 0 6px 20px -8px rgba(14, 27, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(14, 27, 42, .35);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --rail-w: 264px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { font-family: var(--display); color: var(--ink); margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--link); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.muted { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); margin-top: 10px; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

/* ---------- buttons vs links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-quiet:hover { border-color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.i-arrow { transition: transform .15s; }
.btn:hover .i-arrow { transform: translateX(2px); }
.linkish { background: none; border: 0; padding: 8px 2px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--ink); }
/* external/source links: underlined text + arrow glyph — never a filled pill */
.ext { display: inline-flex; align-items: center; gap: 5px; color: var(--link); font-weight: 600; font-size: 14px; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; min-height: 44px; }
.ext:hover { text-decoration-thickness: 2px; }
.ext .i-ext { width: 11px; height: 11px; flex: none; }
.ext.on-dark, .linkish.on-dark { color: #a9d8ff; }

/* ---------- gate ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 85% -10%, rgba(15, 110, 106, .35), transparent 60%),
  radial-gradient(900px 500px at -10% 110%, rgba(30, 95, 174, .28), transparent 60%), var(--rail); }
.gate-card { width: 100%; max-width: 520px; background: var(--surface); border-radius: 22px; padding: clamp(24px, 5vw, 44px); box-shadow: var(--shadow-lg); }
.brandmark { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 28px; }
.brandmark img { border-radius: 10px; }
.gate h1 { font-size: clamp(30px, 6vw, 42px); line-height: 1.05; letter-spacing: -.03em; }
.gate-lede { color: var(--ink-2); margin: 14px 0 26px; font-size: 16px; }
.field-label { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .02em; }
.gate-row { display: flex; gap: 10px; }
.gate-row input { flex: 1; min-width: 0; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line-2); padding: 0 14px; font-size: 16px; letter-spacing: .12em; background: var(--surface-2); }
.gate-row input:focus { border-color: var(--ink); outline: 3px solid rgba(29, 111, 214, .25); outline-offset: 0; }
.gate-row input[aria-invalid="true"] { border-color: #b3261e; }
.gate-row .btn { min-height: 48px; }
.gate-msg { min-height: 22px; margin-top: 8px; color: #b3261e; font-size: 14px; font-weight: 600; }
.gate-note { font-size: 14px; color: var(--ink-2); padding-top: 18px; border-top: 1px solid var(--line); }
.gate-fine { font-size: 12px; color: var(--muted); margin-top: 6px; }
@media (max-width: 460px) { .gate-row { flex-direction: column; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--rail); color: var(--rail-text); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 9px; flex: none; }
.brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 12px; color: #93a3b5; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--rail-text); text-decoration: none; font-weight: 550; font-size: 14.5px; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--rail-2); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.nav a[aria-current="page"] svg { opacity: 1; color: var(--accent); }
.rail-foot { margin-top: auto; display: grid; gap: 0; font-size: 13px; }
.rail-foot .ext { min-height: 36px; font-size: 13.5px; }
.rail-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8193a7; margin-bottom: 2px; }
.rail-meta { color: #93a3b5; font-size: 12px; margin-top: 12px; line-height: 1.5; }
.rail-foot .linkish { justify-self: start; font-size: 13px; min-height: 40px; }
.mtop, .tabbar { display: none; }
.jump, .sp-mobile-hint { display: none; }
.jump { margin-top: 8px; background: none; border: 0; padding: 6px 0; min-height: 44px; font-weight: 650; font-size: 14px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.page-foot { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); display: grid; gap: 22px; }
.flow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flow-link { display: grid; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; min-height: 44px; }
.flow-link:hover { border-color: var(--ink); }
.flow-link span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.flow-link strong { font-size: 16px; }
.flow-link.next { text-align: right; grid-column: 2; }
.foot-meta { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.foot-meta strong { color: var(--ink-2); }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: center; }
.foot-links .int { color: var(--link); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; display: inline-flex; align-items: center; }
.main { padding: 36px clamp(20px, 3.4vw, 52px) 64px; max-width: 1440px; width: 100%; outline: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(28px, 3.3vw, 40px); line-height: 1.08; letter-spacing: -.03em; }
.lede { max-width: 760px; margin-top: 10px; color: var(--ink-2); font-size: 16px; }
.page-head-links { display: flex; gap: 18px; flex: none; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 18px; }
.panel-head, .section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel-head p, .section-head p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.section-head { margin: 34px 0 16px; align-items: flex-end; }
.section-head h2 { font-size: 21px; }
.foot-note { color: var(--muted); font-size: 13px; margin-top: 26px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 4px; box-shadow: var(--shadow); }
.kpi-num { font-family: var(--display); font-size: clamp(30px, 3vw, 40px); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 13.5px; }
.kpi-accent { background: var(--ink); border-color: var(--ink); }
.kpi-accent .kpi-num { color: #7fe0cf; }
.kpi-accent .kpi-label { color: #c9d4e0; }

.brief-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; }
.callout { border-left: 3px solid var(--accent); background: var(--surface-2); padding: 14px 16px; border-radius: 0 10px 10px 0; }
.callout h3 { font-size: 16px; margin-bottom: 4px; }
.callout p { color: var(--ink-2); font-size: 14.5px; }
.lane-summary { margin-top: 18px; }
.lane-rows { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.lane-rows li { display: grid; grid-template-columns: 10px 40px minmax(0, 1fr); align-items: start; gap: 10px; }
.lane-rows .lane-dot { margin-top: 9px; }
.lr-num { font-family: var(--display); font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.lane-rows strong + div strong { display: block; font-size: 14.5px; }
.lane-rows small { color: var(--muted); font-size: 13px; display: block; }

.lanebar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--b0); gap: 2px; min-width: 80px; }
.lanebar.big { height: 12px; }
.lanebar span { display: block; min-width: 4px; }
.l1 { --c: var(--l1); } .l2 { --c: var(--l2); } .l3 { --c: var(--l3); } .l4 { --c: var(--l4); }
.lanebar .l1 { background: var(--l1); } .lanebar .l2 { background: var(--l2); } .lanebar .l3 { background: var(--l3); } .lanebar .l4 { background: var(--l4); }
.lane-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--l4)); flex: none; }
.lane-dot.l34 { background: linear-gradient(90deg, var(--l3) 50%, var(--l4) 50%); }
.lane-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.lane-legend span { display: inline-flex; align-items: center; gap: 7px; }
.lane-legend.stacked { display: grid; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.lane-legend.stacked strong { margin-left: auto; font-variant-numeric: tabular-nums; }

.map-teaser .teaser-link { display: block; border-radius: 10px; }
.teaser-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }

.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.how-step { display: flex; gap: 14px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: inherit; text-decoration: none; transition: border-color .15s, background-color .15s; }
.how-step:hover { border-color: var(--ink); background: var(--surface); }
.how-n { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 700; padding-top: 3px; }
.how-step strong { display: block; font-size: 15px; }
.how-step p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- grade + lane markers ---------- */
.grade { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 8px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; color: var(--gc); background: var(--gbg); }
.grade.great { --gc: var(--g-great); --gbg: var(--g-great-bg); }
.grade.good { --gc: var(--g-good); --gbg: var(--g-good-bg); }
.grade.dev { --gc: var(--g-dev); --gbg: var(--g-dev-bg); }
.meter { display: inline-flex; gap: 2px; align-items: flex-end; }
.meter i { width: 4px; border-radius: 1px; background: currentColor; opacity: .25; }
.meter i:nth-child(1) { height: 6px; } .meter i:nth-child(2) { height: 9px; } .meter i:nth-child(3) { height: 12px; }
.meter i.on { opacity: 1; }
.lane { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.lane i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: .03em; white-space: nowrap; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.card::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-2); }
.card.grade-good::before { background: var(--g-good); }
.card.grade-great::before { background: var(--g-great); }
.card:hover { border-color: var(--line-2); box-shadow: 0 2px 4px rgba(14, 27, 42, .06), 0 16px 32px -14px rgba(14, 27, 42, .22); transform: translateY(-1px); }
.card:focus-within { border-color: var(--ink); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { font-size: 16.5px; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card-open { all: unset; cursor: pointer; font: inherit; color: var(--ink); }
.card-open:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.card-ev { color: var(--ink-2); font-size: 14px; }
.card-meta { margin: auto 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.card-meta dd { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.has-route { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-ink); font-weight: 600; }
.has-route svg { width: 13px; height: 13px; flex: none; }
.card-foot { display: flex; justify-content: space-between; align-items: center; }
.card-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink); }
.card-cta svg { width: 15px; height: 15px; }
.card:hover .i-arrow { transform: translateX(3px); }

/* ---------- toolbar ---------- */
.toolbar { display: grid; grid-template-columns: minmax(200px, 1.5fr) repeat(5, minmax(120px, 1fr)); gap: 12px 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.toolbar .grades { grid-column: 1 / 4; }
.toolbar .views { grid-column: 4 / 7; justify-self: end; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field legend { padding: 0; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input, .toolbar select { width: 100%; min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface-2); padding: 0 12px; font-size: 15px; }
.search input { padding-left: 38px; }
.toolbar select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23566272' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; text-overflow: ellipsis; }
.search input:focus, .toolbar select:focus { border-color: var(--ink); outline: 3px solid rgba(29, 111, 214, .25); outline-offset: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.seg button, .seg-link { min-height: 38px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.seg button:hover:not([disabled]), .seg-link:hover { background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button[disabled] { opacity: .45; cursor: not-allowed; }
.seg .n { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .75; }
.seg-link { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

.result-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 18px 0 12px; }
.result-bar p { color: var(--muted); }
.result-bar strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.pill:hover { border-color: var(--ink); }
.empty { text-align: center; padding: 44px 20px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); display: grid; gap: 8px; justify-items: center; }
.empty h3 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 440px; margin-bottom: 8px; }
.group { margin-top: 22px; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.group-head h2 { font-size: 18px; }
.group-head p { color: var(--muted); font-size: 13px; }

/* ---------- tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 650; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table td { padding: 14px; vertical-align: top; border-bottom: 1px solid var(--line); color: var(--ink-2); overflow-wrap: anywhere; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.table td:nth-child(1) { width: 24%; } .table td:nth-child(2) { width: 15%; } .table td:nth-child(4) { width: 20%; }
.row-open { background: none; border: 0; padding: 2px 0; text-align: left; font-weight: 650; color: var(--ink); font-size: 14.5px; line-height: 1.35; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; min-height: 32px; }
.row-open:hover { text-decoration-color: var(--ink); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; width: 80px; }
.table .act { text-align: right; width: 1%; white-space: nowrap; }
.rollup-table td:nth-child(1) { width: 26%; } .rollup-table td:nth-child(2), .rollup-table td:nth-child(3) { width: 90px; } .rollup-table td:nth-child(4) { width: auto; }
.rollup-table tr.is-sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- map ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.map-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 20px 14px; min-width: 0; }
.map-card-head { display: flex; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 8px; }
.map-card-head h2 { font-size: 18px; }
.map-card-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 420px; }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.legend.compact { grid-template-columns: auto; gap: 4px; }
.legend-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; color: var(--muted); }
.legend-scale { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.legend-scale li { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 16px; height: 12px; border-radius: 3px; border: 1px solid rgba(14, 27, 42, .12); flex: none; }
.sw.b0 { background: var(--b0); } .sw.b1 { background: var(--b1); } .sw.b2 { background: var(--b2); } .sw.b3 { background: var(--b3); } .sw.b4 { background: var(--b4); }
.sw.bx { background: repeating-linear-gradient(45deg, var(--b1) 0 3px, #fff 3px 6px); }
.sw-ring { display: inline-block; width: 22px; height: 14px; border-radius: 99px; background: #fff; border: 2.5px solid #c8961e; }

.map-wrap { position: relative; }
.usmap { width: 100%; height: auto; overflow: visible; }
.usmap .st { stroke: #fff; stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill .15s, opacity .15s; }
.usmap .st.empty { fill: var(--b0); }
.usmap .b1 { fill: var(--b1); } .usmap .b2 { fill: var(--b2); } .usmap .b3 { fill: var(--b3); } .usmap .b4 { fill: var(--b4); }
.usmap .st.has { cursor: pointer; }
.usmap .st.has:hover, .usmap .st.has.hover { filter: brightness(.92); }
.usmap .st.has:focus { outline: none; }
.usmap .st.has:focus-visible { stroke: var(--focus); stroke-width: 3; }
.usmap .sel-outline { fill: none; stroke: var(--ink); stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.usmap .inset rect { fill: none; stroke: var(--line-2); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.usmap .inset text { font: 700 12px var(--font); letter-spacing: .08em; fill: var(--muted); }
.usmap .lbl-empty { font: 600 11px var(--font); fill: #7d8793; text-anchor: middle; pointer-events: none; }
.usmap .lbl-empty.sm { font-size: 8.5px; }
.usmap .leader { stroke: var(--ink-2); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.usmap .badge { cursor: pointer; }
.usmap .badge rect { fill: #fff; stroke: rgba(14, 27, 42, .25); stroke-width: 1; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 1.5px rgba(14, 27, 42, .25)); }
.usmap .badge.good rect { stroke: #c8961e; stroke-width: 2.5; }
.usmap .badge.sel rect { fill: var(--ink); stroke: var(--ink); }
.usmap .badge text { font: 600 13px var(--font); fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums; }
.usmap .badge .b-ab { font-weight: 800; }
.usmap .badge.sel text { fill: #fff; }
.usmap.mini .st { stroke-width: .6; }
.map-hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); }
.tip { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 13px; display: grid; gap: 1px; box-shadow: var(--shadow-lg); max-width: 260px; z-index: 5; }
.tip[hidden] { display: none; }
.tip span { color: #d6e2ee; }
.tip em { font-style: normal; font-size: 12px; color: #9fb2c6; }

.state-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sp-head h2 { font-size: 22px; letter-spacing: -.02em; }
.sp-head > p { color: var(--muted); font-size: 13.5px; width: 100%; }
.sp-title { min-width: 0; }
.sp-states { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sp-states button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 14.5px; }
.sp-states button:hover { background: var(--surface-2); }
.sp-name { flex: 1; font-weight: 550; }
.sp-n { font-variant-numeric: tabular-nums; font-weight: 700; }
.sp-note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.sp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.sp-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; }
.sp-stats strong { font-size: 22px; font-family: var(--display); line-height: 1.1; font-variant-numeric: tabular-nums; }
.sp-stats span { font-size: 12px; color: var(--muted); }
.sp-lanes { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.sp-lanes li { display: flex; align-items: center; gap: 8px; }
.sp-lanes span { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 6px; }
.sp-accounts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.sp-accounts button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; min-height: 44px; }
.sp-accounts button:hover { border-color: var(--ink); }
.sp-acc-name { font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.sp-acc-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.rollup { margin-top: 8px; }

/* ---------- method ---------- */
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.method-grid h2 { margin-bottom: 12px; }
.method-grid p { color: var(--ink-2); }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; color: var(--ink-2); }
.ticks li { position: relative; padding-left: 20px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.grade-defs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.grade-defs li { display: grid; grid-template-columns: 124px 1fr; gap: 4px 12px; align-items: start; }
.grade-defs p { font-size: 14px; }
.grade-defs .n { grid-column: 2; font-size: 12px; color: var(--muted); }
.rhythm { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.rhythm li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rhythm li:first-child { border-top: 0; padding-top: 0; }
.rhythm span { color: var(--ink-2); }
.source-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.source-card { display: grid; gap: 4px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.source-card:hover { border-color: var(--ink); }
.source-card strong { font-size: 18px; font-family: var(--display); }
.src-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent); }
.src-url { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.src-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--link); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.src-go .i-ext { width: 11px; height: 11px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 16, 26, .45); z-index: 40; animation: fade .2s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(24px); opacity: 0; transition: transform .22s ease, opacity .22s ease; outline: none; }
.drawer.in { transform: none; opacity: 1; }
body.drawer-open { overflow: hidden; }
.dr-head { padding: 16px 24px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dr-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dr-head h2 { font-size: clamp(21px, 3vw, 26px); line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.dr-tags { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 12px; }
.dr-body { flex: 1; overflow-y: auto; padding: 6px 24px 24px; overscroll-behavior: contain; }
.dr-block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.dr-block:last-child { border-bottom: 0; }
.dr-block h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.dr-block p { color: var(--ink-2); }
.dr-lead { font-size: 17px; color: var(--ink) !important; line-height: 1.45; }
.contact { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.contact-name { font-weight: 650; color: var(--ink) !important; overflow-wrap: anywhere; }
.phones { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.phones li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tel { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 650; font-size: 15.5px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.tel svg { width: 16px; height: 16px; }
.contact-note { font-size: 13px; color: var(--muted) !important; margin-top: 8px; }
.related { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.related button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 14px; display: grid; gap: 2px; min-height: 44px; }
.related button span { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.related button:hover { border-color: var(--ink); }
.dr-sources { display: grid; justify-items: start; }
.dr-sources .ext { min-height: 36px; }
.dr-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes fade { from { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toolbar .field.grow { grid-column: 1 / -1; }
  .toolbar .grades { grid-column: 1 / 3; }
  .toolbar .views { grid-column: 3 / 5; }
  .map-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1080px) {
  :root { --rail-w: 220px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brief-grid { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; }
  .state-panel { position: static; max-height: none; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .table td:nth-child(5), .table th:nth-child(5) { display: none; }
  .rollup-table td:nth-child(5), .rollup-table th:nth-child(5) { display: table-cell; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mtop { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; background: var(--rail); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; text-align: center; line-height: 1.15; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
  .main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .grades, .toolbar .views { grid-column: 1 / -1; justify-self: stretch; }
  .how { grid-template-columns: 1fr; }
  .method-grid, .source-cards { grid-template-columns: 1fr; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* stacked table rows */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: auto !important; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 4px 0; }
  .table td:nth-child(5), .table th:nth-child(5) { display: block; }
  .table td[data-label]:not([data-label="Account"]):not([data-label="State"])::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin-top: 6px; }
  .table .num { text-align: left; }
  .table .act { text-align: left; padding-top: 8px; }
  .rollup-table tr { display: grid; grid-template-columns: 1fr auto auto; gap: 0 14px; align-items: start; }
  .rollup-table td[data-label="State"] { grid-column: 1; }
  .rollup-table td[data-label="Records"], .rollup-table td[data-label="Good"] { text-align: right; }
  .rollup-table td[data-label="Records"]::before, .rollup-table td[data-label="Good"]::before { margin-top: 0 !important; }
  .rollup-table td[data-label="Lane mix"], .rollup-table td.act { grid-column: 1 / -1; }
  .usmap .lbl-empty { display: none; }
  .jump { display: inline-flex; align-items: center; }
  .map-hint { display: none; }
  .sp-states, .state-panel .sp-note, .state-panel .sp-head > p { display: none; }
  .sp-mobile-hint { display: block; color: var(--muted); font-size: 14px; }
  .state-panel .sp-head { margin-bottom: 4px; }
  .map-card { padding: 14px 12px 10px; }
}
@media (max-width: 520px) {
  body { font-size: 15px; }
  .kpi { padding: 14px; }
  .kpi-label { font-size: 12.5px; }
  .toolbar { grid-template-columns: 1fr; padding: 14px; }
  .toolbar .field.grow { grid-column: auto; }
  .page-head-links { gap: 14px; }
  .card-meta { grid-template-columns: 1fr; }
  .grade-defs li { grid-template-columns: 1fr; }
  .grade-defs .n { grid-column: 1; }
  .rhythm li { grid-template-columns: 1fr; gap: 2px; }
  .dr-head, .dr-body, .dr-foot { padding-left: 16px; padding-right: 16px; }
  .flow { grid-template-columns: 1fr; }
  .flow-link.next { grid-column: 1; }
  .panel { padding: 18px 16px; }
  .panel-head { flex-direction: column; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}
@media (forced-colors: active) {
  .usmap .st.has { stroke: CanvasText; }
  .usmap .sel-outline { stroke: Highlight; }
  .grade, .chip, .btn { border: 1px solid CanvasText; }
}
@media print {
  .rail, .tabbar, .mtop, .toolbar, .page-head-links { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* ---------- release candidate: contact routing (16 Sep 2026) ---------- */
.page-head-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.updated-cue { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--accent-ink); background: var(--accent-soft); border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.updated-cue .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.updated-cue.sm { font-size: 12px; padding: 3px 9px; }
.rq { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 6px; border: 1.5px solid var(--rqc); color: var(--rqc); background: var(--surface); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.rq-k { font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rq-great { --rqc: #0a5c58; } .rq-good { --rqc: #1c5aa5; } .rq-mediocre { --rqc: #7a4f0f; } .rq-quarantined { --rqc: #9b1c1c; } .rq-unlabeled { --rqc: var(--muted); }
.sub-inline { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dr-part { margin: 18px 0 0; padding-bottom: 6px; border-bottom: 2px solid var(--ink); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.dr-contact { border-bottom: 0; }
.cr-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cr-head .cr-title { margin: 0; }
.cr-intro { font-size: 13.5px; margin: 8px 0 12px; }
.cr-quality { margin-bottom: 10px; }
.cf { margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.cf-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.cf-row:first-child { border-top: 0; }
.cf dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 2px; }
.cf dd { margin: 0; min-width: 0; }
.cf-line { font-size: 14px; color: var(--ink-2) !important; overflow-wrap: anywhere; margin: 0 0 6px; }
.cf-line:last-child { margin-bottom: 0; }
.cf-line.none { color: var(--muted) !important; }
.cf-source .cf-line, .cf-scope .cf-line { font-size: 13px; }
.em { font-family: var(--mono); font-size: 12.5px; background: #eef0f3; border-radius: 4px; padding: 0 4px; color: var(--ink); overflow-wrap: anywhere; }
.tel-inline { color: var(--link); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; display: inline-block; min-height: 24px; }
.tag { display: inline-block; margin: 3px 0 0 6px; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 1.6; vertical-align: 1px; white-space: normal; }
.tag.warn { background: #fdecc8; color: #6b4200; }
.tag.old { background: #e9e7f5; color: #3d3a73; }
.tag.note { background: #f1f1ee; color: #4a4a44; border: 1px solid #dcdad2; }
.tag.none { background: transparent; color: var(--muted); border: 1px dashed var(--line-2); }
.tag.src { background: var(--accent-soft); color: var(--accent-ink); }
.shared-note, .quarantine { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.shared-note { background: #eef3fb; border: 1px solid #c9d8ef; color: var(--ink-2); }
.shared-note .linkish { min-height: 32px; padding: 2px 0; }
.quarantine { background: #fbeeee; border: 1px solid #efc9c9; color: #5c1414; display: grid; gap: 6px; }
.quarantine p { color: #5c1414 !important; }
@media (max-width: 1080px) { .page-head-side { justify-items: start; } }
@media (max-width: 520px) {
  .cf-row { grid-template-columns: 1fr; gap: 4px; }
  .updated-cue { white-space: normal; }
}

.cr-head .cr-title { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.dr-contact { margin-top: 18px; padding-top: 10px; border-top: 2px solid var(--ink); }
.seg button[aria-pressed="true"]:hover:not([disabled]) { background: var(--ink); color: #fff; }
