/* Results page v2. Every rule is scoped under .rv2 so nothing here can touch
   the marketing site or the old results page. Tokens: docs/designs/results-v2
   README section 2. Brand is rust only; flagged CBS codes use rose. Flat fills
   only: no gradients, glow or shadows. */

/* Light tokens: the base, and the explicit light choice. */
.rv2,
.rv2[data-mode="light"] {
  --ground: #F1EEE8; --card: #FBFAF8; --ink: #111111; --soft: #55524D;
  --line: #D8D3C8; --edge: #111111; --track: #ECE8E0;
  --accent: #B3452C; --accent-ink: #FBFAF8; --brand: #B3452C; --num: #B3452C;
  --flag: #C2185B; --flag-soft: #F9DCE6; --flag-ink: #8A1040;
  --late1: #F8DDAA; --late2: #F2BE6A; --late3: #DB8C1E; --late3-ink: #111111; --late2-ink: #111111;
  --closed: #6F80B2; --closed-ink: #111111; --unused: #B5BDB8; --cur: #5E9A80; --flag-cell-ink: #FFFFFF;
  --cat-review: #1E9E78; --cat-guarantor: #6070B8; --cat-self: #9AA39E;
  color-scheme: light;
}

/* Dark tokens: follow the device unless the reader picked light, or the
   reader picked dark. The two blocks are identical on purpose. */
@media (prefers-color-scheme: dark) {
  .rv2:not([data-mode="light"]) {
    --ground: #0B0E0C; --card: #161A18; --ink: #F1F5EF; --soft: #95A199;
    --line: #262D29; --edge: #3A443E; --track: #222825;
    --accent: #B3452C; --accent-ink: #FBFAF8; --brand: #E07A55; --num: #E07A55;
    --flag: #FF5C8A; --flag-soft: #3D1824; --flag-ink: #FFB3C8;
    --late1: #4B3E16; --late2: #8C6C1B; --late3: #F0AA24; --late3-ink: #1B1300; --late2-ink: #FFFFFF;
    --closed: #55608F; --closed-ink: #FFFFFF; --unused: #454E49; --cur: #8DB5A0; --flag-cell-ink: #111111;
    --cat-review: #2FB88F; --cat-guarantor: #7F8FD1; --cat-self: #7C8782;
    color-scheme: dark;
  }
}
.rv2[data-mode="dark"] {
  --ground: #0B0E0C; --card: #161A18; --ink: #F1F5EF; --soft: #95A199;
  --line: #262D29; --edge: #3A443E; --track: #222825;
  --accent: #B3452C; --accent-ink: #FBFAF8; --brand: #E07A55; --num: #E07A55;
  --flag: #FF5C8A; --flag-soft: #3D1824; --flag-ink: #FFB3C8;
  --late1: #4B3E16; --late2: #8C6C1B; --late3: #F0AA24; --late3-ink: #1B1300; --late2-ink: #FFFFFF;
  --closed: #55608F; --closed-ink: #FFFFFF; --unused: #454E49; --cur: #8DB5A0; --flag-cell-ink: #111111;
  --cat-review: #2FB88F; --cat-guarantor: #7F8FD1; --cat-self: #7C8782;
  color-scheme: dark;
}

.rv2 {
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --f-code: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --f-wm: "Source Serif 4", Georgia, "Times New Roman", serif;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--f-body);
  border-radius: 14px;
  margin-top: 32px;
  padding: 4px 24px 32px;
}
.rv2[hidden] { display: none; }
.rv2 *, .rv2 *::before, .rv2 *::after { box-sizing: border-box; }
.rv2 :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.rv2 a { color: inherit; }
.rv2 button { font-family: var(--f-body); }

