/* =============================================================
   Mapa Brasil - Estilos globais
   Temas: dark (padrão) e light
   Responsivo: mobile, tablet, desktop e telas grandes
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* =========================================================
   GLOBAL — TEXTO EM CAIXA ALTA
   ========================================================= */

/* =========================================================
   GLOBAL — TEXTO EM CAIXA ALTA
   ========================================================= */

body,
body * {
    text-transform: uppercase;
}

/* Mantém campos digitáveis sem forçar caixa alta */
input,
textarea,
select,
option {
    text-transform: none;
}

/* Elementos SVG do mapa também em caixa alta */
.map-state text,
.state-label,
svg text {
    text-transform: uppercase;
}

body {
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    transition: background-color .3s ease, color .3s ease;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

:root {
    --bg: #081427;
    --bg-elevated: #0d1c34;
    --bg-card: #1a2942;
    --bg-card-alt: #15243a;
    --border: #19406e;
    --border-soft: rgba(255, 255, 255, .06);

    --text: #f8fafc;
    --text-soft: #dbe4f0;
    --text-muted: #8aa2c1;

    --primary: #59d216;
    --primary-dark: #3ea50a;
    --primary-soft: rgba(89, 210, 22, .16);
    --primary-light: #dff7d0;

    --success: #22c55e;
    --danger: #ef4444;

    --radius-xs: .45rem;
    --radius-sm: .6rem;
    --radius: .9rem;
    --radius-lg: 1.2rem;

    --shadow-sm: 0 6px 20px rgba(0, 0, 0, .18);
    --shadow: 0 10px 30px rgba(0, 0, 0, .28);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .38);

    --map-empty: #cbd5e1;
    --map-empty-alt: #e2e8f0;
    --map-stroke: #f8fafc;

    --green-1: #dff7d0;
    --green-2: #b9ee98;
    --green-3: #8ee15e;
    --green-4: #59d216;
    --green-5: #2ea207;

    --overlay: rgba(2, 8, 23, .72);
    --scrollbar: #344764;

    --container: 1800px;
    --header-height: 64px;
}

body.light,
body.theme-light {
    --bg: #f4f7fb;
    --bg-elevated: #eef3f9;
    --bg-card: #ffffff;
    --bg-card-alt: #f7f9fc;
    --border: #dbe5f1;
    --border-soft: rgba(15, 23, 42, .06);

    --text: #0f172a;
    --text-soft: #1e293b;
    --text-muted: #64748b;

    --primary: #4fc512;
    --primary-dark: #399709;
    --primary-soft: rgba(79, 197, 18, .12);
    --primary-light: #ecfadf;

    --shadow-sm: 0 4px 18px rgba(15, 23, 42, .05);
    --shadow: 0 10px 30px rgba(15, 23, 42, .08);
    --shadow-lg: 0 18px 50px rgba(15, 23, 42, .12);

    --map-empty: #cbd5e1;
    --map-empty-alt: #dbe5ef;
    --map-stroke: #ffffff;

    --green-1: #eafadc;
    --green-2: #c7f3a7;
    --green-3: #96e46c;
    --green-4: #4fc512;
    --green-5: #2e930a;

    --overlay: rgba(15, 23, 42, .45);
    --scrollbar: #c6d2df;
}

body.theme-dark {
    --bg: #081427;
    --bg-elevated: #0d1c34;
    --bg-card: #1a2942;
    --bg-card-alt: #15243a;
    --border: #19406e;
    --border-soft: rgba(255, 255, 255, .06);

    --text: #f8fafc;
    --text-soft: #dbe4f0;
    --text-muted: #8aa2c1;

    --primary: #59d216;
    --primary-dark: #3ea50a;
    --primary-soft: rgba(89, 210, 22, .16);
    --primary-light: #dff7d0;

    --shadow-sm: 0 6px 20px rgba(0, 0, 0, .18);
    --shadow: 0 10px 30px rgba(0, 0, 0, .28);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .38);

    --map-empty: #344764;
    --map-empty-alt: #24354d;
    --map-stroke: #0b1729;

    --green-1: #dff7d0;
    --green-2: #b9ee98;
    --green-3: #8ee15e;
    --green-4: #59d216;
    --green-5: #2ea207;

    --overlay: rgba(2, 8, 23, .72);
    --scrollbar: #344764;
}

body {
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.025), transparent 24%),
        radial-gradient(circle at top right, rgba(255,255,255,.02), transparent 20%),
        var(--bg);
    color: var(--text);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 999px;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--header-height);
    background: color-mix(in srgb, var(--bg-card) 86%, transparent);
    border-bottom: 1px solid var(--border-soft);
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: var(--container);
    min-height: var(--header-height);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
}

.header-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    line-height: 0;
    flex-shrink: 1;
}

.header-brand-logo {
    display: block;
    width: auto;
    height: 36px;
    max-width: min(52vw, 220px);
    object-fit: contain;
}

.logo-dark,
.logo-light {
    display: none;
}

body.theme-dark .logo-dark,
body:not(.light):not(.theme-light) .logo-dark {
    display: block;
}

body.light .logo-light,
body.theme-light .logo-light {
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 40px;
    padding: .65rem 1rem;
    border-radius: .75rem;
    border: 1px solid transparent;
    font-size: .875rem;
    font-weight: 700;
    white-space: nowrap;
    transition: transform .15s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 10px 22px rgba(0, 0, 0, .22);
}

.btn-secondary {
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
}

