/* Review page format for the demos. Light by default, dark on T, print on P. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f3f5f8; --total: #eef2f8;
  --border: #e4e7ec; --hair: #eceef2; --rule: #13294b;
  --ink: #0b1b33; --text: #26324a; --dim: #5b6676; --muted: #8a94a3;
  --navy: #13294b; --sky: #7fa6dc; --sky-2: #b9cfee;
  --fav: #12805c; --unfav: #b4232c; --amber: #a86b12;
  --fav-bg: rgba(18, 128, 92, 0.08); --unfav-bg: rgba(180, 35, 44, 0.07); --amber-bg: rgba(168, 107, 18, 0.09);
  --head-bg: #13294b; --head-text: #ffffff;
  --shadow: 0 1px 2px rgba(15, 30, 60, 0.04), 0 4px 14px rgba(15, 30, 60, 0.04);
  --font: 'Aptos', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --maxw: 1240px;
}
:root[data-theme="dark"] {
  --bg: #0d1420; --surface: #131c2b; --surface-2: #182234; --total: #1b2740;
  --border: #243149; --hair: #1f2a3e; --rule: #7fa6dc;
  --ink: #edf2fa; --text: #d3dbe8; --dim: #9aa7ba; --muted: #6f7d93;
  --navy: #9fbbe6; --sky: #4d75b3; --sky-2: #2c4a7a;
  --fav: #3fbf8f; --unfav: #f0727a; --amber: #e0a646;
  --fav-bg: rgba(63, 191, 143, 0.12); --unfav-bg: rgba(240, 114, 122, 0.12); --amber-bg: rgba(224, 166, 70, 0.14);
  --head-bg: #0a101a; --head-text: #edf2fa;
  --shadow: none;
}
html { -webkit-font-smoothing: antialiased; scroll-padding-top: 112px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; font-feature-settings: 'tnum' 1, 'cv11' 1; }
a { color: inherit; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Header */
.rv-head { background: var(--head-bg); color: var(--head-text); }
.rv-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.rv-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rv-brand a.home { display: inline-flex; align-items: center; gap: 9px; color: var(--head-text); text-decoration: none; font-weight: 650; font-size: 15px; white-space: nowrap; }
.rv-brand .sep { width: 1px; height: 20px; background: rgba(255,255,255,0.25); }
.rv-brand h1 { font-size: 15px; font-weight: 500; color: rgba(255,255,255,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-tools { display: flex; align-items: center; gap: 6px; }
.rv-tools button, .rv-tools a { font: inherit; font-size: 13px; color: rgba(255,255,255,0.85); background: transparent; border: 1px solid rgba(255,255,255,0.22); border-radius: 8px; padding: 5px 10px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.rv-tools button:hover, .rv-tools a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.rv-tools kbd { font-family: inherit; font-size: 11px; opacity: 0.7; margin-left: 4px; }
.rv-tools .cta { background: #fff; color: #13294b; border-color: #fff; font-weight: 600; }
.rv-tools .cta:hover { background: #e9eef7; color: #13294b; }
@media (max-width: 760px) { .rv-tools .opt { display: none; } .rv-brand .sep, .rv-brand h1 { display: none; } }

/* Section nav */
.rv-nav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.rv-nav .wrap { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; height: 44px; align-items: center; }
.rv-nav .wrap::-webkit-scrollbar { display: none; }
.rv-nav a { font-size: 13px; color: var(--dim); text-decoration: none; padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.rv-nav a:hover { color: var(--ink); background: var(--surface-2); }
.rv-nav a.on { color: var(--ink); background: var(--total); font-weight: 600; }
.rv-nav .pages { margin-left: auto; display: flex; gap: 2px; padding-left: 16px; border-left: 1px solid var(--border); }

/* Status strip */
.rv-status { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 14px 0; font-size: 13px; color: var(--dim); }
.rv-status b { color: var(--ink); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.tied { color: var(--fav); background: var(--fav-bg); }
.badge.break { color: var(--unfav); background: var(--unfav-bg); }
.badge.stale, .badge.open { color: var(--amber); background: var(--amber-bg); }
.badge.answered { color: var(--navy); background: var(--total); }
.badge.closed { color: var(--muted); background: var(--surface-2); }
.rv-break { display: none; background: var(--unfav-bg); border: 1px solid var(--unfav); color: var(--unfav); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; font-weight: 500; }
.rv-break.show { display: block; }

/* Sections */
.rv-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 26px 28px; margin-bottom: 18px; }
.rv-sec > .k { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px; }
.rv-sec > h2 { font-size: 21px; line-height: 1.3; letter-spacing: -0.015em; font-weight: 650; color: var(--ink); margin-bottom: 18px; max-width: 980px; }
.rv-sec h3 { font-size: 14px; font-weight: 650; color: var(--ink); margin: 0 0 10px; }
.rv-sec p.lead { color: var(--dim); margin: -8px 0 18px; max-width: 860px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.grid-chart { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.grid2 > *, .grid-chart > * { min-width: 0; }
@media (max-width: 900px) { .grid2, .grid-chart { grid-template-columns: 1fr; } }
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 200px; }
.chart-box.tall { height: 300px; }

/* Summary figures */
.figs { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.figs > div { padding: 16px 18px; border-right: 1px solid var(--border); }
.figs > div:last-child { border-right: none; }
.figs .l { font-size: 12px; color: var(--dim); }
.figs .v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); line-height: 1.25; margin: 2px 0; }
.figs .c { font-size: 12.5px; color: var(--dim); }
@media (max-width: 900px) { .figs { grid-template-columns: 1fr 1fr; } .figs > div:nth-child(2) { border-right: none; } .figs > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); } }
.fav { color: var(--fav); } .unfav { color: var(--unfav); } .flat { color: var(--dim); }

/* Tables */
.tbl-wrap { overflow-x: auto; max-width: 100%; }
table.rv { border-collapse: collapse; font-size: 13px; width: auto; min-width: 0; }
table.rv.fill { width: 100%; }
table.rv th, table.rv td { padding: 7px 10px; white-space: nowrap; }
table.rv thead th { font-size: 11.5px; font-weight: 600; color: var(--dim); text-align: right; border-bottom: 2px solid var(--rule); }
table.rv thead tr.blocks th { border-bottom: none; color: var(--ink); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 2px; }
table.rv thead tr.blocks th.b { border-bottom: 1px solid var(--border); }
table.rv th:first-child, table.rv td:first-child { text-align: left; padding-left: 0; }
table.rv td { text-align: right; border-bottom: 1px solid var(--hair); color: var(--text); }
table.rv td.l, table.rv th.l { text-align: left; }
table.rv tr.total td { background: var(--total); font-weight: 650; color: var(--ink); }
table.rv tr.total td:first-child { padding-left: 10px; border-radius: 6px 0 0 6px; }
table.rv tr.total td:last-child { border-radius: 0 6px 6px 0; }
table.rv tr.sub td { color: var(--dim); font-size: 12.5px; }
table.rv td.gap, table.rv th.gap { padding: 0 4px; border: none; background: transparent !important; }
table.rv td.fc, table.rv th.fc { color: var(--dim); font-style: italic; }
table.rv th.sort { cursor: pointer; user-select: none; }
table.rv th.sort::after { content: ' ↕'; color: var(--muted); font-size: 10px; }
.unit { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

/* Lists */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 70px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--navy); border-radius: 4px; }
.bar-row .fill.sky { background: var(--sky); }
.bar-row .fill.unfav { background: var(--unfav); }
.bar-row .n { text-align: right; font-weight: 600; color: var(--ink); }
@media (max-width: 560px) { .bar-row { grid-template-columns: 110px 1fr 56px; } }

/* Detail panels */
details.detail { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.detail > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--navy); list-style: none; }
details.detail > summary::-webkit-details-marker { display: none; }
details.detail > summary::before { content: '▸ '; }
details.detail[open] > summary::before { content: '▾ '; }
details.detail > div { margin-top: 14px; }

/* Review notes */
.notes { margin-top: 18px; display: grid; gap: 8px; }
.note { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; font-size: 13px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.note .who { color: var(--dim); font-size: 12px; white-space: nowrap; }
.note .tx { color: var(--text); }
@media (max-width: 640px) { .note { grid-template-columns: 1fr; gap: 4px; } }

/* Tie-out */
.ties td.st { text-align: left; }

/* Footer */
.rv-foot { padding: 22px 0 40px; font-size: 12px; color: var(--muted); }
.rv-foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rv-foot a { color: var(--dim); }

/* Jump to section */
.rv-jump { position: fixed; inset: 0; background: rgba(10, 20, 35, 0.35); display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; z-index: 100; }
.rv-jump.show { display: flex; }
.rv-jump .box { width: min(520px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,0.25); overflow: hidden; }
.rv-jump input { width: 100%; border: none; border-bottom: 1px solid var(--border); padding: 14px 16px; font: inherit; font-size: 15px; background: transparent; color: var(--ink); outline: none; }
.rv-jump ul { list-style: none; max-height: 50vh; overflow: auto; padding: 6px; }
.rv-jump li { padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.rv-jump li.sel, .rv-jump li:hover { background: var(--total); color: var(--ink); }

/* Print: Letter landscape, chrome hidden, one section per page */
@media print {
  @page { size: letter landscape; margin: 0.45in; }
  :root { --bg: #fff; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 11px; }
  .rv-nav, .rv-tools, .rv-jump { display: none !important; }
  .rv-head { background: #13294b !important; }
  .rv-sec { box-shadow: none; border: none; padding: 0; margin: 0; break-before: page; }
  .rv-sec:first-of-type { break-before: auto; }
  .chart-box, .chart-box.tall, .chart-box.short { height: 3.1in; }
  details.detail > summary { display: none; }
}
