/* Charts, maps and the "at a glance / See more" pattern (js/viz.js, js/india-map.js).
   Colours: the validated data-viz palette, its own steps for each theme (checked with the palette validator against
   the card surfaces #0e1626 and #ffffff). Categorical slots in fixed order; one-hue blue ramp for magnitude on maps;
   blue/red with a grey middle for gains and losses; status colours only with a text label. */

:root {
  --jv-surface: #0e1626;
  --jv-c1: #3987e5; --jv-c2: #d95926; --jv-c3: #199e70; --jv-c4: #c98500;
  --jv-c5: #d55181; --jv-c6: #008300; --jv-c7: #9085e9; --jv-c8: #e66767;
  --jv-s1: #184f95; --jv-s2: #256abf; --jv-s3: #3987e5; --jv-s4: #6da7ec; --jv-s5: #b7d3f6;
  --jv-none: #2f3644;
  --jv-pos: #3987e5; --jv-neg: #e66767; --jv-mid: #383835;
  --jv-good: #0ca30c; --jv-warn: #fab219; --jv-serious: #ec835a; --jv-critical: #d03b3b;
  --jv-grid: rgba(255, 255, 255, 0.08);
  --jv-axis: rgba(255, 255, 255, 0.22);
  --jv-track: rgba(57, 135, 229, 0.18);
  --jv-hover: rgba(255, 255, 255, 0.06);
  --jv-tip-bg: #0b1222;
  --jv-tip-border: rgba(255, 255, 255, 0.14);
  --jv-select: #f8fafc;
  --jv-sel-ring: #ffd24a; --jv-sel-glow: rgba(255, 210, 74, 0.75);
}
:root[data-theme="light"] {
  --jv-surface: #ffffff;
  --jv-c1: #2a78d6; --jv-c2: #eb6834; --jv-c3: #1baf7a; --jv-c4: #eda100;
  --jv-c5: #e87ba4; --jv-c6: #008300; --jv-c7: #6250d6; --jv-c8: #e34948;
  --jv-s1: #86b6ef; --jv-s2: #5598e7; --jv-s3: #2a78d6; --jv-s4: #1c5cab; --jv-s5: #104281;
  --jv-none: #e4e6eb;
  --jv-pos: #2a78d6; --jv-neg: #e34948; --jv-mid: #e8e7e3;
  --jv-grid: rgba(15, 23, 42, 0.08);
  --jv-axis: rgba(15, 23, 42, 0.25);
  --jv-track: rgba(42, 120, 214, 0.14);
  --jv-hover: rgba(15, 23, 42, 0.04);
  --jv-tip-bg: #ffffff;
  --jv-tip-border: rgba(15, 23, 42, 0.14);
  --jv-select: #0f172a;
  --jv-sel-ring: #f0a500; --jv-sel-glow: rgba(240, 165, 0, 0.7);
}

/* ------------------------------------------------------------ the glance card and "See more" */
.jv-glance { padding: 20px; margin-bottom: 20px; }
.jv-glance-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.jv-glance-head h3 { font-size: 17px; margin: 0; }
.jv-glance-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); max-width: 720px; }
.jv-glance-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .jv-glance-grid.two { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  .jv-glance-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.jv-more-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--border-glow); background: var(--accent-teal-glow); color: var(--text-primary);
  font: 600 14px var(--font-body); cursor: pointer; transition: background var(--transition-fast), transform var(--transition-fast);
}
.jv-more-btn:hover { transform: translateY(-1px); background: rgba(6, 182, 212, 0.26); }
:root[data-theme="light"] .jv-more-btn:hover { background: rgba(14, 116, 144, 0.22); }
.jv-more-btn:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; }
.jv-more-btn svg { transition: transform var(--transition-fast); }
.jv-more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.jv-more-body { margin-top: 16px; border-top: 1px solid var(--border-subtle); padding-top: 16px; }
.jv-more-body[hidden] { display: none; }
.jv-more-body > * + * { margin-top: 18px; }
.jv-section-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; font-family: var(--font-display); }

