/* ==========================================================
   Monitor de Combustíveis MT - Clean & Professional Design
   Estilo corporativo, veloz e otimizado (Sem cara de IA genérica)
   ========================================================== */

:root {
    /* Dark Palette (Default) */
    --bg-app: #090d16;
    --bg-card: #0f172a;
    --bg-card-hover: #162036;
    --bg-subtle: #1e293b;
    --bg-input: #0b1120;
    
    --border-subtle: #1e293b;
    --border-strong: #334155;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;

    /* Combustíveis - Cores precisas */
    --color-etanol: #10b981;
    --color-gasolina: #f59e0b;
    --color-aditivada: #ec4899;
    --color-diesel: #0ea5e9;
    --color-s500: #8b5cf6;

    --status-green: #10b981;
    --status-red: #ef4444;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
    --bg-app: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-subtle: #e2e8f0;
    --bg-input: #ffffff;

    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-faint: #94a3b8;

    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
}

/* Reset Básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.45;
    font-size: 0.9rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================
   Header & Navbar
   ========================================================== */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-logo {
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
}

.brand-info h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
    line-height: 1.1;
}

.brand-info h1 strong {
    color: var(--color-etanol);
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-subtle);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-green);
}

.user-session {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-subtle);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--text-main);
    font-weight: 500;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: color 0.15s ease;
}

.btn-ghost:hover {
    color: var(--status-red);
}

.btn-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.btn-icon:hover {
    border-color: var(--border-strong);
}

/* ==========================================================
   Main Content Layout
   ========================================================== */
.app-main {
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ==========================================================
   Auth Gate (Clean & Solid)
   ========================================================== */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 180px);
    padding: 1.5rem;
}

.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-header {
    text-align: center;
}

.auth-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-subtle);
    color: var(--accent-blue);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.auth-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.auth-header p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Abas de Autenticação */
.auth-tabs {
    display: flex;
    background: var(--bg-subtle);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    gap: 0.25rem;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--accent-blue);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.btn-google-auth {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.15s ease;
}

.btn-google-auth:hover {
    background: #f8fafc;
}

.btn-google-auth i {
    color: #ea4335;
}

/* Botão de Admin Badge no Header */
.btn-admin-badge {
    background: rgba(37, 99, 235, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(37, 99, 235, 0.3);
    font-size: 0.76rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-admin-badge:hover {
    background: rgba(37, 99, 235, 0.25);
}

/* Modal de Aprovação de Usuários */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 1rem 1.25rem;
    max-height: 60vh;
    overflow-y: auto;
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-item-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.user-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-item-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-item-email {
    font-size: 0.78rem;
    color: var(--text-muted);
}

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

.btn-approve {
    background: #059669;
    color: #ffffff;
    border: none;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-approve:hover {
    background: #047857;
}

.btn-reject {
    background: #dc2626;
    color: #ffffff;
    border: none;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-reject:hover {
    background: #b91c1c;
}

.auth-sep {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.75rem;
}

.auth-sep::before,
.auth-sep::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.auth-sep span {
    padding: 0 0.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.input-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent-blue);
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    width: 100%;
    padding-right: 2.25rem;
}

.btn-pwd {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-action {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background 0.15s ease;
}

.btn-action:hover {
    background: var(--accent-blue-hover);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.loader {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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

.auth-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--status-red);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.auth-footer {
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.85rem;
    text-align: center;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 0.75rem;
    cursor: pointer;
}

.btn-link:hover {
    color: var(--text-muted);
}

.config-panel {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    text-align: left;
}

/* ==========================================================
   KPI Summary Bar
   ========================================================== */
.kpi-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-tag {
    font-size: 0.68rem;
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.kpi-val {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.kpi-sub {
    font-size: 0.74rem;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card de Paridade */
.kpi-parity {
    border-color: rgba(37, 99, 235, 0.4);
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(37, 99, 235, 0.04) 100%);
}

.parity-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--accent-blue);
    color: #ffffff;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
}

.parity-row {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}

.parity-verdict {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
}

.verdict-etanol {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-etanol);
}

.verdict-gasolina {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-gasolina);
}

/* ==========================================================
   Control Filters Bar
   ========================================================== */
.controls-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.fuel-selector {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.filter-chip {
    background: var(--bg-subtle);
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-chip:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
}

.filter-chip.active {
    background: var(--text-main);
    color: var(--bg-app);
    font-weight: 700;
}

.filter-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field i {
    position: absolute;
    left: 0.65rem;
    color: var(--text-faint);
    font-size: 0.8rem;
}

.search-field input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.4rem 1.8rem 0.4rem 1.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    width: 210px;
    outline: none;
}

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

.btn-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 0.75rem;
}

.select-field select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
}

.btn-icon-square {
    width: 32px;
    height: 32px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-square:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
}

/* ==========================================================
   Map Section: Destaque de Mato Grosso
   ========================================================== */
.map-container-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.map-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.map-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-header-title h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.map-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
}

.map-header-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Seletor de Modo: Postos vs Mapa de Calor */
.map-mode-toggle {
    display: inline-flex;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.btn-map-mode {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.28rem 0.65rem;
    border-radius: calc(var(--radius-sm) - 2px);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.18s ease;
}

.btn-map-mode:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-map-mode.active {
    background: var(--accent-blue);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.35);
}

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

/* Legenda do Mapa de Calor */
.map-legend-heat {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-subtle);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    font-size: 0.72rem;
}

.heat-legend-title {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
}

.heat-bar-label {
    font-weight: 700;
    font-size: 0.72rem;
}

.heat-bar-label.min-label {
    color: #10b981;
}

.heat-bar-label.max-label {
    color: #ef4444;
}

