/* =========================================
   ImobiTech — Dashboard Styles (UX Redesign)
   Map-first fullscreen layout
   ========================================= */

:root {
    --primary: #2563EB;
    --navy: #1E3A5F;
    --text: #111827;
    --text-muted: #6B7280;
    --text-subtle: #9CA3AF;
    --surface: #F8FAFC;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --card-radius: 16px;
    --pill-radius: 50px;
    --chip-radius: 10px;
    --blur: blur(14px);
    --card-bg: rgba(255,255,255,0.97);
    --overlay: rgba(15,23,42,0.52);
    --nav-height: 58px;
    /* Legacy aliases */
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-amber: #f59e0b;
    --bg-card: #ffffff;
    --bg-dark: #f8fafc;
    --bg-input: #f1f5f9;
    --bg-card-hover: #f1f5f9;
    --border: #e2e8f0;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #e8ecf1;
    color: var(--text);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* =========================================
   MAP — fullscreen
   ========================================= */
#map {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100vw;
    height: 100vh;
    background: #e8ecf1;
    /* Issue #55: Leaflet gerencia pan + pinch-zoom internamente.
       'touch-action: none' deixa o Leaflet receber TODOS os gestos. */
    touch-action: none;
}

/* Issue #55: containers fixos da UI não devem receber gestos de zoom de página
   (em mobile o pinch-zoom afetava menus + DC + legend junto com o mapa).
   'touch-action: manipulation' permite tap/scroll mas bloqueia double-tap zoom
   e pinch-zoom da página dentro desses elementos. Combinado com
   'user-scalable=no' no viewport meta. */
#bottom-nav,
#sidebar,
#district-card,
#legend-card,
#map-controls,
#search-pill,
#dc-fab,
#nav-fab,
.bn-center,
.bn-right,
.bn-left {
    touch-action: manipulation;
}

/* Mute basemap */
.basemap-muted {
    filter: saturate(0.3) brightness(1.05);
}

/* =========================================
   DYNAMIC DISTRICT LABELS (Reventure-style)
   ========================================= */
.nv-district-label {
    pointer-events: none !important;
    background: none !important;
    border: none !important;
    width: 0 !important;      /* zero-size wrapper — span is positioned via transform */
    height: 0 !important;
    white-space: nowrap;
    transition: opacity 0.25s ease-out;
}
.nv-district-label span {
    display: inline-block;
    position: absolute;
    left: 0; top: 0;
    transform: translate(-50%, -50%);  /* centers span on the lat/lng anchor */
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    text-align: center;
    max-width: 140px;
    text-shadow:
        -1px -1px 3px rgba(255,255,255,0.95),
         1px -1px 3px rgba(255,255,255,0.95),
        -1px  1px 3px rgba(255,255,255,0.95),
         1px  1px 3px rgba(255,255,255,0.95),
         0 0 6px rgba(255,255,255,0.8);
    opacity: 0.85;
    user-select: none;
}
/* Scale label size with zoom — near (11-13): compact; mid (14-15): default; far (16+): large */
.leaflet-container[data-zoom-level="near-zoom"] .nv-district-label span {
    font-size: 10px;
    opacity: 0.75;
}
.leaflet-container[data-zoom-level="mid-zoom"] .nv-district-label span {
    font-size: 12px;
    opacity: 0.88;
}
.leaflet-container[data-zoom-level="far-zoom"] .nv-district-label span {
    font-size: 13px;
    opacity: 0.92;
    letter-spacing: 0.04em;
}
.leaflet-container.nv-labels-hidden .nv-district-label {
    opacity: 0;
}

/* Issue #212 commit 2 (2026-05-15) + fix scale-blocked: destaque visual da
   label no HOVER do polígono (substitui tooltip rico choropleth deletado).

   ⚠️ Limitação descoberta empiricamente via Chrome MCP smoke prod:
   Span dentro de .leaflet-marker-icon dentro de .leaflet-labels-pane tem
   `transform` e `font-size` computed STUCK pelo cascade do leaflet
   (motivo exato não isolado — comportamento Leaflet/CSSOM idiossincrático
   em pane com transform: translate3d ancestral).

   Workaround: usar APENAS propriedades que ESTÃO confirmadas funcionando
   (color, font-weight, opacity, text-shadow, outline). Sem scale/font-size,
   o destaque visual usa contraste forte (cor azul FT + halo branco amplo
   + bold) suficiente para destacar a label sob cursor.

   Classes aplicadas no PARENT .nv-district-label (não no span — span tem
   o cascade stuck que documentamos acima). O `.nv-district-label.nv-X span`
   pega o filho via descendant selector. */
.nv-district-label.nv-label-hover span {
    color: #0f5499 !important;        /* FT primary blue */
    font-weight: 700 !important;
    opacity: 1 !important;
    text-shadow:
        -1px -1px 4px #fff,
         1px -1px 4px #fff,
        -1px  1px 4px #fff,
         1px  1px 4px #fff,
         0 0 8px rgba(15, 84, 153, 0.4) !important;   /* halo azul FT */
    transition: color 0.15s ease-out, text-shadow 0.15s ease-out;
}

/* Label do distrito SELECIONADO (clique). Paralelo ao polígono em SELECTED_FILL. */
.nv-district-label.nv-label-selected span {
    color: #990F3D !important;        /* FT claret (selecionado) */
    font-weight: 800 !important;
    opacity: 1 !important;
    text-shadow:
        -1px -1px 4px #fff,
         1px -1px 4px #fff,
        -1px  1px 4px #fff,
         1px  1px 4px #fff,
         0 0 10px rgba(153, 15, 61, 0.5) !important;  /* halo claret */
    transition: color 0.2s ease-out, text-shadow 0.2s ease-out;
}

/* Acessibilidade: respeita motion preference do usuário (sem animação) */
@media (prefers-reduced-motion: reduce) {
    .nv-district-label.nv-label-hover span,
    .nv-district-label.nv-label-selected span {
        transition: none !important;
    }
}

/* Touch device: hover não dispara visualmente (já temos guard no JS).
   Defesa em profundidade para o caso de pointerType undefined. */
@media (hover: none) and (pointer: coarse) {
    .nv-district-label.nv-label-hover span {
        color: inherit !important;
        font-weight: inherit !important;
        text-shadow: inherit !important;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .nv-district-label span {
        color: #f1f5f9;
        text-shadow:
            -1px -1px 3px rgba(15,23,42,0.95),
             1px -1px 3px rgba(15,23,42,0.95),
            -1px  1px 3px rgba(15,23,42,0.95),
             1px  1px 3px rgba(15,23,42,0.95);
    }
    .nv-district-label.nv-label-hover span {
        color: #60a5fa !important;
        text-shadow:
            -1px -1px 4px #0f172a,
             1px -1px 4px #0f172a,
            -1px  1px 4px #0f172a,
             1px  1px 4px #0f172a,
             0 0 8px rgba(96, 165, 250, 0.5) !important;
    }
    .nv-district-label.nv-label-selected span {
        color: #f2c3b4 !important;
        text-shadow:
            -1px -1px 4px #0f172a,
             1px -1px 4px #0f172a,
            -1px  1px 4px #0f172a,
             1px  1px 4px #0f172a,
             0 0 10px rgba(242, 195, 180, 0.6) !important;
    }
}

/* Leaflet zoom controls — reposition above bottom nav */
.leaflet-control-zoom {
    margin-bottom: 80px !important;
}

/* =========================================
   SEARCH PILL (top center)
   ========================================= */
#search-pill {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 44px;
    background: var(--card-bg);
    backdrop-filter: var(--blur);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--pill-radius);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s, border-color 0.2s;
    user-select: none;
}
#search-pill:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-color: rgba(37,99,235,0.3);
}
.sp-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}
#search-pill-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#search-pill-text.has-selection {
    color: var(--text);
    font-weight: 500;
}
.sp-kbd {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-subtle);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Inter', sans-serif;
}

/* =========================================
   METRIC CHIPS (top right)
   ========================================= */
#metric-chips {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mc-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    backdrop-filter: var(--blur);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--chip-radius);
    padding: 8px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    min-width: 160px;
}
.mc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mc-dot-green { background: var(--success); }
.mc-dot-blue { background: var(--primary); }
.mc-dot-orange { background: var(--warning); }
.mc-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}
.mc-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: lowercase;
}

/* =========================================
   MAP CONTROLS (basemap switcher)
   ========================================= */
#map-controls {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px + 90px);
    left: 16px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mc-btn {
    width: 36px;
    height: 36px;
    background: var(--card-bg);
    backdrop-filter: var(--blur);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: all 0.15s;
}
.mc-btn:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.mc-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

/* =========================================
   LEGEND CARD (bottom left)
   ========================================= */
#legend-card {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    right: 16px;
    z-index: 800;
    background: var(--card-bg);
    backdrop-filter: var(--blur);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-width: 180px;
    max-width: 220px;
}
.lc-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding-right: 26px;       /* Reserva espaço para .legend-minimize-btn (20px + 6px offset) */
    line-height: 1.25;
    word-break: break-word;    /* Evita que palavras longas (ex: "MATRÍCULA") vazem atrás do botão */
}
.lc-bar {
    height: 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    background: #FFF1E5;
}
.lc-avg {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}
#legend-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}
.legend-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Hidden legacy map legend (map.js writes to legend-title/legend-items) */
#map-legend { display: none !important; }

/* =========================================
   DISTRICT CARD (right-side sliding panel)
   ========================================= */