/* ------------------------------------------------------------ stat tiles */
.jv-stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.jv-stat { padding: 12px 14px; border-radius: 12px; background: var(--jv-hover); border: 1px solid var(--border-subtle); min-width: 0; }
.jv-stat-label { font-size: 12.5px; color: var(--text-secondary); line-height: 1.35; }
.jv-stat-value { font: 700 22px/1.2 var(--font-body); color: var(--text-primary); margin-top: 4px; overflow-wrap: anywhere; }
.jv-stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.jv-stat-value.text { font-size: 15px; line-height: 1.35; }
/* A card with tiles, then panels that explain (the MLA fund card in the Legislature section) */
.jv-fund { padding: 18px 20px; }
.jv-fund-lead { margin: -4px 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); }
.jv-callout { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-teal); background: var(--jv-hover); }
.jv-callout.ask { border-left-color: var(--accent-saffron); }
.jv-callout strong { display: block; font-size: 13.5px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.jv-callout p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); }
.jv-fund .jv-fig-foot { margin: 12px 0 0; }
.jv-hero { font: 700 44px/1.05 var(--font-body); letter-spacing: -0.02em; color: var(--text-primary); }
@media (max-width: 640px) { .jv-hero { font-size: 36px; } .jv-stat-value { font-size: 19px; } }

/* ------------------------------------------------------------ figure frame */
.jv-figure { min-width: 0; }
.jv-fig-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.jv-fig-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0; font-family: var(--font-body); }
.jv-fig-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.jv-fig-tools { display: flex; gap: 6px; flex: none; }
.jv-tool {
  border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); border-radius: 8px;
  padding: 4px 10px; font: 600 12px var(--font-body); cursor: pointer;
}
.jv-tool:hover, .jv-tool[aria-pressed="true"] { color: var(--text-primary); background: var(--jv-hover); }
.jv-tool:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 1px; }
.jv-fig-foot { margin-top: 8px; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.jv-fig-foot a { color: var(--accent-sky); }
.jv-table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: 10px; }
.jv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.jv-table th, .jv-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.jv-table th { position: sticky; top: 0; background: var(--bg-surface); color: var(--text-secondary); font-weight: 700; cursor: pointer; }
.jv-table td.n, .jv-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.jv-table tr.on td { background: var(--accent-teal-glow); }

/* ------------------------------------------------------------ bars (ranked list) */
.jv-bars { display: flex; flex-direction: column; gap: 2px; }
.jv-bar-row {
  display: grid; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 3px 6px; border-radius: 8px; cursor: default; border: 0; background: none; text-align: left; width: 100%;
  color: inherit; font: inherit;
}
.jv-bar-row.click { cursor: pointer; }
.jv-bar-row:hover, .jv-bar-row:focus-visible { background: var(--jv-hover); outline: none; }
.jv-bar-row.on { background: var(--accent-teal-glow); }
.jv-bar-label { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jv-bar-row.on .jv-bar-label { color: var(--text-primary); font-weight: 700; }
.jv-bar-track { position: relative; display: flex; align-items: center; gap: 8px; min-height: 20px; }
.jv-bar { height: 14px; border-radius: 0 4px 4px 0; background: var(--jv-c1); min-width: 2px; flex: none; }
.jv-bar.dim { opacity: 0.45; }
.jv-bar-val { font-size: 12.5px; color: var(--text-primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.jv-bar-ref { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--jv-axis); }
.jv-bar-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.jv-key { display: inline-flex; align-items: center; gap: 6px; }
.jv-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--jv-c1); }
.jv-key i.line { height: 2px; width: 14px; border-radius: 1px; }
.jv-bars-more { margin-top: 6px; background: none; border: 0; color: var(--accent-sky); font: 600 13px var(--font-body); cursor: pointer; padding: 4px 6px; }