/* Header bar: wordmark, report date, mode toggle, PDF button. */
.rv2-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding-block: 20px 14px;
}
.rv2-brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rv2-wm { font: 700 24px/1 var(--f-wm); letter-spacing: -.015em; color: var(--ink); }
.rv2-wm span { color: var(--brand); }
.rv2-brand small {
  font: 500 11px/1.2 var(--f-code); color: var(--soft);
  letter-spacing: .06em; text-transform: uppercase;
}
.rv2-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rv2-mode { display: inline-flex; border: 1.5px solid var(--edge); border-radius: 999px; padding: 2px; }
.rv2-mode button {
  appearance: none; border: 0; background: transparent; color: var(--ink);
  font: 500 13px/1 var(--f-body); padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.rv2-mode button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.rv2-print {
  appearance: none; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: 500 14px/1 var(--f-body); padding: 10px 16px; border-radius: 999px; cursor: pointer;
}

.rv2-head { padding-bottom: 18px; }
.rv2-head h1 { margin: 0 0 10px; font: 600 clamp(1.6rem, 3.4vw, 2.2rem)/1.15 var(--f-body); letter-spacing: -.015em; color: var(--ink); }
.rv2-head h1:focus { outline: none; }
.rv2-dates { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 10px; }
.rv2-dates dt { font: 500 11px/1.2 var(--f-code); letter-spacing: .07em; text-transform: uppercase; color: var(--soft); }
.rv2-dates dd { margin: 3px 0 0; font: 500 14px/1.3 var(--f-body); }
.rv2-context { margin: 0 0 4px; font-size: 13.5px; color: var(--soft); max-width: 70ch; }

/* Tabs: pill buttons, the selected one in rust. Scrolls sideways on its own
   row at phone width so the page itself never does. */
.rv2-tabs {
  display: flex; gap: 8px; overflow-x: auto; max-width: 100%;
  padding: 2px 2px 4px; margin: 0 -2px 18px; scrollbar-width: thin;
}
.rv2-tab {
  flex: none; appearance: none; border: 1.5px solid var(--edge); background: transparent; color: var(--ink);
  font: 500 14px/1 var(--f-body); padding: 10px 16px; border-radius: 999px; cursor: pointer;
}
.rv2-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rv2-tab[hidden] { display: none; }

.rv2-panel[hidden] { display: none; }
.rv2-panel:focus { outline: none; }
.rv2-panel:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 10px; }
.rv2-print-title { display: none; }

/* 12-column card grid. */
.rv2-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.rv2-card { background: var(--card); border-radius: 10px; padding: 20px 22px 22px; min-width: 0; grid-column: span 12; }
.rv2-card.s5 { grid-column: span 5; }
.rv2-card.s6 { grid-column: span 6; }
.rv2-card.s7 { grid-column: span 7; }
.rv2-lab { font: 500 11px/1.2 var(--f-code); letter-spacing: .09em; text-transform: uppercase; color: var(--soft); margin: 0 0 12px; }
.rv2-claim { font: 600 21px/1.25 var(--f-body); letter-spacing: -.01em; margin: 0 0 14px; text-wrap: balance; }
/* Long answers (over 90 characters) read as body text, not a headline. */
.rv2-claim.is-long, .rv2-plain .rv2-claim.is-long { font: 500 16.5px/1.5 var(--f-body); letter-spacing: 0; max-width: 68ch; text-wrap: pretty; }
/* Details flags: one entry per flag, name heavier than its definition. */
.rv2-entries { margin: 0 0 4px; }
.rv2-entries > div { padding: 12px 0; border-top: 1px solid var(--line); }
.rv2-entries > div:last-child { border-bottom: 1px solid var(--line); }
.rv2-entries dt { font: 600 16px/1.35 var(--f-body); color: var(--ink); }
.rv2-entries dd { margin: 4px 0 0; font: 400 15px/1.5 var(--f-body); color: var(--ink); max-width: 68ch; }
.rv2-card .rv2-entry-def { font: 400 15px/1.5 var(--f-body); color: var(--ink); max-width: 68ch; }
.rv2-cap { font-size: 13.5px; color: var(--soft); margin: 14px 0 0; max-width: 62ch; }

/* ---- Shared pieces ---- */
.rv2-card .rv2-lab--gap { margin-top: 24px; margin-bottom: 10px; }
.rv2-cap--top { margin: -6px 0 12px; }
.rv2-cap.rv2-lenders { border-top: 1px solid var(--line); padding-top: 10px; }
.rv2-card p { margin: 0 0 10px; }
.rv2-card p:last-child { margin-bottom: 0; }
.rv2-card .rv2-cap { margin-top: 14px; }
.rv2-summary { font-size: 15.5px; max-width: 68ch; }
/* Notices are neutral: rose is only for codes CBS flags. The extraction
   and report-date notices stay prominent with a border and a bold lead. */
