/* Global Professional Font Override */
* {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.012em;
}

/* keep colour bar tight */
.party-line {
  flex: 0 0 6px !important;
  width: 6px !important;
}
/* Remove the empty column */
.seat-table th:nth-child(3),
.seat-table td:nth-child(3) {
  display: none !important;
}

:root {
  --bg: #f3f3f1;
  --panel: #f7f7f5;
  --panel-2: #efefeb;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --border: #d9d9d4;
  --button: #ecece8;
  --button-active: #111111;
  --button-active-text: #ffffff;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  transition: all 0.4s ease;
  height: 100vh;
  background: var(--bg);
}

/* Desktop Map Hiding */
@media (min-width: 901px) {
  .app.map-hidden {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .app.map-hidden #map,
  .app.map-hidden .reset-zoom-btn {
    display: none;
  }
  .app.map-hidden .map-wrap {
    grid-row: 1;
    height: auto;
  }
  .app.map-hidden .topbar {
    position: static;
    padding: 12px 16px;
    pointer-events: auto;
  }
  .app.map-hidden .panel {
    grid-row: 2;
    border-left: none;
  }
}



.map-wrap,

#map {
  background: #efeee9;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

.topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}


/* 
   Target the panel directly or children of topbar to restore clicks 
*/
.legend {
  pointer-events: auto;
  background: rgba(247,247,245,0.97);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  color: var(--text);
}

.compact-panel {
  pointer-events: auto;
  background: rgba(247,247,245,0.97);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-brand {
  font-weight: 800;
  font-size: 13px;
}

.panel-select {
  font-size: 12px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.panel-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--button);
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  font-family: inherit;
  color: var(--text);
}

.panel-btn:hover {
  background: var(--border);
}

.eyebrow {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #666;
  margin-bottom: 4px;
  font-weight: 700;
}

.title h1 {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  line-height: 1.02;
  color: #111;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.title p,
.status p {
  margin: 2px 0 0;
  color: #666;
  font-size: 11px;
  font-family: Arial, Helvetica, sans-serif;
}

.panel-section.seat-priority {
  padding: 18px 16px;
  background: #ece9df;
  border-bottom: 1px solid #d8d3c7;
}

.panel-section.seat-priority h2 {
  font-size: 13px;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.toggle-group {
  background: rgba(247,247,245,0.72);
}

.reset-zoom-btn {
  position: absolute;
  right: 20px;
  top: 5px;
  z-index: 1000;
  padding: 10px 12px;
  border: 1px solid #d3d0c7;
  border-radius: 6px;
  background: rgba(247,247,245,0.96);
  color: #222;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.reset-zoom-btn:hover {
  background: #efeee9;
}

.search-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  font-family: Arial, Helvetica, sans-serif;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d3d0c7;
  border-radius: 6px;
  background: #faf9f5;
  color: #222;
  font-size: 13px;
  font-family: Arial, Helvetica, sans-serif;
}

.search-input:focus {
  outline: none;
  border-color: #999;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}

.toggle-label {
  display: inline-block;
  margin-top: 12px ;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b6b6b;
  font-family: Arial, Helvetica, sans-serif;
  background: rgba(247,247,245,0.9);
}


.status strong {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  color: #111;
}

.toggle-bar {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.toggle-btn {
  background: var(--button);
  color: #222;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 10px;
  cursor: default;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: Arial, Helvetica, sans-serif;
}

.toggle-btn.active {
  background: var(--button-active);
  color: var(--button-active-text);
  border-color: #111;
}

#listToggleSection {
  padding-top: 10px;
  padding-bottom: 10px;
}

#listToggleSection .toggle-group {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

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

.sidebar-topbar {
  padding-top: 12px;
  padding-bottom: 12px;
}

#searchSection,
#listToggleSection {
  border-top: 1px solid #d8d3c7;
}

#searchSection {
  padding-top: 14px;
  padding-bottom: 14px;
}

#listToggleSection {
  padding-top: 12px;
  padding-bottom: 12px;
}

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

.mini-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5f5a50;
  margin-bottom: 4px;
  font-family: Arial, Helvetica, sans-serif;
}

.mini-big-number {
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  margin-bottom: 4px;
}

.mini-sub {
  font-size: 11px;
  color: #6b6b6b;
  line-height: 1.25;
  font-family: Arial, Helvetica, sans-serif;
}

.title-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-collapse-btn {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #d3d0c7;
  border-radius: 6px;
  background: rgba(247,247,245,0.96);
  color: #222;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  
  letter-spacing: 0.04em;
}

#topLeftPanel .panel-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
  box-shadow: 0 1px 4px rgba(0,0,0,0.14);
}

#topLeftPanel .panel-btn {
  cursor: pointer;
  position: relative;
}

#topLeftPanel .panel-btn::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}

.topbar-collapse-btn:hover {
  background: #efeee9;
}

.title.collapsed .eyebrow {
  margin-bottom: 0;
}

.title.collapsed #topLeftPanelBody {
  display: none;
}

.map-quick-view-btn {
  transition: background 0.10s ease, border-color 0.10s ease, box-shadow 0.10s ease;
}

.map-quick-view-btn:hover {
  background: #efeee9;
}

.map-quick-view-btn.active-region {
  border-color: #111;
  background-color: #e7e7e7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.14);
}

.map-quick-view-btn:active {
  background: #dcd8cf;
}





.title.collapsed {
  padding-bottom: 10px;
}

.live-indicator {
  font-size: 18px;
  line-height: 1;
  color: #ef4444;
  font-weight: 800;
  margin-bottom: 4px;
  font-family: Arial, Helvetica, sans-serif;
}

#listToggleSection .toggle-label {
  display: block;
  padding: 0;
  margin: 0 0 6px;
  background: transparent;
  font-size: 11px;
  color: #6b6b6b;
}

#listToggleSection .toggle-bar {
  margin-top: 0;
}

#listToggleSection .toggle-btn {
  padding: 5px 12px;
  font-size: 11px;
}

.panel {
  background: #f7f7f5;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  min-height: 0;
  color: var(--text);
}

.panel-section {
  padding: 14px 16px;
  border: 1px solid var(--border);
}

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

.panel-section.seat-priority {
  padding: 8px;
  background: #ffffff;
  }

.seat-footnote {
  margin-top: 4px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  color: #5f5a50;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.seat-footnote strong {
  font-weight: 700;
  color: #222;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5f5a50;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
}

.big-number {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: #111;
}

.sub {
  font-size: 12px;
  color: #111;
  margin-top: 6px;
  font-family: Arial, Helvetica, sans-serif;
}

.seat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
  font-family: Arial, Helvetica, sans-serif;
}

.seat-table th,
.seat-table td {
  padding: 6px 6px;
  border-bottom: 1px solid #888888;
  text-align: left;
  vertical-align: top;
}

.seat-table th {
  color: #111;
  font-weight: 700;
  background: transparent;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.seat-table td strong { color: #111; }

.popup-winner-margin {
  font-size: 10px !important;
  font-weight: 500;
  color: #666;
  margin-top: -1px;
  line-height: 1;
}

.seat-table .num {
  text-align: right;
  white-space: nowrap;
}

.table-wrap {
  overflow: visible;
  min-height: 0;
  flex: none;
  max-height: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: Arial, Helvetica, sans-serif;
  color: #3b3a3a;
}

#resultsTableBody td:first-child {
  font-weight: 700;
  color: #222;
}

.small-toggle-bar .toggle-btn {
  padding: 6px 10px;
  font-size: 11px;
}

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

.sortable:hover {
  color: #111;
  text-decoration: underline;
}

#resultsTableBody td:nth-child(2),
#resultsTableBody td:nth-child(3),
#resultsTableBody td:nth-child(4) {
  font-weight: 400;
}

thead th {
  text-align: left;
  position: sticky;
  top: 0;
  background: #ecece8;
  z-index: 2;
  color: #111;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid #dddcd6;
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(0,0,0,0.03);
  cursor: default;
}

.party-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.16);
}

.legend {
  line-height: 1.45;
  padding: 10px 12px;
  color: #222;
  background: rgba(247,247,245,0.97);
  font-family: Arial, Helvetica, sans-serif;
}