/* diverging bars */
.jv-div-row { display: grid; grid-template-columns: minmax(84px, 30%) minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 0 8px; padding: 2px 6px; }
.jv-div-neg { display: flex; justify-content: flex-end; border-right: 1px solid var(--jv-axis); min-height: 18px; align-items: center; gap: 6px; }
.jv-div-pos { display: flex; justify-content: flex-start; min-height: 18px; align-items: center; gap: 6px; }
.jv-div-neg .jv-bar { background: var(--jv-neg); border-radius: 4px 0 0 4px; }
.jv-div-pos .jv-bar { background: var(--jv-pos); }

/* ------------------------------------------------------------ svg charts */
.jv-svg { display: block; width: 100%; height: auto; overflow: visible; }
.jv-svg text { fill: var(--text-muted); font: 12px var(--font-body); }
.jv-svg .grid { stroke: var(--jv-grid); stroke-width: 1; }
.jv-svg .axis { stroke: var(--jv-axis); stroke-width: 1; }
.jv-svg .col { fill: var(--jv-c1); }
.jv-svg .col.dim { opacity: 0.5; }
.jv-svg .hit { fill: transparent; cursor: pointer; }
.jv-svg .hit:hover + .col, .jv-svg .col.hot { filter: brightness(1.15); }
.jv-svg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.jv-svg .area { opacity: 0.1; }
.jv-svg .dot { stroke: var(--jv-surface); stroke-width: 2; }
.jv-svg .xhair { stroke: var(--jv-axis); stroke-width: 1; }
.jv-svg .val { fill: var(--text-primary); font-weight: 600; }
.jv-c1 { fill: var(--jv-c1); stroke: var(--jv-c1); background: var(--jv-c1); }
.jv-c2 { fill: var(--jv-c2); stroke: var(--jv-c2); background: var(--jv-c2); }
.jv-c3 { fill: var(--jv-c3); stroke: var(--jv-c3); background: var(--jv-c3); }
.jv-c4 { fill: var(--jv-c4); stroke: var(--jv-c4); background: var(--jv-c4); }
.jv-c5 { fill: var(--jv-c5); stroke: var(--jv-c5); background: var(--jv-c5); }
.jv-c6 { fill: var(--jv-c6); stroke: var(--jv-c6); background: var(--jv-c6); }
.jv-c7 { fill: var(--jv-c7); stroke: var(--jv-c7); background: var(--jv-c7); }
.jv-c8 { fill: var(--jv-c8); stroke: var(--jv-c8); background: var(--jv-c8); }
.jv-cx { fill: var(--jv-mid); stroke: var(--jv-mid); background: var(--jv-mid); }

