/* pv-layouts.v1.css: the page archetypes beyond the dashboard (DESIGN_SYSTEM.md section 4b). Load after pv-common.v1.css.
   Each layout is the shell one of the sandbox's most used apps built by hand, rebuilt on the tokens:
     .pv-layout-map      map pane beside a scrolling detail pane          (market-profiles)
     .pv-layout-canvas   full-bleed stage, floating title bar and card     (reimbursement-graph-v2)
     .pv-article         long-form write-up with figures and evidence      (clear-rates-accuracy)
     .pv-story           ordered sections, big-number callouts, a mode     (ob-provisions-analyze)
     .pv-matrix          shaded change matrix with sticky row headers      (rate-change-explorer)
     .pv-showcase        card grid for pages with no dataset               (team-catalogue)
     .pv-lookup-*        search first, then a profile                      (provider-profiles)
   The JS helpers (PVMode, PVMatrix, PVReveal, PVLayout) are in pv-layouts.v1.js. Additive only; a breaking change is a .v2 file.
   Exception, 2026-10-06: the matrix block was reworked in place (slot grid, frozen columns, tree styling) because its only consumer was
   _template-matrix; the class names it had are kept. */

/* ---------- fill the viewport: header on top, the layout takes the rest (map and canvas pages) ---------- */
body.pv-fill { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.pv-fill > .pv-header { flex: 0 0 auto; }
body.pv-fill > .pv-layout-map { flex: 1 1 auto; min-height: 0; height: auto; }

/* ---------- map-led split ---------- */
.pv-layout-map { position: relative; display: grid; grid-template-columns: minmax(320px, var(--pv-map-pane, 44%)) minmax(0, 1fr); height: calc(100vh - 64px); background: var(--pv-surface); }
.pv-layout-map > .pv-map-pane { position: relative; border-right: 1px solid var(--pv-stroke); background: var(--pv-card); min-width: 0; overflow: hidden; }
.pv-layout-map > .pv-map-pane > .pv-map-host { position: absolute; inset: 0; }
.pv-layout-map > .pv-detail-pane { overflow: auto; padding: 14px 20px 32px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pv-layout-map.collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.pv-layout-map.collapsed > .pv-map-pane { border-right: none; }
.pv-map-tools { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 3; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; pointer-events: none; }
.pv-map-tools > * { pointer-events: auto; }
.pv-map-legend { position: absolute; left: 10px; bottom: 10px; z-index: 3; background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); box-shadow: var(--pv-shadow-pop); padding: 8px 10px; font-size: 0.74rem; color: var(--pv-text-2); max-width: 260px; }
.pv-map-legend .pv-legend-ramp { height: 8px; border-radius: 4px; margin: 4px 0 2px; }
.pv-map-legend .pv-legend-ends { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
/* the collapse button is a child of .pv-layout-map (the pane clips its own overflow), sitting on the pane's right edge */
.pv-collapse-btn { position: absolute; z-index: 4; top: 50%; transform: translateY(-50%); left: calc(max(320px, var(--pv-map-pane, 44%)) - 13px); width: 26px; height: 40px; border-radius: var(--pv-radius); border: 1px solid var(--pv-stroke-dark); background: var(--pv-card); cursor: pointer; display: grid; place-items: center; color: var(--pv-text-2); }
.pv-layout-map.collapsed > .pv-collapse-btn { left: 0; border-radius: 0 var(--pv-radius) var(--pv-radius) 0; }
@media (max-width: 820px) {
  body.pv-fill { height: auto; overflow: auto; display: block; }
  .pv-layout-map, .pv-layout-map.collapsed { grid-template-columns: 1fr; height: auto; }
  .pv-layout-map > .pv-map-pane { height: 46vh; border-right: none; border-bottom: 1px solid var(--pv-stroke); }
  .pv-collapse-btn { display: none; }
}

/* ---------- canvas: the picture is the page ---------- */
.pv-layout-canvas { position: fixed; inset: 0; background: var(--pv-surface); overflow: hidden; }
.pv-layout-canvas > .pv-stage { position: absolute; inset: 0; }
.pv-layout-canvas > .pv-stage > svg, .pv-layout-canvas > .pv-stage > canvas { display: block; width: 100%; height: 100%; }
.pv-floatbar { position: absolute; z-index: 5; top: 12px; left: 12px; right: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); box-shadow: var(--pv-shadow-pop); padding: 8px 12px; }
.pv-floatbar h1 { font-size: 1rem; font-weight: 600; line-height: 1.2; }
.pv-floatbar .pv-app-mark { width: 28px; height: 28px; border-radius: 7px; } .pv-floatbar .pv-app-mark svg { width: 18px; height: 18px; }
.pv-floatbar-title:has(> .pv-home .pv-app-mark) > .pv-subtitle { padding-left: 38px; }
.pv-floatbar .pv-subtitle { font-size: 0.76rem; }
.pv-floatbar .pv-floatbar-title { flex: 1 1 260px; min-width: 0; }
.pv-floatbar .pv-actions { margin-left: auto; padding-bottom: 0; }
.pv-floatcard { position: absolute; z-index: 5; top: 76px; right: 12px; width: var(--pv-floatcard-width, 340px); max-height: calc(100% - 88px); overflow: auto;
  background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); box-shadow: var(--pv-shadow-pop); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pv-floatcard.pv-left { right: auto; left: 12px; }
.pv-floatcard.collapsed { max-height: 44px; overflow: hidden; }
.pv-floatcard-head { display: flex; align-items: center; gap: 8px; }
.pv-floatcard-head h2 { font-size: 0.95rem; font-weight: 600; flex: 1; }
.pv-canvas-hint { position: absolute; z-index: 4; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 0.74rem; color: var(--pv-text-3); background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: 999px; padding: 4px 12px; }
.pv-zoom { position: absolute; z-index: 5; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.pv-zoom .pv-btn { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; }
@media (max-width: 820px) {
  .pv-floatcard, .pv-floatcard.pv-left { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 50%; border-radius: var(--pv-radius-card) var(--pv-radius-card) 0 0; }
}

/* ---------- write-up: a long-form page ---------- */
.pv-article { max-width: 720px; margin: 0 auto; padding: 36px 24px 72px; font-size: 1rem; line-height: 1.65; color: var(--pv-text); }
.pv-article > * + *, .pv-article section > * + * { margin-top: 14px; }
.pv-article section + section { margin-top: 24px; }
.pv-article section > .pv-part-label:first-child { margin-top: 0; }
.pv-article h1 { font-size: 1.9rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.pv-article .pv-dek { font-size: 1.1rem; color: var(--pv-text-2); line-height: 1.5; }
.pv-article .pv-byline { font-size: 0.8rem; color: var(--pv-text-3); }
.pv-article h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.3; margin-top: 44px; }
/* PVLayout.sectionLinks: the copy-a-link button after a section heading, quiet until the heading is hovered or focused */
.pv-section-link { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 6px; padding: 0; vertical-align: middle; border: 0; border-radius: var(--pv-radius); background: transparent; color: var(--pv-text-3); cursor: pointer; opacity: 0; transition: opacity 0.12s, color 0.12s, background 0.12s; }
:is(h1, h2, h3, h4):hover > .pv-section-link, .pv-section-link:focus-visible { opacity: 1; }
.pv-section-link:hover { color: var(--pv-primary); background: var(--pv-highlight); }
@media (hover: none) { .pv-section-link { opacity: 0.7; } }
@media print { .pv-section-link { display: none; } }
.pv-article [id] { scroll-margin-top: 16px; }
.pv-article h3 { font-size: 1.05rem; font-weight: 600; margin-top: 28px; }
.pv-article ul, .pv-article ol { padding-left: 1.3em; }
.pv-article li + li { margin-top: 4px; }
.pv-article code { font-family: var(--pv-mono); font-size: 0.86em; background: var(--pv-surface); padding: 1px 4px; border-radius: 3px; }
.pv-part-label { display: block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pv-primary); margin-top: 48px; }
.pv-part-label + h2, .pv-article section > .pv-part-label + h2 { margin-top: 4px; }
.pv-article section > .pv-fig { margin-top: 24px; }
.pv-toc { border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); background: var(--pv-card); padding: 12px 16px; font-size: 0.86rem; }
.pv-toc ol { margin: 6px 0 0; } .pv-toc a { color: var(--pv-primary); text-decoration: none; } .pv-toc a:hover { text-decoration: underline; }
.pv-fig { margin-top: 24px; background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); padding: 14px 16px; }
.pv-fig.pv-wide { width: min(1040px, calc(100vw - 48px)); margin-left: 50%; transform: translateX(-50%); }
.pv-fig-title { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.pv-fig-sub { font-size: 0.82rem; color: var(--pv-text-2); line-height: 1.4; margin-top: 2px; }
.pv-fig-body { margin-top: 10px; min-height: 40px; }
.pv-fig-note { font-size: 0.76rem; color: var(--pv-text-3); line-height: 1.45; margin-top: 8px; }
.pv-pullquote { border-left: 3px solid var(--pv-primary); padding: 2px 0 2px 16px; font-size: 1.15rem; line-height: 1.5; color: var(--pv-ink, var(--pv-primary-pressed)); }
.pv-question { display: grid; grid-template-columns: 28px 1fr; gap: 10px; background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); padding: 12px 14px; }
.pv-question-n { width: 24px; height: 24px; border-radius: 50%; background: var(--pv-highlight); color: var(--pv-primary-pressed); font-size: 0.78rem; font-weight: 600; display: grid; place-items: center; }
.pv-question-q { font-weight: 600; } .pv-question-d { font-size: 0.88rem; color: var(--pv-text-2); }
details.pv-evidence { border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); background: var(--pv-surface); font-size: 0.88rem; }
details.pv-evidence > summary { cursor: pointer; padding: 8px 12px; color: var(--pv-primary); font-weight: 500; list-style: none; display: flex; gap: 6px; align-items: center; }
details.pv-evidence > summary::-webkit-details-marker { display: none; }
details.pv-evidence > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
details.pv-evidence[open] > summary::before { transform: rotate(45deg); }
details.pv-evidence > .pv-evidence-body { padding: 0 12px 12px; }
.pv-exercise { border: 1px solid var(--pv-brand-border); border-radius: var(--pv-radius-card); background: var(--pv-card); padding: 14px 16px; }
.pv-exercise-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.pv-exercise-choices button { text-align: left; border: 1px solid var(--pv-stroke-dark); border-radius: var(--pv-radius); background: var(--pv-card); padding: 8px 10px; cursor: pointer; font: inherit; font-size: 0.86rem; }
.pv-exercise-choices button:hover { background: var(--pv-surface); }
.pv-exercise-choices button[aria-pressed="true"] { border-color: var(--pv-primary); box-shadow: inset 0 0 0 1px var(--pv-primary); background: var(--pv-highlight); }
.pv-exercise-result { margin-top: 10px; font-size: 0.9rem; }