.legend strong {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  font-size: 12px;
  color: #222;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.14);
  flex: 0 0 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  padding: 2px 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

.floating-popup {
  position: absolute;
  width: min(340px, calc(100vw - 48px));
  z-index: 1100;
  padding: 14px 15px;
  border-radius: 12px;/* ============================================================
     REPLICATED NYT-STYLE POPUP SYSTEM (FIXED LAYOUT)
     ============================================================ */
  
  .floating-popup {
    position: absolute;
    width: 380px !important;
    z-index: 3000 !important;
    background: #ffffff !important;
    border: 1px solid #d1d1d1 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    padding: 0 !important;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.1s ease;
  }
  
  .floating-popup.visible {
    visibility: visible;
    opacity: 1;
  }
  
  .floating-popup .popup {
    padding: 12px 15px !important;
  }
  
  /* Header */
  .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    border-bottom: 1px solid #111;
    padding-bottom: 6px;
  }
  
  .popup-header h3 {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #111 !important;
    letter-spacing: -0.02em;
  }
  
  .popup-reporting-wrap {
    text-align: right;
    font-size: 11px;
    color: #666;
    width: 100px;
  }
  
  .popup-reporting-wrap span {
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
  }
  
  .popup-reporting-bar {
    height: 4px;
    background: #eee;
    width: 100%;
    border-radius: 2px;
    overflow: hidden;
  }
  
  .popup-reporting-fill {
    height: 100%;
    background: #444;
  }
  
  /* Table */
  .popup-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    margin-top: 4px !important;
  }
  
  .popup-table th {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #999 !important;
    text-transform: uppercase;
    padding: 4px 0 6px !important;
    border-bottom: 1px solid #eee !important;
    text-align: left;
  }
  
  .popup-table th.num { text-align: right; }
  
  .popup-table td {
    padding: 6px 0 !important;
    font-size: 12px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    vertical-align: middle;
    white-space: nowrap;
  }
  
  /* Column Widths - Candidate Mode */
  .popup-results-table-candidate .col-name { width: 48%; }
  .popup-results-table-candidate .col-party { width: 20%; }
  .popup-results-table-candidate .col-votes { width: 17%; }
  .popup-results-table-candidate .col-pct { width: 15%; }
  
  /* Column Widths - Party Mode */
  .popup-results-table-partyvote .col-name { width: 68%; }
  .popup-results-table-partyvote .col-votes { width: 17%; }
  .popup-results-table-partyvote .col-pct { width: 15%; }
  
  /* Candidate Cell with Integrated Bars */
  .candidate-cell {
    position: relative;
    padding-left: 12px !important; /* Fixed space for vertical bar */
    font-weight: 700;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .vertical-party-bar {
    position: absolute;
    left: 0cap;
    top: 0px;
    bottom: 0px;
    width: 5px;
  }
  
  .party-label-text {
    color: #666;
    font-weight: 400;
    font-size: 11px;
  }
  
  .num { text-align: right; font-variant-numeric: tabular-nums; }
  .bold { font-weight: 700; }
  
  /* Footer */
  .popup-footer {
    margin-top: 12px;
    font-size: 11px;
    color: #888;
  }
  
  .footer-line {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
  }
  
  .popup-footer strong { color: #444; }
  
  background: rgba(250,249,245,0.98);
  color: #222;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 14px 30px rgba(0,0,0,0.18);
  font-family: Arial, Helvetica, sans-serif;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

/* ============================================================
   CLEAN NYT-STYLE POPUP SYSTEM (REPLACEMENT)
   ============================================================ */

.floating-popup {
  position: absolute;
  width: min(420px, calc(100vw - 30px)) !important;
  z-index: 3000 !important;
  background: #fff !important;
  border: 1px solid #999 !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
  padding: 0 !important;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.floating-popup.visible {
  visibility: visible;
  opacity: 1;
}

.floating-popup .popup {
  padding: 12px 14px !important;
}

.floating-popup h3 {
  margin: 0 0 10px 0 !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  color: #111 !important;
  border-bottom: 2px solid #111;
  padding-bottom: 4px;
}

/* Header Leader Info */
.popup-leader-block { margin-bottom: 10px !important; }
.popup-leader-label { 
  font-size: 10px !important; 
  text-transform: uppercase; 
  font-weight: 700; 
  color: #666; 
  margin-bottom: 4px;
}
.popup-leader-value { display: flex; align-items: center; gap: 10px; }
.popup-name-stack strong { display: block; font-size: 14px; line-height: 1.1; font-weight: 700; }
.popup-name-stack span { display: block; font-size: 11px; color: #666; }
.popup-ahead { font-size: 11px; font-weight: 700; margin-top: 2px; display: block; }

/* Table Structure */
.popup-table {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important; /* Forces columns to stay in place */
  margin-top: 8px !important;
}

.popup-table th {
  font-size: 10px !important;
  text-transform: uppercase;
  color: #333;
  padding: 4px 6px !important;
  border-bottom: 1px solid #ccc !important;
}

.popup-table td {
  padding: 5px 6px !important;
  font-size: 12px !important;
  border-bottom: 1px solid #eee !important;
  vertical-align: middle !important;
}

/* Candidate Mode Column Widths */
.popup-results-table-candidate .name-col { width: 50%; text-align: left; }
.popup-results-table-candidate .party-label-col { width: 16%; text-align: left; color: #666; }
.popup-results-table-candidate .votes-col { width: 17%; text-align: right; }
.popup-results-table-candidate .pct-col { width: 17%; text-align: right; }

/* Party Mode Column Widths */
.popup-results-table-partyvote .name-col { width: 66%; text-align: left; }
.popup-results-table-partyvote .votes-col { width: 17%; text-align: right; }
.popup-results-table-partyvote .pct-col { width: 17%; text-align: right; }

/* Inner Cell Wrapper - Allows flex bar/name without breaking table */
.popup-cell-wrapper {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100%;
}

.popup-name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #111;
}

.party-line {
  flex: 0 0 4px !important;
  width: 4px !important;
  height: 27px !important;
  display: block;
}

.winner-row { background-color: #f9f9f9 !important; }
.winner-row .popup-name-text { font-weight: 800; }
.winner-row strong { font-weight: 800; }

/* Footer */
.popup-footer {
  margin-top: 12px !important;
  padding-top: 8px !important;
  border-top: 1px solid #ddd !important;
}
.popup-footer-top, .popup-footer-bottom {
  font-size: 11px !important;
  color: #666;
  line-height: 1.4;
}
.popup-footer-progress {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: #eee;
  margin-left: 8px;
  vertical-align: middle;
}
.popup-footer-progress-bar {
  display: block;
  height: 100%;
  background: #444;
}


.winner-row {
  background: rgba(0,0,0,0.03);
  font-weight: 700;
}

.muted { color: #777; }

.leaflet-control-zoom,
.leaflet-control-attribution {
  box-shadow: none;
  font-family: Arial, Helvetica, sans-serif;
}

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

.leaflet-control-attribution {
  background: rgba(247,247,245,0.95);
}

@media (max-width: 900px) {
 .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    transition: none;
    height: 100dvh;
    overflow: hidden;
  }

  .map-wrap {
    grid-row: 1;
    height: auto;
    min-height: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: block;
  }

  /* Remove map elements entirely on mobile */
  #map, .reset-zoom-btn, #toggleMapBtn, .app.map-hidden #toggleMapBtn {
    display: none !important;
  }

  .panel {
    grid-row: 2;
    border-left: 0;
    border-top: none;
    overflow: hidden;
    height: 100%;
  }

  .panel-section {
    padding: 12px 14px;
  }

  .table-wrap {
    flex: 1 1 auto;
    max-height: none;
    overflow: auto;
  }

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

.search-input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d3d0c7;
  border-radius: 6px;
  background: #faf9f5;
  color: #222;
  font-size: 13px;
  font-family: Arial, Helvetica, sans-serif;
}

.clear-search-btn {
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid #d3d0c7;
  border-radius: 6px;
  background: #efeee9;
  color: #222;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.clear-search-btn:hover {
  background: #e7e5de;
}

.topbar {
  position: static;
  z-index: 1000;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 10px;
  width: 100%;
}
  .topbar > div,
  .legend {
    padding: 4px 8px;
    border-radius: 6px;
  }

  .panel-brand {
    font-size: 11px;
  }

  .panel-btn {
    font-size: 10px;
    padding: 2px 6px;
  }

  .title h1 {
    font-size: 22px;
  }

  .title p,
  .status p,
  .eyebrow {
    font-size: 11px;
  }

  .toggle-bar {
    gap: 6px;
    margin-top: 8px;
  }

  .toggle-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .floating-popup {
    width: min(300px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 6px;
  }

  .floating-popup h3 {
    font-size: 15px;
  }

  .popup-table {
    font-size: 11px;
  }

  .seat-table,
  table {
    font-size: 12px;
  }

  .leaflet-control-zoom {
    transform: scale(0.92);
    transform-origin: top left;
  }

  #electorateDetailsContent .popup {
    box-shadow: none; border: none; background: transparent; padding: 0; width: 100%; position: static;
  }
}

@media (max-width: 640px) {
  .app {
    grid-template-rows: 50vh 50vh;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    width: min(92vw, 340px);
  }

  .status {
    align-self: flex-start;
  }

  .legend {
    max-width: 220px;
    font-size: 11px;
  }

  .popup-table th:nth-child(2),
  .popup-table td:nth-child(2) {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }}


@media (max-width: 900px) {
  .app {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .map-wrap {
    display: none !important;
  }

  .panel {
    grid-row: auto;
    border-left: 0;
    border-top: none;
    overflow: visible;
    height: auto;
    min-height: 100dvh;
  }

  .sidebar-topbar {
    padding-top: 14px;
  }

  .table-wrap {
    flex: none;
    overflow: visible;
    max-height: none;
  }

  body {
    overflow-x: hidden;
  }

  #electorateDetailsView .panel-btn {
    font-size: 10px;
    padding: 6px 8px;
  }

  #electorateDetailsContent .popup {
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    width: 100%;
    position: static;
  }

  #electorateDetailsContent .popup h3 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  #electorateDetailsContent .popup-table {
    font-size: 12px;
  }

  #electorateDetailsContent .popup-table th,
  #electorateDetailsContent .popup-table td {
    padding: 7px 6px;
  }
}


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

.reporting-progress {
  flex: 1 1 auto;
  max-width: 160px;
  min-width: 70px;
  height: 10px;
  border-radius: 999px;
  background: #e2dfd7;
  overflow: hidden;
}

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

@media (max-width: 900px) {
  .reporting-number-row {
    gap: 10px;
  }

  .reporting-progress {
    max-width: none;
    height: 8px;
  }
}


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

.reporting-progress {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 220px;
  height: 12px;
  border-radius: 999px;
  background: #ddd8cf;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  overflow: hidden;
}

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

@media (max-width: 900px) {
  .reporting-progress {
    min-width: 90px;
    max-width: none;
    height: 10px;
  }
}


.seat-label-mobile {
    display: table-cell;
}

@media (max-width: 900px) {
  .sidebar-topbar-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 12px;
  }

  .reporting-number-row {
    display: block;
  }

  .reporting-number-row .mini-big-number {
    margin-bottom: 8px;
  }

  .reporting-progress {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 10px;
  }

  .seat-col-list {
    display: none;
  }

  .seat-label-desktop {
    display: none;
  }

  .seat-label-mobile {
    display: inline;
  }
}


@media (max-width: 900px) {
  .sidebar-topbar-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    gap: 10px;
  }

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

  .reporting-number-row .mini-big-number {
    margin-bottom: 0;
    flex: 0 0 auto;
    font-size: 19px;
  }

  .reporting-progress {
    display: block;
    flex: 1 1 auto;
    width: auto;
    min-width: 58px;
    max-width: 120px;
    height: 8px;
    margin-top: 0;
  }

  .seat-table {
    table-layout: fixed;
    font-size: 11px;
  }

  .seat-table th,
  .seat-table td {
    padding: 6px 4px;
  }

  .seat-table th:first-child,
  .seat-table td:first-child {
    width: 44%;
  }

  .seat-table .num {
    white-space: nowrap;
  }

  .seat-col-electorate {
    display: table-cell !important;
    width: 14%;
  }

  .seat-col-list {
    display: none !important;
  }

  .seat-col-total {
    width: 14%;
  }

  .seat-label-desktop {
    display: none !important;
  }

  .seat-label-mobile {
    display: inline !important;
  }

  .party-dot {
    margin-right: 5px;
  }
}


.map-quick-views {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 700;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.map-quick-view-btn,
.reset-zoom-btn {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: rgba(247,247,245,0.96);
  color: #222;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  white-space: nowrap;
}

.map-quick-view-btn:hover,
.reset-zoom-btn:hover {
  background: #efeee9;
}

.reset-zoom-btn {
  position: static;
}

@media (max-width: 900px) {
  .map-quick-views {
    display: none !important;
  }
}


/* Make the top-left map controls match the region quick-view buttons */
#topLeftPanel.compact-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

#topLeftPanel .panel-brand,
#topLeftPanel .panel-btn {
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: rgba(247,247,245,0.96);
  color: #222;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  white-space: nowrap;
}

#topLeftPanel .panel-brand {
  cursor: default;
}

#topLeftPanel .panel-btn {
  cursor: pointer;
}