/* donut */
.jv-donut { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 420px) { .jv-donut { grid-template-columns: 1fr; justify-items: center; } }
.jv-donut svg { width: 100%; max-width: 180px; height: auto; display: block; }
.jv-donut .seg { stroke: var(--jv-surface); stroke-width: 2; cursor: pointer; transition: opacity var(--transition-fast); }
.jv-donut .seg.fade { opacity: 0.35; }
.jv-donut .ctr-v { fill: var(--text-primary); font: 700 20px var(--font-body); }
.jv-donut .ctr-l { fill: var(--text-muted); font: 12px var(--font-body); }
.jv-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.jv-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13px; color: var(--text-secondary); cursor: default; padding: 2px 4px; border-radius: 6px; }
.jv-legend li:hover, .jv-legend li.on { background: var(--jv-hover); color: var(--text-primary); }
.jv-legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.jv-legend b { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* meter */
.jv-meter { min-width: 0; }
.jv-meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.jv-meter-top b { color: var(--text-primary); font-size: 15px; }
.jv-meter-track { height: 10px; border-radius: 6px; background: var(--jv-track); margin-top: 6px; overflow: hidden; }
.jv-meter-fill { height: 100%; border-radius: 6px; background: var(--jv-c1); }
.jv-meter-fill.good { background: var(--jv-good); } .jv-meter-fill.warn { background: var(--jv-warn); }
.jv-meter-fill.serious { background: var(--jv-serious); } .jv-meter-fill.critical { background: var(--jv-critical); }
.jv-meter-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.jv-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.jv-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------ flowchart */
.jv-flow { display: flex; flex-direction: column; align-items: stretch; gap: 0; counter-reset: jvstep; }
.jv-flow-step {
  position: relative; padding: 12px 14px 12px 46px; border-radius: 12px; border: 1px solid var(--border-subtle);
  background: var(--jv-hover); min-width: 0;
}
.jv-flow-step::before {
  counter-increment: jvstep; content: counter(jvstep); position: absolute; left: 12px; top: 12px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--jv-c1); color: #fff; font: 700 12px/24px var(--font-body); text-align: center;
}
.jv-flow-step h4 { margin: 0; font: 700 14px var(--font-body); color: var(--text-primary); }
.jv-flow-step .v { font: 700 17px var(--font-body); color: var(--text-primary); margin-top: 2px; }
.jv-flow-step p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.jv-flow-arrow { align-self: center; width: 2px; height: 18px; background: var(--jv-axis); position: relative; }
.jv-flow-arrow::after {
  content: ""; position: absolute; bottom: -4px; left: -4px; border: 5px solid transparent; border-top-color: var(--jv-axis); border-bottom: 0;
}
.jv-flow-split { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.jv-flow-split .jv-flow-step { padding-left: 14px; }
.jv-flow-split .jv-flow-step::before { display: none; }
@media (min-width: 900px) {
  .jv-flow.across { flex-direction: row; align-items: stretch; }
  .jv-flow.across .jv-flow-step { flex: 1 1 0; }
  .jv-flow.across .jv-flow-arrow { width: 20px; height: 2px; align-self: center; flex: none; }
  .jv-flow.across .jv-flow-arrow::after { bottom: auto; left: auto; right: -4px; top: -4px; border: 5px solid transparent; border-left-color: var(--jv-axis); border-right: 0; }
}

/* ------------------------------------------------------------ mind map */
.jv-mind { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.jv-mind-root {
  justify-self: center; padding: 10px 18px; border-radius: 999px; background: var(--jv-c1); color: #fff;
  font: 700 15px var(--font-body); text-align: center; max-width: 100%;
}
.jv-mind-branches { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); position: relative; }
.jv-mind-branch { border-radius: 12px; border: 1px solid var(--border-subtle); border-top: 3px solid var(--jv-c1); padding: 10px 12px; background: var(--jv-hover); min-width: 0; }
.jv-mind-branch:nth-child(8n+2) { border-top-color: var(--jv-c2); } .jv-mind-branch:nth-child(8n+3) { border-top-color: var(--jv-c3); }
.jv-mind-branch:nth-child(8n+4) { border-top-color: var(--jv-c4); } .jv-mind-branch:nth-child(8n+5) { border-top-color: var(--jv-c5); }
.jv-mind-branch:nth-child(8n+6) { border-top-color: var(--jv-c6); } .jv-mind-branch:nth-child(8n+7) { border-top-color: var(--jv-c7); }
.jv-mind-branch:nth-child(8n) { border-top-color: var(--jv-c8); }
.jv-mind-branch h4 { margin: 0 0 4px; font: 700 14px var(--font-body); color: var(--text-primary); }
.jv-mind-branch p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.jv-mind-branch ul { margin: 6px 0 0; padding-left: 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
@media (min-width: 900px) {
  .jv-mind-branches::before { content: ""; position: absolute; left: 10%; right: 10%; top: -12px; height: 1px; background: var(--jv-axis); }
  .jv-mind-root { position: relative; }
  .jv-mind-root::after { content: ""; position: absolute; left: 50%; bottom: -13px; width: 1px; height: 13px; background: var(--jv-axis); }
}

/* ------------------------------------------------------------ tooltip */
.jv-tip {
  position: fixed; z-index: 4000; pointer-events: none; max-width: 280px; padding: 8px 10px; border-radius: 10px;
  background: var(--jv-tip-bg); border: 1px solid var(--jv-tip-border); box-shadow: var(--shadow-md);
  font: 13px/1.4 var(--font-body); color: var(--text-secondary); opacity: 0; transition: opacity 0.12s;
}
.jv-tip.on { opacity: 1; }
.jv-tip b { display: block; color: var(--text-primary); font-size: 15px; font-weight: 700; }
.jv-tip .k { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; }

/* ------------------------------------------------------------ maps (js/india-map.js) */
.jm { position: relative; }
.jm-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.jm-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.jm-chip {
  border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); border-radius: 999px;
  padding: 7px 13px; font: 600 13px var(--font-body); cursor: pointer; white-space: nowrap;
}
.jm-chip:hover { color: var(--text-primary); background: var(--jv-hover); }
.jm-chip[aria-pressed="true"] { background: var(--jv-c1); border-color: var(--jv-c1); color: #fff; }
.jm-chip:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; }
.jm-more-sel { max-width: 220px; }
.jm-find { position: relative; flex: 1 1 240px; max-width: 340px; }
.jm-find input { width: 100%; padding-left: 36px; }
.jm-find svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.jm-sugg {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; list-style: none; margin: 0; padding: 4px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 12px; box-shadow: var(--shadow-md);
  max-height: 300px; overflow-y: auto;
}
.jm-sugg li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text-primary); display: flex; justify-content: space-between; gap: 8px; }
.jm-sugg li span { color: var(--text-muted); font-size: 12.5px; }
.jm-sugg li[aria-selected="true"], .jm-sugg li:hover { background: var(--accent-teal-glow); }
.jm-body { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
/* side by side on wide screens and on tablets held sideways (their map is limited by the screen's height anyway);
   phones and upright tablets give the map the full width, with its card below */
@media (min-width: 1200px), (min-width: 900px) and (orientation: landscape) {
  .jm-body { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
}
.jm-stage { position: relative; min-width: 0; }
.jm-svg { width: 100%; height: auto; display: block; max-height: 84vh; touch-action: manipulation; }
.jm-svg .r { fill: var(--jv-none); stroke: var(--jv-surface); stroke-width: 1; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill 0.25s, opacity 0.2s; }
.jm-svg .r.b1 { fill: var(--jv-s1); } .jm-svg .r.b2 { fill: var(--jv-s2); } .jm-svg .r.b3 { fill: var(--jv-s3); }
.jm-svg .r.b4 { fill: var(--jv-s4); } .jm-svg .r.b5 { fill: var(--jv-s5); }
.jm-svg .r.neg { fill: var(--jv-neg); } .jm-svg .r.mid { fill: var(--jv-mid); }
.jm-svg .r:hover, .jm-svg .r.hot { filter: brightness(1.18); }
:root[data-theme="light"] .jm-svg .r:hover, :root[data-theme="light"] .jm-svg .r.hot { filter: brightness(0.9); }
.jm-svg .r:focus { outline: none; }
.jm-svg .r.nb { stroke: var(--text-secondary); stroke-width: 1.5; }
.jm-svg .r.sel { stroke: var(--jv-sel-ring); stroke-width: 3.5; filter: drop-shadow(0 0 1.5px var(--jv-surface)) drop-shadow(0 0 5px var(--jv-sel-glow)); }
.jm-svg .r.occ, .jm-svg .r.dis { fill: var(--jv-none); cursor: default; }
.jm-svg .r.fade { opacity: 0.55; }
.jm-svg .mk { fill: var(--jv-none); stroke: var(--jv-surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; }
.jm-svg .mk.b1 { fill: var(--jv-s1); } .jm-svg .mk.b2 { fill: var(--jv-s2); } .jm-svg .mk.b3 { fill: var(--jv-s3); }
.jm-svg .mk.b4 { fill: var(--jv-s4); } .jm-svg .mk.b5 { fill: var(--jv-s5); }
.jm-svg .mk.sel { stroke: var(--jv-sel-ring); stroke-width: 3.5; filter: drop-shadow(0 0 4px var(--jv-sel-glow)); }
.jm-svg .outline { fill: none; stroke: var(--jv-axis); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.jm-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.jm-scale { display: flex; align-items: stretch; gap: 2px; }
.jm-scale span { display: flex; flex-direction: column; gap: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jm-scale i { display: block; height: 10px; min-width: 38px; border-radius: 2px; }
.jm-scale span:first-child i { border-radius: 4px 2px 2px 4px; }
.jm-scale span:last-child i { border-radius: 2px 4px 4px 2px; }
.jm-scale .b1 { background: var(--jv-s1); } .jm-scale .b2 { background: var(--jv-s2); } .jm-scale .b3 { background: var(--jv-s3); }
.jm-scale .b4 { background: var(--jv-s4); } .jm-scale .b5 { background: var(--jv-s5); }
.jm-nodata i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; background: var(--jv-none); vertical-align: middle; margin-right: 5px; border: 1px solid var(--border-subtle); }
.jm-back {
  position: absolute; top: 4px; left: 4px; z-index: 5; display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-primary);
  font: 600 13px var(--font-body); cursor: pointer; box-shadow: var(--shadow-sm);
}
.jm-back:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; }
.jm-zoom { position: absolute; right: 4px; top: 4px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.jm-zoom button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-primary); font: 700 16px var(--font-body); cursor: pointer; }
.jm-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 13px; }
.jm-credit { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

/* the side card */
.jm-card { padding: 16px; border-radius: 14px; border: 1px solid var(--border-subtle); background: var(--jv-hover); min-width: 0; }
.jm-card h3 { margin: 0; font-size: 18px; }
.jm-card .kicker { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.jm-card .big { font: 700 30px/1.15 var(--font-body); color: var(--text-primary); margin: 8px 0 2px; overflow-wrap: anywhere; }
.jm-card .what { font-size: 13px; color: var(--text-secondary); }
.jm-card .rank { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-primary); padding: 3px 9px; border-radius: 999px; background: var(--accent-teal-glow); }
.jm-card .hint { color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin: 8px 0 0; }
.jm-card .jv-bars { margin-top: 12px; }
/* labels stay on one line; a long place name wraps by word in the value column, never letter by letter */
.jm-card .facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin-top: 12px; font-size: 13px; }
.jm-card .facts dt { color: var(--text-secondary); white-space: nowrap; }
.jm-card .facts dd { margin: 0; color: var(--text-primary); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.jm-card .note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.jm-card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.jm-link { color: var(--accent-sky); font-weight: 600; font-size: 13px; text-decoration: none; }
.jm-link:hover { text-decoration: underline; }

/* the home page's map tab */
.ex-wrap { padding: 18px; }
.ex-profile { margin-top: 18px; }
.ex-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ex-metric { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--jv-hover); }
.ex-metric .t { font-size: 13px; color: var(--text-secondary); }
.ex-metric .v { font: 700 20px var(--font-body); color: var(--text-primary); margin-top: 2px; }
.ex-metric .r { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ex-metric .jv-meter-track { margin-top: 8px; height: 6px; }
.ex-metric a { font-size: 12.5px; }
.ex-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-links a { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border-subtle); color: var(--text-primary); text-decoration: none; font-size: 13px; font-weight: 600; }
.ex-links a:hover { background: var(--jv-hover); }