/* scroll reveal: hidden only after PVReveal has marked the page, so a page without JS shows everything */
.pv-reveal-on .pv-reveal:not(.in) { opacity: 0; transform: translateY(8px); }
.pv-reveal { transition: opacity 0.4s ease, transform 0.4s ease; }

/* ---------- story: ordered sections around one change ---------- */
.pv-story { max-width: 1100px; margin: 0 auto; padding: 18px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.pv-story-section { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 16px; }
.pv-story-step { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pv-text-3); }
.pv-story-section > h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.pv-story-section > .pv-story-lede { font-size: 0.95rem; color: var(--pv-text-2); max-width: 760px; line-height: 1.55; }
.pv-callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pv-callout { background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); padding: 16px 18px; border-top: 3px solid var(--pv-mode-color, var(--pv-primary)); }
.pv-callout-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pv-text-3); }
.pv-callout-value { font-size: 2.4rem; font-weight: 600; line-height: 1.1; margin-top: 6px; color: var(--pv-primary-pressed); font-variant-numeric: tabular-nums; }
.pv-callout-caption { font-size: 0.82rem; color: var(--pv-text-2); margin-top: 4px; line-height: 1.4; }
/* the mode: one state of the world at a time (before / after, today / proposed); PVMode sets data-mode on <body> */
body[data-mode="before"] { --pv-mode-color: var(--app-mode-before, var(--pv-viz-3)); --pv-mode-bg: var(--pv-error-bg); }
body[data-mode="after"] { --pv-mode-color: var(--app-mode-after, var(--pv-primary)); --pv-mode-bg: var(--pv-highlight); }
.pv-mode { display: inline-flex; border: 1px solid var(--pv-stroke-dark); border-radius: var(--pv-radius); overflow: hidden; background: var(--pv-card); }
.pv-mode button { border: none; background: transparent; padding: 6px 12px; font: inherit; font-size: 0.82rem; font-weight: 500; cursor: pointer; color: var(--pv-text-2); display: inline-flex; gap: 6px; align-items: center; }
.pv-mode button + button { border-left: 1px solid var(--pv-stroke-dark); }
.pv-mode button[aria-pressed="true"] { background: var(--pv-mode-color, var(--pv-primary)); color: #fff; }
.pv-mode-banner { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--pv-radius-card); background: var(--pv-mode-bg, var(--pv-highlight)); border-left: 3px solid var(--pv-mode-color, var(--pv-primary)); font-size: 0.86rem; }
.pv-mode-accent { color: var(--pv-mode-color, var(--pv-primary)); }