#district-card {
    position: fixed;
    top: 0;
    right: 0;
    bottom: var(--nav-height);
    width: 400px;
    max-width: 100vw;
    z-index: 850;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-out;
    transform: translateX(0);
}
#district-card.dc-closed {
    transform: translateX(100%);
    pointer-events: none;
}

.dc-header {
    background: var(--navy);
    padding: 20px 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}
.dc-name {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
.dc-subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
    margin-top: 4px;
}
.dc-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.dc-export-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.dc-export-btn:hover {
    background: rgba(255,255,255,0.35);
}
.dc-minimize-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.dc-minimize-btn:hover {
    background: rgba(255,255,255,0.35);
}
.dc-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.dc-close:hover {
    background: rgba(255,255,255,0.35);
}

/* Minimized DC — body hidden, header stays as clickable tab */
#district-card.dc-minimized .dc-body {
    display: none;
}
#district-card.dc-minimized {
    bottom: var(--nav-height);
    top: auto;
    cursor: pointer;
    box-shadow: -4px -2px 16px rgba(0,0,0,0.18);
}
#district-card.dc-minimized .dc-header {
    border-radius: 12px 0 0 0;
    cursor: pointer;
    user-select: none;
}
#district-card.dc-minimized .dc-header:hover {
    filter: brightness(1.1);
}
#district-card.dc-minimized .dc-export-btn {
    display: none;
}

.dc-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Hero value */
.dc-hero {
    text-align: center;
    padding: 12px 0;
}
.dc-hero-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text);
}
.dc-hero-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.dc-hero-compare {
    font-size: 0.72rem;
    color: var(--text-subtle);
    margin-top: 4px;
}

/* Context grid 2x2 */
.dc-context-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.dc-ctx-item {
    background: var(--surface);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.dc-ctx-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.dc-ctx-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* DC sections */
.dc-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

/* ============================================================
 * Issue #124 Alt F v2.1 — Freemium DC: anonymous lock masking
 * ============================================================
 * Para anônimos (body.tier-free.dc-v2): esconde 9 seções premium
 * + injeta 1 banner CTA agrupado no topo do DC.
 * Premium (body.tier-premium): zero mudança visual.
 * Override: ?dc_v2=0 desativa (rollback sem deploy).
 */
body.tier-free.dc-v2 #dc-tendencia-section,
body.tier-free.dc-v2 #dc-fiscal-section,
body.tier-free.dc-v2 #dc-infra-section,
body.tier-free.dc-v2 #dc-invest-section,
body.tier-free.dc-v2 #dc-oportunidades-section,
body.tier-free.dc-v2 #dc-precos-section,
body.tier-free.dc-v2 #dc-mercado-section,
body.tier-free.dc-v2 #dc-vendedor-section,
body.tier-free.dc-v2 #detail-cr-decomp,
body.tier-free.dc-v2 #dc-demo-section {
    display: none !important;
}

/* Banner CTA agrupado — injetado dinamicamente via _renderAnonymousPremiumCTA() */
.dc-premium-cta {
    margin: 12px 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, #FFF1E5 0%, #C5DCF0 100%);
    border: 1px solid #B8D4E8;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dc-premium-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 84, 153, 0.15);
}
.dc-premium-cta-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0F5499;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dc-premium-cta-body {
    font-size: 0.72rem;
    color: #555;
    line-height: 1.4;
    margin-bottom: 8px;
}
.dc-premium-cta-btn {
    display: inline-block;
    padding: 6px 14px;
    background: #0F5499;
    color: white;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: none;
}
.dc-premium-cta-btn:hover { background: #2A6FA8; }

.dc-section-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
    font-weight: 600;
}
.dc-select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}
.dc-select:focus {
    border-color: var(--primary);
}

/* DC detail grid */
.dc-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.dc-detail-item {
    background: var(--surface);
    padding: 10px 12px;
    border-radius: 8px;
}
.dc-detail-item.dc-highlight {
    border-left: 3px solid var(--primary);
}
.dc-detail-label {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.dc-detail-value {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2px;
}

/* Issue #99 H+: yield decomposto por tipologia (heterogeneidade compacto/médio/grande) */
.dc-yield-decomposto {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border-left: 3px solid #4A90C2;
    border-radius: 6px;
    font-size: 0.72rem;
    line-height: 1.4;
}
.dc-yield-decomposto-label {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.dc-yield-pill {
    display: inline-block;
    margin-right: 8px;
    color: var(--text);
    cursor: help;
}
.dc-yield-pill b {
    color: #0F5499;
    font-weight: 600;
}
.dc-yield-tipologia-note {
    margin-top: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Mandatory disclaimer footer (audit 2026-04) */
.dc-disclaimer {
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 4px;
}
.dc-disclaimer small {
    font-size: 0.65rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* CTA button */
.dc-cta {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    margin-top: 4px;
}
.dc-cta:hover {
    background: #1d4ed8;
}

/* Mini-histograma de margens vendedor */
.dc-margin-hist {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}
.dc-margin-hist-title {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.dc-margin-bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 60px;
}
.dc-margin-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.dc-margin-bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    transition: height 0.3s;
}
.dc-margin-bar-label {
    font-size: 0.55rem;
    color: #64748b;
    margin-top: 4px;
    text-align: center;
}
.dc-margin-bar-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: #334155;
}

/* Radar de Oportunidades section */
.dc-section.dc-highlight {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%);
    border: 1px solid #86efac;
}
.dc-oport-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 8px 10px;
}
.dc-oport-ring {
    position: relative;
    width: 68px;
    height: 68px;
    flex-shrink: 0;
}
.dc-oport-ring svg {
    transform: rotate(-90deg);
}
.dc-oport-ring-bg { fill: none; stroke: #d1fae5; stroke-width: 6; }
.dc-oport-ring-fg { fill: none; stroke: #059669; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.dc-oport-ring-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #059669;
}
.dc-oport-text {}
.dc-oport-score {
    font-size: 1rem;
    font-weight: 700;
    color: #059669;
    line-height: 1.2;
}
.dc-oport-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 6px;
}
.dc-oport-badge.alto { background: #dcfce7; color: #14532d; }
.dc-oport-badge.medio { background: #fef9c3; color: #713f12; }
.dc-oport-label {
    font-size: 0.68rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.dc-oport-disclaimer {
    font-size: 0.62rem;
    color: #94a3b8;
    padding: 0 8px 6px;
    font-style: italic;
}
.dc-oport-signals {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 8px 10px;
}
.dc-oport-signals .signal-pill {
    font-size: 0.64rem;
    padding: 3px 9px;
    border-radius: 12px;
    background: #d1fae5;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}
.dc-oport-signals .signal-pill::before { content: '✓ '; }
.dc-oport-signals .signal-pill.warn {
    background: #fef3c7;
    color: #92400e;
}
.dc-oport-signals .signal-pill.warn::before { content: '⚡ '; }
.dc-oport-sim-btn {
    width: calc(100% - 16px);
    margin: 0 8px 10px;
    padding: 10px;
    background: linear-gradient(135deg, #059669, #0284c7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.dc-oport-sim-btn:hover { opacity: 0.92; transform: scale(1.01); }
.dc-oport-sim-btn::before { content: '📊 '; }

/* Simulador Modal */
#simulador-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
}
#simulador-modal.hidden { display: none; }
.sim-card {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.sim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.sim-header h3 {
    font-size: 1.1rem;
    margin: 0;
}
.sim-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}
.sim-body {
    padding: 20px;
}
.sim-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.sim-field {
    flex: 1;
}
.sim-field label {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
}
.sim-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}
.sim-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.sim-results {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}
.sim-results h4 {
    font-size: 0.85rem;
    margin: 0 0 12px;
}
.sim-table {
    width: 100%;
    font-size: 0.78rem;
    border-collapse: collapse;
}
.sim-table th, .sim-table td {
    padding: 6px 8px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
}
.sim-table th { text-align: left; font-weight: 500; color: #64748b; }
.sim-table td:first-child { text-align: left; font-weight: 500; }
.sim-chart-container {
    height: 200px;
    margin-top: 16px;
}
.sim-breakeven {
    text-align: center;
    padding: 12px;
    background: #f0fdf4;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.82rem;
    color: #065f46;
}

/* Comparador lado-a-lado */
#comparador-panel {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 12px 20px;
    z-index: 1100;
    display: none;
    align-items: center;
    gap: 12px;
}
#comparador-panel.visible { display: flex; }
.comp-badges {
    display: flex;
    gap: 6px;
}
.comp-badge {
    padding: 4px 10px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 16px;
    font-size: 0.72rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}
.comp-badge .remove {
    cursor: pointer;
    font-weight: bold;
    margin-left: 2px;
}
.comp-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}
.comp-clear {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

/* Comparador modal/drawer */
#comparador-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
}
#comparador-modal.hidden { display: none; }
.comparador-card {
    background: #fff;
    border-radius: 16px;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.comparador-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.comparador-body {
    padding: 20px;
}
.comparador-grid {
    display: grid;
    gap: 16px;
}
.comparador-col {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}
.comparador-col h4 {
    margin: 0 0 12px;
    font-size: 0.95rem;
}
.comparador-metric {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.8rem;
    border-bottom: 1px solid #f1f5f9;
}
.comparador-metric:last-child { border-bottom: none; }
.comparador-metric .label { color: #64748b; }
.comparador-metric .value { font-weight: 600; }
.comparador-charts {
    margin-top: 20px;
}
.comparador-radar {
    height: 280px;
}
.comparador-timeline {
    height: 200px;
    margin-top: 16px;
}

/* =========================================
   BOTTOM NAV
   ========================================= */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 1100;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}

.bn-left {
    display: flex;
    align-items: center;
}
.bn-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bn-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}
.bn-logo-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--navy);
}

.bn-center {
    display: flex;
    align-items: center;
    gap: 4px;
}
.bn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    min-width: 64px;
}
.bn-item:hover {
    color: var(--primary);
}
.bn-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.bn-item svg {
    flex-shrink: 0;
}