@media (prefers-reduced-motion: reduce) {
  .jm-svg .r, .jv-more-btn, .jv-more-btn svg, .jv-donut .seg { transition: none; }
}
@media (forced-colors: active) {
  .jm-svg .r { stroke: CanvasText; }
  .jv-bar, .jv-meter-fill { background: Highlight; }
}

/* phones: the measure chips are one swipeable row, so the map stays near the top */
@media (max-width: 640px) {
  .jm-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -4px; padding-left: 4px; }
  .jm-chips::-webkit-scrollbar { display: none; }
  .jm-chips > * { flex: none; }
  .jm-find { flex-basis: 100%; max-width: none; }
  .ex-wrap { padding: 12px; }
  .jm-card .big { font-size: 26px; }
}
@media (max-width: 640px) {
  .jv-glance { padding: 14px; }
  .jv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .jv-stat { padding: 10px 11px; }
  .jv-stat-value { font-size: 17px; }
  .jv-stat-sub { font-size: 12px; }
}
@media (max-width: 520px) {
  /* bar labels sit above their bar, so long names are never cut */
  .jv-bar-row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 4px 6px; }
  .jv-bar-label { white-space: normal; }
  .jv-div-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .jv-div-row .jv-bar-label { grid-column: 1 / -1; }
}
.jv-meter-top b { white-space: nowrap; }