.btn-danger {
    background: color-mix(in srgb, var(--danger) 12%, var(--bg-card-alt));
    border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.participants-actions-col,
.participants-row-actions {
    text-align: center;
    width: 110px;
}

.participants-row-actions form {
    display: flex;
    justify-content: center;
}

.btn-hide-lead {
    min-height: 34px;
    padding: .45rem .75rem;
    font-size: .78rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: .75rem;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.app-main {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
}

.stat-card {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 96%, white 4%), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .9rem;
    box-shadow: var(--shadow-sm);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-content {
    min-width: 0;
}

.stat-label {
    margin-bottom: .35rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-value {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.stat-desc {
    margin-top: .3rem;
    font-size: .78rem;
    color: var(--text-muted);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.map-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.map-card,
.ranking-card,
.legend {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.map-card {
    position: relative;
    overflow: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .8rem;
    min-width: 0;
}

.map-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, var(--primary) .8px, transparent 0);
    background-size: 28px 28px;
    opacity: .03;
    pointer-events: none;
}

.section-title {
    position: relative;
    z-index: 1;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.map-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 760 / 700;
    min-height: 280px;
}

.map-wrapper svg {
    width: 100%;
    height: 100%;
}

.map-state path,
.map-state polygon,
.map-state rect,
.map-state ellipse {
    fill: var(--map-empty);
    stroke: var(--map-stroke);
    stroke-width: .9;
    transition: fill .35s ease, filter .18s ease, stroke .18s ease, transform .18s ease;
    cursor: pointer;
}

.map-state:hover path,
.map-state:hover polygon,
.map-state:hover rect,
.map-state:hover ellipse {
    filter: brightness(1.06);
    stroke: color-mix(in srgb, var(--primary) 55%, var(--map-stroke));
    stroke-width: 1.2;
}

.map-state.active path,
.map-state.active polygon,
.map-state.active rect,
.map-state.active ellipse {
    stroke: var(--primary);
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, .18));
}

.state-label {
    fill: rgba(255, 255, 255, .52);
    font-family: 'Inter', sans-serif;
    letter-spacing: .3px;
    user-select: none;
    pointer-events: none;
}

body.light .state-label,
body.theme-light .state-label {
    fill: rgba(15, 23, 42, .40);
}

.map-state.has-data .state-label {
    fill: rgba(9, 34, 0, .76);
}

.map-tooltip {
    position: fixed;
    z-index: 9999;
    min-width: 168px;
    max-width: min(280px, calc(100vw - 24px));
    padding: .75rem .9rem;
    border-radius: .8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s ease, transform .12s ease;
    transform: translateY(4px);
}

.map-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-name {
    font-size: .95rem;
    font-weight: 800;
    color: var(--primary);
}

.tooltip-uf {
    margin-top: .1rem;
    font-size: .72rem;
    color: var(--text-muted);
}

.tooltip-row {
    margin-top: .55rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.tooltip-key {
    font-size: .75rem;
    color: var(--text-muted);
}

.tooltip-val {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text);
}

.ranking-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    max-height: 540px;
}

.ranking-header {
    padding: .95rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.ranking-header h2 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: .2rem .65rem;
    border-radius: 999px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.ranking-list {
    flex: 1;
    overflow-y: auto;
    padding: .6rem;
}

.ranking-item {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .7rem;
    border-radius: .75rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}

.ranking-item + .ranking-item {
    margin-top: .35rem;
}

.ranking-item:hover {
    background: var(--bg-card-alt);
    border-color: var(--border);
    transform: translateY(-1px);
}

.ranking-item.active {
    background: color-mix(in srgb, var(--primary-soft) 100%, transparent);
    border-color: color-mix(in srgb, var(--primary) 50%, var(--border));
}

.ranking-item-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.uf-badge {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 800;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all .2s ease;
}

.ranking-item.active .uf-badge {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.ranking-info {
    min-width: 0;
}

.ranking-nome {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-regiao {
    margin-top: .1rem;
    font-size: .72rem;
    color: var(--text-muted);
}

.ranking-count {
    font-size: .95rem;
    font-weight: 800;
    color: var(--text);
    flex-shrink: 0;
}

.ranking-item.active .ranking-count {
    color: var(--primary);
}

.ranking-bar {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg-card-alt);
}

.ranking-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-2), var(--green-4));
    transition: width .45s ease;
}

.ranking-footer {
    padding: .7rem 1rem;
    border-top: 1px solid var(--border-soft);
    font-size: .74rem;
    text-align: center;
    color: var(--text-muted);
}

.legend {
    padding: .85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1rem;
}

.legend-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .74rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, .08);
    flex-shrink: 0;
}

.legend-dot.zero { background: var(--map-empty); }
.legend-dot.range-1 { background: var(--green-1); }
.legend-dot.range-2 { background: var(--green-2); }
.legend-dot.range-3 { background: var(--green-3); }
.legend-dot.range-4 { background: var(--green-4); }
.legend-dot.range-5 { background: var(--green-5); }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    width: 100%;
    max-width: 520px;
    margin: auto;
    padding: 1.2rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-24px);
    transition: transform .25s ease;
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-header {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: .7rem;
    background: var(--bg-card-alt);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color .2s ease, color .2s ease;
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.modal-close svg {
    width: 16px;
    height: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .38rem;
}

.form-label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text);
}

.form-label span {
    color: var(--primary);
}

