/* ============================================================
   ResultsDesk.nz — Monochrome Edition
   ============================================================ */

:root {
  --bg: #2a2a2a;
  --panel: #f7f6f3;
  --panel-soft: #efede8;
  --text: #111111;
  --muted: #5a5650;
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.20);
  --button: #e8e6e1;
  --button-active: #111111;
  --button-active-text: #ffffff;
  --sidebar-width: clamp(430px, 25vw, 540px);
  --resizer-width: 8px;
  --shadow-card: 0 8px 28px rgba(0,0,0,0.18);
  --header-h: 46px;
  --accent: #111111;
  --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, Arial, Helvetica, sans-serif;
  --font-cond: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

html, body, body *, .leaflet-container, .leaflet-container * {
  font-family: var(--font-ui);
  font-style: normal;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── HEADER / TITLEBAR ──────────────────────────────────── */
.app-titlebar {
  position: sticky;
  top: 0;
  z-index: 1400;
  height: var(--header-h);
  background: #111;
  border-bottom: 3px solid #444;
  display: flex;
  align-items: stretch;
}

.app-titlebar-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 0;
}

/* Brand block */
.app-title-kicker {
  display: flex;
  align-items: center;
  background: #fff;
  color: #111;
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 0 18px;
  height: 100%;
  white-space: nowrap;
  flex-shrink: 0;
}

.app-title-main {
  font-family: var(--font-cond);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  padding: 0 20px;
  line-height: 1;
}

/* Live badge */
.live-badge-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.30);
  color: #fff;
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  margin-left: 4px;
  animation: live-pulse 2.5s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%  { opacity: .50; }
}

/* Reporting status in header */
.header-status-block {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-left: 1px solid rgba(255,255,255,0.10);
  height: 100%;
  flex-shrink: 0;
}

.header-feedback-link {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 5px 12px;
  border-radius: 3px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

.header-feedback-link:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}

/* ── APP GRID ───────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: minmax(420px, var(--sidebar-width)) var(--resizer-width) minmax(0, 1fr);
  height: calc(100vh - var(--header-h));
  background: var(--bg);
}

/* ── LEFT PANEL ─────────────────────────────────────────── */
.panel {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  background: #f7f6f3;
  border-right: 1px solid rgba(0,0,0,0.12);
  box-shadow: 4px 0 32px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.14); border-radius: 3px; }

/* ── MAP AREA — cartographic feel ───────────────────────── */
.map-wrap {
  padding: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  flex: 1 1 0;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  /* Layered: light topographic blues/greys with soft vignette */
  background:
    radial-gradient(ellipse 120% 80% at 15% 8%,  rgba(255,255,255,0.55) 0%, transparent 45%),
    radial-gradient(ellipse 90%  90% at 85% 95%,  rgba(200,210,215,0.40) 0%, transparent 50%),
    radial-gradient(ellipse 60%  50% at 50% 50%,  rgba(215,225,230,0.25) 0%, transparent 70%),
    linear-gradient(175deg, #d6dfe5 0%, #cfd8de 20%, #c8d3d9 42%, #cdd2d2 64%, #c9cec9 84%, #c5c9c2 100%);
}

/* subtle topographic crosshatch texture */
.map-stage-texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  background:
    /* fine grid lines */
    repeating-linear-gradient(
      0deg,
      rgba(100,115,125,0.055) 0px, rgba(100,115,125,0.055) 1px,
      transparent 1px, transparent 40px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(100,115,125,0.055) 0px, rgba(100,115,125,0.055) 1px,
      transparent 1px, transparent 40px
    ),
    /* diagonal cross-hatch for depth */
    repeating-linear-gradient(
      45deg,
      rgba(90,105,115,0.028) 0px, rgba(90,105,115,0.028) 1px,
      transparent 1px, transparent 56px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(90,105,115,0.020) 0px, rgba(90,105,115,0.020) 1px,
      transparent 1px, transparent 56px
    );
}

.map-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 85% at 50% 48%, transparent 40%, rgba(0,0,0,0.13) 100%);
  pointer-events: none;
  z-index: 1;
}

.map-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(0,0,0,0.07) 0%, transparent 22%),
    linear-gradient(to bottom, rgba(0,0,0,0.04) 0%, transparent 30%);
  pointer-events: none;
  z-index: 1;
}

#map {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
  background: transparent !important;
  box-shadow: none;
  border: 0;
  outline: none;
}

/* ── RESIZER ────────────────────────────────────────────── */
.sidebar-resizer {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 900;
  width: var(--resizer-width);
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.18) 0%,
    rgba(255,255,255,0.35) 50%,
    rgba(0,0,0,0.18) 100%
  );
  box-shadow:
    inset 1px 0 0 rgba(255,255,255,0.35),
    inset -1px 0 0 rgba(0,0,0,0.18);
}

.sidebar-resizer::before,
.sidebar-resizer::after { content: ''; position: absolute; }

.sidebar-resizer::after {
  top: 50%;
  left: 50%;
  width: 4px;
  height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.42) 0 3px,
    transparent 3px 7px
  );
  opacity: .95;
}

