:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --accent: #a21c3b;
  --accent-dark: #81152e;
  --accent-soft: #fdf2f4;
  --positive: #0f766e;
  --positive-bg: #ecfdf5;
  --negative: #be123c;
  --negative-bg: #fff1f2;
  --neutral-bg: #f1f5f9;
  --map-empty: #e2e8f0;
  --map-stroke: #ffffff;
  --radius-sm: 6px;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.14), 0 4px 10px -6px rgba(15, 23, 42, 0.08);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.num, .kpi-value, .delta-badge, td.num, th.num {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Top Header */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  padding: 8px 11px;
  border-radius: 10px;
  line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.brand-title {
  margin: 0;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Segmented controls */
.segmented {
  display: inline-flex;
  background: var(--neutral-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.segmented-sm .seg-btn {
  font-size: 12px;
  padding: 5px 9px;
}

/* Buttons & Inputs */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--surface-alt);
  border-color: #94a3b8;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-sm {
  font-size: 12.5px;
  padding: 5px 10px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:hover {
  color: var(--accent-dark);
}

.auto-refresh-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  cursor: pointer;
  user-select: none;
}

.auto-refresh-toggle input {
  accent-color: var(--accent);
  margin: 0;
}

.input, .select {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(162, 28, 59, 0.12);
}

/* Status Strip */
.status-strip {
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}

.status-strip-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 7px;
  padding-bottom: 7px;
  flex-wrap: wrap;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-live {
  background: var(--positive-bg);
  color: var(--positive);
}
.status-live::before {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.status-snapshot {
  background: #fef3c7;
  color: #92400e;
}
.status-snapshot::before {
  background: #f59e0b;
}

.status-loading {
  background: var(--neutral-bg);
  color: var(--ink-secondary);
}
.status-loading::before {
  background: #94a3b8;
}

.status-meta {
  color: var(--ink-muted);
}

.scrutiny-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrutiny-label {
  color: var(--ink-secondary);
}

.mini-progress {
  width: 110px;
  height: 7px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Main Content */
.main-content {
  padding-top: 20px;
  padding-bottom: 44px;
}

.section {
  margin-bottom: 22px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.scope-chip {
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(162, 28, 59, 0.18);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Banners */
.notice-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: #78350f;
}

.notice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.error-banner {
  background: var(--negative-bg);
  border: 1px solid #fecdd3;
  border-left: 4px solid var(--negative);
  color: #881337;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.card-subtitle {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}

.card-desc {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.kpi-value {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.15;
}

.kpi-value-sm {
  font-size: 22px;
  padding-top: 3px;
}

.kpi-sub {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.delta-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.delta-badge.up {
  background: var(--positive-bg);
  color: var(--positive);
}

.delta-badge.down {
  background: var(--negative-bg);
  color: var(--negative);
}

.delta-badge.neutral {
  background: var(--neutral-bg);
  color: var(--ink-secondary);
}

/* Turnout comparison bars */
.turnout-compare-card {
  padding: 14px 18px 16px;
}

.turnout-compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.turnout-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.swatch-current {
  background: var(--accent);
}

.swatch-prev {
  background: #94a3b8;
}

.turnout-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.turnout-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.turnout-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  font-weight: 650;
}

.bar-row {
  display: grid;
  grid-template-columns: 44px 1fr 50px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.bar-track {
  height: 9px;
  background: var(--neutral-bg);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.bar-fill-current {
  background: var(--accent);
}

.bar-fill-prev {
  background: #94a3b8;
}

/* Dashboard Split Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* Map Card */
.map-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.map-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 14px 10px;
  background: radial-gradient(circle at 50% 45%, #fafcff 0%, #f1f5f9 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.spain-map {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 820 / 560;
  display: block;
  user-select: none;
}

.province-path {
  stroke: var(--map-stroke);
  stroke-width: 0.9;
  stroke-linejoin: round;
  cursor: pointer;
  transition: opacity 0.15s, filter 0.15s, stroke-width 0.15s;
}

.province-path:hover {
  filter: brightness(0.92);
  stroke: #0f172a;
  stroke-width: 1.7;
}

.province-path.selected {
  stroke: #0f172a;
  stroke-width: 2.3;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.28));
}

.map-inset-line {
  fill: #94a3b8;
  stroke: none;
  pointer-events: none;
}

.map-inset-label {
  font-size: 10.5px;
  font-weight: 650;
  fill: #64748b;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.enclave-pill {
  cursor: pointer;
}

.enclave-pill rect {
  stroke: #ffffff;
  stroke-width: 1.4;
  transition: stroke 0.15s, filter 0.15s;
}

.enclave-pill:hover rect,
.enclave-pill.selected rect {
  stroke: #0f172a;
  stroke-width: 2;
  filter: brightness(0.93);
}

.enclave-pill text {
  font-size: 10.5px;
  font-weight: 700;
  pointer-events: none;
}

/* Map Tooltip */
.map-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  min-width: 215px;
  max-width: 280px;
  font-size: 12.5px;
  line-height: 1.4;
}

.tt-title {
  font-weight: 750;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.tt-ccaa {
  font-size: 11.5px;
  color: #cbd5e1;
  margin-bottom: 7px;
}

.tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 3px;
}

.tt-party {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
}

.tt-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tt-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 6px 0;
}

.tt-muted {
  color: #cbd5e1;
  font-size: 11.5px;
}

/* Map Legend */
.map-legend {
  padding: 12px 18px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 12.5px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-weight: 600;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-scale {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 440px;
}

.legend-gradient {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e0f2fe 0%, #7dd3fc 25%, #0284c7 60%, #1e3a8a 100%);
}

/* Detail Card */
.detail-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
}

.region-tag {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.detail-scrutiny-box {
  text-align: right;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
}

.small-label {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
}

.detail-scrutiny-box strong {
  font-size: 16px;
  font-weight: 800;
}

/* Hemicycle & Seat Bar */
.hemicycle-box {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 12px 18px 4px;
}

.hemicycle-svg {
  width: 100%;
  max-width: 400px;
  height: auto;
  aspect-ratio: 420 / 225;
  display: block;
  margin: 0 auto;
}

.province-seat-bar {
  padding: 8px 0 4px;
}

.seat-bar-track {
  display: flex;
  height: 24px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--neutral-bg);
  gap: 2px;
}

.seat-bar-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11.5px;
  font-weight: 750;
  overflow: hidden;
  white-space: nowrap;
}

.seat-bar-caption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
}

/* Mini stats in detail card */
.detail-mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.mini-stat {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
}

.mini-stat-label {
  font-size: 11px;
  color: var(--ink-muted);
  display: block;
}

.mini-stat-val {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--ink);
}

/* Tables */
.party-table-wrap {
  max-height: 410px;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-toolbar {
  border-bottom: 1px solid var(--border);
}

.table-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-secondary);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--ink);
  background: #eef2f6;
}