.form-control {
    width: 100%;
    min-height: 44px;
    padding: .7rem .85rem;
    border-radius: .7rem;
    border: 1px solid var(--border);
    background: var(--bg-card-alt);
    color: var(--text);
    outline: none;
    appearance: none;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.form-control.error {
    border-color: var(--danger);
}

.form-error {
    display: none;
    margin-top: .1rem;
    font-size: .74rem;
    color: var(--danger);
}

.form-error.visible {
    display: block;
}

.form-feedback {
    display: none;
    margin-bottom: .75rem;
    padding: .75rem .9rem;
    border-radius: .75rem;
    font-size: .84rem;
    font-weight: 600;
}

.form-feedback.success {
    display: block;
    color: var(--success);
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .2);
}

.form-feedback.error {
    display: block;
    color: var(--danger);
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .2);
}

.form-actions {
    margin-top: .25rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
}

.form-actions .btn {
    width: 100%;
}

.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.32);
    border-top-color: #fff;
    border-radius: 999px;
    animation: spin .6s linear infinite;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading .btn-text {
    display: none;
}

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

.app-footer {
    margin-top: 1rem;
    padding: .8rem 1rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-soft);
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem 1rem;
    font-size: .74rem;
    color: var(--text-muted);
}

@media (min-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-brand-logo {
        height: 40px;
    }
}

@media (min-width: 768px) {
    :root {
        --header-height: 50px;
    }

    .header-inner {
        padding: 0 1.5rem;
    }

    .app-main {
        padding: 1.4rem 1.5rem 2.5rem;
        gap: 1.25rem;
    }

    .stats-grid {
        gap: 1rem;
    }

    .stat-card {
        padding: 1.15rem 1.2rem;
    }

    .map-card {
        padding: 1.2rem;
    }

    .ranking-card {
        max-height: 640px;
    }

    .modal {
        padding: 1.4rem;
    }

    .legend {
        padding: 1rem 1.1rem;
    }
}