.sidebar-resizer::before {
  inset: 0;
  background: rgba(255,255,255,0.06);
  opacity: 0;
  transition: opacity .12s ease;
}

body.is-resizing-sidebar,
body.is-resizing-sidebar * { user-select: none !important; }
body.is-resizing-sidebar .app { transition: none !important; }

.sidebar-resizer:hover::before,
body.is-resizing-sidebar .sidebar-resizer::before {
  opacity: 1;
}

.sidebar-resizer:hover,
body.is-resizing-sidebar .sidebar-resizer {
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.24) 0%,
    rgba(255,255,255,0.48) 50%,
    rgba(0,0,0,0.24) 100%
  );
}

/* ── MAP CONTROLS (top-right) ───────────────────────────── */
.topbar {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2600;
  display: flex;
  pointer-events: none;
}

.map-side-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  pointer-events: auto;
}

/* STEP 4: CNN magic wall style — near-invisible containers, controls float on the map */
#topLeftPanel.compact-panel,
.map-quick-views {
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#topLeftPanel.compact-panel {
  width: 190px;
  min-width: 190px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-quick-views {
  width: 190px;
  min-width: 190px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#zoomRegionBody {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-quick-views-title,
.map-control-label {
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  font-family: var(--font-cond);
}

.map-quick-views-title {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: .10em;
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.map-control-block { display: flex; flex-direction: column; gap: 4px; }

.map-toggle-bar,
.toggle-bar {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

/* Map overlay buttons — dark glass, light text */
.map-toggle-btn,
.map-quick-view-btn,
.reset-zoom-btn {
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.70);
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 5px 8px;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  text-transform: uppercase;
  white-space: nowrap;
}

.map-toggle-btn { flex: 1 1 auto; text-align: center; }

.map-toggle-btn.active,
.map-quick-view-btn.active-region {
  background: rgba(255,255,255,0.92);
  color: #111;
  border-color: rgba(255,255,255,0.70);
  font-weight: 800;
}

.map-toggle-btn:hover,
.map-quick-view-btn:hover,
.reset-zoom-btn:hover {
  border-color: rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.95);
}

/* Override info-icon and collapse buttons inside dark map controls */
#topLeftPanel .info-icon,
.map-quick-views .info-icon { color: rgba(255,255,255,0.35); font-size: 10px; }
#topLeftPanel .info-icon:hover,
.map-quick-views .info-icon:hover { color: rgba(255,255,255,0.70); }
#topLeftPanel .coalition-collapse-btn,
.map-quick-views .coalition-collapse-btn { color: rgba(255,255,255,0.50); }
#topLeftPanel .coalition-collapse-btn:hover,
.map-quick-views .coalition-collapse-btn:hover { color: #fff; background: rgba(255,255,255,0.10); }

/* Sidebar buttons */
.toggle-btn,
.panel-btn,
.clear-search-btn {
  border-radius: 4px;
  border: 1.5px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.72);
  color: #222;
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  text-transform: uppercase;
  white-space: nowrap;
}

.toggle-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.toggle-btn:hover,
.panel-btn:hover,
.clear-search-btn:hover {
  border-color: rgba(0,0,0,0.36);
  background: rgba(0,0,0,0.06);
}

.sr-only-controls {
  position: absolute;
  width: 0; height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ── SIDEBAR TOPBAR (reporting / status) ────────────────── */
.panel-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.panel-section.compact { padding-top: 12px; padding-bottom: 12px; }

.sidebar-topbar {
  background: #1a1a1a;
  color: #fff;
  border-bottom: 2px solid #3a3a3a;
}

.sidebar-topbar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.mini-heading {
  color: rgba(255,255,255,0.40);
  font-family: var(--font-cond);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.reporting-number-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-big-number {
  color: #fff;
  font-family: var(--font-cond);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.01em;
}

.live-indicator {
  font-family: var(--font-cond);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff !important;
  margin-bottom: 4px;
  animation: live-pulse 2.5s ease-in-out infinite;
}

.mini-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.36);
  line-height: 1.3;
  margin-top: 3px;
  font-weight: 400;
}

.reporting-progress {
  flex: 1 1 120px;
  min-width: 70px;
  max-width: 180px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  overflow: hidden;
}

.reporting-progress-bar {
  width: 0;
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width .35s ease;
}

/* ── SEAT SUMMARY SECTION ───────────────────────────────── */
.seat-priority {
  background: #fff;
  padding-top: 14px;
  padding-bottom: 14px;
}

@keyframes rowSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.seat-summary-row {
  animation: rowSlideIn 0.22s ease both;
}

/* Stagger each row */
.seat-summary-row:nth-child(1)  { animation-delay: 0.00s; }
.seat-summary-row:nth-child(2)  { animation-delay: 0.04s; }
.seat-summary-row:nth-child(3)  { animation-delay: 0.08s; }
.seat-summary-row:nth-child(4)  { animation-delay: 0.12s; }
.seat-summary-row:nth-child(5)  { animation-delay: 0.16s; }
.seat-summary-row:nth-child(6)  { animation-delay: 0.20s; }
.seat-summary-row:nth-child(7)  { animation-delay: 0.24s; }
.seat-summary-row:nth-child(8)  { animation-delay: 0.28s; }
.seat-summary-row:nth-child(n+9){ animation-delay: 0.30s; }

.panel h2,
.seat-main-heading {
  font-family: var(--font-cond);
  color: #111;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

#seatSummary {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 10px;
}

.seat-footnote {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 400;
}

/* ── SEAT TABLE ─────────────────────────────────────────── */
.seat-table {
  table-layout: fixed;
  font-size: 13px;
  margin-top: 4px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.seat-table th,
.seat-table td {
  padding: 8px 8px;
  border-bottom: 0;
  white-space: nowrap;
  position: relative;
}

.seat-table tbody tr,
.seat-table tfoot tr {
  position: relative;
}

.seat-table tbody tr::after,
.seat-table tfoot tr::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(0,0,0,0.09);
  pointer-events: none;
}

.seat-table th {
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ece9e3;
  color: #2c2c2c;
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0,0,0,0.14);
}

.seat-table th:nth-child(1), .seat-table td:nth-child(1) { width: 42%; text-align: left; }
.seat-table th:nth-child(2), .seat-table td:nth-child(2) { width: 13%; text-align: right; }
.seat-table th:nth-child(3), .seat-table td:nth-child(3) { width: 24%; text-align: right; }
.seat-table th:nth-child(4), .seat-table td:nth-child(4) { width: 21%; text-align: right; }

.seat-table .num { text-align: right; white-space: nowrap; }
.seat-table tfoot td { padding-top: 4px; padding-bottom: 2px; border-bottom: 0; }
.seat-summary-row, .seat-party-cell { background-size: 100% 100%; background-repeat: no-repeat; }
.total-seats-cell strong, .total-votes-cell { color: #111; font-weight: 700; }

/* Minor parties - smaller, muted. Legacy layout only; dashboard owns its own table rules. */
body:not(.dashboard-body) .seat-minor-row td { color: var(--muted); font-size: 12px; }
body:not(.dashboard-body) .seat-minor-row .party-name-text {
  font-size: 11px;
  color: #777;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body:not(.dashboard-body) .seat-minor-row .party-line {
  background: rgba(0,0,0,0.12) !important;
  width: 4px;
  min-width: 4px;
}

/* ── SEAT TABLE EXPANDED ────────────────────────────────── */
.seat-table-expanded th, .seat-table-expanded td { font-size: 14px; }
.seat-table-expanded th { white-space: nowrap; overflow: hidden; text-overflow: clip; }

.seat-table-expanded th:nth-child(1), .seat-table-expanded td:nth-child(1) { width: 42%; text-align: left; }
.seat-table-expanded th:nth-child(2), .seat-table-expanded td:nth-child(2) { width: 17%; text-align: right; }
.seat-table-expanded th:nth-child(3), .seat-table-expanded td:nth-child(3) { width: 10%; text-align: right; }
.seat-table-expanded th:nth-child(4), .seat-table-expanded td:nth-child(4) { width: 11%; text-align: right; }
.seat-table-expanded th:nth-child(5), .seat-table-expanded td:nth-child(5) { width: 10%; text-align: right; }
.seat-table-expanded th:nth-child(6), .seat-table-expanded td:nth-child(6) { width: 10%; text-align: right; }
.seat-table-expanded th:nth-child(7), .seat-table-expanded td:nth-child(7) { width: 10%; text-align: right; }

.seat-table-expanded:not(.seat-table-with-change) th:nth-child(1),
.seat-table-expanded:not(.seat-table-with-change) td:nth-child(1) { width: 42%; }
.seat-table-expanded:not(.seat-table-with-change) th:nth-child(2),
.seat-table-expanded:not(.seat-table-with-change) td:nth-child(2) { width: 20%; }
.seat-table-expanded:not(.seat-table-with-change) th:nth-child(3),
.seat-table-expanded:not(.seat-table-with-change) td:nth-child(3) { width: 12%; }
.seat-table-expanded:not(.seat-table-with-change) th:nth-child(4),
.seat-table-expanded:not(.seat-table-with-change) td:nth-child(4) { width: 12%; }
.seat-table-expanded:not(.seat-table-with-change) th:nth-child(5),
.seat-table-expanded:not(.seat-table-with-change) td:nth-child(5) { width: 14%; }

.seat-change-cell { color: #666; font-size: 12px; }

/* ── COALITION BAR ──────────────────────────────────────── */
.coalition-bar-wrap {
  margin-top: 12px;
  position: relative;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.seat-coalition-title {
  margin: 0 0 6px;
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #444;
}

.seat-footnote-inline { margin: 0 0 8px !important; }
.coalition-footnote-split { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.coalition-footnote-right { text-align: right; }
.coalition-bar-meta { position: relative; height: 24px; margin-bottom: 8px; }

.coalition-bar-govern-label {
  position: absolute;
  top: 0;
  left: var(--govern-left);
  transform: translate(-50%, -2px);
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  color: #111;
  background: rgba(247,246,243,.98);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 3;
}

.coalition-bar-total {
  position: absolute;
  right: 0; top: 2px;
  font-family: var(--font-cond);
  font-size: 20px;
  font-weight: 800;
  color: #111;
}

.coalition-bar-area { position: relative; --govern-left: 50%; overflow: visible; }

.coalition-bar-govern-line {
  position: absolute;
  left: var(--govern-left);
  top: -14px; bottom: 23px;
  width: 0;
  border-left: 2px dashed rgba(0,0,0,0.45);
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}

.coalition-bar-track {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 52px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.10);
}

.coalition-bar-segment {
  border: 0;
  border-right: 1px solid rgba(255,255,255,.24);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 5px 3px;
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
}

.coalition-bar-segment:last-child { border-right: 0; }
.coalition-segment-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; line-height: 1; }
.coalition-segment-label, .coalition-segment-seats { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coalition-segment-label { font-size: 10px; }
.coalition-segment-seats { font-size: 11px; }

.coalition-bar-axis { position: relative; height: 24px; margin-top: 8px; color: #555; font-size: 12px; font-weight: 500; }
.coalition-bar-axis-tick { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; line-height: 1; }
.coalition-bar-axis-tick.axis-pos-0 { left: 0%; transform: translateX(0); }
.coalition-bar-axis-tick.axis-pos-1 { left: 16.393%; }
.coalition-bar-axis-tick.axis-pos-2 { left: 32.787%; }
.coalition-bar-axis-tick.axis-pos-3 { left: 49.180%; }
.coalition-bar-axis-tick.axis-pos-4 { left: 65.574%; }
.coalition-bar-axis-tick.axis-pos-5 { left: 81.967%; }
.coalition-bar-axis-tick.axis-pos-6 { left: 100%; transform: translateX(-100%); }

/* ── TOGGLE CONTROLS (sidebar) ──────────────────────────── */
#listToggleSection { padding-top: 10px; padding-bottom: 10px; border-top: 2px solid rgba(0,0,0,0.10); }
#listToggleSection .seat-main-heading { grid-column: 1 / -1; }

#listToggleSection .toggle-group {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
}

#listToggleSection .toggle-group + .toggle-group { margin-top: 8px; }

.toggle-label, .search-label {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toggle-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.small-toggle-bar .toggle-btn { padding: 5px 11px; }

#listToggleSection .toggle-btn {
  padding: 5px 10px;
  min-height: 28px;
  min-width: 84px;
  font-size: 12px;
  line-height: 1;
  border-radius: 4px;
}

#listToggleSection .toggle-group:nth-child(3) .toggle-btn { min-width: 120px; }

/* ── SEARCH ─────────────────────────────────────────────── */
.search-row { display: flex; gap: 8px; align-items: center; }

.search-input {
  width: 100%;
  min-width: 0;
  padding: 10px 13px;
  border: 1.5px solid rgba(0,0,0,0.14);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color .15s;
}

.search-input:focus {
  outline: none;
  border-color: rgba(0,0,0,0.34);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.search-input::placeholder { color: rgba(0,0,0,0.28); }

/* ── RESULTS TABLE ──────────────────────────────────────── */
.table-wrap { overflow: visible; flex: none; min-height: 0; padding-right: 0; }

/* Use separate borders everywhere so inline background-image can't cover border-bottom */
table, .popup-table { width: 100%; border-collapse: separate; border-spacing: 0; }
table { font-size: 14px; color: #2a2a2a; }

table:not(.seat-table):not(.popup-table) { table-layout: fixed; width: 100%; }
table:not(.seat-table):not(.popup-table) thead th:nth-child(1) { width: 28%; }
table:not(.seat-table):not(.popup-table) thead th:nth-child(2) { width: 38%; }
table:not(.seat-table):not(.popup-table) thead th:nth-child(3) { width: 17%; }
table:not(.seat-table):not(.popup-table) thead th:nth-child(4) { width: 17%; }

#resultsTableBody td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

thead th, .seat-table th, .popup-table thead th {
  text-align: left;
  position: sticky;
  top: 0; z-index: 2;
  background: #eeece7;
  color: #333;
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(0,0,0,0.14);
  padding: 9px 10px;
}

th, td, .seat-table th, .seat-table td, .popup-table th, .popup-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.09);
  vertical-align: top;
}

/* With border-separate, party-name-cell border always shows above background-image */
td.party-name-cell {
  background-origin: padding-box;
}

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: #111; text-decoration: underline; }
tbody tr:hover { background: rgba(0,0,0,0.03); }

#resultsTableBody td:first-child { font-weight: 700; color: #111; font-size: 14px; }
#resultsTableBody td:nth-child(2) { font-size: 13px; font-weight: 500; color: #222; }
#resultsTableBody td:nth-child(3), #resultsTableBody td:nth-child(4) { font-size: 13px; font-weight: 400; color: var(--muted); }

/* ── PARTY NAME CELLS ───────────────────────────────────── */
.party-name-cell, .popup-name-cell {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-origin: padding-box;
}

.party-name-cell > span:last-child, .popup-name-cell > span:last-child {
  display: flex;
  align-items: center;
  min-width: 0;
  color: #222;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 14px;
}

.party-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  min-width: 8px;
  margin: 0;
  border-radius: 0;
  display: block;
  z-index: 1;
}

#resultsTableBody td:nth-child(2) { padding-left: 12px; position: relative; }
.seat-table td:first-child { padding-left: 8px; padding-right: 8px; }
.seat-table .party-name-cell { min-height: 40px; }
.seat-table .party-name-cell > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -.01em;
}
.pv-label-mobile { display: none; }

/* Party name text truncation */
.party-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 0;
  padding-left: 14px;
}

.seat-table td.party-name-cell {
  display: table-cell;
  min-width: auto;
  overflow: hidden;
  vertical-align: middle;
  padding-left: 0;
}

.seat-table td.party-name-cell .party-line {
  left: 0;
}

.seat-table td.party-name-cell .party-name-text {
  display: block;
  width: 100%;
  padding-left: 26px;
}

/* ── FLOATING POPUP ─────────────────────────────────────── */
.floating-popup {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3000;
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 0);
  transition: opacity .12s ease;
  will-change: transform, opacity;
  contain: layout style;
}

