/* VA Ratings. Apex "Signal" look: dark stage, one amber accent. */
:root {
  --bg: #0B0D10;
  --surface: #13161B;
  --surface-2: #1A1E25;
  --line: #262B33;
  --ink: #EDEFF2;
  --ink-2: #A9B0BB;
  --muted: #727A86;
  --accent: #F2B233;
  --accent-ink: #1A1305;
  --accent-soft: rgba(242, 178, 51, .14);
  --good: #4CC38A;
  --warn: #E07A5F;
  --radius: 14px;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F6F5F2; --surface: #FFFFFF; --surface-2: #F0EEE9; --line: #DEDAD2;
    --ink: #15181D; --ink-2: #4A515C; --muted: #737A85;
    --accent: #B97F0B; --accent-ink: #FFFFFF; --accent-soft: rgba(185, 127, 11, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 var(--sans); min-height: 100vh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }

/* Bar */
.bar { border-bottom: 1px solid var(--line); }
.bar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 10px; vertical-align: 1px; }
.env { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 5px 9px; }

/* Views */
.view { padding: 56px 0 40px; }
body { overflow-x: clip; }

/* Hero with the Apex topo map */
.view.start { padding-top: 0; }
.hero { position: relative; width: 100vw; margin-left: calc(50% - 50vw); min-height: min(78vh, 640px); display: flex; align-items: center; border-bottom: 1px solid var(--line); overflow: hidden; margin-bottom: 40px; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-inner { position: relative; padding-top: 72px; padding-bottom: 72px; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); max-width: 15ch; }
.hero .lede { max-width: 50ch; }
.btn.big { font-size: 17px; padding: 18px 28px; text-decoration: none; display: inline-block; }
.hero-sub { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.signin-needed { background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; padding: 12px 14px; max-width: 56ch; margin: 0 0 20px; }
.eyebrow { font: 600 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 0 0 14px; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 16px; font-weight: 800; max-width: 18ch; }
h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.lede { color: var(--ink-2); font-size: 18px; max-width: 58ch; margin: 0 0 28px; }
.note { color: var(--warn); margin: 16px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  font: 700 15px/1 var(--sans); border-radius: 999px; padding: 14px 22px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { font-size: 13px; padding: 9px 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.steps { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; max-width: 640px; }
.steps h2 { margin-bottom: 12px; }
.steps ol { margin: 0; padding-left: 22px; color: var(--ink-2); }
.steps li { margin: 10px 0; }
.steps li strong { color: var(--ink); }
.bookmarklet { display: inline-block; margin-left: 6px; cursor: grab; text-decoration: none; padding: 9px 15px; font-size: 14px; border-color: var(--accent); color: var(--accent); }
.drag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.drag-row .bookmarklet { margin-left: 0; }
.steps-intro { color: var(--ink-2); margin: 0 0 6px; }
.hint { color: var(--accent); font-size: 14px; margin: 12px 0 0; }
.actions.secondary { margin-top: 20px; }
.actions.secondary .btn { font-size: 14px; padding: 11px 18px; }

.facts { list-style: none; padding: 0; margin: 48px 0 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink-2); font-size: 14px; }
.facts strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Summary */
.summary { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-bottom: 40px; }
.ring {
  --p: 0; width: 148px; height: 148px; border-radius: 50%; flex: none;
  display: flex; justify-content: center; align-items: center;
  background:
    radial-gradient(closest-side, var(--bg) 82%, transparent 83%),
    conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0);
}
.ring-num { font: 800 46px/1 var(--sans); letter-spacing: -.03em; }
.ring-pct { font: 700 20px/1 var(--sans); color: var(--ink-2); margin-left: 2px; position: relative; top: -12px; }
.summary-text { flex: 1; min-width: 240px; }
.summary-text h1 { font-size: clamp(26px, 4vw, 36px); margin-bottom: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0 0 12px; font-size: 14px; }
.meta div { display: flex; gap: 8px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-family: var(--mono); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.pill { font: 600 12px/1 var(--sans); border-radius: 999px; padding: 7px 11px; background: var(--accent-soft); color: var(--accent); }
.pill.good { background: rgba(76, 195, 138, .14); color: var(--good); }

/* Table */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.count { color: var(--muted); font-weight: 500; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.ratings { width: 100%; border-collapse: collapse; font-size: 15px; }
.ratings th { text-align: left; font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 16px; background: var(--surface-2); }
.ratings td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: top; }
.ratings .num { text-align: right; }
.cond-name { font-weight: 600; }
.cond-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cond-code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pct { font: 800 18px/1 var(--sans); white-space: nowrap; }
.pct.zero { color: var(--muted); font-weight: 600; }
.bar-mini { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 8px; min-width: 60px; }
.bar-mini span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.date { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.tag { font-size: 12px; color: var(--ink-2); }
.tag.static { color: var(--good); }
.empty { padding: 28px 16px; color: var(--ink-2); text-align: center; }

/* Math */
.math { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.math summary { cursor: pointer; font-weight: 700; }
.math p { color: var(--ink-2); font-size: 14px; }
.math ol { font-family: var(--mono); font-size: 13px; color: var(--ink-2); padding-left: 22px; margin: 0; }
.math li { margin: 4px 0; }
.math li.total { color: var(--ink); font-weight: 600; }
.disclaimer { color: var(--muted); font-size: 13px; margin-top: 24px; }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 20px 0; }
.foot p { margin: 0; }

/* Phone: stack the table into cards */
@media (max-width: 640px) {
  .view { padding-top: 36px; }
  .view.start { padding-top: 0; }
  .hero { min-height: 0; }
  .hero-inner { padding-top: 48px; padding-bottom: 48px; }
  .ring { width: 120px; height: 120px; }
  .ring-num { font-size: 38px; }
  .ratings thead { display: none; }
  .ratings, .ratings tbody, .ratings tr, .ratings td { display: block; width: 100%; }
  .ratings tr { border-top: 1px solid var(--line); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
  .ratings tr:first-child { border-top: 0; }
  .ratings td { border: 0; padding: 0; }
  .ratings td.num { grid-column: 2; grid-row: 1; }
  .ratings td.c-date, .ratings td.c-status { grid-column: 1 / -1; font-size: 13px; }
  .ratings td.c-date::before { content: "Effective"; color: var(--muted); font-family: var(--sans); margin-right: 8px; }
}

/* How you reached X% */
.reach { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 32px; }
.reach canvas { flex: none; max-width: 100%; }
.reach-text { flex: 1; min-width: 240px; }
.reach-text h2 { margin-bottom: 4px; }
.reach-sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start; font-size: 14px; }
.chip { width: 14px; height: 14px; border-radius: 4px; margin-top: 3px; }
.chip.hatch { background-image: repeating-linear-gradient(45deg, rgba(20,18,14,.35) 0 2px, transparent 2px 6px) !important; }
.lg-name { display: block; color: var(--ink); }
.lg-sub { display: block; color: var(--muted); font-size: 12px; }
.lg-val { font-family: var(--mono); font-weight: 600; color: var(--ink); }

.math-wrap { overflow-x: auto; }
.math-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.math-table th { text-align: left; font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.math-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.math-table .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.math-table .strong { color: var(--ink); font-weight: 700; }
.math-result { color: var(--ink) !important; font-weight: 600; }

/* Apex print document: hidden on screen, the only thing printed */
#print-doc { display: none; }

@media print {
  @page { size: letter; margin: 0.45in 0.5in; }
  html, body { background: #fff !important; }
  body > *:not(#print-doc) { display: none !important; }
  #print-doc { display: block !important; color: #3A3732; font: 9pt/1.35 "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-doc, #print-doc * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  #print-doc h1, #print-doc h2 { color: #14120E; margin: 0; letter-spacing: -.01em; }
  #print-doc h2 { font-size: 10.5pt; margin-bottom: 5pt; }
  .pd-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.5pt solid #F2B233; padding-bottom: 7pt; margin-bottom: 9pt; }
  .pd-logo { height: 34pt; width: auto; }
  .pd-title { text-align: right; }
  .pd-eyebrow { font-size: 7pt; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8A6410; }
  .pd-title h1 { font-size: 17pt; line-height: 1.1; }
  .pd-meta { font-size: 7.5pt; color: #8A8478; margin-top: 2pt; }
  .pd-stats { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.6fr; border: .75pt solid #DEDAD2; border-radius: 5pt; margin-bottom: 7pt; }
  .pd-stat { padding: 6pt 9pt; border-left: .75pt solid #DEDAD2; }
  .pd-stat:first-child { border-left: 0; }
  .pd-num { font-size: 22pt; font-weight: 800; color: #14120E; line-height: 1; }
  .pd-val { font-size: 11pt; font-weight: 700; color: #14120E; }
  .pd-lbl { font-size: 7pt; color: #8A8478; text-transform: uppercase; letter-spacing: .06em; margin-top: 2pt; }
  .pd-flags { margin: 0 0 7pt; }
  .pd-flags span { display: inline-block; border: .75pt solid #1C7A4A; color: #1C7A4A; border-radius: 99pt; padding: 1.5pt 7pt; font-size: 7.5pt; font-weight: 700; margin-right: 5pt; }
  .pd-two { display: grid; grid-template-columns: 2.45in 1fr; gap: 14pt; margin-bottom: 9pt; break-inside: avoid; }
  .pd-chart img { width: 1.7in; height: 1.7in; display: block; margin: 0 auto 4pt; }
  .pd-legend { width: 100%; border-collapse: collapse; font-size: 7.5pt; }
  .pd-legend td { padding: 1.5pt 2pt; vertical-align: top; border-bottom: .5pt solid #EEEBE5; }
  .pd-chip { display: inline-block; width: 7pt; height: 7pt; border-radius: 2pt; margin-top: 1pt; }
  .pd-chip.hatch { background-image: repeating-linear-gradient(45deg, rgba(20,18,14,.35) 0 1pt, transparent 1pt 3pt) !important; }
  .pd-math p { margin: 0 0 5pt; font-size: 8pt; }
  .pd-result { font-size: 8.5pt !important; color: #14120E; margin-top: 4pt !important; }
  .pd-table { width: 100%; border-collapse: collapse; font-size: 8pt; }
  .pd-table.tight { font-size: 7.5pt; }
  .pd-table th { text-align: left; font-size: 6.5pt; text-transform: uppercase; letter-spacing: .08em; color: #8A6410; padding: 3pt 4pt; border-bottom: 1pt solid #F2B233; }
  .pd-table td { padding: 2.5pt 4pt; border-bottom: .5pt solid #E6E2DA; vertical-align: top; }
  .pd-table tr { break-inside: avoid; }
  .pd-table tr.muted td { color: #8A8478; }
  #print-doc .n { text-align: right; white-space: nowrap; }
  #print-doc .strong { font-weight: 700; color: #14120E; }
  .pd-sub { display: block; font-size: 6.8pt; color: #8A8478; }
  .pd-all h2 { margin-top: 2pt; }
  .pd-foot { margin-top: 8pt; padding-top: 5pt; border-top: .75pt solid #DEDAD2; font-size: 6.8pt; color: #8A8478; }
}
