/* ============================================================
   Tracking Report Viewer — "research instrument"
   Serif question titles (a published report), monospaced figures
   (an instrument readout), hairline rules, restrained colour.
   Change is coloured by DIRECTION, never by good/bad.
   Everything is scoped to .vv; dark mode follows the app's .dark.
   ============================================================ */

/* Tokens are also exposed on .vv-tokens so other surfaces (Data Explorer) can share the palette. */
.vv,
.vv-tokens {
    --vv-bg: #F8FAFC;
    --vv-surface: #FFFFFF;
    --vv-surface-2: #F4F6FA;
    --vv-ink: #0F172A;
    --vv-ink-2: #334155;
    --vv-muted: #64748B;
    --vv-faint: #94A3B8;
    --vv-rule: #E6EAF0;
    --vv-rule-strong: #CBD5E1;
    --vv-accent: #4F46E5;
    --vv-accent-soft: rgba(79, 70, 229, 0.08);
    --vv-up: #4338CA;
    --vv-up-soft: rgba(67, 56, 202, 0.10);
    --vv-down: #C2410C;
    --vv-down-soft: rgba(194, 65, 12, 0.10);
    --vv-band: rgba(79, 70, 229, 0.06);
    --vv-s0: #4F46E5;
    --vv-s1: #EA580C;
    --vv-s2: #0D9488;
    --vv-s3: #DB2777;
    --vv-s4: #64748B;
    --vv-s5: #CA8A04;
    --vv-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.18);
    --vv-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --vv-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --vv-sans: Inter, -apple-system, sans-serif;

    /* diverging heat scale: amber (down) … neutral … indigo (up) */
    --vv-h-neg-4: #C2410C; --vv-h-neg-3: #EA7A3F; --vv-h-neg-2: #F6B38A; --vv-h-neg-1: #FCE3D2;
    --vv-h-zero: #F1F4F8;
    --vv-h-pos-1: #E0E0FB; --vv-h-pos-2: #B4B2F5; --vv-h-pos-3: #7C77EA; --vv-h-pos-4: #4338CA;
}