/* names that scroll by themselves (judges, MPs, office-holders) */
.jv-names { min-width: 0; }
.jv-names-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.jv-names-row { display: flex; align-items: stretch; gap: 6px; }
.jv-names-track { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; padding: 2px; }
.jv-names-track::-webkit-scrollbar { display: none; }
.jv-names-track:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; border-radius: 10px; }
.jv-name {
  flex: none; display: flex; flex-direction: column; gap: 2px; min-width: 170px; max-width: 240px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border-subtle); background: var(--jv-hover); color: var(--text-primary); text-align: left; font: inherit;
}
button.jv-name { cursor: pointer; }
button.jv-name:hover, .jv-name.on { border-color: var(--border-glow); background: var(--accent-teal-glow); }
.jv-name strong { font-size: 14px; line-height: 1.3; }
.jv-name-role { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.jv-name-sub { font-size: 12px; color: var(--text-secondary); }
.jv-names.compact .jv-name { min-width: 150px; padding: 7px 10px; }
.jv-names-arrow {
  flex: none; width: 30px; border-radius: 8px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary);
  font: 700 18px var(--font-body); cursor: pointer;
}
.jv-names-arrow:hover { background: var(--jv-hover); }
@media (max-width: 640px) { .jv-names-arrow { display: none; } }