#topLeftPanel .panel-btn:hover {
  background: #efeee9;
}

@media (max-width: 900px) {
  #topLeftPanel.compact-panel {
    display: none !important;
  }
}


/* Four-button map control cards */
#topLeftPanel.compact-panel {
  background: rgba(247,247,245,0.97);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

#topLeftPanel .panel-brand {
  display: block;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 6px;
  background: rgba(255,255,255,0.75);
  color: #222;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 800;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  white-space: nowrap;
}

#topLeftPanel .panel-btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: rgba(247,247,245,0.96);
  color: #222;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

#topLeftPanel .panel-btn:hover {
  background: #d6d5cf;
}

.map-quick-views {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 700;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  background: rgba(247,247,245,0.97);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.map-quick-view-btn,
.reset-zoom-btn {
  width: 100%;
  text-align: left;
}

.map-quick-view-btn.active-region {
  border-color: #111;
  background-color: #e7e7e7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.14);
}


:root {
  --sidebar-width: 500px;
}

.app {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.panel {
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid var(--border);
  border-left: 0;
}

.map-wrap {
  grid-column: 2;
  grid-row: 1;
}

.topbar {
  left: 16px;
  right: 16px;
}

#topLeftPanel.compact-panel {
  width: 260px;
  background: rgba(247,247,245,0.97);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

#topLeftPanel .panel-brand,
#topLeftPanel .static-control-btn {
  display: none;
}

.map-card-heading {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  text-align: center;
  background: rgba(255, 255, 255, 0);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  padding: 5px 6px;
  font-family: Arial, Helvetica, sans-serif;
}

.map-control-row {
  display: grid;
  grid-template-columns: 1fr 132px;
  align-items: center;
  gap: 5px;
}

.map-control-label {
  font-size: 11px;
  font-weight: 700;
  color: #333;
  font-family: Arial, Helvetica, sans-serif;
}

#topLeftPanel .top-left-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 15px 4px 5px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background-color: rgba(247, 247, 245, 0);
  color: #222;
  font-size: 11px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #666 50%),
    linear-gradient(135deg, #666 50%, transparent 0%);
  background-position:
    calc(100% - 15px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

#topLeftPanel .top-left-select:hover {
  background-color: #efeee9;
}

.map-quick-views {
  width: 180px;
  align-items: stretch;
}

.map-quick-view-btn,
.reset-zoom-btn {
  width: 100%;
  text-align: left;
}

@media (min-width: 901px) {
  .app.map-hidden {
    grid-template-columns: 1fr;
  }

  .app.map-hidden .panel {
    grid-column: 1;
    border-right: 0;
  }

  .app.map-hidden .map-wrap {
    display: none;
  }
}

@media (max-width: 900px) {
  .app,
  .panel,
  .map-wrap {
    grid-column: auto;
    grid-row: auto;
  }
}


/* ===== Final professional polish ===== */

:root {
  --bg: #f4f3ef;
  --panel: #faf9f5;
  --panel-soft: #f6f4ee;
  --text: #171717;
  --muted: #666158;
  --border: #c6c1b7;
  --border-strong: #c8c2b5;
  --shadow-soft: 0 2px 10px rgba(0,0,0,0.05);
  --shadow-card: 0 8px 22px rgba(0,0,0,0.08);
}

body {
  background: var(--bg);
  color: var(--text);
}

.app-titlebar {
  position: sticky;
  top: 0;
  z-index: 1400;
  background: rgba(255, 255, 255);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.app-titlebar-inner {
  padding: 10px 16px 9px;
}

.app-title-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000000;
  text-align: center;
}

.app-title-main {
  font-size: 12px;
  line-height: 1.0;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #000000;
  text-align: center;

}

.app {
  height: calc(100vh - 50px);
  background: var(--bg);
}

.panel {
  background: var(--panel);
  box-shadow: inset -1px 0 0 rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-section {
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-bottom: 1px solid var(--border);
  padding: 15px 16px;
}

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

.sidebar-topbar {
  background: linear-gradient(to bottom, #faf9f5 0%, #f7f5ef 100%);
}

.sidebar-topbar-grid {
  gap: 18px;
}

.mini-heading {
  margin-bottom: 5px;
  color: #202020;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mini-big-number {
  font-size: 20px;
  font-weight: 800;
  color: #111;
}

.mini-sub {
  color: #201f1d;
  font-size: 11px;
  line-height: 1.25;
}

.live-indicator {
  font-size: 17px;
  font-weight: 800;
}

.reporting-progress {
  background: #ddd8cf;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.07);
  height: 10px;
}

.reporting-progress-bar {
  background: #111;
}

.panel h2,
.seat-main-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #353432;
}

.seat-footnote {
  margin-top: 8px;
  font-size: 12px;
  color: #000000;
}

.search-label,
.toggle-label {
  color: #36332e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.search-input {
  border: 1px solid var(--border);
  background: #fcfbf8;
  border-radius: 8px;
  padding: 11px 12px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.search-input:focus {
  border-color: #9c9689;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.clear-search-btn,
.toggle-btn,
.panel-btn,
.map-quick-view-btn,
.reset-zoom-btn {
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #f6f4ee;
  color: #1f1f1f;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.clear-search-btn:hover,
.toggle-btn:hover,
.panel-btn:hover,
.map-quick-view-btn:hover,
.reset-zoom-btn:hover {
  background: #efede6;
  border-color: var(--border-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.toggle-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

table,
.seat-table,
.popup-table {
  font-family: Arial, Helvetica, sans-serif;
}

thead th,
.seat-table th {
  background: #f0eee8;
  color: #1c1c1b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-bottom: 1px solid #d7d2c6;
}

th, td,
.seat-table th,
.seat-table td {
  border-bottom-color: #ddd8cd;
}

tbody tr:hover {
  background: rgba(0,0,0,0.025);
}

#resultsTableBody td:first-child {
  color: #1c1c1c;
}

.party-dot {
  width: 11px;
  height: 11px;
  margin-right: 4px;
  border: 1px solid rgba(0,0,0,0.14);
}

.topbar {
  top: 14px;
  left: 14px;
  right: 14px;
}

#topLeftPanel.compact-panel,
.map-quick-views {
  background: rgba(250,249,245,0.94);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

#topLeftPanel.compact-panel {
  width: 272px;
  padding: 12px;
  gap: 10px;
}

.map-card-heading {
  background: #fcfbf8;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #222;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.map-control-row {
  grid-template-columns: 1fr 134px;
  gap: 12px;
}

.map-control-label {
  color: #464138;
  font-size: 11px;
  font-weight: 800;
}

#topLeftPanel .top-left-select {
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.12);
  background-color: #f8f6f1;
  padding: 6px 30px 6px 10px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

#topLeftPanel .top-left-select:hover {
  background-color: #f1efe8;
}

.map-quick-views {
  width: 188px;
  padding: 12px;
  gap: 8px;
}

.map-quick-view-btn,
.reset-zoom-btn {
  padding: 10px 12px;
  font-size: 11px;
}

.map-quick-view-btn.active-region {
  background: #111;
  color: #fff;
  border-color: #111;
  box-shadow: 0 3px 10px rgba(0,0,0,0.16);
}

.floating-popup {
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(250,249,245,0.98);
  box-shadow: 0 14px 30px rgba(0,0,0,0.18);
  padding: 14px 15px;
}

.floating-popup h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.popup-metric {
  color: #4c4840;
}

.popup-table thead th {
  background: #f0eee8;
  color: #21201e;
}

.popup-table th,
.popup-table td {
  border-bottom-color: #ddd8cd;
}

.winner-row {
  background: rgba(0,0,0,0.03);
}

.leaflet-control-attribution {
  background: rgba(250,249,245,0.95);
  border-top-left-radius: 6px;
}

#map {
  background: #efede8;
}

@media (max-width: 900px) {
  .app-titlebar-inner {
    padding: 10px 14px 9px;
  }

  .app-title-main {
    font-size: 15px;
  }

  .app {
    height: auto;
    min-height: calc(100dvh - 50px);
  }

  .panel {
    box-shadow: none;
  }
}


/* v3 popup result bars */
.popup-results-table tbody tr {
  transition: background-color 0.14s ease;
}

.popup-bar-row td {
  background: transparent;
}

.popup-bar-row.winner-row td {
  font-weight: 700;
}

/* v3 seat coalition chart */
.seats-coalition-chart-wrap {
  margin-top: 12px;
  padding-top: 2px;
}

.seats-coalition-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  color: #4b473f;
  font-size: 11px;
  font-weight: 700;
}

.seats-coalition-meta strong {
  font-size: 22px;
  line-height: 1;
  color: #111;
  font-weight: 800;
}

.seats-coalition-chart {
  position: relative;
  display: flex;
  width: 100%;
  height: 52px;
  overflow: hidden;
  border: 1px solid #cfc9bc;
  background: #f4f1ea;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.seat-segment {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.26);
}

.seat-segment span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.seats-govern-line {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 0;
  border-left: 2px dotted rgba(17,17,17,0.7);
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 900px) {
  .seats-coalition-chart {
    height: 44px;
  }
  .seat-segment {
    font-size: 9px;
    padding: 4px 4px;
  }
  .seats-coalition-meta strong {
    font-size: 18px;
  }
}


/* === v4 polish and fixes === */
.topbar { z-index: 1200; align-items: flex-start; }
#topLeftPanel.compact-panel {
  display: flex !important;
  width: 236px;
  padding: 10px 12px;
  gap: 8px;
  background: rgba(250,249,245,0.90);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 10px 22px rgba(0,0,0,0.10);
}
.map-card-heading {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4a453d;
  box-shadow: none;
}
.map-control-row { grid-template-columns: 1fr 118px; gap: 8px; }
#topLeftPanel .top-left-select { background-color: rgba(255,255,255,0.78); }
.map-quick-views {
  width: 176px;
  padding: 8px;
  gap: 6px;
  background: rgba(250,249,245,0.88);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 10px 22px rgba(0,0,0,0.10);
}
.map-quick-view-btn, .reset-zoom-btn { padding: 9px 11px; }
.party-line {
  display: inline-block;
  width: 6px;
  min-width: 6px;
  align-self: stretch;
  border-radius: 999px;
  margin-right: 8px;
}
.party-name-cell {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.party-name-cell > span:last-child { display: inline-flex; align-items: center; }
.party-dot { display:none !important; }
.popup-results-table .party-name-cell,
.seat-table .party-name-cell,
#resultsTableBody .party-name-cell { min-height: 20px; }
.popup-bar-row, .seat-summary-row { background-size: 100% 100%; background-repeat: no-repeat; }
.popup-metric-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.popup-metric-value { text-align: right; }
.popup-margin-value { font-weight: 800; }
.seats-coalition-chart-wrap { position: relative; margin-top: 14px; overflow: visible; }
.seats-coalition-meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-bottom: 6px; font-size: 11px; color: #5b564d;
}
.seats-coalition-meta em { font-style: normal; font-weight: 800; color: #171717; }
.seats-coalition-chart {
  position: relative; display: flex; height: 52px; overflow: hidden;
  border-radius: 0; background: #ece8de; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.seat-segment {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; min-width: 0;
  border: 0; border-right: 1px solid rgba(255,255,255,0.28); padding: 6px 4px;
  font: inherit; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; cursor: pointer;
}
.seat-segment:last-child { border-right: 0; }
.seat-segment span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.seats-govern-line {
  position: absolute; top: -4px; bottom: -4px; width: 0;
  border-left: 3px dotted rgba(17,17,17,0.92); z-index: 5; pointer-events: none;
}
.seat-chart-tooltip {
  position: absolute; top: calc(100% + 10px); left: 12px; min-width: 220px; max-width: 280px;
  padding: 10px 12px; border-radius: 10px; background: rgba(250,249,245,0.98);
  border: 1px solid rgba(0,0,0,0.12); box-shadow: 0 14px 26px rgba(0,0,0,0.16);
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity 0.14s ease, transform 0.14s ease; z-index: 20;
}
.seat-chart-tooltip.visible { opacity: 1; transform: translateY(0); }
.seat-chart-tooltip-title { font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.seat-chart-tooltip-grid { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; font-size: 12px; }
.seat-chart-tooltip-grid span { color: #5f5a50; }
.seat-chart-tooltip-grid strong { color: #111; }
.poi-label-icon { z-index: 1000 !important; }
.map-place-label { color: rgba(26,26,26,0.78); font-size: 15px; font-weight: 800; }
@media (max-width: 900px) {
  #topLeftPanel.compact-panel, .map-quick-views, .seat-chart-tooltip { display:none !important; }
}


/* === v5 fixes === */
.topbar{
  position:absolute !important;
  top:16px !important;
  left:16px !important;
  right:16px !important;
  z-index:1600 !important;
  display:flex !important;
  justify-content:space-between !important;
  align-items:flex-start !important;
  pointer-events:none;
}
#topLeftPanel.compact-panel{
  display:flex !important;
  visibility:visible !important;
  opacity:1 !important;
  pointer-events:auto !important;
}
.top-left-control-card{
  min-width:228px;
}
.map-quick-views{ pointer-events:auto; }
.poi-label-icon{
  background:transparent !important;
  border:0 !important;
  display:flex !important;
  align-items:center;
  gap:6px;
  transform:translate(-4px,-4px);
}
.poi-marker-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:#f5f5f4;
  border:2px solid rgba(55,55,55,0.85);
  box-shadow:0 1px 4px rgba(0,0,0,0.18);
  flex:0 0 8px;
}
.map-place-label{
  color:rgba(33,33,33,0.78);
  font-size:14px;
  font-weight:800;
  line-height:1;
  text-shadow:
    -1px -1px 0 rgba(247,247,245,0.95),
     1px -1px 0 rgba(247,247,245,0.95),
    -1px  1px 0 rgba(247,247,245,0.95),
     1px  1px 0 rgba(247,247,245,0.95),
     0 2px 6px rgba(255,255,255,0.55);
}
.party-name-cell,
.popup-name-cell{
  position:relative;
  display:flex;
  align-items:stretch;
  gap:10px;
}
.party-line{
  display:block;
  width:6px;
  min-width:6px;
  align-self:stretch;
  margin:-8px 0;
  border-radius:999px;
}
#resultsTableBody .party-line,
.seat-table .party-line{
  margin:-7px 0;
}
.popup-results-table .party-line{
  margin:-10px 0;
}
.popup-name-stack{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:3px;
  min-width:0;
}
.popup-name-stack strong{
  font-size:15px;
  line-height:1.2;
  color:#171717;
}
.popup-name-stack span{
  font-size:12px;
  line-height:1.2;
  color:#4f4b44;
}
.floating-popup{
  width:min(445px, calc(100vw - 56px));
  border-radius:14px;
  padding:0;
  overflow:hidden;
  background:rgba(247,247,245,0.985);
  border:1px solid rgba(0,0,0,0.10);
  box-shadow:0 18px 34px rgba(0,0,0,0.17);
  pointer-events:none;
}
.floating-popup .popup{ padding:18px 18px 14px; }
.floating-popup h3{
  margin:0 0 14px;
  font-size:20px;
  line-height:1.1;
  font-weight:800;
}
.popup-metric-grid{
  margin-bottom:8px;
}
.popup-metric-row{
  display:grid;
  grid-template-columns: 1fr auto;
  gap:16px;
  align-items:start;
  padding:2px 0;
}
.popup-metric-label{
  font-size:11px;
  font-weight:800;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:#5c574f;
}
.popup-metric-value{
  font-size:13px;
  font-weight:700;
  color:#171717;
  text-align:right;
}
.popup-table{
  margin-top:14px;
  font-size:14px;
}
.popup-table thead th{
  background:#f2f0ea;
  color:#1e1d1b;
  font-size:11px;
  font-weight:800;
  letter-spacing:0.06em;
  padding:11px 10px;
}
.popup-table tbody td{
  padding:14px 10px;
  border-bottom:1px solid #dbd6ca;
  vertical-align:top;
}
.popup-table td:nth-child(2), .popup-table th:nth-child(2),
.popup-table td:nth-child(3), .popup-table th:nth-child(3){
  text-align:right;
  white-space:nowrap;
}
.popup-results-table .winner-row{
  background-color:rgba(0,0,0,0.02);
}
.seats-coalition-chart{
  overflow:visible;
}
.seats-govern-line{
  position:absolute;
  top:-6px;
  bottom:-6px;
  width:3px;
  left:0;
  z-index:9;
  background:repeating-linear-gradient(
    to bottom,
    rgba(17,17,17,0.95) 0 6px,
    transparent 6px 11px
  );
  border-left:0 !important;
  box-shadow:0 0 0 1px rgba(255,255,255,0.45);
}
@media (max-width:900px){
  .floating-popup{ width:min(320px, calc(100vw - 20px)); }
  .popup-name-stack strong{ font-size:14px; }
  .map-place-label{ font-size:13px; }
}


/* === v6 tweaks === */
.seats-coalition-chart-wrap{ margin-top:10px; }
.seats-coalition-meta{ justify-content:flex-end; margin-bottom:4px; }
.seats-govern-label{
  position:absolute;
  top:-18px;
  font-size:10px;
  font-weight:800;
  color:#4d483f;
  white-space:nowrap;
  z-index:10;
  pointer-events:none;
}
.seats-coalition-chart{ overflow:visible; }

.poi-label-icon{ gap:5px; }
.poi-marker-dot{
  width:10px;
  height:10px;
  flex:0 0 10px;
  background:#fbfbfa;
  border:2px solid rgba(42,42,42,0.88);
}
.map-place-label{
  font-size:13px;
  font-weight:800;
}

#topLeftPanel.compact-panel{
  position:relative;
  display:flex !important;
  visibility:visible !important;
  opacity:1 !important;
  z-index:1700 !important;
  background:rgba(250,249,245,0.96) !important;
  border:1px solid rgba(0,0,0,0.10) !important;
}
.topbar{ pointer-events:none; }
.topbar > *{ pointer-events:auto; }

.party-name-cell,
.popup-name-cell{
  gap:8px;
  align-items:stretch;
}
.party-line{
  width:12px !important;
  min-width:12px !important;
  border-radius:0 !important;
  margin:0 !important;
  align-self:stretch !important;
}
#resultsTableBody td,
.seat-table td,
.popup-table tbody td{
  position:relative;
}
#resultsTableBody .party-name-cell,
.seat-table .party-name-cell,
.popup-results-table .party-name-cell,
.popup-results-table .popup-name-cell{
  min-height:100%;
}

.floating-popup{
  width:min(410px, calc(100vw - 44px));
  border-radius:12px;
}
.floating-popup .popup{ padding:12px 12px 10px; }
.floating-popup h3{
  margin:0 0 8px;
  font-size:17px;
  line-height:1.05;
}
.popup-leader-block{
  margin-bottom:8px;
}
.popup-leader-label{
  font-size:10px;
  font-weight:800;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:#5d584f;
  margin-bottom:3px;
}
.popup-leader-value{
  display:flex;
  align-items:stretch;
  gap:8px;
}
.popup-name-stack{ gap:1px; }
.popup-name-stack strong{
  font-size:13px;
  line-height:1.08;
}
.popup-name-stack span{
  font-size:11px;
  line-height:1.08;
}
.popup-ahead{
  font-size:11px;
  line-height:1.05;
  font-weight:800;
  margin-top:2px;
}
.popup-table{ margin-top:8px; font-size:13px; }
.popup-table thead th{ padding:7px 8px; font-size:10px; }
.popup-table tbody td{ padding:8px 8px; }
.popup-results-table .party-line{ margin:0 !important; }
.popup-footer{
  margin-top:8px;
  padding-top:7px;
  border-top:1px solid #dbd6ca;
}
.popup-footer-top,
.popup-footer-bottom{
  font-size:11px;
  line-height:1.2;
  color:#514c44;
}
.popup-footer-top strong{ color:#3d392f; margin-right:4px; }
.popup-footer-bottom{ margin-top:2px; }
.popup-metric-grid,.popup-metric-row,.popup-metric-label,.popup-metric-value,.popup-margin-value{ display:none !important; }

@media (max-width:900px){
  .seats-govern-label{ font-size:9px; top:-16px; }
  .floating-popup{ width:min(320px, calc(100vw - 20px)); }
}


/* === v7 refinements === */
.reporting-progress{ display:block !important; overflow:hidden !important; }
.reporting-progress-bar{ display:block !important; min-width:6px; background:#111 !important; }

.seats-govern-label{ top:-15px !important; transform:translateX(-44%); background:rgba(250,249,245,0.92); padding:0 4px; }

.map-wrap .topbar{ position:absolute !important; top:14px !important; left:14px !important; right:14px !important; z-index:2000 !important; min-height:0; }
.map-wrap #topLeftPanel.compact-panel{
  display:flex !important;
  position:absolute !important;
  top:0 !important; left:0 !important;
  width:236px !important;
  visibility:visible !important; opacity:1 !important;
  pointer-events:auto !important;
}

.floating-popup{ width:min(370px, calc(100vw - 34px)) !important; border-radius:10px !important; }
.floating-popup .popup{ padding:9px 10px 8px !important; }
.floating-popup h3{ margin:0 0 6px !important; font-size:16px !important; }
.popup-leader-block{ margin-bottom:6px !important; }
.popup-leader-label{ margin-bottom:2px !important; font-size:10px !important; }
.popup-name-stack strong{ font-size:12px !important; }
.popup-name-stack span{ font-size:10px !important; }
.popup-ahead{ font-size:10px !important; margin-top:1px !important; }
.popup-table{ margin-top:6px !important; font-size:12px !important; }
.popup-table thead th{ padding:6px 7px !important; }
.popup-table tbody td{ padding:6px 7px !important; }
.popup-results-table .party-line{ width:14px !important; min-width:14px !important; }
.popup-footer{ margin-top:6px !important; padding-top:6px !important; }
.popup-footer-top,.popup-footer-bottom{ font-size:10px !important; line-height:1.15 !important; }
.popup-footer-progress{
  display:inline-block; vertical-align:middle; margin-left:6px; width:64px; height:8px;
  background:#d1ccc1; box-shadow:inset 0 0 0 1px rgba(0,0,0,0.06); overflow:hidden;
}
.popup-footer-progress-bar{ display:block; height:100%; background:#777; min-width:0; }

.poi-label-icon{ gap:4px !important; }
.poi-marker-dot{ width:9px !important; height:9px !important; flex:0 0 9px !important; }
.map-place-label{ font-size:12px !important; }

@media (max-width:900px){
  .map-wrap #topLeftPanel.compact-panel{ display:none !important; }
  .floating-popup{ width:min(310px, calc(100vw - 16px)) !important; }
}


/* === v8 fixes === */
.map-wrap .topbar{
  display:flex !important;
  align-items:flex-start !important;
  justify-content:space-between !important;
  pointer-events:none !important;
}
.map-wrap .topbar > *{ pointer-events:auto !important; }
.map-wrap #topLeftPanel.compact-panel{
  display:flex !important;
  flex-direction:column !important;
  position:absolute !important;
  top:0 !important;
  left:0 !important;
  width:248px !important;
  min-width:248px !important;
  visibility:visible !important;
  opacity:1 !important;
  z-index:2600 !important;
}
.map-wrap .map-quick-views{ z-index:2500 !important; }

.seats-govern-label{
  top:-2px !important;
  transform:translate(-50%, -100%) !important;
  white-space:nowrap !important;
}

.popup-footer-top{
  display:flex !important;
  align-items:center !important;
  gap:6px !important;
}
.popup-footer-progress{
  display:inline-flex !important;
  align-items:center !important;
  width:62px !important;
  height:8px !important;
  border-radius:0 !important;
  background:#bdb7ad !important;
  overflow:hidden !important;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,0.08) !important;
}
.popup-footer-progress-bar{
  display:block !important;
  height:100% !important;
  background:#6f6f6f !important;
}

.floating-popup{ width:min(352px, calc(100vw - 26px)) !important; }
.floating-popup .popup{ padding:8px 9px 7px !important; }
.floating-popup h3{ margin:0 0 5px !important; font-size:15px !important; }
.popup-leader-block{ margin-bottom:5px !important; }
.popup-leader-label{ font-size:9px !important; margin-bottom:1px !important; }
.popup-name-stack strong{ font-size:11px !important; }
.popup-name-stack span{ font-size:9px !important; }
.popup-ahead{ font-size:9px !important; }
.popup-table{ margin-top:5px !important; font-size:11px !important; }
.popup-table thead th{ padding:5px 6px !important; font-size:9px !important; }
.popup-table tbody td{ padding:5px 6px !important; }
.popup-footer{ margin-top:5px !important; padding-top:5px !important; }
.popup-footer-top,.popup-footer-bottom{ font-size:9px !important; }

@media (max-width:900px){
  .map-wrap #topLeftPanel.compact-panel{ display:none !important; }
}


/* === v9 refinements === */
.map-wrap .topbar{display:flex !important;position:absolute !important;top:14px !important;left:14px !important;right:auto !important;justify-content:flex-start !important;gap:12px !important;pointer-events:none !important;z-index:2600 !important;transform:none !important;}
.map-wrap #topLeftPanel.compact-panel{display:flex !important;visibility:visible !important;opacity:1 !important;position:relative !important;left:auto !important;top:auto !important;width:250px !important;z-index:2700 !important;pointer-events:auto !important;}
.map-quick-views{position:absolute !important;top:14px !important;right:14px !important;z-index:2500 !important;display:flex !important;flex-direction:column !important;align-items:stretch !important;gap:8px !important;min-width:184px;}
.map-quick-views-title{font-size:12px;font-weight:800;letter-spacing:.04em;text-align:center;color:#403c35;padding:2px 0 4px;}

.popup, .popup-table th, .popup-table td, .popup-footer-top, .popup-footer-bottom, .popup-name-stack span, .popup-ahead, .popup-leader-label{font-size:12px !important;}
.floating-popup{padding:8px 9px !important;border-radius:10px !important;width:min(440px, calc(100vw - 32px)) !important;}
.floating-popup h3{font-size:18px !important;margin:0 0 5px !important;}
.popup-leader-block{margin-bottom:4px !important;}
.popup-leader-value{gap:8px !important;align-items:flex-start !important;}
.popup-name-stack{gap:0 !important;line-height:1.02 !important;}
.popup-name-stack strong{font-size:12px !important;line-height:1.02 !important;}
.popup-name-stack span{line-height:1.02 !important;}
.popup-ahead{margin-top:1px !important;font-weight:800 !important;}
.popup-table{margin-top:4px !important;font-size:12px !important;}
.popup-table th,.popup-table td{padding:4px 6px !important;}
.popup-table thead th{font-size:12px !important;}
.popup-footer{margin-top:4px !important;padding-top:4px !important;}
.popup-footer-top,.popup-footer-bottom{font-size:12px !important;line-height:1.18 !important;}
.popup-footer-bottom{margin-top:1px !important;}
.popup-footer-progress{display:inline-block !important;vertical-align:middle;width:62px;height:10px;margin-left:8px;background:#d0cbc0;border-radius:0;overflow:hidden;}
.popup-footer-progress-bar{display:block !important;height:100% !important;background:#8f8f8f !important;min-width:0;}
.popup-party-line{width:8px !important;}
.popup-table td:first-child .popup-party-line,.popup-leader-value .popup-party-line{align-self:stretch !important;min-height:100% !important;}
.seat-col-electorate{display:none !important;}
@media (max-width:900px){.map-wrap .topbar,.map-quick-views,#topLeftPanel.compact-panel{display:none !important;}}
/* Ensure electorate list expands naturally */
.table-wrap { flex: none !important; overflow: visible !important; }


/* === v10 tweaks === */
.seat-chart-axis{display:grid;grid-template-columns:repeat(7,1fr);align-items:center;margin-top:4px;font-size:10px;font-weight:700;color:#6a645b;}
.seat-chart-axis span{text-align:center;}
.seats-govern-line{left:50% !important;transform:translateX(-1.5px);}
.seats-govern-label{left:50% !important;transform:translateX(-50%);white-space:nowrap;}
#topLeftPanel, #topLeftPanel.compact-panel{display:flex !important;visibility:visible !important;opacity:1 !important;position:relative !important;z-index:2002 !important;}
.topbar{display:flex !important;visibility:visible !important;opacity:1 !important;z-index:2000 !important;}
.party-name-cell{position:relative;display:flex;align-items:stretch;gap:0;padding-left:18px;}
.party-line{position:absolute;left:0;top:-9px;bottom:-9px;width:10px !important;min-width:10px !important;margin:0 !important;border-radius:0 !important;display:block !important;}
.party-name-cell > span:last-child{display:flex;align-items:center;}
.popup-table td:first-child .party-line,.seat-table td:first-child .party-line,#resultsTableBody td:nth-child(2) .party-line{top:-9px;bottom:-9px;}


/* ===== v11 fixes ===== */

/* Make the central govern line stand out on any party colour */
.seats-govern-line{
  left: 50% !important;
  transform: translateX(-2px) !important;
  width: 4px !important;
  border-left: 0 !important;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.98) 0 4px,
    rgba(17,17,17,0.98) 4px 8px
  ) !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.9),
    0 0 0 2px rgba(17,17,17,0.28) !important;
  opacity: 1 !important;
  z-index: 8 !important;
}

.seats-govern-label{
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 9 !important;
  background: rgba(250,249,245,0.95) !important;
  padding: 0 6px !important;
  border-radius: 4px !important;
  font-weight: 800 !important;
}

/* Anchor the vertical party bars to the row/cell, not the popup */
.popup-leader-value,
.popup-name-cell,
#resultsTableBody td:nth-child(2),
.seat-table td:first-child{
  position: relative !important;
}

.party-line{
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 12px !important;
  min-width: 12px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  display: block !important;
  align-self: auto !important;
}

.popup-leader-value,
.popup-name-cell{
  padding-left: 18px !important;
}

#resultsTableBody td:nth-child(2),
.seat-table td:first-child{
  padding-left: 20px !important;
}

.popup-results-table .party-line,
.popup-leader-value .party-line,
#resultsTableBody .party-line,
.seat-table .party-line{
  top: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
}

/* No coloured outer strip down the side of the popup */
.floating-popup,
#electorateDetailsContent .popup{
  border-left: 1px solid rgba(0,0,0,0.12) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,0.14) !important;
}

/* ===== v12 refinements ===== */
.seats-coalition-chart-wrap{
  position: relative;
  padding-top: 22px !important;
}
.seats-govern-label{
  position: absolute !important;
  top: 0 !important;
  transform: translateX(-50%) !important;
  white-space: nowrap !important;
  z-index: 6 !important;
  background: rgba(244,243,239,0.92) !important;
  padding: 0 6px !important;
  border-radius: 4px !important;
}
.seats-coalition-chart{
  position: relative;
}
.seats-govern-line{
  z-index: 5 !important;
}

.popup-leader-value,
.popup-name-cell{
  gap: 12px !important;
}

.popup-name-cell{
  padding-left: 16px !important;
}

.popup-leader-value{
  padding-left: 12px !important;
}

.popup-name-stack{
  margin-left: 2px !important;
}

.popup-table td:first-child,
.popup-table th:first-child{
  padding-left: 14px !important;
}

.popup-results-table .party-line,
.popup-leader-value .party-line{
  margin-right: 0 !important;
}


/* ===== v29 requested updates ===== */
:root{
  --sidebar-width: 500px;
  --resizer-width: 10px;
}

.app{
  grid-template-columns: var(--sidebar-width) var(--resizer-width) minmax(0, 1fr) !important;
  height: calc(100vh - 50px) !important;
}

.panel{
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0;
}

.sidebar-resizer{
  grid-column: 2;
  grid-row: 1;
  width: var(--resizer-width);
  cursor: col-resize;
  position: relative;
  background: transparent;
}

.sidebar-resizer::before{
  content:'';
  position:absolute;
  top:0;
  bottom:0;
  left:50%;
  width:2px;
  transform:translateX(-50%);
  background:#d9d4c9;
}

.sidebar-resizer:hover::before,
body.is-resizing-sidebar .sidebar-resizer::before{
  background:#9c9689;
}

.map-wrap{
  grid-column: 3 !important;
  grid-row: 1 !important;
  min-width: 0;
}

@media (max-width: 900px){
  .app{
    display:block !important;
    height:auto !important;
  }
  .sidebar-resizer{
    display:none !important;
  }
}

/* revert coalition chart to single stacked bar */
.coalition-bar-wrap{
  margin-top:12px;
  position:relative;
}

.seat-coalition-title{
  margin:0 0 4px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:#3f3a32;
}

.seat-footnote-inline{
  margin:0 0 8px !important;
  font-size:12px !important;
}

.coalition-bar-meta{
  position:relative;
  height:26px;
  margin-bottom:6px;
}

.coalition-bar-govern-label{
  position:absolute;
  top:0;
  transform:translateX(-50%);
  font-size:10px;
  font-weight:800;
  color:#4a453d;
  background:rgba(244,243,239,0.96);
  padding:2px 8px;
  border-radius:6px;
  white-space:nowrap;
  z-index:3;
}

.coalition-bar-total{
  position:absolute;
  right:0;
  top:50%;
  transform:translateY(-50%);
  font-size:18px;
  font-weight:700;
  color:#111;
}

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

.coalition-bar-govern-line{
  position:absolute;
  left:var(--govern-left);
  top:-24px;
  bottom:24px;
  width:0;
  border-left:3px dotted rgba(17,17,17,0.95);
  transform:translateX(-1.5px);
  z-index:2;
  pointer-events:none;
  box-shadow:0 0 0 1px rgba(255,255,255,0.55);
}

.coalition-bar-track{
  display:flex;
  align-items:stretch;
  width:100%;
  height:56px;
}

.coalition-bar-segment{
  border:0;
  border-right:1px solid rgba(255,255,255,0.28);
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  padding:6px 4px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.03em;
  text-transform:uppercase;
  cursor:pointer;
}

.coalition-bar-segment:last-child{
  border-right:0;
}

.coalition-bar-segment span{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.coalition-bar-axis{
  position:relative;
  height:22px;
  margin-top:8px;
  color:#5a554b;
  font-size:11px;
  font-weight:500;
}

.coalition-bar-axis-tick{
  position:absolute;
  top:0;
  transform:translateX(-50%);
  white-space:nowrap;
  line-height:1;
}

.coalition-bar-axis-tick.tick-start{
  transform:translateX(0);
}

.coalition-bar-axis-tick.tick-end{
  transform:translateX(-100%);
}

.total-seats-cell strong{
  font-size:14px !important;
  font-weight:700 !important;
  color:#111 !important;
}

.seat-table tfoot td{
  padding-top:4px !important;
  padding-bottom:2px !important;
  border-bottom:0 !important;
}

.seat-table-total-row td{
  box-shadow:none !important;
}

@media (max-width:900px){
  .coalition-bar-track{
    height:52px;
  }
  .coalition-bar-total{
    font-size:16px;
  }
  .coalition-bar-govern-line{
    top:-22px;
    bottom:22px;
  }
  .coalition-bar-axis{
    font-size:10px;
  }
  .total-seats-cell strong{
    font-size:13px !important;
  }
}


/* ===== v30 single coalition bar + sidebar resize + zoom fix ===== */
.map-side-stack,
.map-side-stack > *,
.map-quick-views,
.map-quick-view-btn,
.reset-zoom-btn {
  pointer-events: auto !important;
}

.map-wrap .topbar {
  pointer-events: none !important;
}

.map-wrap .topbar .map-side-stack {
  pointer-events: auto !important;
}

.coalition-bar-wrap {
  margin-top: 12px;
  position: relative;
}

.coalition-bar-meta {
  position: relative;
  height: 32px;
  margin-bottom: 8px;
}

.coalition-bar-govern-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  color: #4a453d;
  background: rgba(244,243,239,0.96);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 3;
}

.coalition-bar-total {
  position: absolute;
  right: 0;
  top: 2px;
  font-size: 18px;
  font-weight: 800;
  color: #111;
}

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

.coalition-bar-govern-line {
  position: absolute;
  left: var(--govern-left);
  top: -16px;
  bottom: 24px;
  width: 0;
  border-left: 3px dotted rgba(17,17,17,0.95);
  transform: translateX(-1.5px);
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.55);
}

.coalition-bar-track {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 56px;
}

.coalition-bar-segment {
  border: 0;
  border-right: 1px solid rgba(255,255,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
}

.coalition-bar-segment:last-child {
  border-right: 0;
}

.coalition-bar-segment span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coalition-bar-axis {
  position: relative;
  height: 24px;
  margin-top: 8px;
  color: #5a554b;
  font-size: 11px;
  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%); }

.total-seats-cell strong {
  font-size: 13px !important;
  font-weight: 700 !important;
}

.seat-table tfoot td {
  padding-top: 4px !important;
  padding-bottom: 2px !important;
  border-bottom: 0 !important;
}

.seat-table-total-row td {
  box-shadow: none !important;
}

.sidebar-resizer {
  z-index: 50;
}

@media (max-width: 900px) {
  .coalition-bar-track {
    height: 52px;
  }
  .coalition-bar-total {
    font-size: 16px;
  }
  .coalition-bar-govern-line {
    top: -14px;
    bottom: 22px;
  }
  .coalition-bar-axis {
    font-size: 10px;
  }
}


/* ===== v31 requested fixes ===== */
:root{
  --bg: #e9e6df;
  --panel: #f4f1ea;
  --panel-soft: #efebe3;
  --text: #111111;
  --muted: #4f4b44;
  --border: #b9b2a5;
  --border-strong: #8f887a;
  --button: #ebe7dd;
  --button-active: #111111;
  --button-active-text: #ffffff;
}

body,
.app,
#map{
  background: var(--bg);
}

.app-titlebar{
  background: #111111;
  border-bottom: 1px solid #000000;
}
.app-title-kicker,
.app-title-main{
  color: #ffffff;
}

.panel{
  background: #f3f0e8;
  box-shadow: inset -1px 0 0 rgba(0,0,0,0.08);
}

.panel-section,
thead th,
.seat-table th{
  border-bottom-color: #c6bfb2;
}

.sidebar-topbar{
  background: linear-gradient(to bottom, #efebe3 0%, #e7e2d8 100%);
}

.mini-heading,
.panel h2,
.seat-main-heading,
.search-label,
.toggle-label,
.map-card-heading,
.map-control-label,
.map-quick-views-title{
  color: #111111 !important;
}

.mini-big-number,
.live-indicator,
#resultsTableBody td:first-child,
.seat-table td strong,
.coalition-bar-total{
  color: #111111 !important;
}

.reporting-progress,
.popup-footer-progress{
  background: #cfc7ba !important;
}
.reporting-progress-bar,
.popup-footer-progress-bar{
  background: #111111 !important;
}

.clear-search-btn,
.toggle-btn,
.panel-btn,
.map-quick-view-btn,
.reset-zoom-btn,
#topLeftPanel .top-left-select,
.map-toggle-btn{
  background: #f2eee6 !important;
  border-color: rgba(0,0,0,0.2) !important;
  color: #111111 !important;
}

.clear-search-btn:hover,
.toggle-btn:hover,
.panel-btn:hover,
.map-quick-view-btn:hover,
.reset-zoom-btn:hover,
.map-toggle-btn:hover{
  background: #e4dfd5 !important;
  border-color: rgba(0,0,0,0.32) !important;
}

.toggle-btn.active,
.map-toggle-btn.active,
.map-quick-view-btn.active-region{
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.22) !important;
}

#topLeftPanel.compact-panel,
.map-quick-views{
  background: rgba(243,240,232,0.96) !important;
  border: 1px solid rgba(0,0,0,0.16) !important;
  box-shadow: 0 12px 24px rgba(0,0,0,0.16) !important;
}

.map-side-stack{
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2600;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  pointer-events: auto;
}

.map-wrap .topbar{
  left: auto !important;
  right: 14px !important;
  width: auto !important;
  justify-content: flex-end !important;
}

.map-wrap #topLeftPanel.compact-panel{
  width: 150px !important;
  min-width: 80px !important;
}

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

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