@media (min-width: 1024px) {
    .header-inner {
        padding: 0 2rem;
    }

    .app-main {
        padding: 1.8rem 2rem 3rem;
        gap: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .map-section {
        grid-template-columns: minmax(0, 2fr) minmax(300px, 340px);
        align-items: start;
    }

    .map-card {
        min-height: 720px;
    }

    .ranking-card {
        position: sticky;
        top: calc(var(--header-height) + 1rem);
        max-height: calc(100vh - var(--header-height) - 2rem);
    }

    .header-brand-logo {
        height: 25px;
        max-width: 240px;
    }
    
    .map-wrapper svg {
    width: 100%;
    height: 100%;
}
}

@media (min-width: 1360px) {
    .map-section {
        grid-template-columns: minmax(0, 1.8fr) minmax(340px, 380px);
    }

    .map-card {
        min-height: 760px;
    }

    .ranking-card {
        max-height: 760px;
    }
    
}

@media (min-width: 1800px) {
    html {
        font-size: 17px;
    }

    .app-main {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }

    .stats-grid {
        gap: 1.25rem;
    }

    .map-section {
        gap: 1.25rem;
    }
}

@media (max-width: 767px) {
    .header-inner {
        min-height: 60px;
    }

    .header-actions {
        gap: .45rem;
    }

    .btn {
        min-height: 38px;
        padding: .58rem .9rem;
    }

    .btn-primary {
        font-size: .82rem;
    }

    .stat-card {
        padding: .95rem;
    }

    .map-wrapper {
        min-height: 240px;
        aspect-ratio: 1 / 1;
    }

    .ranking-header {
        padding: .85rem .9rem;
    }

    .ranking-list {
        padding: .5rem;
    }

    .legend {
        gap: .5rem .8rem;
    }

    .modal-overlay {
        padding: .75rem;
    }

    .modal {
        padding: 1rem;
        border-radius: 1rem;
    }

    .map-tooltip {
        min-width: 148px;
        padding: .65rem .75rem;
    }
}

@media (max-width: 575px) {
    .header-brand-logo {
        height: 30px;
        max-width: 160px;
    }

    .header-actions .btn-primary {
        display: none;
    }

    .stat-label {
        font-size: .68rem;
    }

    .stat-value {
        font-size: 1.7rem;
    }

    .stat-desc {
        font-size: .74rem;
    }

    .uf-badge {
        width: 32px;
        height: 32px;
        font-size: .68rem;
    }

    .ranking-nome {
        font-size: .82rem;
    }

    .ranking-count {
        font-size: .88rem;
    }

    .section-title {
        font-size: .7rem;
    }
}

@media (max-width: 375px) {
    .header-inner {
        padding: 0 .8rem;
    }

    .app-main {
        padding: .9rem .8rem 1.5rem;
    }

    .stat-card {
        gap: .7rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

    .map-card,
    .ranking-card,
    .legend {
        border-radius: .8rem;
    }

    .modal {
        padding: .9rem;
    }

    .modal-header h2 {
        font-size: 1rem;
    }
}

/* =============================================================
   Gráficos
   ============================================================= */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chart-card-header {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-soft);
}

.chart-card-header h2 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.chart-card-body {
    padding: 1rem 1.1rem 1.2rem;
}

.chart {
    width: 100%;
    min-height: 320px;
}

.chart-empty {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: .9rem;
}

.chart-vertical {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    min-height: 320px;
    padding: 1rem .5rem 0;
    border-bottom: 1px dashed var(--border-soft);
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.chart-col-value {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.chart-col-bar-wrap {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: end;
    justify-content: center;
}

.chart-col-bar {
    width: min(38px, 100%);
    border-radius: .5rem .5rem 0 0;
    background: linear-gradient(180deg, var(--green-3), var(--green-4));
    min-height: 2px;
    transition: height .35s ease;
}

.chart-col-label {
    font-size: .76rem;
    color: var(--text-muted);
    text-align: center;
}

.chart-horizontal {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
    padding-top: .25rem;
}

.chart-row {
    display: grid;
    grid-template-columns: 220px 1fr 70px;
    align-items: center;
    gap: 1rem;
}

.chart-row-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
}

.chart-row-track {
    width: 100%;
    height: 36px;
    background: var(--bg-card-alt);
    border-radius: .5rem;
    overflow: hidden;
    position: relative;
}

.chart-row-bar {
    height: 100%;
    border-radius: .5rem;
    background: linear-gradient(90deg, var(--green-3), var(--green-4));
    min-width: 2px;
    transition: width .35s ease;
}

.chart-row-value {
    font-size: .82rem;
    font-weight: 800;
    color: var(--text);
    text-align: right;
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767px) {
    .chart-row {
        grid-template-columns: 1fr;
        gap: .45rem;
    }

    .chart-row-value {
        text-align: left;
    }

    .chart-vertical {
        gap: .65rem;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: .5rem;
    }

    .chart-col {
        min-width: 62px;
    }
}
/* =============================================================
   Login / Autenticação
   ============================================================= */
.login-page {
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(34, 88, 150, .24), transparent 34%), var(--bg-main, #071426);
    color: var(--text-primary, #f8fafc);
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg, #14233a);
    border: 1px solid var(--border-color, rgba(96, 165, 250, .25));
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
    padding: 2rem;
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    max-width: 170px;
    height: auto;
}

.login-copy {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-copy h1 {
    margin: 0 0 .45rem;
    font-size: 1.55rem;
    font-weight: 800;
}

.login-copy p {
    margin: 0;
    color: var(--text-muted, #94a3b8);
    font-size: .95rem;
}

.login-alert {
    background: rgba(239, 68, 68, .12);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, .35);
    padding: .85rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.login-form {
    display: grid;
    gap: 1rem;
}

.login-field {
    display: grid;
    gap: .45rem;
}

.login-field label {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted, #94a3b8);
}

.login-field input {
    width: 100%;
    border: 1px solid var(--border-color, rgba(96, 165, 250, .25));
    background: rgba(15, 23, 42, .66);
    color: var(--text-primary, #f8fafc);
    border-radius: 14px;
    padding: .95rem 1rem;
    outline: none;
    font-size: 1rem;
}

.login-field input:focus {
    border-color: rgba(34, 197, 94, .75);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
}

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

.password-field input {
    padding-right: 3.25rem;
}

.password-toggle {
    position: absolute;
    right: .55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: rgba(34, 197, 94, .12);
    color: #22c55e;
    outline: none;
}

.password-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

.password-toggle .icon-eye-off {
    display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
    display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
    display: block;
}

.login-button {
    border: 0;
    background: #22c55e;
    color: #06230f;
    border-radius: 14px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease;
}

.login-button:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.btn-logout {
    text-decoration: none;
    min-height: 38px;
}

/* Multi-cliente / multi-projeto */
.project-context {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .35rem .75rem;
    border: 1px solid var(--border-color, rgba(255,255,255,.12));
    border-radius: 999px;
    font-size: .78rem;
    line-height: 1.1;
    white-space: nowrap;
}

.project-context .project-client {
    opacity: .72;
    font-size: .72rem;
}

.project-switcher select {
    min-width: 220px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border-color, rgba(255,255,255,.12));
    background: var(--card-bg, rgba(255,255,255,.08));
    color: var(--text-color, inherit);
    padding: 0 .85rem;
    outline: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.charts-dinamicos:empty {
    display: none;
}

@media (max-width: 760px) {
    .project-context {
        display: none;
    }

    .project-switcher select {
        min-width: 160px;
        max-width: 52vw;
    }
}

/* =============================================================
   Navegacao superior da pagina + pagina de participantes
   ============================================================= */
.app-shell {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.app-shell > .app-main {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 0 2rem;
    min-width: 0;
}


.app-sidebar {
    display: none;
}

.page-hero-title {
    min-width: 0;
}

.page-tabs {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.page-tab {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 42px;
    border-radius: .8rem;
    padding: .68rem .9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 850;
    box-shadow: var(--shadow-sm);
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}

.page-tab:hover {
    background: var(--bg-card-alt);
    color: var(--text);
    transform: translateY(-1px);
}

.page-tab.active {
    background: var(--primary-soft);
    border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
    color: var(--primary);
}

.page-tab svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
}

.app-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    align-self: start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: .75rem;
}

.sidebar-nav {
    display: grid;
    gap: .45rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    border-radius: .75rem;
    padding: .75rem .85rem;
    color: var(--text-muted);
    font-size: .93rem;
    font-weight: 800;
    transition: background .2s ease, color .2s ease, transform .15s ease;
}

.sidebar-link:hover {
    background: var(--bg-card-alt);
    color: var(--text);
    transform: translateY(-1px);
}

.sidebar-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.page-hero {
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--bg-card)), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.page-hero .eyebrow {
    display: inline-flex;
    margin-bottom: .35rem;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.page-hero h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.05;
    color: var(--text);
}

.page-hero p {
    margin-top: .45rem;
    color: var(--text-muted);
    font-size: .95rem;
}

.hero-metrics {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.hero-metric {
    min-width: 110px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: .8rem 1rem;
    box-shadow: var(--shadow-sm);
}

.hero-metric strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1;
    color: var(--text);
}

.hero-metric span {
    display: block;
    margin-top: .3rem;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 700;
}


 .participantes-hero {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(560px, 1.25fr);
    align-items: center;
    gap: clamp(1rem, 2.4vw, 2rem);
}

.participantes-hero .page-hero-title {
    min-width: 0;
}

.hero-insights {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, .42fr);
    align-items: stretch;
    gap: .9rem;
}

.hero-summary {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: .9rem;
}

.summary-table-card {
    min-width: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 96%, white 4%), var(--bg-card));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: .95rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.summary-card-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .55rem;
}

.summary-card-icon {
    width: 26px;
    height: 26px;
    border-radius: .7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .72rem;
    font-weight: 950;
    line-height: 1;
}

.summary-table-card h2 {
    margin: 0;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.summary-table-card table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table-card tr + tr th,
.summary-table-card tr + tr td {
    border-top: 1px solid var(--border-soft);
}

.summary-table-card th,
.summary-table-card td {
    padding: .42rem 0;
    color: var(--text);
    font-size: .88rem;
    line-height: 1.2;
}

.summary-table-card th {
    text-align: left;
    font-weight: 800;
}

.summary-table-card td {
    text-align: right;
    font-weight: 950;
    white-space: nowrap;
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(88px, 1fr));
    gap: .9rem;
    align-items: stretch;
}

.hero-metric {
    min-width: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 96%, white 4%), var(--bg-card));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: .95rem 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column-reverse;
    justify-content: center;
    align-items: flex-start;
    gap: .35rem;
}