/* ---------- matrix: where to look in a grid of changes (rate-change-explorer) ---------- */
/* one scroll container that scrolls both ways; the header rows and the frozen columns stick inside it */
.pv-matrix-wrap { position: relative; overflow: auto; max-height: var(--pv-matrix-height, max(360px, calc(100vh - 200px))); background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); }
.pv-matrix-wrap:has(> table.pv-matrix) { width: fit-content; max-width: 100%; }   /* a few columns do not stretch across the page */
table.pv-matrix { --pv-row-bg: var(--pv-card); --pv-matrix-label-w: 300px; --pv-matrix-cell-min: 7.6rem;
  --pv-matrix-up-text: color-mix(in srgb, var(--app-up, var(--pv-up)) 70%, var(--pv-text));
  --pv-matrix-down-text: color-mix(in srgb, var(--app-down, var(--pv-down)) 60%, var(--pv-text));
  border-collapse: separate; border-spacing: 0; font-size: 0.8rem; width: max-content; }
table.pv-matrix.pv-matrix-detail { --pv-matrix-cell-min: 15.2rem; }
.pv-matrix th, .pv-matrix td { padding: 5px 10px; border-bottom: 1px solid var(--pv-stroke); white-space: nowrap; vertical-align: middle; background-color: var(--pv-row-bg); }
/* header: both rows stick; row two sits under row one (PVMatrix measures row one once per draw) */
.pv-matrix thead th { position: sticky; top: 0; z-index: 3; --pv-row-bg: var(--pv-surface); color: var(--pv-text-2); font-weight: 600; font-size: 0.74rem; text-align: right; vertical-align: bottom; }
.pv-matrix thead tr + tr th { top: var(--pv-matrix-head-1, 29px); }
.pv-matrix thead th.pv-group { text-align: center; vertical-align: middle; white-space: nowrap; }
.pv-matrix thead th.pv-matrix-col { white-space: normal; min-width: var(--pv-matrix-cell-min); max-width: 13rem; line-height: 1.25; }
.pv-matrix .pv-gstart { border-left: 1px solid var(--pv-stroke); }
.pv-matrix thead tr:first-child > th:first-child, .pv-matrix thead th.pv-corner { left: 0; z-index: 4; text-align: left; }   /* the corner cell; rowspan it over a two-row header */
.pv-matrix th.pv-corner { width: var(--pv-matrix-label-w); min-width: var(--pv-matrix-label-w); max-width: var(--pv-matrix-label-w); white-space: normal; }
.pv-matrix-shared { color: var(--pv-text); font-size: 0.8rem; margin-bottom: 4px; }
.pv-matrix-shared-sub { color: var(--pv-primary); margin-bottom: 4px; }
.pv-matrix-colname { display: inline-block; max-width: max(8.5rem, calc(var(--pv-matrix-cell-min) - 1.6rem)); text-align: right; vertical-align: bottom; }   /* long names wrap */
.pv-matrix-colsub { font-weight: 500; color: var(--pv-text-3); font-size: 0.7rem; }
.pv-matrix-cap { margin-top: 4px; font-size: 0.68rem; font-weight: 500; color: var(--pv-text-3); }
.pv-matrix-cap > span { text-align: right; }
/* sortable headers: a real button, the arrow drawn in CSS */
.pv-matrix-sort { border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: inherit; }
.pv-matrix th.pv-matrix-col .pv-matrix-sort { display: block; width: 100%; text-align: right; }
.pv-matrix-sort:hover, .pv-matrix-sort.on { color: var(--pv-primary); }
.pv-sort-arrow { display: inline-block; width: 0; height: 0; margin-left: 4px; vertical-align: 2px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.pv-sort-arrow.asc { border-top: none; border-bottom: 5px solid currentColor; }
/* frozen columns: solid backgrounds that follow the row type, so content never shows through while scrolling sideways */
.pv-matrix .pv-frozen { position: sticky; z-index: 2; }
.pv-matrix thead .pv-frozen { z-index: 4; }
.pv-matrix .pv-frozen-last { box-shadow: inset -1px 0 0 var(--pv-stroke-dark); }
.pv-matrix tbody th { position: sticky; left: 0; z-index: 2; text-align: left; font-weight: 500; color: var(--pv-text); width: var(--pv-matrix-label-w); min-width: var(--pv-matrix-label-w); max-width: var(--pv-matrix-label-w); overflow: hidden; text-overflow: ellipsis;
  box-shadow: inset 3px 0 0 var(--pv-mx-accent, transparent); }
.pv-matrix tbody th.pv-frozen-last { box-shadow: inset 3px 0 0 var(--pv-mx-accent, transparent), inset -1px 0 0 var(--pv-stroke-dark); }
.pv-matrix th.pv-matrix-lead, .pv-matrix td.pv-matrix-lead { text-align: right; min-width: 4.6rem; }
.pv-matrix td.pv-matrix-lead { color: var(--pv-text-2); font-variant-numeric: tabular-nums; }
/* hierarchy: indent by level (PVMatrix sets it), class bands, alternating bands, a level accent on the label, a roll-up row */
.pv-matrix tbody tr.pv-band { --pv-row-bg: var(--pv-surface-2); }
.pv-matrix tbody tr[data-level="0"] { --pv-row-bg: var(--pv-surface); }
.pv-matrix tbody tr[data-level="0"] > * { border-top: 1px solid var(--pv-stroke-dark); }
.pv-matrix tbody tr[data-level="0"] th { font-weight: 600; color: var(--pv-primary-pressed); }
.pv-matrix tbody tr[data-level="1"] { --pv-mx-accent: var(--pv-interactive); }
.pv-matrix tbody tr[data-level="1"] th { padding-left: 26px; }
.pv-matrix tbody tr[data-level="2"], .pv-matrix tbody tr[data-level="3"] { --pv-mx-accent: var(--pv-highlight); }
.pv-matrix tbody tr[data-level="2"] th { padding-left: 42px; font-weight: 400; }
.pv-matrix tbody tr.pv-matrix-rollup { --pv-row-bg: var(--pv-brand-accent); }
.pv-matrix tbody tr.pv-matrix-rollup > * { border-bottom: 2px solid var(--pv-stroke-dark); }
.pv-matrix tbody tr.pv-matrix-rollup th { font-weight: 600; }
.pv-matrix-rollup-sub { margin-left: 6px; font-weight: 400; color: var(--pv-text-3); font-size: 0.74rem; }
.pv-matrix tbody tr:hover { --pv-row-bg: var(--pv-highlight); }
.pv-matrix tbody tr.pv-hidden { display: none; }
.pv-matrix-label { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pv-matrix-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-matrix-toggle, .pv-matrix-toggle-sp { flex: 0 0 auto; width: 16px; height: 16px; margin-right: 2px; }
.pv-matrix-toggle-sp { display: inline-block; }
.pv-matrix-toggle { border: none; background: none; padding: 0; cursor: pointer; color: var(--pv-primary); vertical-align: -2px; border-radius: var(--pv-radius); }
.pv-matrix-toggle::before { content: ""; display: inline-block; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
.pv-matrix-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
.pv-matrix-count, span.pv-matrix-count[data-tip] { flex: 0 0 auto; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--pv-card); border: 1px solid var(--pv-stroke); color: var(--pv-text-2);
  font-size: 0.68rem; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; text-decoration: none; }
.pv-matrix-more th button { border: none; background: none; padding: 2px 0; font: inherit; font-size: 0.78rem; font-weight: 500; color: var(--pv-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pv-matrix tbody tr.pv-matrix-more th, .pv-matrix tbody tr.pv-matrix-loading th { width: auto; max-width: none; }
.pv-matrix-loading .pv-skel-line { margin: 2px 0; }
/* a cell: fixed slots (mark, change, was -> now) aligned right, so a label sits over its number and nothing spills into the next column */
.pv-matrix td.pv-cell { text-align: right; cursor: default; min-width: var(--pv-matrix-cell-min); }
.pv-matrix td.pv-cell[data-key] { cursor: pointer; }
.pv-matrix td.pv-cell[data-sign="up"], .pv-matrix td.pv-cell[data-sign="down"] { background-color: color-mix(in srgb, var(--pv-cell-color) calc(7% + var(--t, 0) * 28%), var(--pv-row-bg)); }
.pv-matrix td.pv-cell[data-sign="up"], .pv-swatch[data-sign="up"] { --pv-cell-color: var(--app-up, var(--pv-up)); }
.pv-matrix td.pv-cell[data-sign="down"], .pv-swatch[data-sign="down"] { --pv-cell-color: var(--app-down, var(--pv-down)); }
.pv-matrix td.pv-cell:focus-visible { outline: 2px solid var(--pv-primary); outline-offset: -2px; }
.pv-matrix td.pv-cell.sel { box-shadow: inset 0 0 0 2px var(--pv-primary); }
.pv-cell-grid { display: grid; grid-template-columns: 0.7rem 4.2rem 7.8rem; justify-content: end; align-items: center; column-gap: 0.4rem; white-space: nowrap; }
.pv-matrix-compact .pv-cell-grid { grid-template-columns: 0.7rem 4.2rem; }
.pv-matrix-compact .pv-cell-grid > :nth-child(n+3) { display: none; }
.pv-mark-slot { display: flex; align-items: center; justify-content: center; }
.pv-cell-v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: var(--pv-text); }
.pv-matrix td[data-sign="up"] .pv-cell-v { color: var(--pv-matrix-up-text); }
.pv-matrix td[data-sign="down"] .pv-cell-v { color: var(--pv-matrix-down-text); }
.pv-matrix td[data-sign="flat"] .pv-cell-v { color: var(--pv-text-3); font-weight: 500; }
.pv-cell-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; font-size: 0.72rem; color: var(--pv-text-3); font-variant-numeric: tabular-nums; }
.pv-cell-sub b { color: var(--pv-text); font-weight: 600; }
.pv-cell-empty, .pv-matrix td[data-sign] .pv-cell-v.pv-cell-empty { color: var(--pv-text-4); font-weight: 400; }
.pv-mark { display: inline-block; width: 6px; height: 6px; border-radius: 50%; vertical-align: 1px; flex: 0 0 auto; }
.pv-mark.none { visibility: hidden; }
.pv-mark.thin { background: var(--pv-text-4); }
.pv-mark.noisy { background: var(--pv-warning-border); }
.pv-mark.outside { border: 1.5px solid var(--pv-error); background: transparent; width: 7px; height: 7px; }
/* the legend: PVMatrix.legend draws it from the same rule as the cells */
.pv-matrix-legend { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; font-size: 0.74rem; color: var(--pv-text-2); }
.pv-matrix-legend .pv-swatch { display: inline-block; width: 22px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--pv-stroke); }
.pv-swatch[data-sign] { background-color: var(--pv-card); }
.pv-swatch[data-sign="up"], .pv-swatch[data-sign="down"] { background-color: color-mix(in srgb, var(--pv-cell-color) calc(7% + var(--t, 0) * 28%), var(--pv-card)); }
.pv-legend-scale { display: inline-flex; align-items: center; gap: 3px; }
.pv-legend-scale > span:first-child { margin-right: 4px; } .pv-legend-scale > span:last-child { margin-left: 4px; }
.pv-legend-scale .pv-swatch { margin-right: 0; width: 18px; }
.pv-legend-note { color: var(--pv-text-3); }
.pv-legend-mark { display: inline-flex; align-items: center; gap: 5px; }
/* the hover card's pieces */
.pv-matrix-tipmark { display: grid; grid-template-columns: 10px 1fr; gap: 6px; align-items: baseline; padding: 2px 0; font-size: 0.74rem; line-height: 1.4; color: var(--pv-text-2); }
.pv-matrix-tipmark b { color: var(--pv-text); font-weight: 600; }
.pv-matrix-spark { display: block; max-width: 100%; height: auto; margin-top: 2px; }
.pv-matrix-spark-ends { display: flex; justify-content: space-between; gap: 8px; font-size: 0.7rem; color: var(--pv-text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { table.pv-matrix { --pv-matrix-label-w: 200px; } }

/* ---------- showcase: the subject is the page ---------- */
.pv-showcase { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--pv-showcase-min, 220px), 1fr)); gap: 12px; }
.pv-showcase-card { display: flex; flex-direction: column; gap: 8px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--pv-card); border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); padding: 12px; transition: box-shadow 0.15s, border-color 0.15s; }
.pv-showcase-card:hover { border-color: var(--pv-stroke-dark); box-shadow: var(--pv-shadow-pop); }
.pv-showcase-card.on, .pv-showcase-card[aria-pressed="true"] { border-color: var(--pv-primary); box-shadow: 0 0 0 2px var(--pv-primary); }
.pv-showcase-art { aspect-ratio: 4 / 3; border-radius: var(--pv-radius); background: var(--pv-surface); display: grid; place-items: center; overflow: hidden; color: var(--pv-ink, var(--pv-primary-pressed)); }
.pv-showcase-art img { max-width: 100%; max-height: 100%; }
.pv-sprite { image-rendering: pixelated; }
.pv-showcase-title { font-size: 0.95rem; font-weight: 600; }
.pv-showcase-sub { font-size: 0.8rem; color: var(--pv-text-2); line-height: 1.4; }
.pv-showcase-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- lookup: search first, then a profile ---------- */
.pv-lookup-hero { max-width: 760px; margin: 20px auto 4px; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.pv-lookup-search { display: flex; gap: 8px; }
.pv-lookup-search .pv-input { flex: 1; height: 42px; font-size: 0.95rem; padding-inline: 12px; }
.pv-lookup-search .pv-btn { height: 42px; padding-inline: 16px; }
.pv-lookup-results { border: 1px solid var(--pv-stroke); border-radius: var(--pv-radius-card); background: var(--pv-card); box-shadow: var(--pv-shadow-pop); overflow: hidden; }
.pv-lookup-results [role="option"] { padding: 8px 12px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.pv-lookup-results [role="option"][aria-selected="true"], .pv-lookup-results [role="option"]:hover { background: var(--pv-surface); }
.pv-lookup-results .pv-lookup-meta { margin-left: auto; font-size: 0.76rem; color: var(--pv-text-3); }
.pv-lookup-recent { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 0.78rem; color: var(--pv-text-3); }
.pv-lookup-recent button { border: 1px solid var(--pv-stroke-dark); background: var(--pv-card); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 0.78rem; cursor: pointer; color: var(--pv-text); }
.pv-profile-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pv-profile-head h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.pv-profile-head .pv-profile-sub { font-size: 0.86rem; color: var(--pv-text-2); }
.pv-profile-head .pv-actions { margin-left: auto; }

/* ---------- print: story and write-up pages hand over cleanly ---------- */
@media print {
  body { background: #fff; }
  .pv-actions, .pv-tabs, .pv-mode, .pv-floatbar .pv-actions, .pv-dev-queries, .pv-collapse-btn, .pv-zoom, #tq-ask-ai, .pv-no-print { display: none !important; }
  .pv-article, .pv-story { max-width: none; padding: 0; }
  .pv-card, .pv-fig, .pv-callout, .pv-question { break-inside: avoid; box-shadow: none; }
  .pv-fig.pv-wide { width: auto; margin-left: 0; transform: none; }
  details.pv-evidence { display: none; }
  .pv-reveal-on .pv-reveal:not(.in) { opacity: 1; transform: none; }
  .pv-matrix-wrap { max-height: none; overflow: visible; }
}