.vv {
    font-family: var(--vv-sans);
    color: var(--vv-ink-2);
    background: var(--vv-bg);
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.dark .vv,
.dark .vv-tokens {
    --vv-bg: #141B2A;
    --vv-surface: #1B2436;
    --vv-surface-2: #212B40;
    --vv-ink: #F1F5F9;
    --vv-ink-2: #CBD5E1;
    --vv-muted: #94A3B8;
    --vv-faint: #64748B;
    --vv-rule: #2A354C;
    --vv-rule-strong: #3A4763;
    --vv-accent: #A5B4FC;
    --vv-accent-soft: rgba(165, 180, 252, 0.10);
    --vv-up: #A5B4FC;
    --vv-up-soft: rgba(165, 180, 252, 0.14);
    --vv-down: #FDBA74;
    --vv-down-soft: rgba(253, 186, 116, 0.13);
    --vv-band: rgba(165, 180, 252, 0.07);
    --vv-s0: #A5B4FC;
    --vv-s1: #FB923C;
    --vv-s2: #2DD4BF;
    --vv-s3: #F472B6;
    --vv-s4: #94A3B8;
    --vv-s5: #FACC15;
    --vv-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -18px rgba(0, 0, 0, 0.6);
    --vv-h-neg-4: #EA7A3F; --vv-h-neg-3: #B8612F; --vv-h-neg-2: #7A4327; --vv-h-neg-1: #3F2E2B;
    --vv-h-zero: #232D42;
    --vv-h-pos-1: #2E3358; --vv-h-pos-2: #3F4592; --vv-h-pos-3: #5E62CF; --vv-h-pos-4: #A5B4FC;
}

.vv .vv-num { font-family: var(--vv-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.vv .vv-display { font-family: var(--vv-serif); font-weight: 400; color: var(--vv-ink); letter-spacing: -0.005em; margin: 0; }
.vv .vv-eyebrow { font-family: var(--vv-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vv-faint); }

/* ── header ─────────────────────────────────────────────── */
.vv-head {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 12px 24px;
    background: color-mix(in srgb, var(--vv-surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--vv-rule);
}
.vv-head-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.vv-crumb { color: var(--vv-muted); text-decoration: none; font-weight: 500; }
.vv-crumb:hover { color: var(--vv-accent); }
.vv-crumb-sep { color: var(--vv-faint); }
.vv-head-name { font-weight: 600; color: var(--vv-ink); }
.vv-head-stamp { font-family: var(--vv-mono); font-size: 11px; color: var(--vv-faint); margin-left: 6px; }
.vv-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.vv-range {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 4px 3px 10px;
    border: 1px solid var(--vv-rule); border-radius: 10px; background: var(--vv-surface);
    margin-right: 6px;
}
.vv-range label { display: flex; align-items: center; gap: 6px; margin: 0; }
.vv-range label > span { font-family: var(--vv-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vv-faint); }
.vv-range select {
    appearance: none; border: 0; background: var(--vv-surface-2); color: var(--vv-ink);
    font: 600 12.5px var(--vv-sans); padding: 5px 24px 5px 9px; border-radius: 7px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--vv-muted) 50%), linear-gradient(135deg, var(--vv-muted) 50%, transparent 50%);
    background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
    background-size: 4px 4px; background-repeat: no-repeat;
}
.vv-range select:focus-visible { outline: 2px solid var(--vv-accent); outline-offset: 1px; }
.vv-range-arrow { color: var(--vv-faint); font-family: var(--vv-mono); }

/* ── body grid ──────────────────────────────────────────── */
.vv-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); flex: 1; min-height: 0; }
.vv-main { padding: 28px 32px 64px; min-width: 0; animation: vv-rise 360ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes vv-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── rail ───────────────────────────────────────────────── */
.vv-rail {
    border-right: 1px solid var(--vv-rule); background: var(--vv-surface);
    padding: 14px 10px 40px; overflow-y: auto;
    position: sticky; top: 57px; max-height: calc(100vh - 121px);
}
.vv-rail-heading { font-family: var(--vv-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--vv-faint); padding: 16px 10px 6px; }
.vv-rail-item {
    width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
    border: 0; background: transparent; color: inherit; cursor: pointer;
    padding: 9px 10px; border-radius: 9px; position: relative;
    transition: background-color 140ms ease;
}
.vv-rail-item:hover { background: var(--vv-surface-2); }
.vv-rail-item.is-active { background: var(--vv-accent-soft); }
.vv-rail-item.is-active::before {
    content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--vv-accent);
}
.vv-rail-item:focus-visible { outline: 2px solid var(--vv-accent); outline-offset: -2px; }
.vv-rail-overview .vv-rail-title { font-weight: 600; color: var(--vv-ink); flex: 1; }
.vv-rail-icon svg { fill: none; stroke: var(--vv-accent); stroke-width: 2; stroke-linecap: round; display: block; }
.vv-rail-count { font-size: 11px; color: var(--vv-faint); }
.vv-rail-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.vv-rail-main .vv-rail-title {
    font-weight: 500; color: var(--vv-ink); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vv-rail-meta { font-size: 11px; color: var(--vv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-rail-figs { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 2px; align-items: center; justify-items: end; }
.vv-rail-figs .vv-spark { grid-row: 1 / span 2; }
.vv-rail-value { font-size: 12.5px; font-weight: 600; color: var(--vv-ink); }

/* ── sparkline ──────────────────────────────────────────── */
.vv-spark { display: block; overflow: visible; }
.vv-spark-line { fill: none; stroke: var(--vv-muted); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.vv-rail-item.is-active .vv-spark-line, .vv-kpi.is-active .vv-spark-line { stroke: var(--vv-accent); }
.vv-spark-dot { fill: var(--vv-ink); }
.vv-rail-item.is-active .vv-spark-dot, .vv-kpi.is-active .vv-spark-dot { fill: var(--vv-accent); }

/* ── chips ──────────────────────────────────────────────── */
.vv-chip {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11px; font-weight: 600; line-height: 1;
    padding: 3px 6px; border-radius: 6px; white-space: nowrap;
    color: var(--vv-muted); background: var(--vv-surface-2);
}
.vv-chip-arrow { font-size: 8px; }
.vv-chip.is-up { color: var(--vv-up); background: var(--vv-up-soft); }
.vv-chip.is-down { color: var(--vv-down); background: var(--vv-down-soft); }
.vv-chip.is-none { opacity: 0.6; }

/* ── section headings, cards ───────────────────────────── */
.vv-section-head { margin-bottom: 20px; }
.vv-section-head .vv-display { font-size: 34px; line-height: 1.1; margin-top: 4px; }
.vv-card {
    background: var(--vv-surface); border: 1px solid var(--vv-rule); border-radius: 14px;
    box-shadow: var(--vv-shadow); padding: 18px 20px 20px; margin-top: 16px;
}
.vv-card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.vv-card-head-wrap { justify-content: space-between; align-items: flex-start; }
.vv-card-head h3 { font-size: 14px; font-weight: 600; color: var(--vv-ink); margin: 0; }
.vv-card-note { font-size: 11.5px; color: var(--vv-faint); }
.vv-card-head-wrap .vv-card-note { display: block; margin-top: 3px; }
.vv-empty-inline { padding: 24px 0 8px; color: var(--vv-muted); text-align: center; }

/* Card-level tabs: sized like the card heading, the active one underlined in the accent. */
.vv-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--vv-rule); margin-bottom: 2px; }
.vv-tabs button {
    border: 0; background: transparent; cursor: pointer; padding: 0 0 8px; margin-bottom: -1px;
    font: 600 14px var(--vv-sans); color: var(--vv-faint); border-bottom: 2px solid transparent;
    transition: color 120ms ease, border-color 120ms ease; white-space: nowrap;
}
.vv-tabs button:hover { color: var(--vv-ink); }
.vv-tabs button.is-on { color: var(--vv-ink); border-bottom-color: var(--vv-accent); }
.vv-tabs + .vv-card-note { margin-top: 8px; }

.vv-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vv-seg { display: inline-flex; background: var(--vv-surface-2); border-radius: 9px; padding: 2px; gap: 2px; }
.vv-seg button {
    border: 0; background: transparent; color: var(--vv-muted); cursor: pointer;
    font: 500 12px var(--vv-sans); padding: 5px 10px; border-radius: 7px; white-space: nowrap;
    transition: background-color 120ms ease, color 120ms ease;
}
.vv-seg button:hover { color: var(--vv-ink); }
.vv-seg button.is-on { background: var(--vv-surface); color: var(--vv-ink); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1); }
.vv-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--vv-muted); margin: 0; cursor: pointer; }
.vv-check input { accent-color: var(--vv-accent); }