.hero-metric strong {
    display: block;
    font-size: clamp(1.45rem, 2vw, 1.8rem);
    line-height: 1;
    color: var(--text);
    letter-spacing: -.04em;
}

.hero-metric span {
    display: block;
    margin: 0;
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 850;
    text-transform: lowercase;
}

.participants-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.participants-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-soft);
}

.participants-toolbar h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.participants-toolbar p {
    margin-top: .15rem;
    color: var(--text-muted);
    font-size: .85rem;
}

.participants-search {
    display: grid;
    grid-template-columns: minmax(320px, 420px) auto;
    align-items: center;
    gap: .5rem;
    justify-content: end;
}

.participants-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-content: end;
    gap: .75rem;
    width: min(100%, 880px);
    margin-left: auto;
}

.btn-download-excel {
    justify-self: end;
}

.btn-download-excel svg {
    width: 18px;
    height: 18px;
}

.participants-search input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: .85rem;
    background: var(--bg-card-alt);
    color: var(--text);
    padding: .75rem .9rem;
    outline: none;
}

.participants-search input:focus {
    border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
    box-shadow: 0 0 0 4px var(--primary-soft);
}

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

.participants-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    font-size: .86rem;
}

.participants-table th,
.participants-table td {
    padding: .85rem .9rem;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.participants-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-card-alt);
    color: var(--text);
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.table-sort-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}

.table-sort-link:hover,
.table-sort-link:focus-visible {
    color: var(--primary);
    outline: none;
}

.sort-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    color: var(--text-muted);
    font-size: .72rem;
    line-height: 1;
}

.table-sort-link.active .sort-indicator {
    color: var(--primary);
}

.participants-table td {
    color: var(--text-soft);
}