.bn-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bn-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.bn-icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.bn-icon-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.bn-text-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.bn-text-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Auth button (Entrar/Sair) — adapta estilo pra não parecer ação destrutiva como "Sair" puro */
.bn-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: -0.005em;
}
.bn-auth-btn svg {
    flex-shrink: 0;
    opacity: 0.85;
}
.bn-auth-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37,99,235,0.04);
}
.bn-auth-btn:hover svg { opacity: 1; }
.bn-auth-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* =========================================
   COMMAND PALETTE
   ========================================= */
#cmd-palette {
    position: fixed;
    inset: 0;
    z-index: 960;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    transition: opacity 0.15s;
}
#cmd-palette.cp-hidden {
    opacity: 0;
    pointer-events: none;
}
.cp-overlay {
    position: absolute;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
}
.cp-card {
    position: relative;
    width: 560px;
    max-width: calc(100vw - 32px);
    max-height: 480px;
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.cp-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.cp-search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}
#cp-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: none;
}
#cp-input::placeholder {
    color: var(--text-subtle);
}
.cp-esc {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-subtle);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: 'Inter', sans-serif;
}
.cp-results {
    overflow-y: auto;
    flex: 1;
}
.cp-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 20px 6px;
}
.cp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.1s;
}
.cp-item:hover, .cp-item.cp-active {
    background: var(--bg-input);
}
.cp-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.cp-item-text {
    flex: 1;
    min-width: 0;
}
.cp-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cp-item-cat {
    font-size: 0.6rem;
    color: var(--text-subtle);
    background: var(--bg-input);
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 500;
}
.cp-item-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-item-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* =========================================
   ESTIMATOR MODAL
   ========================================= */
/* AUDIT FIX: z-index was 850, below bottom-nav (1100) — modal blocked navigation.
   Now 1200 so modal overlays everything including nav. */
#estimator-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    transition: opacity 0.15s;
}
#estimator-modal.em-hidden {
    opacity: 0;
    pointer-events: none;
}
.em-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.em-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}
.em-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.em-close:hover {
    background: var(--danger);
    color: #fff;
}
.em-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 24px 16px calc(var(--nav-height) + 24px);
}
.em-form {
    width: 100%;
    max-width: 600px;
}
.em-field {
    margin-bottom: 16px;
}
.em-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.em-field select,
.em-field input[type="number"],
.em-field input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.em-field select:focus,
.em-field input:focus {
    border-color: var(--primary);
}
.em-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.em-buyer-highlight {
    border-left: 3px solid var(--primary);
    padding-left: 14px;
}
.em-btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    margin-bottom: 16px;
}
.em-btn-primary:hover { background: #1d4ed8; }
.em-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.em-btn-secondary {
    width: 100%;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 8px;
}
.em-btn-secondary:hover {
    border-color: var(--primary);
}

/* Estimate result cards */
.estimate-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    border: 1px solid var(--border);
    text-align: center;
}
.estimate-card.best {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37,99,235,0.06), rgba(37,99,235,0.02));
}
.estimate-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.estimate-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}
.estimate-card.small .estimate-value {
    font-size: 1rem;
}
.estimate-m2 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.estimate-model {
    font-size: 0.7rem;
    color: var(--text-subtle);
    margin-top: 4px;
}
.estimate-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.models-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
/* Tooltips nos modelos de estimativa */
.est-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
    flex-shrink: 0;
    user-select: none;
    transition: background 0.15s;
}
.est-tip:hover { background: var(--primary-hover, #1d4ed8); }
.est-tip-box {
    margin: 6px 0 4px;
    padding: 8px 10px;
    background: #f0f4ff;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    font-size: 0.75rem;
    color: var(--text-muted, #555);
    line-height: 1.45;
}
.estimate-label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.cr-info {
    margin-top: 12px;
    padding: 12px;
    background: rgba(217,119,6,0.06);
    border: 1px solid rgba(217,119,6,0.2);
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--warning);
    text-align: center;
}

/* Address group for Model D */
.em-address-group {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(34, 197, 94, 0.04);
    border: 1px dashed rgba(34, 197, 94, 0.3);
    border-radius: 10px;
}
.em-address-group .em-row {
    margin-bottom: 4px;
}
.em-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}
.em-optional {
    font-size: 0.65rem;
    color: var(--text-subtle);
    font-weight: normal;
}

/* Model D details panel */
.model-d-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.model-d-header strong {
    color: var(--success);
    font-size: 0.85rem;
}
.model-d-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.model-d-estimate {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    margin-bottom: 12px;
}
.model-d-main {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
}
.model-d-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.model-d-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success);
}
.model-d-range {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.model-d-adjustments {
    margin-bottom: 10px;
}
.model-d-adjustment {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--surface);
    border-radius: 6px;
    font-size: 0.75rem;
    margin-bottom: 4px;
}
.model-d-adjustment .adj-name {
    color: var(--text);
}
.model-d-adjustment .adj-factor {
    font-weight: 600;
}
.model-d-adjustment .adj-factor.positive { color: var(--success); }
.model-d-adjustment .adj-factor.negative { color: var(--danger); }
.model-d-comparables {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.model-d-comparables table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}
.model-d-comparables th, .model-d-comparables td {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.model-d-comparables th {
    font-weight: 600;
    color: var(--text-subtle);
    font-size: 0.65rem;
    text-transform: uppercase;
}

/* Buyer analysis */
.buyer-analysis {
    margin-top: 16px;
    padding: 16px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.buyer-analysis h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}
.buyer-verdict {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.buyer-verdict.above { background: rgba(220,38,38,0.08); color: var(--danger); }
.buyer-verdict.within { background: rgba(22,163,74,0.08); color: var(--success); }
.buyer-verdict.below { background: rgba(37,99,235,0.08); color: var(--primary); }
.buyer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 10px 0;
}
.buyer-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.buyer-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.buyer-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.buyer-suggestion {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.5;
}
.buyer-vintagem {
    font-size: 0.72rem;
    color: var(--text-subtle);
    margin-top: 8px;
}
.vintagem-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}

/* =========================================
   COMPARAR VIEW
   ========================================= */
#comparar-view {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    padding-bottom: var(--nav-height);
    transition: opacity 0.15s;
}
#comparar-view.cv-hidden {
    opacity: 0;
    pointer-events: none;
}
.cv-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.cv-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}
.cv-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    flex-wrap: wrap;
}
.cv-select {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
}
.cv-mode-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.cv-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
}
.cv-close:hover {
    background: var(--danger);
    color: #fff;
}
.cv-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

/* Mode toggle buttons (in comparar and hidden) */
.mode-btn {
    padding: 6px 14px;
    border: none;
    background: var(--bg-input);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.mode-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.mode-btn.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* ── Collapsible Sections ── */
.cv-section {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.cv-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: var(--surface);
    transition: background 0.15s;
}
.cv-section-header:hover { background: var(--bg-input); }
.cv-section-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.cv-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    color: var(--text-muted);
}
.cv-section.collapsed .cv-chevron {
    transform: rotate(-90deg);
}
.cv-section-body {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.25s ease;
    padding: 16px;
}
.cv-section.collapsed .cv-section-body {
    max-height: 0;
    padding: 0 16px;
}

/* Export CSV button */
.cv-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.cv-export-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.cv-export-btn svg { flex-shrink: 0; }

/* Charts */
#charts-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}
.chart-panel {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}
.chart-panel.full-width {
    grid-column: 1 / -1;
}
.chart-panel h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.chart-panel-header { margin-bottom: 10px; }
.chart-select {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-family: Inter, sans-serif;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}
.chart-select:focus { outline: none; border-color: var(--accent); }
.chart-panel canvas {
    max-height: 300px;
}

/* Data table */
#table-area {
    margin-top: 8px;
}
#table-area h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}
.table-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 16px;
}
.table-search-wrapper {
    position: relative;
}
#table-search {
    width: 220px;
    padding: 8px 12px 8px 32px;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, width 0.3s;
}
#table-search:focus {
    border-color: var(--primary);
    width: 280px;
}
#table-search::placeholder {
    color: var(--text-subtle);
}
.table-search-wrapper::before {
    content: '\1F50D';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    pointer-events: none;
}
.table-col-selector {
    position: relative;
}
.table-col-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.table-col-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.table-col-btn svg {
    stroke: currentColor;
}
.table-col-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 100;
    padding: 8px 0;
}
.table-col-dropdown-header {
    padding: 8px 14px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-subtle);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.table-col-dropdown label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}
.table-col-dropdown label:hover {
    background: var(--bg-input);
}
.table-col-dropdown input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}
.table-wrapper {
    overflow: auto;
    max-height: 480px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
}
#data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
#data-table th {
    padding: 10px 14px;
    text-align: left;
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
#data-table th:hover { color: var(--primary); }
#data-table td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(226,232,240,0.6);
    white-space: nowrap;
    color: var(--text);
}
#data-table tbody tr { transition: background 0.15s; }
#data-table tbody tr:hover {
    background: var(--bg-input);
    cursor: pointer;
}
#data-table tbody tr.selected {
    background: rgba(37,99,235,0.08);
}
#data-table tbody tr.search-hidden {
    display: none;
}