/* ── overview ───────────────────────────────────────────── */
.vv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--vv-rule); border-radius: 14px; background: var(--vv-surface); overflow: hidden; }
.vv-stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.vv-stat + .vv-stat { border-left: 1px solid var(--vv-rule); }
.vv-stat-value { font-size: 26px; font-weight: 500; color: var(--vv-ink); line-height: 1; }
.vv-stat-label { font-size: 11.5px; color: var(--vv-muted); }

.vv-movers { list-style: none; margin: 0; padding: 0; }
.vv-movers li + li { border-top: 1px solid var(--vv-rule); }
.vv-mover {
    width: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) 150px minmax(120px, 1fr) 70px; align-items: center; gap: 16px;
    border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
    padding: 11px 8px; border-radius: 8px; transition: background-color 120ms ease;
}
.vv-mover:hover { background: var(--vv-surface-2); }
.vv-mover-text { display: flex; flex-direction: column; min-width: 0; }
.vv-mover-title { font-weight: 500; color: var(--vv-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-mover-metric { font-size: 11.5px; color: var(--vv-muted); }
.vv-mover-vals { font-size: 12px; color: var(--vv-muted); white-space: nowrap; }
.vv-mover-vals strong { color: var(--vv-ink); font-weight: 600; }
.vv-arrow { color: var(--vv-faint); }
.vv-mover-bar { position: relative; height: 18px; }
.vv-mover-axis { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--vv-rule-strong); }
.vv-mover-fill { position: absolute; top: 5px; height: 8px; border-radius: 3px; }
.vv-mover-fill.is-up { background: var(--vv-up); }
.vv-mover-fill.is-down { background: var(--vv-down); }
.vv-mover-fill.is-flat { background: var(--vv-faint); }
.vv-mover > .vv-chip { justify-self: end; }

/* ── question header + KPIs ────────────────────────────── */
.vv-q-head { margin-bottom: 18px; }
.vv-q-title { font-size: 36px; line-height: 1.08; margin-top: 6px; max-width: 30ch; }
.vv-q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--vv-muted); }
.vv-dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--vv-faint); }
.vv-base { display: inline-flex; gap: 6px; align-items: baseline; padding: 2px 8px; border: 1px solid var(--vv-rule); border-radius: 6px; background: var(--vv-surface); }
.vv-base-wave { color: var(--vv-muted); }
.vv-base .vv-num { color: var(--vv-ink-2); font-size: 11.5px; }
.vv-base.is-strong { border-color: var(--vv-rule-strong); }
.vv-base.is-strong .vv-num { color: var(--vv-ink); font-weight: 600; }

/* Tiles wrap onto further rows instead of squeezing: the column minimum is what a tile actually needs
   (value + sparkline + padding), and full width on a narrow screen. */