.floating-popup.visible { visibility: visible; opacity: 1; pointer-events: auto; }
.floating-popup .popup { padding: 6px 8px 6px; }

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
  border-bottom: 2px solid #111;
  padding-bottom: 4px;
}

.floating-popup h3 {
  margin: 0;
  font-family: var(--font-cond);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: #111;
}

.popup-reporting-wrap {
  min-width: 122px;
  text-align: right;
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 700;
  color: #111;
}
.popup-reporting-meta {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  margin-bottom: 3px;
}
.popup-reporting-meta strong {
  font-weight: 800;
}
.popup-reporting-bar { width: 100%; height: 3px; background: #ddd; border-radius: 2px; overflow: hidden; }
.popup-reporting-fill { height: 100%; background: #333; }

.popup-table { table-layout: fixed; margin-top: 1px; }
.popup-table th { padding: 3px 4px; font-size: 10px; }
.popup-table td { padding: 3px 4px; font-size: 12px; vertical-align: middle; }

.popup-results-table-candidate .col-name { width: 38%; }
.popup-results-table-candidate .col-party { width: 18%; }
.popup-results-table-candidate .col-votes { width: 17%; }
.popup-results-table-candidate .col-pct { width: 12%; }
.popup-results-table-candidate .col-change { width: 15%; }
.popup-results-table-candidate th.col-change, .popup-results-table-candidate td.col-change { white-space: nowrap; text-align: right; }
.popup-results-table-partyvote .col-name { width: 60%; }
.popup-results-table-partyvote .col-votes { width: 18%; }
.popup-results-table-partyvote .col-pct { width: 22%; }
.popup-results-table-partyvote-change .col-name { width: 54%; }
.popup-results-table-partyvote-change .col-votes { width: 16%; }
.popup-results-table-partyvote-change .col-pct { width: 13%; }
.popup-results-table-partyvote-change .col-change { width: 17%; }
.popup-results-table-partyvote-change th.col-change, .popup-results-table-partyvote-change td.col-change { white-space: nowrap; text-align: right; }

.popup-results-table-partyvote-change th, .popup-results-table-partyvote-change td,
.popup-results-table-partyvote th, .popup-results-table-partyvote td { padding-left: 6px; padding-right: 6px; }

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

.popup-results-table-partyvote-change th.col-votes, .popup-results-table-partyvote-change th.col-pct,
.popup-results-table-partyvote-change th.col-change, .popup-results-table-partyvote th.col-votes,
.popup-results-table-partyvote th.col-pct { text-align: right; white-space: nowrap; }

.popup-results-table-partyvote-change .candidate-cell, .popup-results-table-partyvote .candidate-cell { background-size: 100% 100%; }

.candidate-cell {
  position: relative;
  padding-left: 16px !important;
  font-weight: 600;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vertical-party-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.party-label-text { font-size: 12px; font-weight: 500; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; color: #222; font-weight: 500; }
.bold { font-weight: 700; }

.popup-winner-margin { font-size: 11px; font-weight: 600; color: #585858; margin-top: 2px; line-height: 1; }
.popup-footer {
  margin-top: 6px;
  font-size: 12px;
  color: #888888;
}
.popup-footer-inline {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.popup-footer-inline strong {
  color: #555;
}
.popup-footer-sep {
  color: rgba(0,0,0,0.28);
}
.footer-line { display: flex; justify-content: space-between; margin-top: 2px; }
.footer-line strong { color: #555; }
.footer-line-inline { justify-content: flex-start; }
.footer-line-inline span { display: inline-flex; align-items: baseline; gap: 6px; }

/* ── POI / CITY LABELS ──────────────────────────────────── */
.poi-label-icon {
  background: transparent !important;
  border: 0 !important;
  display: flex !important;
  align-items: center;
  gap: 5px;
  transform: translate(-4px,-4px);
  z-index: 1000 !important;
}

.poi-marker-dot {
  width: 10px; height: 10px; flex: 0 0 10px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(255,255,255,0.70);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.20);
}

.map-place-label {
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  color: rgba(30,30,30,0.90);
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.92),
     1px -1px 0 rgba(255,255,255,0.92),
    -1px  1px 0 rgba(255,255,255,0.92),
     1px  1px 0 rgba(255,255,255,0.92),
     0 2px 10px rgba(255,255,255,0.80);
}

/* ── LEAFLET OVERRIDES ──────────────────────────────────── */
.leaflet-container, .leaflet-pane, .leaflet-map-pane, .leaflet-overlay-pane,
.leaflet-shadow-pane, .leaflet-marker-pane, .leaflet-tooltip-pane, .leaflet-popup-pane {
  background: transparent !important;
}

.leaflet-container { border: 0 !important; outline: none !important; box-shadow: none !important; }
.leaflet-control-zoom, .leaflet-control-attribution { box-shadow: none; }

.leaflet-control-zoom a {
  background: rgba(255,255,255,0.92) !important;
  color: #222 !important;
  border-radius: 5px !important;
  border: 1px solid rgba(0,0,0,0.16) !important;
  margin-bottom: 4px;
}

.leaflet-control-zoom a:hover { background: #fff !important; color: #000 !important; }

.leaflet-control-attribution {
  background: rgba(255,255,255,0.78) !important;
  color: rgba(0,0,0,0.44) !important;
  border-top-left-radius: 5px;
  font-size: 10px;
}

.leaflet-control-attribution a { color: rgba(0,0,0,0.50) !important; }

/* ── SEAT CHART TOOLTIP ─────────────────────────────────── */
.seat-chart-tooltip {
  position: absolute;
  top: calc(100% + 6px); left: 12px;
  min-width: 180px; max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  z-index: 20;
}

.seat-chart-tooltip.visible { opacity: 1; transform: translateY(0); }
.seat-chart-tooltip-title { font-family: var(--font-cond); font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.seat-chart-tooltip-grid { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font-size: 12px; }
.seat-chart-tooltip-grid span { color: var(--muted); }
.seat-chart-tooltip-grid strong { color: #111; }

#electorateDetailsView h2 { font-family: var(--font-cond); font-size: 14px; font-weight: 700; letter-spacing: .06em; }

/* ── INFO ICON (tooltip trigger) ───────────────────────── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(0,0,0,0.40);
  cursor: help;
  margin-left: 3px;
  vertical-align: middle;
  line-height: 1;
  position: relative;
}

.info-icon:hover,
.info-icon:focus { color: #111; outline: none; }

/* Native title tooltip is fine for desktop; on touch we show a custom tip */
.info-icon[title]:focus::after,
.info-icon[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.92);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  min-width: 180px;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: 5px;
  z-index: 100;
  pointer-events: none;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0,0,0,0.28);
}

/* ── MOBILE HEADER FIXES ────────────────────────────────── */
@media (max-width: 600px) {
  .app-titlebar { height: auto; min-height: var(--header-h); flex-wrap: wrap; }

  .app-titlebar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0;
    row-gap: 0;
  }

  .app-title-kicker {
    font-size: 10px;
    padding: 0 12px;
    height: var(--header-h);
    flex-shrink: 0;
  }

  .app-title-main {
    font-size: 16px;
    padding: 0 12px;
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .live-badge-header {
    font-size: 10px;
    padding: 3px 8px;
    margin-left: 0;
  }

  .header-status-block {
    padding: 0 12px;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    width: 100%;
    height: auto;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* Push app down to account for taller header */
  .app { height: calc(100vh - 88px); }
}


@media (max-width: 1200px) {
  :root { --sidebar-width: clamp(420px, 28vw, 520px); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 420px; }
  body { overflow-x: hidden; overflow-y: auto; }
  .app { display: block; height: auto; min-height: calc(100dvh - var(--header-h)); }

  .map-column, .map-wrap, .topbar, .map-side-stack, .map-quick-views,
  #topLeftPanel.compact-panel, .sidebar-resizer, .sr-only-controls { display: none !important; }

  .panel { min-height: calc(100dvh - var(--header-h)); height: auto; overflow: visible; border-right: 0; box-shadow: none; }

  /* Reporting strip */
  .sidebar-topbar-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .reporting-number-row { gap: 8px; }
  .mini-big-number { font-size: 26px; }
  .reporting-progress { min-width: 60px; max-width: 130px; height: 5px; }
  .mini-sub { font-size: 11px; }

  /* Tables */
  .table-wrap { overflow: visible; }
  table { font-size: 13px; }
  .seat-table { font-size: 12px; }
  .seat-table th, .seat-table td { padding: 6px 5px; }
  .seat-table td:first-child { padding-left: 6px; }
  .seat-table .party-line { width: 10px; min-width: 10px; }
  #resultsTableBody td:first-child { font-size: 13px; }
  #resultsTableBody td:nth-child(2), #resultsTableBody td:nth-child(3), #resultsTableBody td:nth-child(4) { font-size: 12px; }

  .seat-table-expanded th, .seat-table-expanded td { font-size: 12px; }
  .seat-table-expanded th:nth-child(1), .seat-table-expanded td:nth-child(1) { width: 40%; }
  .seat-table-expanded th:nth-child(2), .seat-table-expanded td:nth-child(2) { width: 18%; }
  .seat-table-expanded th:nth-child(3), .seat-table-expanded td:nth-child(3) { width: 14%; }
  .seat-table-expanded th:nth-child(4), .seat-table-expanded td:nth-child(4) { width: 14%; }
  .seat-table-expanded th:nth-child(5), .seat-table-expanded td:nth-child(5) { width: 18%; }

  .seat-table-expanded.seat-table-with-change th:nth-child(4),
  .seat-table-expanded.seat-table-with-change td:nth-child(4) { display: none; }
  .seat-table-expanded.seat-table-with-change th:nth-child(1),
  .seat-table-expanded.seat-table-with-change td:nth-child(1) { width: 40% !important; }
  .seat-table-expanded.seat-table-with-change th:nth-child(2),
  .seat-table-expanded.seat-table-with-change td:nth-child(2) { width: 19% !important; }
  .seat-table-expanded.seat-table-with-change th:nth-child(3),
  .seat-table-expanded.seat-table-with-change td:nth-child(3) { width: 14% !important; }
  .seat-table-expanded.seat-table-with-change th:nth-child(5),
  .seat-table-expanded.seat-table-with-change td:nth-child(5) { width: 13% !important; }
  .seat-table-expanded.seat-table-with-change th:nth-child(6),
  .seat-table-expanded.seat-table-with-change td:nth-child(6) { width: 14% !important; }

  /* Coalition bar */
  .coalition-bar-track { height: 46px; }
  .coalition-bar-segment { padding: 4px 2px; font-size: 9px; }
  .coalition-bar-axis { height: 18px; margin-top: 6px; font-size: 10px; }
  .coalition-bar-govern-label { font-size: 10px; padding: 2px 8px; white-space: nowrap; }
  .coalition-bar-meta { height: 28px; }
  .floating-popup { width: min(340px, calc(100vw - 20px)); }
  .popup-header { gap: 10px; }
  .popup-reporting-wrap { min-width: 110px; }
  .popup-footer-inline { gap: 4px; font-size: 11px; }

  /* Toggle section */
  #listToggleSection { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding-top: 10px; padding-bottom: 10px; }
  #listToggleSection .toggle-group { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
  #listToggleSection .toggle-group + .toggle-group { margin-top: 0; }
  #listToggleSection .toggle-bar, #listToggleSection .small-toggle-bar { display: flex; flex-wrap: wrap; gap: 6px; }
  #listToggleSection .toggle-btn { flex: 1 1 calc(50% - 3px); min-width: 0; padding: 8px 8px; font-size: 12px; }
  #listToggleSection .toggle-group:first-child .toggle-btn:nth-child(3) { flex-basis: 100%; }
  #searchSection .clear-search-btn { flex: 0 0 auto; min-width: 80px; }

  .coalition-bar-total { font-size: 16px; }
  .coalition-bar-govern-line { top: -14px; bottom: 22px; }
  .coalition-footnote-split { font-size: 12px; }

  /* Electorate detail in mobile panel */
  #electorateDetailsContent .popup { box-shadow: none; border: none; background: transparent; padding: 0; width: 100%; position: static; }
  .panel-section { padding-left: 14px; padding-right: 14px; }

  /* Info icon tooltip — reposition below on mobile since above may clip */
  .info-icon[title]:focus::after,
  .info-icon[title]:hover::after {
    bottom: auto;
    top: calc(100% + 6px);
  }
}

.app { height: calc(100vh - var(--header-h)); }


/* Disabled live seat-table row animation to avoid constant replay on refresh */
.seat-summary-row { animation: none !important; }
.seat-summary-row:nth-child(n) { animation-delay: 0s !important; }


/* Popup rows — no animation overhead */
.popup-table tbody tr {
  transition: none;
}

/* Cleaner coalition axis */
.coalition-bar-axis-simple {
  position: relative;
  height: 22px;
  margin-top: 8px;
  color: #555;
  font-size: 12px;
  font-weight: 500;
}

.coalition-bar-axis-simple .coalition-bar-axis-tick {
  position: absolute;
  top: 0;
  white-space: nowrap;
  line-height: 1;
  transform: none;
}

.coalition-bar-axis-simple .axis-left { left: 0; }
.coalition-bar-axis-simple .axis-center {
  left: var(--govern-left);
  transform: translateX(-50%);
}
.coalition-bar-axis-simple .axis-right { right: 0; }


/* ── MAP COALITION BANNER ──────────────────────────────── */
.map-column {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 6px 10px 10px 0;
  gap: 6px;
}

.map-coalition-banner {
  position: relative;
  z-index: 2550;
  pointer-events: none;
  width: 100%;
  flex-shrink: 0;
}

.app { position: relative; }

.map-coalition-banner.is-visible {
  pointer-events: auto;
}

.coalition-bar-wrap-map {
  background: rgba(245,245,245,0.97);
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 12px 6px;
  border-radius: 10px;
}

.seat-coalition-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.seat-coalition-title-map {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .03em;
  color: #111;
  flex-shrink: 0;
}

.coalition-info-btn {
  background: none;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  padding: 0;
  line-height: 1;
}
.coalition-info-btn:hover { background: rgba(0,0,0,0.06); }

.coalition-title-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.coalition-body {
font-weight: 100;}

.coalition-bar-wrap-map.is-collapsed {
  padding-bottom: 10px;
}

.coalition-info-panel {
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
}

/* subtitle removed */

.seat-coalition-meta {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: rgba(17,17,17,0.7);
}

.coalition-bar-area-map {
  position: relative;
}

.coalition-bar-track-map {
  height: 50px;
  border-radius: 10px;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

/* side tints removed */

.coalition-bar-wrap-map .coalition-bar-govern-line {
  top: -1px;
  bottom: 22px;
  border-left: 4px dashed rgba(255, 255, 255, 0.85);
  z-index: 3;
}

.coalition-bar-govern-label-map {
  top: -30px;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 4px;
  box-shadow: none;
  color: #333;
}

.coalition-bar-wrap-map .coalition-bar-segment {
  position: relative;
  z-index: 2;
  font-size: 13px;
}

.coalition-bar-wrap-map .coalition-segment-inner {
  gap: 3px;
}

.coalition-bar-wrap-map .coalition-segment-label {
  font-size: 13px;
  font-weight: 800;
}

.coalition-bar-wrap-map .coalition-segment-seats {
  font-size: 16px;
  font-weight: 900;
}

.coalition-bar-axis-map {
  margin-top: 4px;
  height: 18px;
  font-size: 13px;
  font-weight: 800;
  color: rgba(17,17,17,0.82);
}

.coalition-bar-axis-map .axis-center {
  transform: translateX(-50%);
}

.coalition-bar-wrap-map.cross-left .coalition-bar-govern-line,
.coalition-bar-wrap-map.cross-right .coalition-bar-govern-line {
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.15));
}

.coalition-bar-wrap-map.cross-left .coalition-bar-govern-label-map,
.coalition-bar-wrap-map.cross-right .coalition-bar-govern-label-map {
  font-weight: 800;
  border-color: rgba(0,0,0,0.25);
}

@media (max-width: 1400px) {
  .seat-coalition-title-map { font-size: 16px; }
  .coalition-bar-track-map { height: 78px; }
}

@media (max-width: 1100px) {
  .seat-coalition-title-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .coalition-bar-track-map { height: 58px; }
  .coalition-bar-wrap-map .coalition-segment-seats { font-size: 14px; }
}

@media (max-width: 900px) {
  .map-column { display: none !important; }
  .map-coalition-banner {
    position: relative;
    width: 100%;
    margin-top: 0;
    padding: 0 8px;
    box-sizing: border-box;
    margin-bottom: 8px;
  }
  .coalition-bar-track-map { height: 56px; }
  .coalition-bar-wrap-map .coalition-segment-seats { font-size: 12px; }
  .coalition-bar-wrap-map .coalition-segment-label { font-size: 10px; }
  .seat-coalition-title-map { font-size: 16px !important; }
}

/* === STEP 3: Operator panel & status indicator === */
.operator-toggle-btn {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1100;
  width: 32px;
  height: 32px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: rgba(255,255,255,0.92);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  color: #555;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.operator-toggle-btn:hover { background: #fff; color: #111; }

.operator-panel {
  position: absolute;
  bottom: 52px;
  left: 12px;
  z-index: 1100;
  background: rgba(255,255,255,0.96);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  font-family: var(--font-ui);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  min-width: 200px;
}
.operator-panel-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  color: #333;
}
.operator-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 12px;
  color: #333;
}
.operator-toggle input { margin: 0; }
.operator-refresh-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
}
.operator-label { font-size: 12px; color: #333; }
.operator-refresh-row select {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #ccc;
}
.operator-btn {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 5px 0;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #999;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: pointer;
}
.operator-btn:hover { background: #e8e8e8; }
.operator-health {
  margin-top: 8px;
  font-size: 11px;
  color: #666;
  line-height: 1.4;
}

.refresh-status-dot {
  position: absolute;
  bottom: 16px;
  left: 52px;
  z-index: 1100;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 3px rgba(0,0,0,0.2);
  transition: background 0.3s;
}
.refresh-status-dot.error { background: #ef4444; }
.refresh-status-dot.warning { background: #f59e0b; }
.refresh-status-dot.stale { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .22), 0 0 3px rgba(0,0,0,0.2); }
.refresh-status-dot.paused { background: #94a3b8; }
.refresh-status-dot.refreshing { background: #3b82f6; animation: pulse-dot 1s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.4} }

@media (max-width:900px) {
  .operator-toggle-btn, .operator-panel, .refresh-status-dot { display: none !important; }
}