/* Sort arrows */
.sort-arrow {
    font-size: 0.6rem;
    color: var(--text-subtle);
    margin-left: 3px;
    opacity: 0.4;
}
.sort-arrow.active {
    color: var(--primary);
    opacity: 1;
}

/* =========================================
   SIDEBAR LOCK STATE (Freemium — Premium indicator for free users)
   ========================================= */
.isb-item.isb-locked {
    position: relative;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(37,99,235,0.025) 30%, rgba(37,99,235,0.04));
    cursor: pointer;
    transition: background 0.2s ease;
}
.isb-item.isb-locked:hover {
    background: linear-gradient(to right, rgba(37,99,235,0.04), rgba(37,99,235,0.06));
}
.isb-item.isb-locked .isb-item-label {
    color: var(--text-muted);
}
.isb-item.isb-locked .isb-item-desc {
    opacity: 0.65;
}
.isb-item-value.isb-lock {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff !important;
    border-radius: 100px;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    min-width: unset !important;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}
.isb-item-value.isb-lock svg {
    width: 11px; height: 11px;
    flex-shrink: 0;
    stroke-width: 2.6;
}
.isb-lock-label { line-height: 1; }
.isb-item.isb-locked:hover .isb-item-value.isb-lock {
    box-shadow: 0 3px 10px rgba(37,99,235,0.45);
    transform: translateY(-1px);
}

/* =========================================
   UPGRADE MODAL (Premium paywall)
   ========================================= */
#upgrade-modal {
    position: fixed;
    inset: 0;
    z-index: 990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: opacity 0.2s;
}
#upgrade-modal.um-hidden {
    opacity: 0;
    pointer-events: none;
}
.um-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 12, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.um-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    padding: 32px 32px 24px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.1);
    animation: umCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes umCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.um-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px; height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.um-close:hover { background: #f1f5f9; color: var(--text); }
.um-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.um-head {
    text-align: center;
    margin-bottom: 22px;
}
.um-lock-icon {
    width: 52px; height: 52px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}
.um-lock-icon svg { width: 24px; height: 24px; }
.um-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.um-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.um-sub strong { color: var(--text); font-weight: 600; }

.um-features {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.um-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.5;
    letter-spacing: -0.005em;
}
.um-features li svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
    color: var(--success);
}
.um-features li strong { font-weight: 600; }

.um-price-box {
    padding: 18px;
    background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.03) 100%);
    border: 1px solid rgba(37,99,235,0.15);
    border-radius: 14px;
    text-align: center;
    margin-bottom: 20px;
}
.um-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
    margin-bottom: 6px;
}
.um-price-big {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.035em;
    line-height: 1;
}
.um-price-cents {
    font-size: 1.1rem;
    font-weight: 700;
    vertical-align: top;
}
.um-price-period {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}
.um-trial {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: -0.005em;
}

.um-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.um-btn-primary {
    padding: 14px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.005em;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 6px 16px rgba(37,99,235,0.3);
}
.um-btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37,99,235,0.4); }
.um-btn-primary:active { transform: translateY(0); }
.um-btn-primary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.um-btn-ghost {
    padding: 12px 20px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.um-btn-ghost:hover { background: #f8fafc; border-color: var(--text-subtle); color: var(--text); }
.um-btn-ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.um-fineprint {
    font-size: 0.7rem;
    color: var(--text-subtle);
    text-align: center;
    line-height: 1.5;
    letter-spacing: -0.005em;
}
.um-fineprint a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.um-fineprint a:hover { text-decoration: underline; }

@media (max-width: 520px) {
    #upgrade-modal { padding: 12px; }
    .um-card { padding: 24px 20px 20px; border-radius: 16px; }
    .um-title { font-size: 1.2rem; }
    .um-features li { font-size: 0.82rem; }
    .um-price-big { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .um-card { animation: none; }
    .um-btn-primary, .um-btn-ghost, .um-close, #upgrade-modal { transition: none; }
}

/* =========================================
   ONBOARDING TOUR (v2 — 2026-04-22: 4 steps instrutivos + dica + back)
   ========================================= */
#onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 980;
    transition: opacity 0.25s;
}
#onboarding-overlay.ob-hidden {
    opacity: 0;
    pointer-events: none;
}
.ob-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.ob-card {
    position: absolute;
    bottom: calc(var(--nav-height) + 24px);
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 18px;
    padding: 28px 28px 22px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.1);
    animation: obCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes obCardIn {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

.ob-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.ob-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--accent-soft, rgba(37,99,235,0.1));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ob-icon svg {
    width: 20px; height: 20px;
}
.ob-step-counter {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-subtle);
    letter-spacing: 0.04em;
}

.ob-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.015em;
    margin-bottom: 10px;
}
.ob-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 16px;
}
.ob-desc b, .ob-desc strong {
    color: var(--text);
    font-weight: 600;
}
.ob-desc kbd {
    display: inline-block;
    padding: 1px 6px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 0.78em;
    color: var(--text);
    box-shadow: 0 1px 0 #cbd5e1;
    font-weight: 600;
    vertical-align: baseline;
    line-height: 1.2;
    margin: 0 1px;
}

.ob-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(37, 99, 235, 0.06);
    border-radius: 10px;
    margin-bottom: 18px;
    border-left: 3px solid var(--primary);
}
.ob-tip-icon {
    width: 16px; height: 16px;
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 1px;
}
.ob-tip span {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.5;
}
.ob-tip b, .ob-tip strong {
    font-weight: 600;
}

.ob-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 18px;
}
.ob-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.2s, transform 0.2s;
}
.ob-dot.is-active {
    background: var(--primary);
    transform: scale(1.3);
}