.rv2-notice { border: 1.5px solid var(--edge); }
.rv2-notice strong { font-weight: 600; }
.rv2-note { background: var(--track); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; margin-top: 14px !important; }
.rv2-nowrap { white-space: nowrap; }
.rv2-dot { width: 10px; height: 10px; border-radius: 2px; flex: none; display: inline-block; }

.rv2-tag { display: inline-block; font: 500 11.5px/1.25 var(--f-code); border-radius: 3px; padding: 4px 6px; background: var(--track); color: var(--ink); }
.rv2-tag--severe { background: var(--flag-soft); color: var(--flag-ink); }
.rv2-tag--late { background: var(--late1); color: var(--ink); }
.rv2-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.rv2-stack-note { font-size: 12.5px; color: var(--soft); }
.rv2-estimate { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }

.rv2-jump {
  appearance: none; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left;
  text-decoration: underline; text-decoration-color: var(--soft); text-underline-offset: 3px; cursor: pointer;
}
.rv2-jump:hover { text-decoration-color: var(--ink); }

/* Tap-to-define terms. */
.rv2-term { position: relative; display: inline; }
.rv2-term-btn {
  appearance: none; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: help;
  text-decoration: underline dotted; text-decoration-color: var(--soft); text-underline-offset: 3px;
}
.rv2-term-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: max-content; max-width: min(280px, 80vw);
  background: var(--ink); color: var(--ground); font: 400 13px/1.45 var(--f-body); padding: 9px 11px; border-radius: 6px;
  display: none;
}
.rv2-term:hover .rv2-term-pop, .rv2-term-btn:focus-visible + .rv2-term-pop, .rv2-term.is-open .rv2-term-pop { display: block; }
/* Phones: an open definition sits under the line, never off the screen edge. */
@media (max-width: 600px) {
  .rv2-term-pop { position: static; width: auto; max-width: none; margin: 6px 0; }
  .rv2-term:hover .rv2-term-pop { display: none; }
  .rv2-term.is-open .rv2-term-pop { display: block; }
}

/* Native disclosure styled as a quiet row. */
.rv2-more { margin-top: 12px; border-top: 1px solid var(--line); }
.rv2-more > summary { cursor: pointer; padding: 11px 0; font: 500 13.5px/1.3 var(--f-body); list-style: none; }
.rv2-more > summary::-webkit-details-marker { display: none; }
.rv2-more > summary::after { content: " +"; color: var(--soft); }
.rv2-more[open] > summary::after { content: " -"; }
.rv2-more > summary .rv2-when-open, .rv2-more[open] > summary .rv2-when-closed { display: none; }
.rv2-more[open] > summary .rv2-when-open { display: inline; }
.rv2-more-body > p { max-width: 70ch; }
.rv2-card > .rv2-more:first-child { margin-top: 0; border-top: 0; }

/* Tables: mono, tabular numbers; stack into labelled rows on phones. */
.rv2-table-wrap { max-width: 100%; }
.rv2-table { border-collapse: collapse; width: 100%; font: 400 13px/1.4 var(--f-code); font-variant-numeric: tabular-nums; }
.rv2-table th { font-weight: 500; text-align: left; color: var(--soft); padding: 7px 12px 7px 0; border-bottom: 1px solid var(--edge); white-space: nowrap; }
.rv2-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.rv2-table .is-num { text-align: right; padding-left: 12px; }
.rv2-table th:last-child, .rv2-table td:last-child { padding-right: 0; }
.rv2-table .is-num + :not(.is-num) { padding-left: 20px; }
.rv2-table .is-nowrap { white-space: nowrap; }
.rv2-table tr.is-total td { font-weight: 500; border-top: 1px solid var(--edge); border-bottom: 0; }
.rv2-table .rv2-jump { font: inherit; }
@media (max-width: 600px) {
  .rv2-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rv2-table, .rv2-table tbody, .rv2-table tr, .rv2-table td { display: block; width: 100%; }
  .rv2-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .rv2-table td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; text-align: left; }
  .rv2-table td.is-num { text-align: left; padding-left: 0; }
  .rv2-table td::before { content: attr(data-label); color: var(--soft); font-size: 11.5px; }
  .rv2-table td > * { justify-self: start; }
  .rv2-table td > .rv2-cells { justify-self: stretch; }
  .rv2-table tr.is-total td { display: block; }
  .rv2-table tr.is-total td::before { content: none; }
}