/* map pins and labels */
.jm-points .pt { cursor: pointer; }
.jm-points .pt-hit { fill: transparent; }
.jm-points .pt-dot { fill: var(--jv-c2); stroke: var(--jv-surface); }
.jm-points .pt.on .pt-dot { fill: var(--jv-c4); }
.jm-points .pt.dim { opacity: 0.35; }
.jm-points .pt:hover .pt-dot, .jm-points .pt:focus .pt-dot { stroke: var(--jv-select); }
.jm-points .pt:focus { outline: none; }
.jm-pt-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--jv-c2); margin-right: 6px; vertical-align: middle; }
.jm-svg .lbl { font-weight: 800; font-family: var(--font-body); letter-spacing: 0.02em; fill: var(--text-primary); paint-order: stroke; stroke: var(--jv-surface); stroke-opacity: 0.92; stroke-linejoin: round; pointer-events: none; }
.jm-svg .lbl.on { fill: var(--gold); }
.jm-sum { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--text-secondary); line-height: 1.45; }
.jm-sum li::marker { color: var(--jv-c1); }
.jv-how { margin-top: 26px !important; padding-top: 14px; border-top: 1px solid var(--border-subtle); }

/* people in a place (district card on the Parliament map) */
.jm-people { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.jm-person {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; text-align: left; width: 100%; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary); font: inherit; cursor: pointer;
}
.jm-person:hover, .jm-person.on { border-color: var(--border-glow); background: var(--accent-teal-glow); }
.jm-person strong { font-size: 14px; }
.jm-person .tag { font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-subtle); }
.jm-person .sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-muted); }
.inst-prompt { padding: 28px 20px; text-align: center; color: var(--text-secondary); font-size: 15px; }
.inst-prompt strong { display: block; color: var(--text-primary); font-size: 17px; margin-bottom: 6px; }
.inst-search { position: relative; max-width: 420px; }
.inst-search input { width: 100%; padding-left: 36px; }
.inst-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

#section-institutions.inst-empty .reforms-panel, #section-institutions.inst-news .reforms-panel { display: none; }