.map-toggle-btn{
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px !important;
  font-size: 11px !important;
  text-align: center !important;
  cursor: pointer !important;
}

.map-quick-views{
  position: static !important;
  width: 150px !important;
  min-width: 80px !important;
}

.map-quick-view-btn,
.reset-zoom-btn{
  text-align: center !important;
}

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

.sidebar-resizer{
  position: relative;
  z-index: 400;
  user-select: none;
}

.sidebar-resizer::before{
  width: 3px;
  background: #b7b0a2;
}

.sidebar-resizer:hover::before,
body.is-resizing-sidebar .sidebar-resizer::before{
  background: #111111;
}

.coalition-bar-govern-line{
  left: var(--govern-left) !important;
  top: -18px !important;
  bottom: 24px !important;
  border-left: 3px dotted rgba(17,17,17,0.96) !important;
  transform: translateX(-1.5px) !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.45) !important;
}

.coalition-bar-govern-label{
  left: var(--govern-left) !important;
  transform: translateX(-50%) !important;
  top: 0 !important;
  background: rgba(243,240,232,0.98) !important;
  color: #111111 !important;
}

.coalition-bar-meta{
  height: 30px !important;
}

.coalition-bar-axis{
  color: #3f3b35 !important;
  font-weight: 700 !important;
}

