/* ============================================================
   Shared per-state recap block (rendered by js/state_recap.js)
   Used by: primaries-2026, general-2026, general-2024, state
   Extracted from the results pages' inline CSS 2026-07-10 so the
   state-page recap and results-page recap can never drift.
   (general-2026/2024 had already drifted: they were missing the
   .stb-ctx/.stb-cmp rules primaries-2026 gained later.)
   ============================================================ */
  .ev-basics {
    font-family: 'Merriweather', serif; font-size: 14px; line-height: 1.7;
    color: var(--ms-text); margin: 0 0 14px;
  }
  /* current legislature composition bars (reuse state-page buildChamberBar/buildCoalitionBar) */
  .ev-leg {
    display: flex; flex-wrap: wrap; gap: 22px 30px;
    margin: 2px 0 18px; padding-bottom: 14px; border-bottom: 1px solid #eef1f5;
  }
  .ev-leg-col { flex: 1 1 330px; min-width: 280px; }
  .ev-leg-h {
    font-family: 'Work Sans', sans-serif; font-weight: 700; font-size: 13px;
    color: var(--ms-navy); margin: 0 0 4px;
  }
  .ev-leg-super {
    display: inline-block; padding: 1px 7px; border-radius: 9px;
    font-size: 10px; font-weight: 600; color: #fff; vertical-align: middle;
  }
  .ev-section-title {
    font-family: 'Work Sans', sans-serif; font-weight: 800;
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--ms-navy); margin: 18px 0 10px;
  }
  .notable-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
  }
  .notable-card { position: relative; }
  /* Ballot measures — full-width cards (more prominent; measures carry more detail) */
  .measure-grid {
    display: grid; grid-template-columns: 1fr;
    gap: 14px; margin-bottom: 8px;
  }
  .measure-card {
    border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; background: #fff;
  }
  .m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
  .m-title { font-weight: 700; font-size: 14px; color: var(--ms-navy, #043858); line-height: 1.25; }
  .m-badge { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
  .m-badge.pass { background: #e6f4ea; color: #1e7e34; border: 1px solid #b7e1c1; }
  .m-badge.fail { background: #fdecea; color: #c62828; border: 1px solid #f5c6c0; }
  .m-badge.counting { background: #ede7f6; color: #4527a0; border: 1px solid #b39ddb; }
  .m-badge.pending { background: #f5f5f5; color: #666; border: 1px solid #ddd; }
  .m-desc { font-size: 12.5px; color: #555; line-height: 1.4; margin-bottom: 8px; }
  .m-bar { height: 6px; border-radius: 3px; background: #e4572e22; overflow: hidden; margin-bottom: 7px; }
  .m-bar-yes { height: 100%; background: #3f8f5b; }
  .m-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 1px 0; }
  .m-lbl { font-weight: 700; width: 32px; }
  .m-lbl.yes { color: #1e7e34; } .m-lbl.no { color: #c62828; }
  .m-pct { width: 52px; font-variant-numeric: tabular-nums; }
  .m-votes { color: #777; font-variant-numeric: tabular-nums; }
  .m-foot { margin-top: 6px; }
  .m-src { font-size: 12px; }
  .notable-reason {
    display: inline-block; padding: 2px 9px; border-radius: 3px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    margin-bottom: 6px;
  }
  .notable-reason.incumbent_defeat { background:#fce4ec; color:#c62828; border:1px solid #f8bbd0; }
  .notable-reason.flip            { background:#e8f5e9; color:#2e7d32; border:1px solid #a5d6a7; }
  .notable-reason.rcv_reversal    { background:#e0f2f1; color:#00695c; border:1px solid #80cbc4; }
  .notable-reason.runoff_comeback { background:#e0f2f1; color:#00695c; border:1px solid #80cbc4; }
  .notable-reason.too_close       { background:#fff3e0; color:#bf360c; border:1px solid #ffab91; }
  .notable-reason.uncalled        { background:#ede7f6; color:#4527a0; border:1px solid #b39ddb; }
  .notable-reason.recount         { background:#fff3e0; color:#e65100; border:1px solid #ffb74d; }
  .notable-reason.close_race      { background:#e3f2fd; color:#1565c0; border:1px solid #90caf9; }
  details.all-races { margin-top: 18px; border-top: 1px dashed var(--ms-border); padding-top: 12px; }
  details.all-races > summary {
    list-style: none; cursor: pointer;
    font-family: 'Work Sans', sans-serif; font-weight: 700;
    font-size: 13px; color: var(--ms-navy);
  }
  details.all-races > summary::-webkit-details-marker { display: none; }
  details.all-races > summary::before { content: '▸ '; color: #b0b6bd; }
  details.all-races[open] > summary::before { content: '▾ '; }
  .all-races-body { margin-top: 12px; }
  .ev-section-title.sw { margin-top: 4px; }

  /* ── Interactive historical stat boxes (per state) ───────────────── */
  .stat-trend-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 8px; margin: 0 0 14px;
  }
  .stat-trend-box {
    border: 1px solid var(--ms-border); border-radius: var(--ms-radius);
    background: #fbfcfd; padding: 9px 11px 9px; cursor: pointer; text-align: left;
    font-family: 'Work Sans', sans-serif; position: relative;
    transition: border-color .12s, box-shadow .12s, background .12s;
  }
  .stat-trend-box:hover { border-color: #9bb5c4; box-shadow: var(--ms-card-shadow); }
  .stat-trend-box.active { border-color: var(--ms-navy); background: #eef3f9; box-shadow: var(--ms-card-shadow); }
  .stat-trend-box .stb-num { font-size: 22px; font-weight: 800; color: var(--ms-navy); line-height: 1.05; font-variant-numeric: tabular-nums; }
  .stat-trend-box .stb-proj { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #9a7b2e; vertical-align: 3px; }
  .stat-trend-box .stb-lbl { font-size: 11px; font-weight: 600; color: var(--ms-text-light); line-height: 1.2; margin-top: 2px; }
  .stat-trend-box .stb-ctx { font-size: 10px; font-weight: 500; color: #9096a0; line-height: 1.2; margin-top: 3px; }
  .stat-trend-box .stb-cmp { font-size: 10px; font-weight: 600; color: #6b7684; line-height: 1.2; margin-top: 3px; }
  .stat-trend-box .stb-spark { display: block; margin-top: 6px; width: 100%; height: 20px; overflow: visible; }
  .stat-trend-box .stb-caret { position: absolute; top: 8px; right: 9px; font-size: 10px; color: #b0b6bd; transition: transform .12s; }
  .stat-trend-box.active .stb-caret { color: var(--ms-navy); transform: rotate(90deg); }
  .stat-trend-panel {
    border: 1px solid var(--ms-border); border-radius: var(--ms-radius);
    background: #fff; padding: 13px 16px 11px; margin: 0 0 14px;
    box-shadow: var(--ms-card-shadow);
  }
  .stat-trend-panel .stp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 3px; }
  .stat-trend-panel .stp-title { font-family: 'Work Sans', sans-serif; font-weight: 800; font-size: 14px; color: var(--ms-navy); }
  .stat-trend-panel .stp-dl { font-family: 'Work Sans', sans-serif; font-size: 11px; color: #3f6fa3; cursor: pointer; background: none; border: none; padding: 0; white-space: nowrap; }
  .stat-trend-panel .stp-dl:hover { text-decoration: underline; }
  .stat-trend-panel .stp-desc { font-family: 'Work Sans', sans-serif; font-size: 11.5px; color: var(--ms-text-light); margin-bottom: 8px; line-height: 1.4; }
  .stat-trend-panel .stp-wrap { position: relative; height: 210px; }
  .stat-trend-panel .stp-note { font-family: 'Work Sans', sans-serif; font-size: 10.5px; color: var(--ms-text-light); margin-top: 7px; font-style: italic; }

@media (max-width: 768px) {
  .notable-grid { grid-template-columns: 1fr; }
  .stat-trend-row { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
}
