:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-hover: rgba(26, 38, 64, 0.9);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(255, 255, 255, 0.25);
  
  --lula-red: #e53935;
  --lula-red-dark: #b71c1c;
  --lula-glow: rgba(229, 57, 53, 0.35);
  --lula-bg: rgba(229, 57, 53, 0.12);
  
  --bolsonaro-blue: #1e88e5;
  --bolsonaro-blue-dark: #0d47a1;
  --bolsonaro-glow: rgba(30, 136, 229, 0.35);
  --bolsonaro-bg: rgba(30, 136, 229, 0.12);

  --accent-gold: #ffb300;
  --accent-green: #00e676;
  --accent-orange: #f97316;
  --accent-slate: #94a3b8;
  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(229, 57, 53, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(30, 136, 229, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 60%);
  min-height: 100vh;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-badge {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-group h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-group p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Controls / Turno Selector */
.controls-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.turno-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
}

.turno-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.45rem 1.15rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.turno-btn:hover {
  color: var(--text-primary);
}

.turno-btn.active {
  background: var(--bg-card-hover);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-focus);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 2.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.5);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: #ffffff;
  border-bottom-color: var(--bolsonaro-blue);
}

/* Main Container */
main {
  padding: 2rem 2.5rem;
  max-width: 1750px;
  margin: 0 auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.kpi-card.lula {
  border-left: 4px solid var(--lula-red);
}

.kpi-card.bolsonaro {
  border-left: 4px solid var(--bolsonaro-blue);
}

.kpi-card.branco {
  border-left: 4px solid var(--accent-slate);
}

.kpi-card.nulo {
  border-left: 4px solid var(--accent-orange);
}

.kpi-card.neutral {
  border-left: 4px solid var(--accent-gold);
}

.kpi-title {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0.35rem 0 0.15rem 0;
  letter-spacing: -0.02em;
}

.kpi-card.lula .kpi-value {
  color: #ff5252;
}

.kpi-card.bolsonaro .kpi-value {
  color: #448aff;
}

.kpi-card.branco .kpi-value {
  color: #cbd5e1;
}

.kpi-card.nulo .kpi-value {
  color: #fb923c;
}

.kpi-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  margin-top: 0.65rem;
  overflow: hidden;
  display: flex;
}

.progress-bar-fill.lula {
  background: var(--lula-red);
}

.progress-bar-fill.bolsonaro {
  background: var(--bolsonaro-blue);
}

.progress-bar-fill.branco {
  background: var(--accent-slate);
}

.progress-bar-fill.nulo {
  background: var(--accent-orange);
}

/* Candidatos do 1º Turno (Todos os Candidatos com Cores Diferentes) */
.candidatos-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.75rem;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.candidatos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.candidatos-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.candidatos-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  color: #f0f4f8;
}

.candidatos-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.candidatos-title-group p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.candidatos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.cand-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cand-card:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
}