@media (max-width: 900px){
  .map-side-stack,
  .sr-only-controls{
    display: none !important;
  }
}


/* ===== v31 polish fixes ===== */
body.is-resizing-sidebar,
body.is-resizing-sidebar * {
  user-select: none !important;
}

body.is-resizing-sidebar .app {
  transition: none !important;
}

.sidebar-resizer {
  position: relative;
  z-index: 500;
  width: 14px !important;
  margin-left: -2px;
  margin-right: -2px;
  touch-action: none;
}

.sidebar-resizer::after {
  content: '';
  position: absolute;
  inset: 0;
}

.sidebar-resizer::before {
  width: 4px !important;
  border-radius: 999px;
  background: #9b9487 !important;
  transition: background 0.12s ease, transform 0.12s ease;
}

.sidebar-resizer:hover::before,
body.is-resizing-sidebar .sidebar-resizer::before {
  background: #111111 !important;
  transform: translateX(-50%) scaleY(0.98);
}

.coalition-bar-meta {
  height: 34px !important;
}

.coalition-bar-govern-label {
  transform: translate(-50%, -2px) !important;
  padding: 2px 7px !important;
}

.coalition-bar-govern-line {
  top: -14px !important;
  bottom: 23px !important;
}

.coalition-bar-segment[data-party='ACT NEW ZEALAND'] {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10);
}