.vv-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); gap: 10px; }
.vv-kpi {
    position: relative; text-align: left; cursor: pointer; overflow: hidden; min-width: 0;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(56px, 120px); grid-template-areas: "label label" "value spark" "foot foot";
    column-gap: 10px;
    row-gap: 6px; padding: 14px 16px; border-radius: 12px;
    border: 1px solid var(--vv-rule); background: var(--vv-surface); color: inherit;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.vv-kpi:hover { border-color: var(--vv-rule-strong); transform: translateY(-1px); }
.vv-kpi.is-active { border-color: var(--vv-accent); box-shadow: 0 0 0 3px var(--vv-accent-soft); }
.vv-kpi:focus-visible { outline: 2px solid var(--vv-accent); outline-offset: 2px; }
.vv-kpi-label { grid-area: label; display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; font-weight: 500; color: var(--vv-muted); }
.vv-kpi-label-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-kpi-value { grid-area: value; font-size: 30px; font-weight: 500; color: var(--vv-ink); line-height: 1; align-self: end; white-space: nowrap; }
.vv-kpi-spark { grid-area: spark; align-self: end; justify-self: end; width: 100%; }
.vv-kpi-spark .vv-spark { width: 100%; max-width: 120px; height: auto; margin-left: auto; }
.vv-kpi-foot { grid-area: foot; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.vv-kpi-from { font-family: var(--vv-mono); font-size: 11px; color: var(--vv-faint); }
.vv-kpi.is-margin { background: linear-gradient(180deg, var(--vv-surface) 0%, var(--vv-surface-2) 100%); }

.vv-swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }
.vv-c0 { background: var(--vv-s0); } .vv-c1 { background: var(--vv-s1); } .vv-c2 { background: var(--vv-s2); }
.vv-c3 { background: var(--vv-s3); } .vv-c4 { background: var(--vv-s4); } .vv-c5 { background: var(--vv-s5); }

/* ── trend chart ────────────────────────────────────────── */
.vv-trend { position: relative; }
.vv-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.vv-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--vv-ink-2); }
.vv-legend-item.is-muted { color: var(--vv-faint); }
.vv-trend-plot { position: relative; }
.vv-trend-svg { width: 100%; height: auto; display: block; overflow: visible; }
.vv-grid { stroke: var(--vv-rule); stroke-width: 1; shape-rendering: crispEdges; }
.vv-grid-zero { stroke: var(--vv-rule-strong); stroke-dasharray: 3 3; }
.vv-axis-label { font-family: var(--vv-mono); font-size: 10.5px; fill: var(--vv-faint); }
.vv-axis-label.is-strong { fill: var(--vv-ink-2); font-weight: 600; }
.vv-range-band { fill: var(--vv-band); }
.vv-crosshair { stroke: var(--vv-rule-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.vv-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; transition: opacity 160ms ease; }
.vv-line.is-muted { stroke-width: 1.5; opacity: 0.35; }
.vv-point { stroke: var(--vv-surface); stroke-width: 2; transition: r 120ms ease; }
.vv-point.is-muted { opacity: 0.4; }
.vv-s0 { stroke: var(--vv-s0); } .vv-point.vv-s0 { fill: var(--vv-s0); stroke: var(--vv-surface); }
.vv-s1 { stroke: var(--vv-s1); } .vv-point.vv-s1 { fill: var(--vv-s1); stroke: var(--vv-surface); }
.vv-s2 { stroke: var(--vv-s2); } .vv-point.vv-s2 { fill: var(--vv-s2); stroke: var(--vv-surface); }
.vv-s3 { stroke: var(--vv-s3); } .vv-point.vv-s3 { fill: var(--vv-s3); stroke: var(--vv-surface); }
.vv-s4 { stroke: var(--vv-s4); } .vv-point.vv-s4 { fill: var(--vv-s4); stroke: var(--vv-surface); }
.vv-s5 { stroke: var(--vv-s5); } .vv-point.vv-s5 { fill: var(--vv-s5); stroke: var(--vv-surface); }
.vv-hit { fill: transparent; cursor: crosshair; }

.vv-tooltip {
    position: absolute; top: 34px; transform: translateX(14px); pointer-events: none; z-index: 3;
    min-width: 200px; padding: 10px 12px; border-radius: 10px;
    background: var(--vv-ink); color: var(--vv-bg);
    box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.5);
    font-size: 12px; animation: vv-fade 120ms ease;
}
.dark .vv .vv-tooltip { background: #0B1120; color: var(--vv-ink); border: 1px solid var(--vv-rule-strong); }
.vv-tooltip.is-flipped { transform: translateX(calc(-100% - 14px)); }
@keyframes vv-fade { from { opacity: 0; } to { opacity: 1; } }
.vv-tooltip-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(148, 163, 184, 0.25); }
.vv-tooltip-n { font-family: var(--vv-mono); font-weight: 400; opacity: 0.7; }
.vv-tooltip-row { display: grid; grid-template-columns: 8px 1fr auto 44px; gap: 8px; align-items: center; padding: 2px 0; }
.vv-tooltip-label { opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-delta { font-size: 11px; text-align: right; opacity: 0.8; }
.vv-tooltip .vv-delta.is-up { color: #C7D2FE; } .vv-tooltip .vv-delta.is-down { color: #FDBA74; }

/* ── dumbbell ───────────────────────────────────────────── */
.vv-dumbbell { --db-label: minmax(140px, 220px); }
.vv-db-row { display: grid; grid-template-columns: var(--db-label) minmax(0, 1fr) 64px 56px; align-items: center; gap: 14px; min-height: 34px; border-radius: 6px; }
.vv-db-row:not(.vv-db-axis):hover { background: var(--vv-surface-2); }
.vv-db-axis { min-height: 24px; border-bottom: 1px solid var(--vv-rule); margin-bottom: 4px; }
.vv-db-colhead { font-family: var(--vv-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vv-faint); }
.vv-db-label { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding-left: 8px; }
/* The category is what the row is about, so it keeps its full width; the banner name beside it gives way. */
.vv-db-name { flex: 0 0 auto; max-width: 100%; color: var(--vv-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-db-sub { flex: 0 1 auto; min-width: 0; font-size: 10.5px; color: var(--vv-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-db-label .vv-tag { flex: 0 0 auto; }
.vv-db-track { position: relative; height: 34px; margin: 0 10px; }
.vv-db-axis .vv-db-track { height: 24px; }
.vv-db-tick { position: absolute; top: 5px; transform: translateX(-50%); font-family: var(--vv-mono); font-size: 10px; color: var(--vv-faint); }
.vv-db-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--vv-rule); }
.vv-db-grid.is-zero { background: var(--vv-rule-strong); }
.vv-db-bar { position: absolute; top: 50%; height: 3px; transform: translateY(-50%); border-radius: 2px; background: var(--vv-faint); }
.vv-db-bar.is-up { background: var(--vv-up); } .vv-db-bar.is-down { background: var(--vv-down); }
.vv-db-dot { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; transform: translate(-50%, -50%); box-sizing: border-box; }
.vv-db-dot.is-from { background: var(--vv-surface); border: 2px solid var(--vv-faint); }
.vv-db-dot.is-to { background: var(--vv-faint); box-shadow: 0 0 0 2px var(--vv-surface); }
.vv-db-dot.is-to.is-up { background: var(--vv-up); } .vv-db-dot.is-to.is-down { background: var(--vv-down); }
.vv-db-dot.is-static { position: static; display: inline-block; transform: none; vertical-align: -1px; margin-right: 6px; }
.vv-db-value { position: absolute; top: 1px; transform: translateX(-50%); font-family: var(--vv-mono); font-size: 9.5px; color: var(--vv-muted); opacity: 0; transition: opacity 120ms ease; white-space: nowrap; }
.vv-db-row:hover .vv-db-value, .vv-db-row.is-highlight .vv-db-value { opacity: 1; }
.vv-db-change { text-align: right; font-weight: 600; font-size: 12px; color: var(--vv-muted); }
.vv-db-change.is-up { color: var(--vv-up); } .vv-db-change.is-down { color: var(--vv-down); }
.vv-db-n { text-align: right; font-size: 11px; color: var(--vv-faint); padding-right: 8px; }
.vv-db-row.is-highlight { background: var(--vv-accent-soft); }
.vv-db-row.is-highlight .vv-db-name { font-weight: 600; }
.vv-db-row.is-small { opacity: 0.45; }
.vv-db-group { font-family: var(--vv-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--vv-faint); padding: 14px 8px 4px; border-bottom: 1px solid var(--vv-rule); margin-bottom: 2px; }
.vv-tag { font-style: normal; font-family: var(--vv-mono); font-size: 9.5px; color: var(--vv-down); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.vv-db-key { display: flex; gap: 16px; justify-content: flex-end; font-size: 11.5px; color: var(--vv-muted); margin-top: 10px; }

/* ── heatmap ────────────────────────────────────────────── */
.vv-heat-wrap { overflow-x: auto; }
.vv-heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 12px; }
.vv-heat th { font-family: var(--vv-mono); font-size: 10.5px; font-weight: 500; color: var(--vv-faint); text-align: center; padding: 2px 4px 6px; white-space: nowrap; }
.vv-heat th.is-current { color: var(--vv-ink); }
.vv-heat-rowhead { text-align: left !important; color: var(--vv-ink-2); padding-right: 12px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.vv-heat-group td { font-family: var(--vv-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--vv-faint); padding: 12px 0 2px; }
.vv-heat tr.is-small { opacity: 0.45; }
.vv-heat-cell { text-align: center; border-radius: 5px; height: 30px; min-width: 64px; transition: transform 100ms ease; }
.vv-heat-cell:hover { transform: scale(1.06); box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.25); }
.vv-heat-cell.is-current { outline: 1.5px solid var(--vv-ink-2); outline-offset: 1px; }
.vv-heat-cell .vv-num { font-size: 11px; font-weight: 500; }
.vv-heat-empty { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--vv-rule) 4px 5px); }
.vv-heat-zero { background: var(--vv-h-zero); color: var(--vv-muted); }
.vv-heat-pos-1 { background: var(--vv-h-pos-1); color: var(--vv-ink-2); }
.vv-heat-pos-2 { background: var(--vv-h-pos-2); color: var(--vv-ink); }
.vv-heat-pos-3 { background: var(--vv-h-pos-3); color: #fff; }
.vv-heat-pos-4 { background: var(--vv-h-pos-4); color: #fff; }
.vv-heat-neg-1 { background: var(--vv-h-neg-1); color: var(--vv-ink-2); }
.vv-heat-neg-2 { background: var(--vv-h-neg-2); color: var(--vv-ink); }
.vv-heat-neg-3 { background: var(--vv-h-neg-3); color: #fff; }
.vv-heat-neg-4 { background: var(--vv-h-neg-4); color: #fff; }
.dark .vv .vv-heat-pos-4, .dark .vv .vv-heat-neg-4 { color: #0B1120; }
.vv-heat-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 10px; font-size: 11px; color: var(--vv-muted); }
.vv-heat-legend i { width: 16px; height: 10px; border-radius: 2px; }
.vv-heat-legend > span:first-child { margin-right: 4px; }
.vv-heat-legend > span:nth-last-child(2) { margin-left: 4px; }
.vv-heat-legend-note { font-family: var(--vv-mono); font-size: 10px; color: var(--vv-faint); margin-left: 12px; }

/* ── empty state ───────────────────────────────────────── */
.vv-empty { max-width: 460px; margin: 12vh auto 0; text-align: center; padding: 0 16px; }
.vv-empty-mark svg { fill: none; stroke: var(--vv-accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.vv-empty-mark circle { fill: var(--vv-accent); }
.vv-empty .vv-display { font-size: 30px; margin: 14px 0 8px; }
.vv-empty p { color: var(--vv-muted); line-height: 1.55; }
.vv-empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
    .vv-mover { grid-template-columns: minmax(0, 1fr) auto 70px; }
    .vv-mover-bar { display: none; }
}
@media (max-width: 900px) {
    .vv-body { grid-template-columns: 1fr; }
    .vv-rail { position: static; max-height: 280px; border-right: 0; border-bottom: 1px solid var(--vv-rule); }
    .vv-main { padding: 20px 16px 48px; }
    .vv-head { padding: 10px 16px; }
    .vv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vv-stat:nth-child(3) { border-left: 0; }
    .vv-stat:nth-child(n+3) { border-top: 1px solid var(--vv-rule); }
    .vv-q-title { font-size: 28px; }
    .vv-db-row { grid-template-columns: minmax(96px, 120px) minmax(0, 1fr) 54px; }
    .vv-db-n { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .vv-main, .vv-tooltip { animation: none; }
    .vv-kpi, .vv-heat-cell { transition: none; }
}

/* ── banner picker (scales to dozens of banners) ───────── */
.vv-picker { position: relative; }
.vv-picker-btn {
    display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
    border: 1px solid var(--vv-rule); background: var(--vv-surface); color: var(--vv-ink);
    border-radius: 9px; padding: 5px 10px; cursor: pointer; font: 500 12px var(--vv-sans);
    transition: border-color 120ms ease;
}
.vv-picker-btn:hover, .vv-picker-btn.is-open { border-color: var(--vv-rule-strong); }
.vv-picker-btn:focus-visible { outline: 2px solid var(--vv-accent); outline-offset: 1px; }
.vv-picker-k { font-family: var(--vv-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vv-faint); }
.vv-picker-v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-picker-btn svg { fill: none; stroke: var(--vv-muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.vv-picker-scrim { position: fixed; inset: 0; z-index: 20; }
.vv-picker-pop {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 21; width: 320px;
    background: var(--vv-surface); border: 1px solid var(--vv-rule-strong); border-radius: 12px;
    box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.45); overflow: hidden;
    animation: vv-fade 120ms ease;
}
.vv-picker-search {
    width: 100%; border: 0; border-bottom: 1px solid var(--vv-rule); background: transparent; color: var(--vv-ink);
    font: 13px var(--vv-sans); padding: 11px 14px; outline: none;
}
.vv-picker-search::placeholder { color: var(--vv-faint); }
.vv-picker-list { max-height: 320px; overflow-y: auto; padding: 4px; }
.vv-picker-opt {
    width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 28px 64px; align-items: center; gap: 8px;
    border: 0; background: transparent; color: var(--vv-ink-2); text-align: left; cursor: pointer;
    padding: 7px 10px; border-radius: 7px; font: 13px var(--vv-sans);
}
.vv-picker-opt:hover, .vv-picker-opt:focus-visible { background: var(--vv-surface-2); outline: none; }
.vv-picker-opt.is-on { background: var(--vv-accent-soft); color: var(--vv-ink); font-weight: 600; }
.vv-picker-opt > .vv-chip { justify-self: end; }
.vv-picker-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-picker-meta { font-size: 11px; color: var(--vv-faint); text-align: right; }
.vv-picker-none { justify-self: end; color: var(--vv-faint); font-size: 11px; }
.vv-picker-empty { padding: 16px 10px; color: var(--vv-muted); font-size: 12.5px; text-align: center; }
.vv-picker-foot {
    display: flex; justify-content: flex-end; gap: 18px; padding: 7px 14px;
    border-top: 1px solid var(--vv-rule); background: var(--vv-surface-2);
    font-family: var(--vv-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vv-faint);
}
/* Waves picker: two modes on top, then a checklist of steps. */
.vv-step-opt { grid-template-columns: minmax(0, 1fr) auto; }
.vv-step-check { grid-template-columns: 16px minmax(0, 1fr); font-weight: 400; }
.vv-step-check.is-checked { color: var(--vv-ink); }
.vv-step-box {
    width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--vv-rule-strong);
    display: inline-flex; align-items: center; justify-content: center; font-size: 10px; line-height: 1; color: #fff;
}
.vv-step-check.is-checked .vv-step-box { background: var(--vv-accent); border-color: var(--vv-accent); }
.vv-step-sub { margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--vv-faint); }
.vv-step-rule { height: 1px; background: var(--vv-rule); margin: 4px 6px; }

@media (max-width: 900px) { .vv-picker-pop { left: 0; right: auto; width: min(320px, calc(100vw - 32px)); } }


/* ── full-width question title ─────────────────────────── */
.vv .vv-q-title { max-width: none; }

/* ── weighting switch ──────────────────────────────────── */
.vv-weighting button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── significance marks ────────────────────────────────── */
.vv-sig {
    font-family: var(--vv-mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    margin-left: 4px; padding: 1px 3px; border-radius: 3px; border: 1px solid currentColor; opacity: 0.85; line-height: 1;
}
.vv-db-change .vv-sig { vertical-align: 1px; }
.vv-heat-cell { position: relative; }
.vv-heat-cell.is-sig::after {
    content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; opacity: 0.9;
}

/* ── written analysis ──────────────────────────────────── */
.vv-analysis {
    position: relative; margin: 4px 0 18px; padding: 16px 20px 14px 22px;
    background: var(--vv-surface); border: 1px solid var(--vv-rule); border-radius: 14px; box-shadow: var(--vv-shadow);
}
.vv-analysis::before {
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--vv-accent), color-mix(in srgb, var(--vv-accent) 30%, transparent));
}
.vv-analysis-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.vv-link { border: 0; background: none; padding: 0; cursor: pointer; font: 500 12px var(--vv-sans); color: var(--vv-accent); }
.vv-link:hover { text-decoration: underline; }
.vv-link:focus-visible { outline: 2px solid var(--vv-accent); outline-offset: 2px; border-radius: 3px; }
.vv-analysis-headline { font-family: var(--vv-serif); font-size: 24px; line-height: 1.2; color: var(--vv-ink); margin: 2px 0 10px; }
.vv-analysis-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.vv-analysis-points li { position: relative; padding-left: 18px; color: var(--vv-ink-2); line-height: 1.55; font-size: 13.5px; max-width: 95ch; }
.vv-analysis-points li::before {
    content: ""; position: absolute; left: 2px; top: 0.62em; width: 8px; height: 1.5px; background: var(--vv-accent);
}
.vv-analysis-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--vv-rule); font-size: 11px; color: var(--vv-faint); }
.vv-analysis-empty { margin: 4px 0 2px; color: var(--vv-muted); }
.vv-analysis-skeleton { display: grid; gap: 9px; padding: 4px 0 6px; }
.vv-analysis-skeleton i {
    display: block; height: 11px; border-radius: 6px;
    background: linear-gradient(90deg, var(--vv-surface-2) 0%, var(--vv-rule) 40%, var(--vv-surface-2) 80%);
    background-size: 200% 100%; animation: vv-shimmer 1.3s ease-in-out infinite;
}
.vv-analysis-skeleton i:nth-child(1) { width: 72%; height: 18px; }
.vv-analysis-skeleton i:nth-child(2) { width: 94%; }
.vv-analysis-skeleton i:nth-child(3) { width: 81%; }
@keyframes vv-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .vv-analysis-skeleton i { animation: none; } }

/* ── measures as a list (more than four) ───────────────── */
.vv-kpis.is-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 8px; }
.vv-kpis.is-list .vv-kpi {
    grid-template-columns: minmax(0, 1fr) auto 96px;
    grid-template-areas: "label value spark" "label foot spark";
    column-gap: 16px; row-gap: 3px; padding: 11px 14px; align-items: center;
}
.vv-kpis.is-list .vv-kpi:hover { transform: none; }
.vv-kpis.is-list .vv-kpi-label { align-self: center; align-items: flex-start; font-size: 13px; color: var(--vv-ink-2); }
.vv-kpis.is-list .vv-kpi-label .vv-swatch { margin-top: 4px; }
.vv-kpis.is-list .vv-kpi-label-text {
    white-space: normal; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.vv-kpis.is-list .vv-kpi-value { font-size: 22px; justify-self: end; align-self: end; }
.vv-kpis.is-list .vv-kpi-foot { justify-self: end; justify-content: flex-end; flex-wrap: nowrap; align-self: start; }
.vv-kpis.is-list .vv-kpi-from { display: none; }
.vv-kpis.is-list .vv-kpi-spark { align-self: center; }
.vv-kpis.is-list .vv-kpi-spark .vv-spark { max-width: 96px; }
.vv-kpis.is-list .vv-kpi.is-margin { grid-column: 1 / -1; background: var(--vv-surface-2); }
@media (max-width: 560px) {
    .vv-kpis.is-list .vv-kpi { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "label foot"; }
    .vv-kpis.is-list .vv-kpi-spark { display: none; }
}

/* ============================================================
   Data Explorer — borrows the viewer's tokens (.vv-tokens) so the
   variable title, frequency table and distribution chart read as
   the same instrument as the tracking reports.
   ============================================================ */
.dx-stack {
    flex: 1; min-height: 0; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
    padding: 1px 4px 16px 1px; /* room for card shadows inside the scroller */
}
.dx-editor { display: flex; flex-direction: column; gap: 12px; }
.dx-card {
    background: var(--vv-surface); border: 1px solid var(--vv-rule); border-radius: 14px;
    box-shadow: var(--vv-shadow); padding: 16px 20px 18px; flex: none;
}
.dx-card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dx-card-head h3 { font-size: 14px; font-weight: 600; color: var(--vv-ink); margin: 0; }
.dx-card-note { font-size: 11.5px; color: var(--vv-faint); }
.dx-empty { padding: 28px 20px; text-align: center; font-size: 13px; color: var(--vv-muted); }

.dx-title-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dx-title-text { min-width: 0; }
.dx-eyebrow {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--vv-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vv-faint);
}
.dx-tag {
    font-family: var(--vv-sans); font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
    padding: 1px 7px; border-radius: 999px; color: var(--vv-accent); background: var(--vv-accent-soft);
}
.dx-title {
    font-weight: 600; font-size: 18px; line-height: 1.3;
    color: var(--vv-ink); margin: 6px 0 0;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dx-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--vv-muted); }
.dx-num { font-family: var(--vv-mono); font-variant-numeric: tabular-nums; color: var(--vv-ink-2); }
.dx-dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--vv-rule-strong); }