.heat-bar-gradient {
    width: 90px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #10b981, #0ea5e9, #eab308, #f97316, #ef4444);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.leg-pill {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.leg-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.leg-green .dot { background: #10b981; }
.leg-blue .dot { background: #0ea5e9; }
.leg-red .dot { background: #ef4444; }

.btn-sm-action {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-sm-action:hover {
    border-color: var(--border-strong);
}

.map-view-wrapper {
    width: 100%;
    height: 480px;
    position: relative;
}

.leaflet-map-canvas {
    width: 100%;
    height: 100%;
    background: #0b0f19;
}

/* Custom Marker Pins: Clean Price Tag */
.price-marker-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #ffffff;
    border: 1.5px solid #334155;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.price-marker-tag:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
}

.tag-cheapest {
    background: #064e3b;
    border-color: #10b981;
    color: #6ee7b7;
}

.tag-medium {
    background: #0c4a6e;
    border-color: #0ea5e9;
    color: #7dd3fc;
}

.tag-expensive {
    background: #7f1d1d;
    border-color: #ef4444;
    color: #fca5a5;
}

/* City Heatmap Badges & Markers */
.city-heat-badge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.city-heat-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(4px);
    border: 1.5px solid #3b82f6;
    border-radius: 8px;
    padding: 0.25rem 0.55rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
    white-space: nowrap;
}

.city-heat-pill:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    z-index: 9999 !important;
}

.city-heat-pill .pill-city-name {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #cbd5e1;
    text-transform: uppercase;
    line-height: 1.1;
}

.city-heat-pill .pill-city-price {
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 1px;
}

.city-heat-pill .pill-city-count {
    font-size: 0.62rem;
    color: #94a3b8;
    line-height: 1;
    margin-top: 1px;
}

.city-heat-pill.pill-cool {
    border-color: #10b981;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}
.city-heat-pill.pill-cool .pill-city-price {
    color: #34d399;
}

.city-heat-pill.pill-mild {
    border-color: #0ea5e9;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.25);
}
.city-heat-pill.pill-mild .pill-city-price {
    color: #38bdf8;
}

.city-heat-pill.pill-warm {
    border-color: #f59e0b;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}
.city-heat-pill.pill-warm .pill-city-price {
    color: #fbbf24;
}

.city-heat-pill.pill-hot {
    border-color: #ef4444;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}
.city-heat-pill.pill-hot .pill-city-price {
    color: #f87171;
}

/* Badge de variação no popup */
.city-variation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.city-variation-cheaper {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.city-variation-expensive {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.city-variation-neutral {
    background: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

/* Subregions Choropleth Tooltips & Hover Cards */
.leaflet-tooltip.subregion-custom-tooltip {
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid #334155 !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55) !important;
    color: var(--text-main) !important;
    padding: 0.55rem 0.75rem !important;
    font-family: var(--font) !important;
    pointer-events: none !important;
}

.leaflet-tooltip.subregion-custom-tooltip::before {
    border-top-color: rgba(15, 23, 42, 0.96) !important;
}

.subregion-hover-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 180px;
}

.subregion-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.subregion-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.subregion-type {
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.subregion-price-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #38bdf8;
    line-height: 1.2;
}

.subregion-unit {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
}

.subregion-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.25rem;
    margin-top: 0.2rem;
}

.subregion-ref-row {
    font-size: 0.68rem;
    color: var(--text-faint);
    margin-top: 0.15rem;
}

/* Leaflet Popups */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3) !important;
    padding: 0.1rem !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-strong) !important;
}

.popup-content {
    padding: 0.4rem;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.popup-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
}

.popup-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-etanol);
}

.popup-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.popup-route {
    margin-top: 0.25rem;
    background: var(--accent-blue);
    color: #ffffff !important;
    text-decoration: none;
    text-align: center;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    display: block;
}

/* ==========================================================
   Analytics Grid
   ========================================================== */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.chart-span-2 {
    grid-column: 1 / -1;
}

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

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-head h3 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.chart-period-selector {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-subtle);
    padding: 0.2rem;
    border-radius: var(--radius-sm);
}

.period-chip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-chip:hover {
    color: var(--text-main);
}

.period-chip.active {
    background: var(--bg-card);
    color: var(--accent-blue);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.chart-box {
    position: relative;
    height: 250px;
    width: 100%;
}

/* ==========================================================
   Table Section
   ========================================================== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-head-bar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-head-bar h3 {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-total {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.clean-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.clean-table th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.clean-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    vertical-align: middle;
}

.clean-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.tag-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.fuel-etanol { background: rgba(16, 185, 129, 0.15); color: var(--color-etanol); }
.fuel-gasolina-comum { background: rgba(245, 158, 11, 0.15); color: var(--color-gasolina); }
.fuel-gasolina-aditivada { background: rgba(236, 72, 153, 0.15); color: var(--color-aditivada); }
.fuel-diesel-s10 { background: rgba(14, 165, 233, 0.15); color: var(--color-diesel); }
.fuel-diesel-s500 { background: rgba(139, 92, 246, 0.15); color: var(--color-s500); }

.price-num {
    font-weight: 700;
    font-size: 0.95rem;
}

.btn-table-route {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-table-route:hover {
    text-decoration: underline;
}

.table-footer-bar {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pagination-btns {
    display: flex;
    gap: 0.25rem;
}

.p-btn {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    min-width: 28px;
    height: 28px;
    padding: 0 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.p-btn.active {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
}

.p-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 0.85rem 1.25rem;
    margin-top: 1.5rem;
    background: var(--bg-card);
}

.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-faint);
}

@media (max-width: 640px) {
    .header-container, .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .map-view-wrapper {
        height: 340px;
    }
}