.popup-ahead[style*='#c89200'],
.popup-ahead[style*='rgb(200, 146, 0)'] {
  color: #9a7100 !important;
}


/* ===== v32 NZ First key matching + govern line alignment ===== */
.coalition-bar-area {
  overflow: visible;
}

.coalition-bar-govern-line {
  left: var(--govern-left) !important;
  transform: translateX(-50%) !important;
  width: 0 !important;
  border-left: 3px dotted rgba(17,17,17,0.98) !important;
  box-shadow: none !important;
}

.coalition-bar-govern-label {
  left: var(--govern-left) !important;
  transform: translate(-50%, -2px) !important;
}

.sidebar-resizer {
  cursor: ew-resize !important;
}

.sidebar-resizer::before {
  transition: background 0.12s ease, transform 0.12s ease, opacity 0.12s ease !important;
  opacity: 0.75;
}

.sidebar-resizer:hover::before,
body.is-resizing-sidebar .sidebar-resizer::before {
  opacity: 1;
  transform: translateX(-50%) scaleY(0.96) !important;
}


/* ===== v33 candidate vote fallback + pixel-perfect govern marker ===== */
.coalition-bar-govern-line {
  left: var(--govern-left-px, var(--govern-left)) !important;
  transform: translateX(-50%) !important;
}