.data-table th.sort-asc::after {
  content: " ▲";
  font-size: 10px;
  color: var(--accent);
}

.data-table th.sort-desc::after {
  content: " ▼";
  font-size: 10px;
  color: var(--accent);
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.provinces-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

.provinces-table tbody tr:hover {
  background: #f8fafc;
}

.provinces-table tbody tr.selected-row {
  background: var(--accent-soft);
}

.prov-name {
  font-weight: 680;
  color: var(--ink);
}

.prov-ccaa {
  display: block;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.party-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.party-bar-color {
  width: 5px;
  height: 26px;
  border-radius: 3px;
  flex-shrink: 0;
}

.party-siglas {
  font-weight: 720;
  color: var(--ink);
  display: block;
  line-height: 1.2;
}

.party-fullname {
  font-size: 11px;
  color: var(--ink-muted);
  display: block;
  max-width: 195px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.party-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sub-delta {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 1px;
}

.sub-delta.up { color: var(--positive); }
.sub-delta.down { color: var(--negative); }
.sub-delta.neutral { color: var(--ink-muted); }

.pct-bar-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 64px;
}

.pct-mini-bar {
  width: 58px;
  height: 4px;
  background: var(--neutral-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 3px;
}

.pct-mini-fill {
  height: 100%;
  border-radius: 999px;
}

.empty-cell {
  text-align: center;
  color: var(--ink-muted);
  padding: 24px 12px !important;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-meta {
  color: var(--ink-muted);
  font-size: 12px;
}

/* Modal */
.modal {
  border: none;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 520px;
  width: calc(100% - 32px);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16.5px;
}

.icon-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--ink-secondary);
  margin: 0 0 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 13px;
  font-weight: 650;
}

.help-text {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.diagnostics-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-secondary);
  margin-bottom: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Responsive */
@media (max-width: 1080px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .turnout-bars {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 12px;
  }
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .detail-mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px 12px;
  }
  .topbar-inner {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .brand-title {
    font-size: 16.5px;
  }
  .card-header {
    padding: 14px 12px 10px;
  }
  .map-stage {
    padding: 6px 6px 8px;
  }
  .hemicycle-box {
    padding: 10px 10px 4px;
  }
  .map-legend {
    padding: 10px 12px 12px;
  }
  .segmented {
    max-width: 100%;
    flex-wrap: wrap;
  }
  .segmented-sm {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .segmented-sm .seg-btn {
    text-align: center;
    padding: 6px 6px;
  }
  .table-filters {
    width: 100%;
  }
  .table-filters .input,
  .table-filters .select {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
  .party-table th,
  .party-table td {
    padding: 8px 8px;
    font-size: 12.5px;
  }
  .party-fullname {
    max-width: 120px;
  }
  .pct-bar-wrap {
    min-width: 52px;
  }
  .pct-mini-bar {
    width: 46px;
  }
}