.dx-editor .viz-table { flex: none; }
.dx-editor td.dx-num-cell { text-align: right; font-family: var(--vv-mono); font-variant-numeric: tabular-nums; }
.dx-editor th.dx-num-cell { text-align: right; }
.dx-editor th.dx-num-cell .column-header { justify-content: flex-end; }

/* ── horizontal percentage bars (VizBarChart) ──────────── */
.vbar { display: flex; flex-direction: column; font-family: var(--vv-sans); }
.vbar-row {
    display: grid; grid-template-columns: minmax(120px, 260px) minmax(0, 1fr) 56px;
    align-items: center; gap: 14px; min-height: 30px; border-radius: 6px;
}
.vbar-row:not(.vbar-axis):hover { background: var(--vv-surface-2); }
.vbar-axis { min-height: 22px; border-bottom: 1px solid var(--vv-rule); margin-bottom: 4px; }
.vbar-label {
    padding: 4px 0 4px 8px; font-size: 12.5px; line-height: 1.3; color: var(--vv-ink-2);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vbar-track { position: relative; align-self: stretch; margin: 0 10px; }
.vbar-tick { position: absolute; top: 5px; transform: translateX(-50%); font-family: var(--vv-mono); font-size: 10px; color: var(--vv-faint); }
.vbar-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--vv-rule); }
.vbar-grid.is-zero { left: 0; background: var(--vv-rule-strong); }
.vbar-fill {
    position: absolute; left: 0; top: 50%; height: 12px; transform: translateY(-50%);
    border-radius: 0 4px 4px 0; background: var(--vv-s0); opacity: 0.85;
    transition: width 420ms cubic-bezier(0.16, 1, 0.3, 1), opacity 120ms ease;
}
.vbar-row:hover .vbar-fill { opacity: 1; }
.vbar-value { text-align: right; padding-right: 8px; font-family: var(--vv-mono); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; color: var(--vv-ink); }
.vbar-row.is-strong .vbar-label { font-weight: 600; color: var(--vv-ink); }
.vbar-row.is-strong .vbar-fill { background: var(--vv-ink-2); opacity: 0.8; }
.vbar-empty { padding: 24px 0 8px; text-align: center; color: var(--vv-muted); }
@media (max-width: 560px) {
    .vbar-row { grid-template-columns: minmax(90px, 40%) minmax(0, 1fr) 48px; gap: 8px; }
}

/* Renaming a question from the viewer: a pencil beside the heading, then an inline editor. */
.vv .vv-q-title-btn { border: 0; background: none; padding: 4px; margin-left: 6px; vertical-align: middle; color: var(--vv-faint); cursor: pointer; border-radius: 6px; opacity: 0; transition: opacity 120ms; }
.vv .vv-q-title:hover .vv-q-title-btn, .vv .vv-q-title-btn:focus-visible { opacity: 1; }
.vv .vv-q-title-btn:hover { color: inherit; background: var(--mud-palette-action-default-hover); }
.vv .vv-q-title-edit { display: flex; align-items: center; gap: 8px; margin-top: 6px; max-width: 48rem; }
.vv .vv-q-title-edit > :first-child { flex: 1; }
.vv .vv-q-title-hint { font-size: 12px; color: var(--vv-faint); margin: 4px 0 0; }
.vv .vv-outdated { font-size: 12px; color: var(--mud-palette-warning); white-space: nowrap; }
@media (hover: none) { .vv .vv-q-title-btn { opacity: 1; } }