.coalition-bar-govern-label {
  left: var(--govern-left-px, var(--govern-left)) !important;
  transform: translate(-50%, -2px) !important;
}


/* ===== v5 typography + final fixes ===== */
body,
.panel,
.floating-popup,
table,
.seat-table,
.popup-table,
#resultsTableBody td,
#resultsTableBody th,
.seat-summary-row,
.popup-name-stack strong,
.popup-name-stack span,
.app-title-main,
.app-title-kicker {
  font-family: 'Merriweather', serif !important;
}

button,
input,
select,
textarea,
.map-card-heading,
.map-control-label,
.mini-heading,
.search-label,
.toggle-label,
.live-indicator,
.panel h2,
.seat-main-heading,
.coalition-bar-govern-label,
.seat-coalition-title,
.map-quick-views-title,
.map-quick-view-btn,
.reset-zoom-btn,
.clear-search-btn,
.toggle-btn,
.panel-btn,
.app-titlebar {
  font-family: 'Merriweather Sans', sans-serif !important;
}

.floating-popup h3 {
  font-family: 'Merriweather Sans', sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
}

.popup-name-stack strong {
  font-weight: 700 !important;
}

.popup-name-stack span,
.popup-footer-top,
.popup-footer-bottom,
.popup-table th,
.popup-table td,
#resultsTableBody td,
.seat-table td,
.seat-table th {
  font-size: 0.98em;
}

.coalition-bar-area {
  overflow: visible;
}

.coalition-bar-govern-line {
  left: 0;
  transform: translateX(-50%) !important;
}

.coalition-bar-govern-label {
  transform: translateX(-50%) !important;
}


/* ===== v6 typography + polish overrides ===== */
html, body, button, input, select, textarea, table, th, td {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
}

.app-title-kicker,
.app-title-main,
.floating-popup h3,
.popup-table thead th,
.panel h2,
.seat-main-heading,
.seat-coalition-title {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
}

.floating-popup h3 {
  font-size: 19px !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}

.popup-name-stack strong,
#resultsTableBody td:first-child,
.party-name-cell > span:last-child {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
}

.popup-name-stack strong {
  font-weight: 700 !important;
}

.popup-name-stack span,
.popup-ahead,
.popup-footer-top,
.popup-footer-bottom,
.mini-sub,
.seat-footnote,
.coalition-bar-axis {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
}

.popup-table,
.popup-table th,
.popup-table td,
.seat-table,
.seat-table th,
.seat-table td,
#resultsTableBody td,
#resultsTableBody th {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
}

.coalition-bar-govern-line {
  transform: translateX(-50%) !important;
}

.coalition-bar-govern-label {
  transform: translateX(-50%) !important;
}

/* undo the Merriweather overrides from earlier versions */
body, .panel, .floating-popup, .app-titlebar, .table-wrap {
  letter-spacing: 0 !important;
}


/* v7 all-font cleanup */
html, body, button, input, select, textarea, table, th, td, div, span, p, h1, h2, h3, h4, h5, h6, label, strong, em, small {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
  font-style: normal !important;
}

.app-title-kicker, .app-title-main, .mini-heading, .seat-main-heading, .seat-coalition-title, .map-card-heading, .map-control-label, .toggle-label, .search-label, thead th, .seat-table th, .popup-table thead th, .popup-leader-label {
  letter-spacing: 0.02em;
}

.floating-popup h3, .popup-name-stack strong, #resultsTableBody td:first-child, .panel h2 {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
}


/* v8 force Inter everywhere, no serif fallbacks */
*, *::before, *::after {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
  font-style: normal !important;
}


/* v10 hard force Inter everywhere */
html, body, body *, .leaflet-container, .leaflet-container * {
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
  font-style: normal !important;
}


/* v11 final font cleanup */
html, body, body *, button, input, select, textarea, table, th, td, .panel, .panel *, .popup, .popup *, .floating-popup, .floating-popup *, .leaflet-container, .leaflet-container * {

/* Consolidated Table column widths to prevent obstruction and fix gaps */
.popup-results-table-partyvote th:nth-child(1),
.popup-results-table-partyvote td:nth-child(1) {
  width: 65% !important;
  text-align: left !important;
}
.popup-results-table-partyvote th:nth-child(2),
.popup-results-table-partyvote td:nth-child(2) {
  width: 18% !important;
  text-align: right !important;
}
.popup-results-table-partyvote th:nth-child(3),
.popup-results-table-partyvote td:nth-child(3) {
  width: 17% !important;
  text-align: right !important;
}

.popup-candidate-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 18px !important;
}