/* money allocated (red, the whole circle) and money spent (green slice) */
.jv-spend { min-width: 0; }
.jv-spend-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.jv-spend-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.jv-spend-svg { width: 132px; height: auto; flex: none; display: block; }
.jv-spend.compact .jv-spend-svg { width: 76px; }
.jv-spend-svg path { stroke: var(--jv-surface); stroke-width: 1; cursor: pointer; transition: opacity 0.15s; }
.jv-spend-svg path:hover, .jv-spend-svg path:focus { opacity: 0.85; outline: none; }
.jv-spend-svg .al { fill: var(--jv-critical); }
.jv-spend-svg .sp { fill: var(--jv-good); }
.jv-spend-svg .ctr-v { fill: var(--text-primary); font: 700 15px var(--font-body); }
.jv-spend-svg .ctr-l { fill: var(--text-muted); font: 9px var(--font-body); }
.jv-spend .jv-legend { flex: 1 1 220px; min-width: min(100%, 220px); }
.jv-spend .jv-legend i.sp { background: var(--jv-good); }
.jv-spend .jv-legend i.al { background: var(--jv-critical); }
.jv-spend .jv-legend i.ring { background: transparent; border: 2px solid var(--jv-critical); }
.jv-spend .jv-legend li.tot { border-top: 1px solid var(--border-subtle); padding-top: 4px; }
.jv-spend.compact .jv-legend { font-size: 12.5px; gap: 3px; }
.jv-spend-slot { margin: 8px 0; }


/* one item at a time, year by year (Budget tables and others) */
.jv-yp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.jv-yp-name { display: block; font-size: 16px; color: var(--text-primary); }
.jv-yp-sub { display: block; font-size: 12.5px; color: var(--text-muted); }
.jv-yp-now { text-align: right; }
.jv-yp-now b { display: block; font-size: 20px; color: var(--text-primary); }
.jv-yp-now span { font-size: 12.5px; color: var(--text-secondary); }
.jv-yp-list-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin: 14px 0 6px; }
.jv-yp-find { width: 100%; max-width: 420px; margin-bottom: 8px; }
.jv-yp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.jv-yp-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); font: 13px var(--font-body); cursor: pointer;
}
.jv-yp-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jv-yp-item b { color: var(--text-primary); font-variant-numeric: tabular-nums; flex: none; }
.jv-yp-item:hover { background: var(--jv-hover); color: var(--text-primary); }
.jv-yp-item.on { border-color: var(--jv-c1); background: var(--accent-teal-glow); color: var(--text-primary); font-weight: 600; }
.jv-yp-item:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 1px; }

.jv-kpi-pie { padding: 16px 18px; margin-bottom: 18px; }
.jv-card-pie { margin: 0 0 14px; }

/* trend line over columns: rise and fall from one period to the next */
.jv-svg .trend { fill: none; stroke: var(--jv-c2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.jv-svg .tdot { fill: var(--jv-c2); stroke: var(--jv-surface); stroke-width: 2; pointer-events: none; }
.jv-svg .chg { fill: var(--text-secondary); font-size: 11.5px; font-weight: 600; pointer-events: none; paint-order: stroke; stroke: var(--jv-surface); stroke-width: 3px; stroke-linejoin: round; }
.jv-svg .val { paint-order: stroke; stroke: var(--jv-surface); stroke-width: 3px; stroke-linejoin: round; }
.jv-col-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-muted); margin: 2px 0 4px; }
.jv-col-key span { display: inline-flex; align-items: center; gap: 6px; }
.jv-col-key .k-col { width: 10px; height: 12px; border-radius: 3px 3px 0 0; background: var(--jv-c1); }
.jv-col-key .k-line { width: 18px; height: 2px; background: var(--jv-c2); position: relative; }
.jv-col-key .k-line::after { content: ''; position: absolute; left: 5px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--jv-c2); }

/* the chosen place on a map's card, in the same gold as place names on cards (css .jw-place) */
.jm-card h3.jm-place-name { color: var(--gold); font-weight: 800; }
.jm-card .kicker.jm-place-kick { color: var(--gold); }

/* phones: the map uses the card's padding too, so it is drawn as wide as the screen allows */
@media (max-width: 640px) {
  .jm-stage { margin-left: -10px; margin-right: -10px; }
  .jm-svg { max-height: none; }
  .jm-zoom { right: 12px; }
}