.cand-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.cand-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.cand-rank {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.cand-name {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.cand-party {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.cand-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.cand-votes {
  font-size: 1.15rem;
  font-weight: 800;
}

.cand-pct {
  font-size: 0.85rem;
  font-weight: 700;
}

.cand-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.cand-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Map & Drill-Down Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.map-container {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.map-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.lula { background: var(--lula-red); box-shadow: 0 0 8px var(--lula-glow); }
.legend-dot.bolsonaro { background: var(--bolsonaro-blue); box-shadow: 0 0 8px var(--bolsonaro-glow); }
.legend-dot.branco { background: var(--accent-slate); }
.legend-dot.nulo { background: var(--accent-orange); }

/* Leaflet Map Styles */
#leaflet-map {
  height: 620px;
  width: 100%;
  border-radius: var(--radius-md);
  background: #070a12;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.9);
}

.btn-voltar-brasil {
  position: absolute;
  top: 16px;
  left: 65px;
  z-index: 1000;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.btn-voltar-brasil:hover {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: #ffd700;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
}

/* Leaflet Dark UI Overrides */
.leaflet-bar {
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: rgba(18, 26, 43, 0.95) !important;
  color: #f0f4f8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-bar a:hover {
  background-color: rgba(30, 41, 69, 1) !important;
  color: #ffd700 !important;
}

.leaflet-container {
  font-family: var(--font-family) !important;
  cursor: default;
}

.leaflet-interactive {
  cursor: pointer;
  outline: none !important;
  transition: fill 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease;
}

.leaflet-custom-tooltip {
  background: rgba(11, 15, 25, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #f0f4f8 !important;
  font-family: var(--font-family) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
  padding: 10px 14px !important;
  font-size: 0.85rem !important;
  line-height: 1.45 !important;
  pointer-events: none !important;
  user-select: none !important;
  max-width: 390px !important;
  white-space: normal !important;
}

.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
  border-color: rgba(11, 15, 25, 0.96) !important;
}

/* Detail & Drill-down Panel */
.drill-panel {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 620px;
}

.drill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.drill-title-area h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.drill-title-area p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Search and Filters */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--bolsonaro-blue);
}

.filter-select {
  background: rgba(18, 26, 43, 0.9);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* City / Zone List */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 470px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.items-list::-webkit-scrollbar {
  width: 6px;
}
.items-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.item-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.item-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
  transform: translateX(3px);
}

.item-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.winner-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
}

.winner-badge.lula {
  background: var(--lula-red);
}

.winner-badge.bolsonaro {
  background: var(--bolsonaro-blue);
}

.item-info-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.item-info-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.item-stats {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.item-pct {
  font-weight: 700;
  font-size: 1rem;
}

.item-pct.lula { color: #ff5252; }
.item-pct.bolsonaro { color: #448aff; }

.item-delta {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.item-delta.positive {
  background: rgba(0, 230, 118, 0.15);
  color: var(--accent-green);
}

.item-delta.negative {
  background: rgba(229, 57, 53, 0.15);
  color: #ff5252;
}

/* Tables */
.data-table-wrap {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

table.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Favorite Star & Pinned Rows */
.btn-star {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: transform 0.15s ease, filter 0.2s ease;
  filter: grayscale(0.9) opacity(0.4);
}

.btn-star:hover {
  filter: grayscale(0) opacity(1);
  transform: scale(1.3);
}

.btn-star.active {
  filter: grayscale(0) opacity(1);
  transform: scale(1.2);
  text-shadow: 0 0 12px rgba(255, 179, 0, 0.9);
}

table.data-table tr.row-favorite td {
  background: rgba(255, 179, 0, 0.07) !important;
  border-top: 1px solid rgba(255, 179, 0, 0.25) !important;
  border-bottom: 1px solid rgba(255, 179, 0, 0.25) !important;
}

table.data-table tr.row-favorite td:first-child {
  border-left: 3px solid #ffb300 !important;
}

.badge-favorite {
  background: rgba(255, 179, 0, 0.18);
  color: #ffd54f;
  border: 1px solid rgba(255, 179, 0, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-load-more {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem 1.6rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-load-more:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

/* Modal for Zones */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

/* Badge tags */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-red {
  background: var(--lula-bg);
  color: #ff5252;
  border: 1px solid rgba(229, 57, 53, 0.3);
}

.tag-blue {
  background: var(--bolsonaro-bg);
  color: #448aff;
  border: 1px solid rgba(30, 136, 229, 0.3);
}

.tag-branco {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.tag-nulo {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.tag-gold {
  background: rgba(255, 179, 0, 0.15);
  color: #ffb300;
  border: 1px solid rgba(255, 179, 0, 0.3);
}

.tag-green {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

/* Population & Voter Turnout Cards */
.pop-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pop-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.pop-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.pop-card-uf-badge {
  font-size: 1.1rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.pop-turnos-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pop-turno-box {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Map Quick Search & Autocomplete */
.map-search-bar-wrap {
  position: relative;
  margin-bottom: 0.85rem;
  z-index: 500;
}

.map-search-input-box {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
  gap: 0.65rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
}

.map-search-input-box:focus-within {
  border-color: #ffd700;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.6);
}

.map-search-icon {
  font-size: 1.05rem;
  opacity: 0.85;
}

.map-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
}

.map-search-input::placeholder {
  color: #94a3b8;
}

.map-search-clear {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.map-search-clear:hover {
  color: #fff;
}

.map-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: var(--radius-md);
  max-height: 380px;
  overflow-y: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
  z-index: 1000;
}

.map-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.15s ease;
}

.map-search-item:hover, .map-search-item.highlighted {
  background: rgba(255, 215, 0, 0.12);
}

.map-search-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-search-item-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Floating City Focus Banner */
.city-focus-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  border: 1.5px solid #ffd700;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75), 0 0 18px rgba(255, 215, 0, 0.25);
  z-index: 800;
  max-width: 90%;
  animation: bannerSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.city-focus-title {
  font-weight: 800;
  font-size: 1rem;
  color: #ffd700;
}

.city-focus-desc {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.city-focus-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-focus-action {
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-focus-action.primary {
  background: #ffd700;
  color: #0b1120;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-focus-action.primary:hover {
  background: #ffea75;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn-focus-action.close {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.5rem 0.75rem;
}

.btn-focus-action.close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Upgraded Sections Modal */
.modal-card.modal-large {
  max-width: 1280px;
  width: 95vw;
  max-height: 90vh;
}

.modal-kpi-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-color);
}

.modal-kpi-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.modal-kpi-item-title {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.modal-kpi-item-val {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 2px;
}

.modal-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  flex-wrap: wrap;
}

.modal-tabs {
  display: flex;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.modal-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-tab-btn:hover {
  color: #fff;
}

.modal-tab-btn.active {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.modal-search-box {
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

/* Sections Table Enhancements */
.secoes-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.badge-virada {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid #ffd700;
  color: #ffd700;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  animation: pulseGold 2s infinite ease-in-out;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

.badge-zero-urna {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Action buttons on sidebar city cards */
.item-actions-group {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.btn-card-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #ffd700;
  color: #ffd700;
}

.btn-card-action.primary {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}

.btn-card-action.primary:hover {
  background: rgba(59, 130, 246, 0.4);
  color: #fff;
}

/* Loading Spinner */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: #ffd700;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