.popup-candidate-cell .party-line {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 12px !important;
  min-width: 12px !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

.popup-candidate-name {
  display: block;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
  color: #000000;
}

.popup-party-text {
  font-size: 11px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #000000;
}

.popup-results-table tbody td {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
  vertical-align: middle !important;
}

.popup-results-table thead th {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
}

.popup-results-table .winner-row .popup-candidate-name,
.popup-results-table .winner-row .popup-party-text {
  color: #111;
}

@media (max-width: 900px) {
  .popup-results-table-candidate th:nth-child(2),
  .popup-results-table-candidate td:nth-child(2) {
    width: 18%;
    font-size: 10px;
  }

  .popup-candidate-name {
    font-size: 11px;
  }
}

/* ===== compact popup candidate rows ===== */
.popup-results-table-candidate {
  table-layout: fixed !important;
  width: 100% !important;
}

.popup-results-table-candidate th:nth-child(1),
.popup-results-table-candidate td:nth-child(1) {
  width: 46% !important;
}

.popup-results-table-candidate th:nth-child(2),
.popup-results-table-candidate td:nth-child(2) {
  width: 16% !important;
}

.popup-results-table-candidate th:nth-child(3),
.popup-results-table-candidate td:nth-child(3) {
  width: 18% !important;
}

.popup-results-table-candidate th:nth-child(4),
.popup-results-table-candidate td:nth-child(4) {
  width: 20% !important;
}

.popup-results-table-candidate thead th {
  padding: 5px 6px !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

.popup-results-table-candidate tbody td {
  padding: 4px 6px !important;
  line-height: 1.05 !important;
  vertical-align: middle !important;
}

.popup-results-table-candidate .popup-candidate-cell {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}

.popup-results-table-candidate .party-line {
  position: static !important;
  flex: 0 0 8px !important;
  width: 8px !important;
  min-width: 8px !important;
  align-self: stretch !important;
}

.popup-results-table-candidate .popup-candidate-name {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.05 !important;
}

.popup-results-table-candidate .popup-party-text {
  font-size: 11px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

.popup-results-table-candidate .winner-row td {
  font-weight: 700 !important;
}

.floating-popup {
  width: min(460px, calc(100vw - 28px)) !important;
}


/* compact popup table tuning */
.popup-results-table {
  table-layout: fixed !important;
}

.popup-results-table-candidate {
  width: 100% !important;
}

.popup-results-table-candidate th:nth-child(1),
.popup-results-table-candidate td:nth-child(1) {
  width: 34% !important; /* Pulled closer to the name to fix 2cm gap */
}

.popup-results-table-candidate th:nth-child(2),
.popup-results-table-candidate td:nth-child(2) {
  width: 36% !important; /* More room for Party name to prevent obstruction */
  text-align: left !important;
  white-space: nowrap !important;
}

.popup-results-table-candidate th:nth-child(3),
.popup-results-table-candidate td:nth-child(3) {
  width: 15% !important; /* Visible Candidate Votes */
  text-align: right !important;
  white-space: nowrap !important;
}

.popup-results-table-candidate th:nth-child(4),
.popup-results-table-candidate td:nth-child(4) {
  width: 15% !important; /* Visible Percentage */
  text-align: right !important;
  white-space: nowrap !important;
}

.popup-results-table-candidate thead th {
  padding: 5px 4px !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

.popup-results-table-candidate tbody td {
  padding: 3px 8px !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  border-bottom: 1px solid rgba(0,0,0,0.12) !important;
}

.popup-results-table-candidate .popup-candidate-cell {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important; /* Tighter gap to keep names close to their party color bars */
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  padding-left: 0 !important;
}

.popup-results-table-candidate .party-line {
  position: static !important;
  flex: 0 0 10px !important;
  width: 10px !important;
  min-width: 10px !important;
  align-self: stretch !important;
  height: auto !important;
  margin: 0 !important;
}

.popup-results-table-candidate .popup-candidate-name {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

.popup-results-table-candidate .popup-party-text {
  font-size: 11px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  color: #222 !important;
}

.popup-results-table-candidate .winner-row td {
  background-color: rgba(0,0,0,0.02) !important;
}

.popup-results-table-candidate .winner-row .popup-candidate-name,
.popup-results-table-candidate .winner-row .popup-party-text,
.popup-results-table-candidate .winner-row td:nth-child(4) {
  font-weight: 800 !important;
}

.popup-results-table tbody td {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.floating-popup {
  width: min(470px, calc(100vw - 28px)) !important;
}

.poi-marker-dot {
  width: 11px !important;
  height: 11px !important;
  flex: 0 0 11px !important;
  background: #ffffff !important;
  border: 2px solid rgba(20,20,20,0.95) !important;
  box-shadow: 0 1px 5px rgba(0,0,0,0.24) !important;
}

.map-place-label {
  font-size: 13px !important;
  font-weight: 900 !important;
  color: rgba(20,20,20,0.88) !important;
  text-shadow:
    -1px -1px 0 rgba(247,247,245,0.98),
     1px -1px 0 rgba(247,247,245,0.98),
    -1px  1px 0 rgba(247,247,245,0.98),
     1px  1px 0 rgba(247,247,245,0.98),
     0 2px 7px rgba(255,255,255,0.7) !important;
}

@media (max-width: 900px) {
  .popup-results-table-candidate th:nth-child(1),
  .popup-results-table-candidate td:nth-child(1) {
    width: 52% !important;
  }

  .popup-results-table-candidate th:nth-child(2),
  .popup-results-table-candidate td:nth-child(2) {
    width: 16% !important;
  }

  .popup-results-table-candidate th:nth-child(3),
  .popup-results-table-candidate td:nth-child(3) {
    width: 12% !important;
  }

  .popup-results-table-candidate th:nth-child(4),
  .popup-results-table-candidate td:nth-child(4) {
    width: 20% !important;
  }

  .popup-results-table-candidate .popup-candidate-name,
  .popup-results-table-candidate .popup-party-text {
    font-size: 10px !important;
  }
}


/* === popup nyt-style cleanup === */
.floating-popup{
  width: min(440px, calc(100vw - 32px)) !important;
  padding:0 !important;
  border-radius:6px !important;
  background:#fff !important;
  border:1px solid rgba(0,0,0,0.16) !important;
  box-shadow:0 2px 12px rgba(0,0,0,0.20) !important;
}
.floating-popup .popup{
  padding:14px 16px 12px !important;
}
.floating-popup h3{
  font-size:17px !important;
  font-weight:700 !important;
  margin:0 0 6px !important;
  line-height:1.2 !important;
  color:#2b2b2b !important;
}
.popup-leader-block{margin-bottom:8px !important;}
.popup-leader-label{
  font-size:10px !important;
  letter-spacing:.03em !important;
  color:#666 !important;
  margin-bottom:2px !important;
}
.popup-leader-value{padding-left:0 !important;gap:12px !important;align-items:center !important;}
.popup-leader-value .party-line{position:static !important; width:6px !important; min-width:6px !important; height:48px !important;}
.popup-name-stack strong{font-size:12px !important; font-weight:700 !important; line-height:1.08 !important;}
.popup-name-stack span{font-size:10px !important; line-height:1.08 !important; color:#666 !important;}
.popup-ahead{font-size:10px !important; margin-top:2px !important;}

.popup-results-table{
  width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
  margin-top:6px !important;
  font-size:12px !important;
}
.popup-results-table thead th{
  background:#fff !important;
  color:#2c2c2c !important;
  font-size:11px !important;
  font-weight:800 !important;
  text-transform:none !important;
  letter-spacing:0 !important;
  padding:0 8px 6px !important;
  border-bottom:1px solid #d9d9d9 !important;
}
.popup-results-table tbody td{
  vertical-align:right !important;
  color:#333 !important;
  background-color:transparent !important;
}
.popup-results-table-partyvote th:nth-child(1),
.popup-results-table-partyvote td:nth-child(1){width:64% !important; text-align:left !important;}

.popup-results-table-partyvote th:nth-child(2),
.popup-results-table-partyvote td:nth-child(2){width:20% !important; text-align:right !important;}

.popup-results-table-partyvote th:nth-child(3),
.popup-results-table-partyvote td:nth-child(3){width:16% !important; text-align:right !important;}

.popup-results-table .popup-candidate-cell{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  min-width:0 !important;
}
.popup-results-table .popup-candidate-cell .party-line{
  position:static !important;
  width:8px !important;
  margin:0 !important;
  border-radius:0 !important;
}
.popup-results-table .popup-candidate-name{
  display:block !important;
  flex:1 1 auto !important;
  min-width:0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
}
.popup-results-table .popup-party-text{
  font-size:12px !important;
  font-weight:400 !important;
  color:#222 !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}
.popup-results-table .winner-row td:last-child,
.popup-results-table .winner-row td:nth-last-child(2){
  font-weight:700 !important;
  color:#222 !important;
}
.popup-results-table .winner-row td{ background-color:transparent !important; }

.popup-footer{
  margin-top:4px !important;
  padding-top:2px !important;
}
.popup-footer-top, .popup-footer-bottom{
  font-size:11px !important;
  color:#666 !important;
  line-height:1.2 !important;
}
.popup-footer-top strong, .popup-footer-bottom strong{color:#444 !important;}
.popup-footer-progress{
  width:78px !important;
  height:10px !important;
  background:#ddd !important;
  border-radius:0 !important;
  margin-left: 1px !important;
}
.popup-footer-progress-bar{background:#111 !important;}


.popup-results-table-candidate td:nth-child(2),
.popup-results-table-candidate th:nth-child(2){
  text-align:right !important;
}

/* Global popup name obstruction and overlap fix */
.floating-popup .party-name-cell,
.floating-popup .popup-candidate-cell,
.floating-popup .popup-name-cell,
.popup-results-table td:first-child {
  display: flex !important;
  gap: 6px !important; /* Consistently tight gap across all popup rows */
  padding-left: 0 !important;
  align-items: center !important;
}
.floating-popup .party-line,
.popup-results-table .party-line {
  position: static !important;
  flex: 0 0 8px !important;
  width: 8px !important;
  margin: 0 !important;
  height: 24px !important;
}

/* ===== v34 Professional Polish & Layout Alignment ===== */

/* 1. Eliminate the "2cm Gap" and Obstructions in Popups */
.popup-results-table,
.popup-results-table-candidate,
.popup-results-table-partyvote {
  table-layout: auto !important; /* Core fix: allows columns to sit next to each other based on content length */
  width: 100% !important;
  border-collapse: collapse !important;
}

.popup-results-table th,
.popup-results-table td {
  width: auto !important;
  padding: 6px 10px !important;
  white-space: nowrap !important; /* Prevents wrapping as requested */
  vertical-align: middle !important;
  overflow: visible !important;
}

/* 2. Greedy Candidate Name Column: Pushes Party column closer */
.popup-results-table-candidate td:first-child {
  width: 50% !important; 
  padding-right: 4px !important;
}

.popup-results-table-candidate td:nth-child(2) {
  padding-left: 4px !important; /* Party name sits almost touching the candidate name */
}

/* 3. Protection: Truncate with ellipsis if name is excessively long, instead of wrapping */
.popup-candidate-name {
  display: block !important;
  max-width: 190px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.popup-party-text {
  display: block !important;
  max-width: 120px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* 4. Ensure long party names in Party Vote view are not obstructed */
.popup-results-table-partyvote td:first-child .popup-party-text {
  max-width: 280px !important;
  overflow: visible !important;
}
}

/* ===== mobile layout fix ===== */
@media (max-width: 900px) {
  .panel {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .panel-section {
    padding: 12px 12px !important;
  }

  .sidebar-topbar-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .mini-big-number {
    font-size: 18px !important;
  }

  .mini-sub {
    font-size: 11px !important;
    line-height: 1.2 !important;
  }

  .seat-table,
  table {
    table-layout: fixed !important;
    width: 100% !important;
  }

  thead th,
  th,
  td {
    padding: 6px 6px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  /* PARTY VOTE & SEATS table */
  .seat-table th:nth-child(1),
  .seat-table td:nth-child(1) {
    width: 58% !important;
    white-space: normal !important;
    word-break: keep-all !important;
  }

  .seat-table th:nth-child(2),
  .seat-table td:nth-child(2) {
    width: 24% !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  .seat-table th:nth-child(3),
  .seat-table td:nth-child(3) {
    width: 18% !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  /* keep party labels readable */
  .party-name-cell {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding-left: 0 !important;
  }

  .party-line {
    position: static !important;
    flex: 0 0 8px !important;
    width: 8px !important;
    min-width: 8px !important;
    height: auto !important;
    align-self: stretch !important;
    margin: 0 !important;
  }

  .party-name-cell > span:last-child {
    display: block !important;
    min-width: 0 !important;
    white-space: normal !important;
    line-height: 1.15 !important;
  }

  /* coalition chart */
  .coalition-bar-track {
    height: 44px !important;
  }

  .coalition-bar-segment {
    font-size: 9px !important;
    padding: 4px 2px !important;
  }

  .coalition-bar-total {
    font-size: 14px !important;
  }

  .coalition-bar-axis {
    font-size: 9px !important;
    margin-top: 6px !important;
    height: 18px !important;
  }

  .coalition-bar-govern-label {
    font-size: 9px !important;
    padding: 1px 6px !important;
  }

  /* search + electorate table */
  .search-input {
    font-size: 12px !important;
    padding: 9px 10px !important;
  }

  #resultsTableBody td,
  #resultsTableBody th {
    font-size: 11px !important;
  }
}
/* ===== FORCE SINGLE LINE (NO WRAP) ===== */
.seat-table td,
.seat-table th {
  white-space: nowrap !important;
}

/* party name cell */
.party-name-cell {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
}

/* actual text inside party cell */
.party-name-cell span:last-child {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}



/* Dataset toggle polish */
#topLeftPanel .map-toggle-bar {
  flex-wrap: wrap;
}

#year2023Btn,
#yearTestBtn {
  min-width: 72px;
}

.app-title-kicker {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ===== loading overlay + mobile year toggle + seat total summary ===== */
.loading-overlay{position:fixed;inset:0;background:rgba(20,18,15,.28);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s ease,visibility .18s ease;z-index:5000;}
.loading-overlay.visible{opacity:1;visibility:visible;pointer-events:auto;}
.loading-overlay-card{min-width:220px;max-width:90vw;background:#f4f1ea;border:1px solid #cfc8ba;border-radius:16px;box-shadow:0 18px 40px rgba(0,0,0,.18);padding:18px 18px 16px;text-align:center;}
.loading-overlay-spinner{width:28px;height:28px;margin:0 auto 10px;border:3px solid #d7d0c2;border-top-color:#111;border-radius:50%;animation:rdSpin .8s linear infinite;}
.loading-overlay-title{font-weight:800;font-size:18px;line-height:1.1;color:#1f1c17;}
.loading-overlay-sub{margin-top:6px;font-size:13px;line-height:1.35;color:#5a544a;}
@keyframes rdSpin{to{transform:rotate(360deg);}}
.mobile-only-section{display:none;}
.seat-total-summary{font-size:14px;font-weight:800;color:#2b2721;margin:0 0 10px 0;}
@media (max-width:900px){
  .mobile-only-section{display:block;}
  #mobileYearSection{padding-top:12px;padding-bottom:12px;}
  .seat-total-summary{font-size:15px;margin-bottom:8px;}
}