.participants-table tbody tr:hover {
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.empty-state {
    padding: 2rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem;
    border-top: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: .9rem;
}

.pagination .disabled {
    opacity: .45;
    pointer-events: none;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        gap: .8rem;
        padding: .8rem;
    }

    .app-sidebar {
        position: static;
        padding: .55rem;
        overflow-x: auto;
    }

    .sidebar-nav {
        display: flex;
        min-width: max-content;
    }

    .sidebar-link {
        min-height: 40px;
        padding: .65rem .8rem;
    }

    .page-hero,
    .participants-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-summary {
        width: 100%;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .summary-table-card {
        flex: 1 1 220px;
    }

    .participants-actions {
        width: 100%;
        display: flex;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .participants-search {
        width: 100%;
        display: flex;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .participants-search input {
        width: 100%;
        flex: 1 1 100%;
    }

    .participants-actions .btn-download-excel {
        width: 100%;
        justify-self: stretch;
    }

    .participants-row-actions form,
    .participants-row-actions .btn-hide-lead {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .participants-table-wrap {
        overflow: visible;
        padding: .75rem;
    }

    .participants-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 .75rem;
    }

    .participants-table thead {
        display: none;
    }

    .participants-table,
    .participants-table tbody,
    .participants-table tr,
    .participants-table td {
        display: block;
        width: 100%;
    }

    .participants-table tr {
        background: var(--bg-card-alt);
        border: 1px solid var(--border-soft);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .participants-table td {
        display: grid;
        grid-template-columns: minmax(110px, 42%) minmax(0, 1fr);
        gap: .75rem;
        white-space: normal;
        word-break: break-word;
        padding: .75rem .9rem;
    }

    .participants-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: .72rem;
        font-weight: 900;
        letter-spacing: .04em;
        text-transform: uppercase;
    }

    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 520px) {
    .header-actions {
        gap: .35rem;
    }

    .project-switcher select {
        max-width: 46vw;
    }

    .page-hero {
        padding: 1rem;
    }

    .hero-metrics {
        width: 100%;
        justify-content: stretch;
    }

    .hero-metric {
        flex: 1 1 120px;
    }

    .hero-summary {
        flex-direction: column;
    }

    .summary-table-card {
        width: 100%;
    }
}


/* v5: menu dentro do card de titulo, sem sidebar lateral */
.app-shell {
    grid-template-columns: minmax(0, 1fr);
}
.app-sidebar {
    display: none !important;
}
.dashboard-hero {
    margin-bottom: 1rem;
}
@media (max-width: 980px) {
    .page-tabs {
        width: 100%;
    }
    .page-tab {
        flex: 1 1 150px;
        justify-content: center;
    }
}

/* Ajustes de responsividade para os resumos do topo de Participantes */
@media (max-width: 1200px) {
    .participantes-hero {
        grid-template-columns: 1fr;
    }

    .hero-insights {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .hero-summary,
    .hero-metrics {
        grid-template-columns: 1fr;
    }
}

/* v26 - Correção final: resumos de Participantes na mesma linha */
.participantes-hero {
    display: grid !important;
    grid-template-columns: minmax(320px, 1fr) minmax(720px, 1.58fr) !important;
    align-items: center !important;
    gap: clamp(1.25rem, 3vw, 3rem) !important;
    min-height: 260px;
}

.participantes-hero .page-hero-title {
    min-width: 0;
}

.participantes-hero .hero-insights {
    width: 100% !important;
    max-width: 920px;
    margin-left: auto;
    display: grid !important;
    grid-template-columns: minmax(190px, 1.35fr) minmax(210px, 1.45fr) minmax(104px, .75fr)  !important;
    align-items: stretch !important;
    gap: .85rem !important;
}

.participantes-hero .hero-summary,
.participantes-hero .hero-metrics {
    display: contents !important;
}

.participantes-hero .summary-table-card,
.participantes-hero .hero-metric {
    min-width: 0 !important;
    height: 100%;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 97%, #ffffff 3%), var(--bg-card)) !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
}

.participantes-hero .summary-table-card {
    padding: 1.05rem 1.15rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.participantes-hero .summary-card-header {
    margin: 0 0 .65rem !important;
    display: block !important;
}

.participantes-hero .summary-card-icon {
    display: none !important;
}

.participantes-hero .summary-table-card h2 {
    margin: 0 !important;
    color: var(--text-muted) !important;
    font-size: .72rem !important;
    font-weight: 900 !important;
    letter-spacing: .09em !important;
    line-height: 1.2 !important;
    text-transform: uppercase !important;
}

.participantes-hero .summary-table-card table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
}

.participantes-hero .summary-table-card tr + tr th,
.participantes-hero .summary-table-card tr + tr td {
    border-top: 1px solid var(--border-soft) !important;
}

.participantes-hero .summary-table-card th,
.participantes-hero .summary-table-card td {
    padding: .48rem 0 !important;
    color: var(--text) !important;
    font-size: .9rem !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
}

.participantes-hero .summary-table-card th {
    text-align: left !important;
    font-weight: 800 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participantes-hero .summary-table-card td {
    width: 54px !important;
    text-align: right !important;
    font-weight: 950 !important;
    white-space: nowrap !important;
}

.participantes-hero .hero-metric {
    padding: 1rem .85rem !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .4rem !important;
    text-align: center !important;
}

.participantes-hero .hero-metric strong {
    display: block !important;
    margin: 0 !important;
    color: var(--text) !important;
    font-size: clamp(1.65rem, 2.2vw, 2.1rem) !important;
    font-weight: 950 !important;
    line-height: 1 !important;
}

.participantes-hero .hero-metric span {
    display: block !important;
    margin: 0 !important;
    color: var(--text-muted) !important;
    font-size: .78rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

@media (max-width: 1320px) {
    .participantes-hero {
        grid-template-columns: minmax(300px, .95fr) minmax(640px, 1.65fr) !important;
    }

    .participantes-hero .hero-insights {
        grid-template-columns: minmax(170px, 1.25fr) minmax(190px, 1.35fr) minmax(96px, .7fr) minmax(96px, .7fr) !important;
        gap: .7rem !important;
    }

    .participantes-hero .summary-table-card th,
    .participantes-hero .summary-table-card td {
        font-size: .84rem !important;
    }
}

@media (max-width: 1120px) {
    .participantes-hero {
        grid-template-columns: 1fr !important;
        align-items: stretch !important;
    }

    .participantes-hero .hero-insights {
        max-width: none;
        margin-left: 0;
        grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
    }
}

@media (max-width: 640px) {
    .participantes-hero .hero-insights {
        grid-template-columns: 1fr !important;
    }

    .participantes-hero .hero-summary,
    .participantes-hero .hero-metrics {
        display: contents !important;
    }
}

/* =============================================================
   Página de gráficos e gerenciamento admin
   ============================================================= */
.graficos-main {
    gap: 1.25rem;
}

.graficos-hero {
    align-items: center;
}

.graficos-map-section {
    align-items: stretch;
}

.dashboard-map-card {
    min-height: 0;
}

.mapa-uf-wrapper {
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.mapa-uf-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(6, minmax(44px, 1fr));
    gap: .65rem;
    align-content: center;
}

.mapa-uf {
    min-height: 54px;
    border-radius: .85rem;
    border: 1px solid var(--border);
    background: var(--map-empty);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease, background-color .35s ease;
}

.mapa-uf:hover,
.mapa-uf.active {
    transform: translateY(-1px);
    border-color: var(--primary);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 18%, transparent);
}

.mapa-uf .state-label {
    color: color-mix(in srgb, var(--text) 86%, #000 14%);
    font-size: .78rem;
    pointer-events: none;
}

.graph-admin-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem;
}

.graph-admin-header {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.graph-admin-header h2 {
    margin-top: .2rem;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    color: var(--text);
}

.graph-admin-header p {
    margin-top: .25rem;
    color: var(--text-muted);
    font-size: .92rem;
}

.graph-admin-form {
    display: grid;
    gap: 1rem;
}

.graph-admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.graph-admin-card {
    background: var(--bg-card-alt);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem;
    min-width: 0;
}

.graph-admin-card h3 {
    margin-bottom: .85rem;
    font-size: 1rem;
    color: var(--text);
}

.graph-toggle-list {
    display: grid;
    gap: .55rem;
}

.graph-toggle-list-scroll {
    max-height: 440px;
    overflow-y: auto;
    padding-right: .25rem;
}

.graph-toggle-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .7rem;
    padding: .72rem .8rem;
    border: 1px solid var(--border-soft);
    border-radius: .75rem;
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color .2s ease, transform .15s ease, background-color .2s ease;
}

.graph-toggle-row:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.graph-toggle-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.graph-toggle-row span {
    min-width: 0;
    display: grid;
    gap: .1rem;
}

.graph-toggle-row strong {
    color: var(--text);
    font-size: .9rem;
}

.graph-toggle-row small {
    color: var(--text-muted);
    font-size: .75rem;
}

.graph-admin-actions {
    display: flex;
    justify-content: flex-end;
}

.login-alert.success {
    background: rgba(34, 197, 94, .12);
    color: #86efac;
    border-color: rgba(34, 197, 94, .35);
}

@media (min-width: 900px) {
    .graph-admin-grid {
        grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
    }
}

@media (min-width: 1024px) {
    .map-card.dashboard-map-card,
    .graficos-map-section .map-card {
        height: min(700px, calc(100vh - var(--header-height) - 4rem));
        max-height: 700px;
        min-height: 520px;
    }

    .graficos-map-section .ranking-card {
        max-height: 700px;
    }

    .map-wrapper.mapa-uf-wrapper,
    .dashboard-map-card .map-wrapper {
        height: 100%;
        max-height: 620px;
        min-height: 0;
        aspect-ratio: auto;
    }
}

@media (max-width: 767px) {
    .map-card.dashboard-map-card,
    .graficos-map-section .map-card {
        height: auto;
        max-height: none;
        min-height: 0;
    }

    .map-wrapper.mapa-uf-wrapper,
    .dashboard-map-card .map-wrapper {
        height: min(62vh, 420px);
        min-height: 260px;
        aspect-ratio: auto;
    }

    .mapa-uf-grid {
        grid-template-columns: repeat(4, minmax(42px, 1fr));
        gap: .5rem;
    }

    .mapa-uf {
        min-height: 44px;
        border-radius: .7rem;
    }

    .graph-admin-panel {
        padding: .9rem;
    }

    .graph-admin-actions .btn {
        width: 100%;
    }
}

/* =============================================================
   Correção: mapa por UF em SVG com altura proporcional
   ============================================================= */
.dashboard-map-card {
    overflow: hidden;
}

.map-wrapper.mapa-svg-wrapper,
.dashboard-map-card .map-wrapper.mapa-svg-wrapper {
    width: 100%;
    height: clamp(360px, 54vh, 620px);
    max-height: 620px;
    min-height: 320px;
    aspect-ratio: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .25rem;
}

.mapa-brasil-svg {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 700px;
    overflow: visible;
}

.mapa-brasil-bg path {
    fill: color-mix(in srgb, var(--primary) 4%, transparent);
    stroke: color-mix(in srgb, var(--primary) 12%, transparent);
    stroke-width: 1;
}

.mapa-uf-svg {
    cursor: pointer;
    outline: none;
}

.mapa-uf-svg .map-state-shape {
    fill: var(--map-empty);
    stroke: var(--map-stroke);
    stroke-width: 2;
    filter: drop-shadow(0 10px 16px rgba(15, 23, 42, .08));
    transition: fill .28s ease, stroke .2s ease, filter .2s ease, transform .2s ease;
}

.mapa-uf-svg:hover .map-state-shape,
.mapa-uf-svg:focus-visible .map-state-shape,
.mapa-uf-svg.active .map-state-shape {
    stroke: var(--primary);
    filter: drop-shadow(0 12px 20px color-mix(in srgb, var(--primary) 22%, transparent));
}

.mapa-uf-svg.has-data .map-state-shape {
    stroke: color-mix(in srgb, var(--primary) 34%, var(--map-stroke));
}

.mapa-uf-svg .state-label {
    fill: color-mix(in srgb, var(--text) 88%, #000 12%);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .02em;
    dominant-baseline: middle;
}

@media (min-width: 1024px) {
    .map-card.dashboard-map-card,
    .graficos-map-section .map-card.dashboard-map-card {
        height: auto;
        min-height: 0;
        max-height: 700px;
    }

    .graficos-map-section .ranking-card {
        max-height: 700px;
    }

    .map-wrapper.mapa-svg-wrapper,
    .dashboard-map-card .map-wrapper.mapa-svg-wrapper {
        height: min(58vh, 620px);
        max-height: 620px;
        min-height: 420px;
    }
}

@media (max-width: 767px) {
    .map-wrapper.mapa-svg-wrapper,
    .dashboard-map-card .map-wrapper.mapa-svg-wrapper {
        height: min(58vh, 390px);
        max-height: 390px;
        min-height: 280px;
        padding: 0;
    }

    .mapa-brasil-svg {
        max-height: 390px;
    }

    .mapa-uf-svg .state-label {
        font-size: 22px;
    }
}

/* =============================================================
   Ajuste final: preservar SVG real do mapa e limitar altura
   ============================================================= */
.map-wrapper.mapa-svg-wrapper,
.dashboard-map-card .map-wrapper.mapa-svg-wrapper {
    width: 100%;
    height: clamp(420px, 62vh, 700px);
    max-height: 700px;
    min-height: 360px;
    aspect-ratio: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .5rem;
    overflow: hidden;
}

.map-wrapper.mapa-svg-wrapper > svg,
.dashboard-map-card .map-wrapper.mapa-svg-wrapper > svg {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 700px;
    object-fit: contain;
    overflow: visible;
}

.dashboard-map-card {
    max-height: none;
}

.graficos-map-section .ranking-card {
    max-height: 700px;
}

@media (max-width: 767px) {
    .map-wrapper.mapa-svg-wrapper,
    .dashboard-map-card .map-wrapper.mapa-svg-wrapper {
        height: clamp(280px, 56vh, 420px);
        max-height: 420px;
        min-height: 280px;
        padding: 0;
    }

    .map-wrapper.mapa-svg-wrapper > svg,
    .dashboard-map-card .map-wrapper.mapa-svg-wrapper > svg {
        max-height: 420px;
    }
}


/* Gerenciamento: seleção de tipo de gráfico dinâmico */
.graph-toggle-row-with-select {
    grid-template-columns: auto minmax(0, 1fr) minmax(170px, 240px);
}

.graph-type-select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: var(--bg-card);
    color: var(--text);
    padding: .45rem .65rem;
    font-size: .82rem;
    font-weight: 700;
}

.chart-card-header small {
    display: inline-block;
    margin-top: .25rem;
    color: var(--text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.chart-line {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-line svg {
    width: 100%;
    max-height: 320px;
}

.chart-line-axis {
    stroke: var(--border);
    stroke-width: 2;
}

.chart-line-path {
    fill: none;
    stroke: var(--green-4);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line circle {
    fill: var(--green-4);
    stroke: var(--bg-card);
    stroke-width: 2;
}

.chart-text-list {
    display: grid;
    gap: .65rem;
    align-content: start;
}

.chart-text-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: .75rem;
    background: var(--bg-card-alt);
}

.chart-text-row span {
    font-weight: 700;
    color: var(--text);
}

.chart-text-row strong {
    color: var(--text);
}


.chart-pie {
    min-height: 320px;
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.chart-pie-figure {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-pie-figure svg {
    width: min(100%, 280px);
    height: auto;
    filter: drop-shadow(0 12px 22px rgba(15, 23, 42, .08));
}

.chart-pie-figure path {
    stroke: var(--bg-card);
    stroke-width: 2;
}

.chart-donut-hole {
    fill: var(--bg-card);
}

.chart-donut-total {
    fill: var(--text);
    font-size: 24px;
    font-weight: 900;
}

.chart-donut-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.chart-pie-legend {
    display: grid;
    gap: .55rem;
    align-content: center;
}

.chart-pie-legend-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .55rem;
    align-items: center;
    padding: .65rem .75rem;
    border: 1px solid var(--border-soft);
    border-radius: .75rem;
    background: var(--bg-card-alt);
    color: var(--text);
    font-size: .86rem;
}

.chart-pie-legend-item span:nth-child(2) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.chart-pie-legend-item strong {
    color: var(--text);
    font-size: .82rem;
    white-space: nowrap;
}

.chart-pie-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

@media (max-width: 767px) {
    .chart-pie {
        grid-template-columns: 1fr;
        min-height: 260px;
    }

    .chart-pie-figure svg {
        width: min(100%, 230px);
    }

    .chart-pie-legend-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .chart-pie-legend-item strong {
        grid-column: 2;
    }
}

@media (max-width: 767px) {
    .graph-toggle-row-with-select {
        grid-template-columns: auto 1fr;
    }

    .graph-type-select {
        grid-column: 2;
    }
}

/* =============================================================
   Avaliacoes do evento
   ============================================================= */

.avaliacoes-section {
    margin-top: 1rem;
}

.avaliacoes-section[hidden] {
    display: none !important;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.35rem 0 1rem;
}

.section-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 800;
}

.eyebrow {
    margin: 0 0 .25rem;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.avaliacoes-stats-grid {
    margin-bottom: 1rem;
}

.avaliacoes-charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card-wide {
    grid-column: 1 / -1;
}

.avaliacoes-sugestoes-list {
    display: grid;
    gap: .75rem;
    max-height: 420px;
    overflow: auto;
    padding-right: .25rem;
}

.avaliacoes-sugestao-item {
    padding: .85rem .95rem;
    border: 1px solid var(--border-soft);
    border-radius: .9rem;
    background: color-mix(in srgb, var(--bg-card) 94%, var(--primary-soft) 6%);
}

.avaliacoes-sugestao-item p {
    margin: 0;
    color: var(--text);
    font-size: .92rem;
    line-height: 1.45;
}

.avaliacoes-sugestao-item span {
    display: block;
    margin-top: .45rem;
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 700;
}

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

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}