.ob-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ob-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ob-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 8px 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(107,114,128,0.4);
    transition: color 0.15s, text-decoration-color 0.15s;
}
.ob-skip:hover {
    color: var(--text);
    text-decoration-color: var(--text);
}
.ob-back {
    padding: 8px 14px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.ob-back:hover {
    background: #f8fafc;
    border-color: var(--text-subtle);
}
.ob-next {
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(37,99,235,0.25);
    white-space: nowrap;
}
.ob-next:hover { background: #1d4ed8; transform: translateY(-1px); }
.ob-next:active { transform: translateY(0); }
.ob-next:focus-visible,
.ob-back:focus-visible,
.ob-skip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Keyboard shortcut footer — subtle, helps power users */
.ob-shortcuts {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.7rem;
    color: var(--text-subtle);
    text-align: center;
    letter-spacing: 0.01em;
}
.ob-shortcuts kbd {
    display: inline-block;
    padding: 1px 5px;
    margin: 0 2px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 0.85em;
    color: var(--text-muted);
    box-shadow: 0 1px 0 #e2e8f0;
    font-weight: 600;
}

@media (max-width: 520px) {
    .ob-card {
        width: calc(100vw - 24px);
        padding: 22px 20px 18px;
        bottom: calc(var(--nav-height) + 14px);
    }
    .ob-title { font-size: 1.08rem; }
    .ob-desc { font-size: 0.85rem; }
    .ob-actions { flex-wrap: wrap; }
    .ob-skip { order: 2; width: 100%; text-align: center; margin-top: 6px; }
    .ob-actions-right { order: 1; margin-left: auto; }
    .ob-shortcuts { display: none; }  /* Mobile users navegam via touch, kbd hints só atrapalha */
}

@media (prefers-reduced-motion: reduce) {
    .ob-card { animation: none; }
    .ob-dot, .ob-next, .ob-back { transition: none; }
    #onboarding-overlay { transition: none; }
}

/* =========================================
   ONBOARDING v3 — NPS scale + UX textarea (extra slot)
   ========================================= */
.ob-extra {
    margin: 14px 0 4px;
}
.ob-nps-scale {
    display: flex;
    gap: 4px;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ob-nps-btn {
    flex: 1 1 auto;
    min-width: 0;
    height: 36px;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}
.ob-nps-btn:hover { border-color: #94a3b8; background: #f8fafc; transform: translateY(-1px); }
.ob-nps-btn.is-active {
    color: #ffffff;
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.ob-nps-red.is-active   { background: #dc2626; border-color: #b91c1c; }
.ob-nps-yellow.is-active{ background: #d97706; border-color: #b45309; }
.ob-nps-green.is-active { background: #059669; border-color: #047857; }
.ob-nps-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 10px;
    padding: 0 2px;
}
.ob-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #0f172a;
    background: #ffffff;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}
.ob-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.ob-input-tall { min-height: 92px; }

@media (max-width: 520px) {
    .ob-nps-btn { height: 32px; font-size: 0.82rem; }
    .ob-nps-labels { font-size: 0.68rem; }
}

/* =========================================
   FEEDBACK MODAL (rodapé "Fale com a gente")
   ========================================= */
#feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.18s ease;
}
#feedback-modal.fb-hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}
.fb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.fb-card {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    padding: 24px 26px 20px;
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    animation: fbSlideUp 0.22s ease-out;
}
@keyframes fbSlideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.fb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.fb-title {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.fb-close {
    background: transparent;
    border: none;
    font-size: 1.7rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s ease;
}
.fb-close:hover { color: #0f172a; }
.fb-intro {
    margin: 0 0 18px;
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.45;
}
.fb-label {
    display: block;
    margin: 12px 0 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fb-label .fb-opt {
    text-transform: none;
    font-weight: 400;
    color: #94a3b8;
    letter-spacing: 0;
}
.fb-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.92rem;
    color: #0f172a;
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fb-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.fb-textarea { resize: vertical; min-height: 110px; }
.fb-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}
.fb-cancel, .fb-send {
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s ease;
}
.fb-cancel {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #475569;
}
.fb-cancel:hover { background: #f1f5f9; border-color: #cbd5e1; }
.fb-send {
    background: #2563eb;
    color: #ffffff;
}
.fb-send:hover { background: #1d4ed8; transform: translateY(-1px); }
.fb-send:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}
.fb-status {
    margin-top: 12px;
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2em;
}
.fb-status.fb-success { color: #059669; font-weight: 600; }
.fb-status.fb-error { color: #dc2626; font-weight: 600; }

body.fb-open { overflow: hidden; }

@media (max-width: 520px) {
    .fb-card { padding: 20px 18px 16px; border-radius: 12px; }
    .fb-title { font-size: 1.05rem; }
    .fb-intro { font-size: 0.84rem; }
}

/* =========================================
   FAQ — Refazer tour button no header
   ========================================= */
.faq-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.faq-replay-tour {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.faq-replay-tour:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.faq-replay-tour svg { flex-shrink: 0; }

@media (max-width: 520px) {
    .faq-replay-tour { padding: 5px 8px; font-size: 0.74rem; }
    .faq-replay-tour svg { width: 12px; height: 12px; }
}

/* =========================================
   BADGES
   ========================================= */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-green { background: rgba(22,163,74,0.1); color: var(--success); }
.badge-amber { background: rgba(217,119,6,0.1); color: var(--warning); }
.badge-red { background: rgba(220,38,38,0.1); color: var(--danger); }

/* =========================================
   UTILITY
   ========================================= */
.hidden { display: none !important; }
.fmt-money { font-variant-numeric: tabular-nums; }

/* =========================================
   LOADING OVERLAY
   ========================================= */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 16px;
}
/* Issue #87 (2026-05-04): regra `body.loading > *:not(.loading-overlay) { visibility:hidden }`
   foi removida. A overlay 100% opaca + z-index 9999 já cobre tudo visualmente — a regra
   genérica era defesa-em-profundidade redundante e estava escondendo #district-popup,
   #district-card e #map (filhos diretos de body) em condições que causaram regressão UX
   (nomes de distritos sumindo após seleção). Se um elemento ghost específico vazar no
   futuro, adicionar `body.loading #element { visibility: hidden }` específico em vez de
   regra genérica. */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.loading-progress-wrap {
    width: 280px;
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #4A90C2);
    border-radius: 999px;
    transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.loading-percent {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}
.loading-fade-out {
    opacity: 0;
    transition: opacity 0.25s ease-out;
    pointer-events: none;
}

/* Issue #212 commit 1 (2026-05-15): bloco .choropleth-tt-container/.choropleth-tooltip/.tt-*
   deletado (~98 LoC). DOM correspondente nunca mais é injetado pois _bindTooltip()
   foi removido de map.js. NOTA: .dp-highlight .tt-ind-label/value em ~3100 são
   autocontidas (definem font-size + color explícitos), preservadas. */

/* Leaflet custom popup (for map.js district popup) */
.leaflet-popup-content-wrapper {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-radius: 8px !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3) !important;
}
.leaflet-popup-tip {
    background: #1e293b !important;
    border-right: 1px solid #334155 !important;
    border-bottom: 1px solid #334155 !important;
}
.leaflet-popup-content {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.82rem !important;
    color: #e2e8f0 !important;
    line-height: 1.5 !important;
}
.popup-title { font-weight: 700; font-size: 0.95rem; color: #60a5fa; margin-bottom: 6px; }
.popup-row { display: flex; justify-content: space-between; padding: 2px 0; }
.popup-label { color: #94a3b8; }
.popup-value { font-weight: 600; }
.popup-value.green { color: #22c55e; }
.popup-value.amber { color: #f59e0b; }
.popup-value.red { color: #ef4444; }

/* District popup (map.js) */
#district-popup {
    display: none;
    position: absolute;
    z-index: 999;
    pointer-events: auto;
    max-height: 80%;
    overflow: visible;
}
#district-popup.open {
    display: flex;
    gap: 6px;
}
.dp-panel {
    background: rgba(15,23,42,0.97);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59,130,246,0.4);
    border-radius: 10px;
    min-width: 250px;
    max-width: 300px;
    font-family: 'Inter', sans-serif;
    color: #e2e8f0;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    pointer-events: auto;
}
.dp-close {
    position: absolute; top: 6px; right: 8px;
    background: none; border: none; color: #64748b;
    font-size: 1.1rem; cursor: pointer; line-height: 1;
    padding: 2px 5px; border-radius: 4px; z-index: 2;
}
.dp-close:hover { color: #fff; background: rgba(239,68,68,0.5); }
.dp-header {
    padding: 10px 32px 6px 14px;
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 8px; position: relative;
}
.dp-name { font-size: 0.88rem; font-weight: 700; color: #60a5fa; }
.dp-counts { font-size: 0.65rem; color: #64748b; white-space: nowrap; }
.dp-highlight {
    padding: 6px 14px 8px;
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(59,130,246,0.08);
    border-top: 1px solid rgba(59,130,246,0.15);
    border-bottom: 1px solid rgba(59,130,246,0.15);
}
.dp-highlight .tt-ind-label { font-size: 0.7rem; color: #94a3b8; }
.dp-highlight .tt-ind-value { font-size: 0.92rem; font-weight: 700; color: #fff; }
.dp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0; padding: 8px 0 6px;
}
.dp-grid.dp-grid-2 { grid-template-columns: 1fr 1fr; }
.dp-cell {
    text-align: center; padding: 2px 8px;
    border-right: 1px solid rgba(51,65,85,0.4);
}
.dp-cell:last-child { border-right: none; }
.dp-cell-label {
    display: block; font-size: 0.58rem; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px;
}
.dp-cell-value { display: block; font-size: 0.78rem; font-weight: 600; color: #e2e8f0; }
.dp-bairro-row {
    padding: 6px 14px 10px;
    border-top: 1px solid rgba(51,65,85,0.4);
}
.dp-bairro-row label {
    display: block; font-size: 0.6rem; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 3px;
}
.dp-bairro-row select {
    width: 100%; padding: 5px 8px;
    background: #334155; color: #e2e8f0;
    border: 1px solid #475569; border-radius: 5px;
    font-size: 0.8rem; font-family: inherit; outline: none; cursor: pointer;
}
.dp-bairro-row select:focus { border-color: #3b82f6; }
.dp-bairro-detail { display: none; }
.dp-bairro-detail.open { display: block; }

/* Metro tooltip */
.metro-tooltip {
    background: rgba(15,23,42,0.95) !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
    border-radius: 6px !important;
    font-family: Inter, sans-serif !important;
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
}

/* ── Metro Active: dim everything except metro markers ── */
#map.metro-active .leaflet-tile-pane {
    filter: saturate(0.15) brightness(0.7) contrast(0.85);
    transition: filter 0.4s ease;
}
#map.metro-active .leaflet-overlay-pane {
    filter: saturate(0.2) brightness(0.75) opacity(0.4);
    transition: filter 0.4s ease;
}
/* Metro markers pane stays vivid above dimmed layers */
#map.metro-active .leaflet-metro-pane {
    filter: none !important;
    opacity: 1 !important;
}

/* ── Metro / CPTM Legend Panel ── */
.metro-legend {
    position: absolute;
    bottom: 76px;
    left: 16px;
    z-index: 800;
    background: rgba(15,23,42,0.95);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 180px;
    font-family: 'Inter', sans-serif;
    color: #e2e8f0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.metro-legend.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.metro-legend-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(59,130,246,0.2);
}
.metro-legend-group {
    font-size: 0.6rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.metro-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}
.metro-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}
.metro-legend-symbol {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-family: Inter, sans-serif;
    border: 1.5px solid rgba(255,255,255,0.3);
}
.metro-legend-symbol-mini {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    font-family: Inter, sans-serif;
    color: #94a3b8;
    background: transparent;
}
.metro-legend-name {
    font-size: 0.72rem;
    color: #cbd5e1;
}
.metro-legend-hint {
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(100,116,139,0.3);
    font-size: 0.62rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Collapsible DC sections */
.dc-collapsible .dc-collapse-body {
    display: none;
}
.dc-collapsible.dc-expanded .dc-collapse-body {
    display: grid;
}
.dc-toggle {
    cursor: pointer;
    user-select: none;
}
.dc-toggle::after {
    content: ' +';
    font-weight: 400;
    color: var(--text-muted);
}
.dc-expanded .dc-toggle::after {
    content: ' −';
}

/* Map search box (hidden, for compatibility) */
#map-search-box { display: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* =========================================
   LEFT SIDEBAR — All Indicators Panel
   ========================================= */
#indicator-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--nav-height);
    z-index: 860;
    display: flex;
    transition: transform 0.25s ease-out;
    transform: translateX(-360px);
    pointer-events: none;
}
#indicator-sidebar .isb-panel {
    pointer-events: auto;
}
#indicator-sidebar .isb-toggle {
    pointer-events: auto;
}
#indicator-sidebar.isb-open {
    transform: translateX(0);
    pointer-events: auto;
}
.isb-toggle {
    position: absolute;
    top: 80px;
    right: -44px;
    width: 40px;
    height: 40px;
    border-radius: 0 8px 8px 0;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
    transition: background 0.15s;
}
.isb-toggle:hover { background: #162e4a; }
.isb-panel {
    width: 360px;
    height: 100%;
    background: #fff;
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.isb-header {
    padding: 16px 16px 8px;
    border-bottom: 1px solid #e2e8f0;
}
.isb-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 2px 0;
}
.isb-district-name {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.isb-search {
    padding: 8px 16px;
}
.isb-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.78rem;
    outline: none;
    box-sizing: border-box;
}
.isb-search input:focus { border-color: var(--primary); }
.isb-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
}
.isb-category {
    margin-top: 10px;
}
.isb-cat-header {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 4px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.isb-cat-header::after {
    content: '\25BE';
    font-size: 0.7rem;
    color: var(--text-muted);
}
.isb-category.isb-collapsed .isb-cat-header::after {
    content: '\25B8';
}
.isb-cat-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
}
.isb-category.isb-collapsed .isb-cat-items {
    display: none;
}
.isb-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 6px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 6px;
}
.isb-item:hover { background: #f1f5f9; }
.isb-item.isb-active { background: #e0e7ff; }
.isb-item-info {
    flex: 1;
    min-width: 0;
}
.isb-item-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.isb-item-desc {
    font-size: 0.58rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.isb-item-value {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}
.isb-item-value.isb-null { color: var(--text-muted); font-weight: 400; }
.isb-no-district {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* =========================================
   INFO TOOLTIPS (i) icons
   ========================================= */
/* AUDIT FIX: increased size and contrast for better visibility */
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #dbeafe;
    color: #2563eb;
    font-size: 0.6rem;
    font-weight: 700;
    font-style: normal;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
    border: 1px solid #93c5fd;
    transition: background 0.15s, transform 0.1s;
}
.info-tip:hover { background: #bfdbfe; transform: scale(1.1); }
.info-tip-popup {
    /* Issue #85 (2026-05-04): width fixa (em vez de max-width) + max-height + scroll
       evitam tooltips "estreitos e longos" saindo da tela. Width responsivo:
       380px ou (viewport - 32px), o que for menor — sempre cabe. */
    position: fixed;
    z-index: 9999;
    background: #1e293b;
    color: #f1f5f9;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.5;
    width: min(380px, calc(100vw - 32px));
    max-height: min(60vh, 480px);
    overflow-y: auto;
    word-wrap: break-word;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    pointer-events: auto;
}
.info-tip-popup::after {
    /* Issue #85: arrow rastreia o ícone (?) via --arrow-x setada no JS.
       Sem isso, popup deslocado pelo viewport-fit deixava arrow apontando p/ outro lugar. */
    content: '';
    position: absolute;
    top: -5px;
    left: var(--arrow-x, 16px);
    width: 10px;
    height: 10px;
    background: #1e293b;
    transform: rotate(45deg);
    box-shadow: -1px -1px 1px rgba(0,0,0,0.05);
}
/* Quando popup está acima do tip (sem espaço abaixo), arrow vai pro fundo */
.info-tip-popup.above::after {
    top: auto;
    bottom: -5px;
    box-shadow: 1px 1px 1px rgba(0,0,0,0.05);
}

/* =========================================
   BENCHMARK CARDS (Tendência section)
   ========================================= */
.bm-legend {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 4px 0;
}
.bm-tag {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    color: #fff;
    letter-spacing: 0.02em;
}
.bm-tag.bm-imovel { background: #1e3a5f; }
.bm-tag.bm-cdi    { background: #7c3aed; }
.bm-tag.bm-ipca   { background: #ea580c; }
.bm-tag.bm-incc   { background: #0891b2; }
.bm-tag.bm-dolar  { background: #16a34a; }

.bm-card {
    background: var(--surface);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}
.bm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.bm-period {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.bm-hero {
    font-size: 0.9rem;
    font-weight: 700;
}
.bm-hero.bm-green { color: #16a34a; }
.bm-hero.bm-amber { color: #d97706; }
.bm-hero.bm-red   { color: #dc2626; }

.bm-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.bm-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 14px;
}
.bm-bar {
    height: 10px;
    border-radius: 2px;
    min-width: 3px;
    transition: width 0.3s ease;
}
.bm-bar.bm-imovel { background: #1e3a5f; }
.bm-bar.bm-cdi    { background: #7c3aed; opacity: 0.7; }
.bm-bar.bm-ipca   { background: #ea580c; opacity: 0.7; }
.bm-bar.bm-incc   { background: #0891b2; opacity: 0.7; }
.bm-bar.bm-dolar  { background: #16a34a; opacity: 0.7; }
.bm-bar-val {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 42px;
}

/* =========================================
   QUADRA DETAIL PANEL (inside Estimator)
   ========================================= */
.qd-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0 4px 0;
}
.qd-match-info {
    font-size: 0.8rem;
    color: var(--text);
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 4px;
}
.qd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}
.qd-item {
    background: var(--surface);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
}
.qd-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.qd-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}
.qd-chart-wrap {
    margin-top: 6px;
    height: 220px;
    position: relative;
}
.qd-table-wrap {
    margin-top: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.qd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}
.qd-table th {
    background: var(--surface);
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    padding: 4px 6px;
    text-align: left;
    position: sticky;
    top: 0;
}
.qd-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
}
.qd-table tr:hover td {
    background: #f8fafc;
}

/* =========================================
   RESPONSIVE — Mobile
   ========================================= */
@media (max-width: 768px) {
    /* Search pill */
    #search-pill {
        width: calc(100% - 32px);
        max-width: 340px;
    }

    /* Metric chips — horizontal, single row */
    #metric-chips {
        top: 68px;
        right: 8px;
        flex-direction: column;
        gap: 4px;
    }
    .mc-chip {
        padding: 6px 10px;
        min-width: auto;
    }
    .mc-label { display: none; }

    /* District card — full width */
    #district-card {
        width: 100%;
        border-radius: 16px 16px 0 0;
        top: auto;
        bottom: var(--nav-height);
        max-height: 60vh;
    }

    /* Bottom nav */
    .bn-logo-text { display: none; }
    .bn-item {
        padding: 6px 10px;
        min-width: 48px;
        flex-shrink: 0;
    }
    .bn-item span { font-size: 0.58rem; }
    /* Issue #21 V2: esconder bn-text-btn EXCETO auth e upgrade.
       Antes: TODOS escondiam → "não consigo logar no iPhone".
       Auth (Entrar/Sair) e upgrade (Premium) ficam visíveis em mobile com
       microcopy preservado (Reventure pattern: ícone + label). */
    .bn-text-btn:not(.bn-auth-btn):not(.bn-upgrade) { display: none; }

    /* Auth btn — V3 N3: 0.75rem (12px) Apple HIG mínimo legível */
    .bn-auth-btn {
        display: inline-flex !important;
        flex-shrink: 0;
        min-height: 44px;          /* Apple HIG tap target */
        align-items: center;
        gap: 4px;
        padding: 6px 10px;
        font-size: 0.75rem;
        font-weight: 600;
    }
    .bn-auth-btn #auth-btn-label { display: inline; font-size: 0.75rem; }

    /* Upgrade btn: compacto em mobile mas visível */
    .bn-upgrade {
        display: inline-flex !important;
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 0.7rem;
        min-height: 44px;
        align-items: center;
    }

    #bottom-nav {
        padding: 0 6px;
        gap: 3px;
        /* V2 F6: safe-area inset bottom (iPhone X+ home bar) */
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    .bn-center {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex: 1 1 auto;
        min-width: 0;
    }
    .bn-center::-webkit-scrollbar { display: none; }
    .bn-right {
        flex-shrink: 0;
        display: flex;
        gap: 4px;
        align-items: center;
    }
}

/* V3 F1: iPhone SE / 320px — esconde Premium em <380px (mantém só auth) */
@media (max-width: 380px) {
    .bn-upgrade { display: none !important; }
    .bn-item { padding: 6px 8px; min-width: 42px; }
    /* V3 N5: 0.6rem (9.6px) mínimo legível — antes 0.55rem (8.8px ilegível) */
    .bn-item span { font-size: 0.6rem; }
    .bn-auth-btn { padding: 6px 8px; }
    /* V3 N3: 0.7rem (11.2px) acima do crítico — antes 0.65rem ilegível */
    .bn-auth-btn #auth-btn-label { font-size: 0.7rem; }
}

/* V3 N1: hover guard correto (`(hover: none) and (pointer: coarse)`) — captura
   touch devices puros, evita laptops com touchscreen híbrido. */
@media (hover: none) and (pointer: coarse) {
    /* Touch device: força tooltip do mapa a ficar oculto.
       Issue #212 commit 1 (2026-05-15): .choropleth-tt-container removida da lista
       (classe DOM nunca mais é injetada). .leaflet-tooltip mantida para METRO. */
    .leaflet-tooltip { display: none !important; }
}

/* V3 N4: affordance visual de scroll horizontal no .bn-center */
@media (max-width: 768px) {
    .bn-center {
        -webkit-mask-image: linear-gradient(to right, black 90%, transparent);
        mask-image: linear-gradient(to right, black 90%, transparent);
    }
}

/* Issue #212 commit 1 (2026-05-15): regra `body.dc-open .nv-district-label`
   DELETADA. Era documentada como fallback iOS <16.4 (sem `:has()`), mas iOS é
   mobile-only — em desktop a regra escondia labels indevidamente ao abrir DC.
   Suporte universal de `:has()` em 2026 (iOS 16.4+ / Chrome 105+ / FF 121+);
   regra mobile-only em ~3970 com `body:has(#district-card:not(.dc-closed))`
   cobre o caso restante. */

/* ════════════════════════════════════════════════════════════════════════
   #21 V5 — FAB DC (Floating Action Button) + Bug Fixes mobile
   ════════════════════════════════════════════════════════════════════════
   Resolve 2 bugs reportados em real device test:
   - Bug 1: DC minimizado sobrepunha legenda (canto inferior direito)
   - Bug 2: DC fechado no X não reabria ao clicar no mapa

   Solução UX 10/10 (Apple Maps + Reventure pattern):
   1. Eliminar estado "minimized" em mobile (só open/closed)
   2. FAB sempre disponível pra reabrir DC quando há distrito selecionado
   3. Esconder legenda em mobile quando DC aberto (evita sobreposição)
   ════════════════════════════════════════════════════════════════════════ */

/* FAB botão flutuante — só aparece em mobile, quando body.dc-fab-show */
/* V5.1 FURO 1: position bottom-left (Material FAB padrão) — evita colisão com:
   - .isb-toggle em top: 80px (sidebar de indicadores)
   - #legend-card em bottom + right (canto inferior direito)
   Plus alinha com Apple Maps/Reventure pattern. */
#dc-fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);  /* acima do bottom-nav */
    left: 12px;
    z-index: 850;
    display: none;      /* default hidden — JS toggle via .dc-fab-show */
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    min-height: 44px;   /* Apple HIG tap target */
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}
#dc-fab:hover, #dc-fab:active {
    transform: scale(1.04);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}
#dc-fab svg { flex-shrink: 0; }
#dc-fab #dc-fab-label {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}

/* FAB aparece em mobile QUANDO body.dc-fab-show (JS controla) */
@media (max-width: 768px) {
    body.dc-fab-show #dc-fab { display: inline-flex; }
}

@media (max-width: 380px) {
    /* iPhone SE: FAB compacto sem texto, só ícone */
    body.dc-fab-show #dc-fab {
        padding: 10px 12px;
        gap: 0;
    }
    body.dc-fab-show #dc-fab #dc-fab-label { display: none; }
}

/* Bug 1 fix — esconder LEGENDA em mobile quando DC aberto (evita sobreposição) */
@media (max-width: 768px) {
    body.dc-open #legend-card { display: none !important; }
}

/* Bug 1 fix — eliminar estado MINIMIZED em mobile (só open/closed).
   Em mobile, o botão minimize-btn vira "fechar" via JS. CSS hide se mobile. */
@media (max-width: 768px) {
    /* Esconde estado minimized em mobile — não deve mais aparecer */
    #district-card.dc-minimized { display: none !important; }
}

/* V2 F9: esconder label flutuante do distrito quando DC aberto em mobile.
   Evita 3ª camada visual sobreposta. */
@media (max-width: 768px) {
    body:has(#district-card:not(.dc-closed)) .nv-district-label {
        display: none;
    }

    /* Charts */
    #charts-area { grid-template-columns: 1fr; }

    /* Table */
    .table-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    #table-search { width: 100%; font-size: 16px; }
    #table-search:focus { width: 100%; }

    /* Inputs — prevent iOS zoom */
    .em-field select,
    .em-field input,
    .dc-select,
    #cp-input {
        font-size: 16px;
    }

    /* Models grid */
    .models-grid { grid-template-columns: 1fr; }
    .buyer-grid { grid-template-columns: 1fr; }
    .em-row { grid-template-columns: 1fr; }

    /* Map controls */
    #map-controls {
        bottom: calc(var(--nav-height) + 16px + 70px);
    }

    /* Command palette */
    .cp-card {
        max-width: calc(100vw - 16px);
    }

    /* Leaflet zoom */
    .leaflet-control-zoom {
        margin-bottom: 80px !important;
        margin-top: 70px !important;
    }
}

@media (max-width: 480px) {
    #search-pill { width: calc(100% - 24px); }
    .mc-chip { padding: 4px 8px; }
    .mc-value { font-size: 0.8rem; }
    #legend-card { min-width: 140px; padding: 8px 10px; }
    .bn-item { padding: 6px 8px; min-width: 42px; }
    .ob-card { width: calc(100vw - 24px); }

    /* Sidebar: constrain panel so toggle button stays on-screen */
    .isb-panel { width: calc(100vw - 44px); max-width: calc(100vw - 44px); }

    /* Quadra detail: single column on very small screens */
    .qd-grid { grid-template-columns: 1fr; }

    /* Quadra table: allow horizontal scroll */
    .qd-table-wrap { overflow-x: auto; }

    /* Close buttons: min 44px touch target */
    .dc-close, .em-close { min-width: 44px; min-height: 44px; font-size: 1.4rem; }

    /* Metric chips: hide value label to save space */
    .mc-chip { min-width: 36px; }
}

/* =========================================
   Login overlay — iOS keyboard handling
   Override inline align-items:center so the form
   stays visible when the soft keyboard opens.
   ========================================= */
@media (max-width: 768px) {
    #login-overlay {
        align-items: flex-start !important;
        padding: 24px 12px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #login-overlay > div {
        margin-top: max(env(safe-area-inset-top, 0px), 8px);
        padding: 28px 22px !important;
        width: 100% !important;
        max-width: 360px !important;
    }
    #login-overlay input {
        font-size: 16px !important; /* prevent iOS auto-zoom on focus */
    }
}

/* Sidebar backdrop — shown when sidebar open on mobile */
#isb-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 859;
}
#isb-backdrop.isb-bd-visible { display: block; }

/* =========================================
   COMPATIBILITY — Old elements referenced by map.js
   ========================================= */

/* Map search (map.js references) */
#map-search-results {
    display: none;
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    max-width: calc(100vw - 32px);
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    overflow: hidden;
    max-height: 340px;
    overflow-y: auto;
    z-index: 810;
}
#map-search-results.open { display: block; }
.search-result-item {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.active { background: #eff6ff; }
.search-result-name { font-size: 0.82rem; font-weight: 500; color: #1e293b; }
.search-result-district { font-size: 0.7rem; color: #64748b; font-weight: 400; }
.search-result-value { font-size: 0.72rem; font-weight: 600; color: #3b82f6; white-space: nowrap; flex-shrink: 0; }

/* Old panel/detail elements that might be referenced */
.panel { display: none; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-item { padding: 8px; }
.detail-label { display: block; font-size: 0.65rem; color: var(--text-muted); }
.detail-value { display: block; font-size: 1rem; font-weight: 600; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.info-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 13px; height: 13px; border-radius: 50%;
    background: #9ca3af; color: #fff;
    font-size: 0.55rem; font-weight: 700; font-style: italic;
    cursor: help; vertical-align: middle; margin-left: 3px;
}

/* Shortcut hint (hidden in new design) */
.shortcut-hint { display: none; }

/* Indicator desc (hidden) */
.indicator-desc { display: none; }
.indicator-desc:empty { display: none; }

/* Toggle label for metro */
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; cursor: pointer; }

/* =========================================
   SPRINT 4 — Mobile Polish
   ========================================= */

/* Simulador: stack form fields side-by-side → single column */
@media (max-width: 768px) {
    .sim-row { flex-direction: column; }
    .cv-export-btn {
        min-height: 44px;
        padding: 8px 14px;
    }
    .dc-export-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    /* Tooltip boxes: ensure text wraps in small model cards */
    .est-tip-box {
        font-size: 0.72rem;
        padding: 6px 8px;
        word-break: break-word;
    }

    /* District card: reduce multi-col grids to single col */
    .dc-detail-grid {
        grid-template-columns: 1fr;
    }

    /* Simulador: bottom-sheet + scrollable table */
    #simulador-modal {
        align-items: flex-end;
    }
    .sim-card {
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 88vh;
    }
    .sim-body { padding: 12px; }
    .sim-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Comparador: bottom-sheet + stacked columns */
    #comparador-modal {
        align-items: flex-end;
    }
    .comparador-card {
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 88vh;
    }
    .comparador-body { padding: 12px; }
    #comparador-grid {
        grid-template-columns: 1fr !important;
    }
    .comparador-radar { height: 220px; }

    /* Comparador panel: wrap when many badges */
    #comparador-panel {
        flex-wrap: wrap;
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }
    .comp-badges { flex-wrap: wrap; }

    /* Command palette: full-width */
    .cp-card { width: calc(100vw - 16px); }

    /* Fix 1: Column selector dropdown — alinhar à esquerda em mobile */
    .table-col-dropdown {
        right: auto;
        left: 0;
    }

    /* Fix 2: Botão hamburguer sidebar — descer para não sobrepor zoom do mapa */
    .isb-toggle {
        top: 140px !important;
    }

    /* Fix 3: Legendas do mapa — reduzir em mobile */
    #legend-card {
        max-width: 160px;
        font-size: 0.6rem;
        padding: 6px 10px;
    }
    .metro-legend {
        max-width: 160px;
        font-size: 0.68rem;
        padding: 8px 12px;
    }
}

/* ── Botão minimizar legendas ── */
.legend-minimize-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(0,0,0,0.08);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    line-height: 1;
    transition: background 0.15s;
}
.legend-minimize-btn:hover { background: rgba(0,0,0,0.15); }
#legend-card { position: fixed; }
#legend-card.legend-minimized .lc-bar,
#legend-card.legend-minimized #legend-items,
#legend-card.legend-minimized .lc-avg { display: none; }
#legend-card.legend-minimized { padding: 4px 10px; min-width: 0; }

/* Metro legend minimize */
.metro-legend-minimize-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.metro-legend-minimize-btn:hover { background: rgba(255,255,255,0.2); }
.metro-legend.metro-minimized .metro-legend-title,
.metro-legend.metro-minimized .metro-legend-group,
.metro-legend.metro-minimized .metro-legend-item { display: none; }
.metro-legend.metro-minimized { padding: 6px 12px; }
.metro-legend-collapsed-label {
    display: none;
    font-size: 0.7rem;
    color: #60a5fa;
    font-weight: 600;
}
.metro-legend.metro-minimized .metro-legend-collapsed-label { display: block; }

/* ═══════════════════════════════════════════════════════════
   UX POLISH — Sprint 5 (2026-04-07)
   Skeleton loaders, empty states, button feedback, transitions
   ═══════════════════════════════════════════════════════════ */

/* Skeleton loader animation */
@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}
.skeleton-row {
    height: 14px;
    margin: 6px 0;
    border-radius: 4px;
}
.skeleton-row.short { width: 60%; }
.skeleton-row.medium { width: 80%; }
.skeleton-row.full { width: 100%; }

/* Empty state — "Dados insuficientes" pill */
.no-data-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #64748b;
    background: rgba(100,116,139,0.1);
    border: 1px solid rgba(100,116,139,0.2);
    border-radius: 10px;
    padding: 1px 6px;
    white-space: nowrap;
}

/* Button active feedback — scale + subtle shadow */
.bn-item:active,
.mc-btn:active,
.cv-tab-btn:active,
.est-btn:active {
    transform: scale(0.95);
    transition: transform 0.08s ease;
}

/* Panel slide-in transitions */
#district-card {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}
#district-card.dc-visible {
    transform: translateX(0);
    opacity: 1;
}

/* Table column dropdown wider for new columns */
.table-col-dropdown {
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
}

/* Smooth chart container fade on tab switch */
.cv-chart-wrapper {
    transition: opacity 0.15s ease;
}
.cv-chart-wrapper.loading {
    opacity: 0.4;
}

/* Tooltip hover pop effect */
.info-tip:hover::before {
    transform: scale(1.15);
    transition: transform 0.15s ease;
}

/* Comparar view smooth open */
#comparar-view:not(.cv-hidden) {
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   FAQ MODAL (Perguntas & Respostas)
   ========================================= */
#faq-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    transition: opacity 0.15s;
}
#faq-modal.faq-hidden {
    opacity: 0;
    pointer-events: none;
}
.faq-overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
}
.faq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-card);
}
.faq-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.faq-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.faq-header-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.faq-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.faq-close:hover {
    background: var(--danger, #e11d48);
    color: #fff;
}
.faq-search-row {
    padding: 16px 24px 8px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.faq-search-wrap {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}
.faq-search-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
#faq-search {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
#faq-search:focus {
    border-color: var(--primary);
}
#faq-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 24px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
#faq-categories::-webkit-scrollbar { display: none; }
.faq-chip {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.faq-chip span {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 4px;
    border-radius: 6px;
    background: rgba(0,0,0,0.08);
    font-size: 0.7rem;
    font-weight: 700;
}
.faq-chip:hover { background: var(--border); }
.faq-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.faq-chip.active span {
    background: rgba(255,255,255,0.25);
    color: #fff;
}
.faq-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px calc(var(--nav-height, 60px) + 40px);
}
#faq-results {
    max-width: 760px;
    margin: 0 auto;
}
.faq-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.faq-cat-group {
    margin-bottom: 24px;
}
.faq-cat-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.faq-cat-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 1px 8px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.faq-item[open] {
    border-color: var(--primary);
}
.faq-item summary {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text);
    user-select: none;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
    content: '▸';
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.15s;
    flex-shrink: 0;
}
.faq-item[open] summary::before { transform: rotate(90deg); }
.faq-q { flex: 1; }
.faq-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--primary);
    color: #fff;
}
.faq-badge-free {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.faq-a {
    padding: 4px 16px 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}
.faq-link {
    padding: 0 16px 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.faq-link code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.75rem;
}
body.faq-open { overflow: hidden; }

/* Mobile */
@media (max-width: 640px) {
    .faq-header { padding: 12px 16px; }
    .faq-search-row { padding: 12px 16px 6px; }
    #faq-categories { padding: 8px 16px; }
    .faq-body { padding: 12px 16px calc(var(--nav-height, 60px) + 32px); }
    .faq-item summary { padding: 10px 12px; font-size: 0.88rem; }
    .faq-a { padding: 4px 12px 14px; font-size: 0.85rem; }
}

/* Reliability badges (Plano B Fase 4 — cr_iqr, margem_erro, n_revendas) */
.dc-badge-conf {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    vertical-align: middle;
    letter-spacing: 0.02em;
    cursor: help;
}
.dc-badge-conf:empty { display: none; }
.dc-badge-green  { background: rgba(34, 197, 94, 0.12);  color: #166534; border: 1px solid rgba(34, 197, 94, 0.35); }
.dc-badge-yellow { background: rgba(234, 179, 8, 0.15);  color: #854d0e; border: 1px solid rgba(234, 179, 8, 0.35); }
.dc-badge-red    { background: rgba(239, 68, 68, 0.12);  color: #991b1b; border: 1px solid rgba(239, 68, 68, 0.35); }

/* Issue #139: FN > 100% (raro). Cor amber sutil + cursor help indicando tooltip
   nativo (HTML title attribute). Nao e erro -- sinal real de mercado em correcao. */
.cr-mercado-acima {
    color: #b45309;
    cursor: help;
    border-bottom: 1px dotted rgba(180, 83, 9, 0.5);
}

/* ============================================================
   Issue #198 fix DEFINITIVO (2026-05-15) — Leaflet pane position
   ============================================================
   Em alguns ambientes (Edge InPrivate, Chrome MCP background tab,
   service worker contexts), as regras de `leaflet.css` para
   `.leaflet-pane { position: absolute }` falham em aplicar no
   computed style apesar de a stylesheet estar carregada. Resultado:
   panes empilham como divs static em fluxo de bloco — o overlay
   (polígonos do choropleth) renderiza ABAIXO do tile pane, fora
   do viewport visual do mapa.

   Diagnóstico via Chrome MCP confirmou:
   - Paths SVG existem no DOM (96 paths com fill correto)
   - `leaflet-overlay-pane` em `top: 2080px, position: static`
   - Setando `position:absolute; top:0; left:0` via JS faz mapa
     renderizar imediatamente

   Fix: replicar regras críticas com `!important` defensivo.
   Custo: zero (alinha com Leaflet defaults). Benefício: blindagem
   contra environments que perdem o cascade de leaflet.css.
   ============================================================ */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
}

.leaflet-tile-pane    { z-index: 200 !important; }
.leaflet-overlay-pane { z-index: 400 !important; }
.leaflet-shadow-pane  { z-index: 500 !important; }
.leaflet-marker-pane  { z-index: 600 !important; }
.leaflet-tooltip-pane { z-index: 650 !important; }
.leaflet-popup-pane   { z-index: 700 !important; }
.leaflet-map-pane canvas { z-index: 100 !important; }
.leaflet-map-pane svg    { z-index: 200 !important; }
.leaflet-container { overflow: hidden !important; }

/* ============================================================
   Issue #210 fix (2026-05-15) — pointer-events em paths interativos
   ============================================================
   Mesma classe de defesa que o fix #198: em ambientes onde a
   cascade de leaflet.css falha (Edge InPrivate, contextos isolados),
   a regra leaflet `.leaflet-pane > svg path.leaflet-interactive
   { pointer-events: auto }` deixa de aplicar. O SVG container tem
   atributo `pointer-events="none"` (Leaflet padrão) que normalmente
   é overridado pelo CSS — quando o CSS não aplica, paths herdam
   `pointer-events: none` e ficam não-clicáveis. Resultado: mapa
   parece ok mas clicar nos polígonos não abre o DC.

   Replicamos a regra com !important pra blindar contra o problema.
   ============================================================ */
.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
    pointer-events: visiblePainted !important;
}

/* ============================================================
   Issue #210 fix (2026-05-15) — district labels span defensive CSS
   ============================================================
   Mesma natureza do fix de pointer-events acima: em ambientes
   onde a cascade falha, `.nv-district-label span` perde os
   atributos `display: inline-block` e `transform: translate(-50%, -50%)`,
   colapsando o span pra 0x0 (texto presente mas invisível).
   Sintoma reportado pelo usuário: "nomes dos distritos somem do mapa".

   Aplica !important pra garantir que os labels permaneçam visíveis
   independente da ordem de carregamento de stylesheets ou de
   contextos isolados. NOTA: text-shadow continua sem !important
   (visual decorativo, não afeta layout).
   ============================================================ */
.nv-district-label span {
    display: inline-block !important;
    transform: translate(-50%, -50%) !important;
}

/* ============================================================
   Toast (pre go-live UX fix 2026-05-17, Bug #6 plano UX)
   Singleton atualizável — não stack. Em mobile, full-width responsivo.
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;  /* container não bloqueia clicks, mas .toast restaura */
}
.toast {
    background: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
    max-width: 360px;
    display: flex;
    gap: 12px;
    align-items: center;
    font-family: Inter, -apple-system, sans-serif;
    font-size: 14px;
    color: #0f172a;
    pointer-events: auto;  /* .toast aceita interações (close button) */
    border-left: 4px solid #2563eb;  /* default info */
    transition: opacity 0.25s ease;
}
.toast-info    { border-left-color: #2563eb; }
.toast-warning { border-left-color: #f59e0b; }
.toast-error   { border-left-color: #dc2626; }
.toast-success { border-left-color: #10b981; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    padding: 0 4px;
}
.toast-close:hover { color: #0f172a; }
.toast-hiding { opacity: 0; }
@media (max-width: 480px) {
    #toast-container { left: 12px; right: 12px; bottom: 12px; }
    .toast { max-width: none; }
}