/* ---- Overview ---- */
.rv2-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 18px; }
.rv2-trio > * { appearance: none; background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }
.rv2-trio button { cursor: pointer; text-decoration: none; }
.rv2-trio b { color: var(--num); display: block; font: 600 clamp(2.4rem, 6vw, 3.6rem)/1 var(--f-num); font-variant-numeric: tabular-nums; }
.rv2-trio span { display: block; font-size: 13px; color: var(--soft); margin-top: 6px; }
.rv2-trio button span { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.rv2-seg { display: flex; height: 16px; border-radius: 4px; overflow: hidden; gap: 2px; }
.rv2-seg i { display: block; min-width: 4px; }
.rv2-segkey { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; }
.rv2-segkey li { display: flex; align-items: center; gap: 7px; }
.rv2-segkey b { font: 600 14px/1 var(--f-num); }
.rv2-plain .rv2-claim { font-size: 23px; }

.rv2-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.rv2-box { border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.rv2-box-label { font: 500 11px/1.2 var(--f-code); letter-spacing: .07em; text-transform: uppercase; color: var(--soft); }
.rv2-box-amount { margin: 6px 0 4px; font: 600 22px/1.1 var(--f-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv2-box-note { font-size: 12.5px; color: var(--soft); }

.rv2-donutrow { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; }
.rv2-donut { flex: none; width: 150px; height: 150px; }
.rv2-donut-total { font: 600 26px var(--f-num); fill: var(--ink); }
.rv2-legend { flex: 1 1 200px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.rv2-legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rv2-legend li:last-child { border: 0; }
.rv2-legend b { font: 600 18px/1 var(--f-num); font-variant-numeric: tabular-nums; }
.rv2-mbars { display: flex; gap: 3px; border-bottom: 1px solid var(--line); padding-top: 18px; }
.rv2-mbar { flex: 1 1 0; min-width: 0; position: relative; }
.rv2-mbar-plot { height: 110px; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.rv2-mbar-bar { display: flex; flex-direction: column-reverse; gap: 1px; border-radius: 2px 2px 0 0; overflow: hidden; }
.rv2-mbar-part { min-height: 2px; }
.rv2-mbar-n { font: 500 11px/1 var(--f-code); text-align: center; margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.rv2-mbar-label { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; font: 400 11px/1 var(--f-code); color: var(--soft); visibility: hidden; }
.rv2-mbar.is-labelled .rv2-mbar-label { visibility: visible; }
.rv2-mbars { margin-bottom: 24px; }

.rv2-scale { margin-top: 6px; }
.rv2-grades { display: flex; flex-wrap: wrap; gap: 6px; }
.rv2-grades { flex-wrap: nowrap; }
.rv2-grades span { flex: 1 1 0; min-width: 0; text-align: center; padding: 11px 0; border-radius: 4px; background: var(--track); font: 500 13px/1 var(--f-code); }
.rv2-grades span.is-own { background: var(--accent); color: var(--accent-ink); }
.rv2-grades span.is-gap { flex: 0 0 10px; min-width: 10px; background: transparent; }

@media (max-width: 600px) {
  .rv2-boxes { grid-template-columns: minmax(0, 1fr); }
  .rv2-donut { width: 132px; height: 132px; }
  .rv2-grades { gap: 3px; }
  .rv2-grades span { font-size: 11.5px; padding: 9px 0; }
  .rv2-mbars { gap: 2px; }
  .rv2-mbar-n { font-size: 9.5px; }
  .rv2-mbar.is-labelled .rv2-mbar-label { visibility: hidden; }
  .rv2-mbar.is-labelled-wide .rv2-mbar-label { visibility: visible; }
}

/* ---- Accounts ---- */
.rv2-span { grid-column: 1 / -1; min-width: 0; }
.rv2-span[hidden] { display: none; }
.rv2-howto { font-size: 13.5px; max-width: 72ch; }
.rv2-howto-label { display: block; font: 500 11px/1.2 var(--f-code); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); margin-bottom: 4px; }
.rv2-source { margin: 0; font-size: 12.5px; color: var(--soft); }
.rv2-tabnote { margin: 0; max-width: 70ch; font-size: 14px; color: var(--soft); }
.rv2-notice-inline { background: var(--track); color: var(--ink); border-radius: 6px; padding: 9px 11px; font-size: 13px; }

.rv2-letters { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; margin: 0; }
.rv2-letters > div { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; font-size: 13.5px; }
.rv2-letters dd { margin: 0; }

.rv2-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rv2-chip {
  appearance: none; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: 500 13px/1 var(--f-body); padding: 8px 13px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.rv2-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.rv2-chip em { font: 500 12px/1 var(--f-code); font-style: normal; opacity: .8; }
.rv2-chip[aria-pressed="true"] em { opacity: 1; }

.rv2-group-head { margin: 8px 0 12px; font: 500 12px/1.2 var(--f-code); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.rv2-agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.rv2-acard { background: var(--card); border-radius: 10px; padding: 16px 16px 6px; min-width: 0; }
.rv2-acard:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.rv2-acard-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 12px; margin-bottom: 10px; }
.rv2-acard-title { min-width: 0; }
.rv2-acard h4 { margin: 0; font: 600 15px/1.25 var(--f-body); }
.rv2-acard .rv2-acard-sub { margin: 2px 0 0; font-size: 13px; color: var(--soft); }
.rv2-acard p { margin: 8px 0 0; }
.rv2-acard-note { font-size: 13px; }
.rv2-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 12px; }
.rv2-meta dt { font: 500 10.5px/1.2 var(--f-code); letter-spacing: .07em; text-transform: uppercase; color: var(--soft); }
.rv2-meta dd { margin: 2px 0 0; font: 500 13.5px/1.3 var(--f-code); font-variant-numeric: tabular-nums; }

.rv2-cells { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.rv2-cells li { flex: 1 1 0; min-width: 0; display: flex; }
.rv2-cell {
  appearance: none; border: 0; padding: 0; width: 100%; min-width: 0; height: 26px; display: grid; place-items: center;
  font: 500 12px/1 var(--f-code); border-radius: 3px; background: var(--track); color: var(--ink);
}
button.rv2-cell { cursor: pointer; }
.rv2-cell.is-late1 { background: var(--late1); }
.rv2-cell.is-late2 { background: var(--late2); color: var(--late2-ink); }
.rv2-cell.is-late3 { background: var(--late3); color: var(--late3-ink); }
.rv2-cell.is-closed { background: var(--closed); color: var(--closed-ink); }
.rv2-cell.is-unused { background: var(--unused); }
.rv2-cell.is-flag { background: var(--flag); color: var(--flag-cell-ink); }
.rv2-cell.is-na { background: transparent; outline: 1px dashed var(--soft); outline-offset: -1px; color: var(--soft); }
.rv2-cell.is-sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.rv2-letters dt.rv2-cell { width: 30px; }
.rv2-cells.is-mini { min-width: 120px; }
.rv2-cells.is-mini .rv2-cell { height: 18px; font-size: 10.5px; }
.rv2-read { min-height: 20px; font-size: 12.5px; color: var(--soft); }
.rv2-read b { color: var(--ink); font-weight: 600; }
.rv2-compact { padding-bottom: 8px; }
.rv2-minor-head { margin: 14px 0 6px; font: 600 13.5px/1.3 var(--f-body); }
@media (max-width: 600px) {
  .rv2-agrid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Enquiries ---- */
.rv2-legend--notes li { grid-template-columns: 12px 1fr auto; align-items: start; }
.rv2-legend--notes li .rv2-dot { margin-top: 4px; }
.rv2-legend small { grid-column: 2 / -1; color: var(--soft); font-size: 12.5px; line-height: 1.4; }
.rv2-chips--gap { margin-bottom: 14px; }
.rv2-table tr.rv2-extra { display: none; }
.is-all .rv2-table tr.rv2-extra { display: table-row; }
.rv2-showall { margin-top: 12px !important; }
@media (max-width: 600px) {
  .is-all .rv2-table tr.rv2-extra { display: block; }
}

/* ---- Defaults ---- */
.rv2-sub { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 20px; margin: 22px 0 10px; }
.rv2-sub h3 { margin: 0; font: 600 16px/1.3 var(--f-body); }
.rv2-sub .rv2-subnote { margin: 2px 0 0; }
.rv2-subnote { font-size: 13px; color: var(--soft); }
.rv2-subtotal { text-align: right; }
.rv2-subamount { font: 600 26px/1.1 var(--f-num); color: var(--num); font-variant-numeric: tabular-nums; }
.rv2-total { font: 500 14px/1.4 var(--f-code); font-variant-numeric: tabular-nums; margin-top: 12px !important; }
.rv2-card .rv2-source { margin-top: 14px; }

/* ---- Score ---- */
.rv2-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 4px 0 18px; }
.rv2-tile { border: 1.5px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.rv2-tile.is-key { border-color: var(--accent); }
.rv2-tile-label { font: 500 11px/1.2 var(--f-code); letter-spacing: .07em; text-transform: uppercase; color: var(--soft); }
.rv2-tile-value { margin: 6px 0 4px; font: 600 30px/1.1 var(--f-num); font-variant-numeric: tabular-nums; }
.rv2-tile-value.is-text { font: 600 20px/1.2 var(--f-body); }
.rv2-tile-value.is-accent { color: var(--num); }
.rv2-tile-caption { font-size: 12.5px; color: var(--soft); }
.rv2-scale-row { display: flex; gap: 10px; align-items: stretch; }
.rv2-scale-grades { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; }
.rv2-grade { flex: 1 1 0; min-width: 0; text-align: center; padding: 11px 0; border-radius: 4px; background: var(--track); font: 500 13px/1 var(--f-code); }
.rv2-grade.is-own { background: var(--accent); color: var(--accent-ink); }
.rv2-grade.is-outside { flex: 0 0 52px; }
.rv2-scale .rv2-lab { margin-top: 6px; }
.rv2-note .rv2-lab { margin: 12px 0 4px; }
.rv2-note .rv2-lab:first-child { margin-top: 0; }
div.rv2-note { padding: 14px 16px; }
.rv2-code-list { display: grid; grid-template-columns: 30px 1fr; gap: 6px 12px; margin: 4px 0 10px; font-size: 13.5px; }
.rv2-code-list dt.rv2-cell { width: 30px; height: 24px; }
.rv2-code-list dd { margin: 0; align-self: center; }
@media (max-width: 600px) {
  .rv2-scale-row { gap: 4px; }
  .rv2-scale-grades { gap: 3px; }
  .rv2-grade { font-size: 11.5px; padding: 9px 0; }
  .rv2-grade.is-outside { flex-basis: 40px; }
}

/* ---- Details ---- */
.rv2-terms-group + .rv2-terms-group { margin-top: 18px; }
.rv2-terms-group .rv2-lab { margin-bottom: 8px; }
.rv2-terms { margin: 0; }
.rv2-terms > div { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 4px 20px; padding: 10px 0; border-top: 1px solid var(--line); }
.rv2-terms dt { font-weight: 600; }
.rv2-terms dd { margin: 0; max-width: 70ch; }
.rv2-more-body h3 { margin: 12px 0 4px; font: 600 15px/1.3 var(--f-body); }
@media (max-width: 600px) {
  .rv2-terms > div { grid-template-columns: minmax(0, 1fr); }
}

.rv2-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.rv2-hint { margin: 0 0 8px; font-size: 13px; color: var(--soft); }
.rv2-disclaimer { margin: 0; font-size: 13px; color: var(--soft); max-width: 80ch; }
.rv2-feedback { margin-top: 8px; }

@media (max-width: 900px) {
  .rv2-card.s5, .rv2-card.s6, .rv2-card.s7 { grid-column: span 12; }
  .rv2-card { padding: 18px 16px 20px; }
}
/* Phone: bleed to the screen edge (the site wrap has a 20px gutter there)
   and keep a 16px gutter inside. */
@media (max-width: 820px) {
  .rv2 { margin-inline: -20px; border-radius: 0; padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .rv2 * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Print / Save as PDF ----
   beforeprint (src/lib/results-v2.ts) shows every visible tab's panel, opens
   every disclosure, expands accounts and enquiries, sets light mode and adds
   the @page margin boxes. These rules lay that out for paper. */
@media print {
  html, body { background: #fff !important; }
  /* Light tokens whatever the screen mode, colours printed as shown. */
  .rv2, .rv2[data-mode] {
    --ground: #FFFFFF; --card: #FBFAF8; --ink: #111111; --soft: #55524D;
    --line: #D8D3C8; --edge: #111111; --track: #ECE8E0;
    --accent: #B3452C; --accent-ink: #FBFAF8; --brand: #B3452C; --num: #B3452C;
    --flag: #C2185B; --flag-soft: #F9DCE6; --flag-ink: #8A1040;
    --late1: #F8DDAA; --late2: #F2BE6A; --late3: #DB8C1E; --late3-ink: #111111; --late2-ink: #111111;
    --closed: #6F80B2; --closed-ink: #111111; --unused: #B5BDB8; --cur: #5E9A80; --flag-cell-ink: #FFFFFF;
    --cat-review: #1E9E78; --cat-guarantor: #6070B8; --cat-self: #9AA39E;
    color-scheme: light;
  }
  .rv2, .rv2 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rv2 { margin: 0 !important; padding: 0 !important; border-radius: 0; font-size: 10pt; }

  /* Screen-only controls and hints. */
  .rv2-tabs, .rv2-mode, .rv2-print, .rv2-actions, .rv2-chiprow, .rv2-chips, .rv2-showall, .rv2-feedback,
  .rv2-hint-tap, .rv2-read, .rv2-hint, .rv2-term-pop, .rv2-more > summary { display: none !important; }
  .rv2-more { border-top: 0; margin-top: 8px; }
  .rv2-term-btn { cursor: default; }
  .rv2-jump { text-decoration: none; }

  /* The bar keeps the wordmark on page one for browsers without page
     margin boxes; Chrome also repeats it in the margins. */
  .rv2-bar { padding-block: 0 3mm; }
  .rv2-head { padding-bottom: 6mm; }

  /* One tab per section, each from a new page, named by its tab. */
  .rv2-panel { break-before: page; }
  .rv2-tabs + .rv2-panel { break-before: auto; }
  .rv2-print-title { display: block; margin: 0 0 4mm; font: 600 16pt/1.2 var(--f-body); color: var(--ink); }
  .rv2-grid { gap: 4mm; }
  .rv2-card { padding: 4mm 5mm; border: 1px solid var(--line); }
  .rv2-card.s5, .rv2-card.s6, .rv2-card.s7 { grid-column: span 12; }
  /* One account per row: code tables stay one line per run, so cards are
     short enough to fit several to a page. */
  .rv2-agrid { grid-template-columns: minmax(0, 1fr); gap: 3mm; }
  .rv2-acard { border: 1px solid var(--line); }

  /* Keep small units whole; let long cards flow so no page is left half
     empty. Table headers repeat on each page. */
  .rv2-card:not(:has(.rv2-table)), .rv2-entries > div, .rv2-acard, .rv2-tile, .rv2-tiles, .rv2-box, .rv2-boxes, .rv2-scale, .rv2-grades, .rv2-note,
  .rv2-legend li, .rv2-letters > div, .rv2-terms > div, .rv2-sub, .rv2-notice, .rv2-notice-inline,
  .rv2-mbars, .rv2-donutrow, .rv2-seg, .rv2-segkey, .rv2-table tr, .rv2-howto { break-inside: avoid; }
  .rv2-lab, .rv2-claim, .rv2-sub, .rv2-group-head, .rv2-print-title, .rv2-minor-head, .rv2-howto-label { break-after: avoid; }
  .rv2-table thead { display: table-header-group; }
  .rv2-table tr.rv2-extra { display: table-row !important; }

  .rv2-foot { margin-top: 6mm; }
}
