:root {
    --bg-body: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-muted: #f8fafc;
    --text-main: #0f172a;
    --text-subtle: #64748b;
    --border: #e2e8f0;
    --accent: #73c341;
    --radius: 12px;
    --gap: 16px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.22);
}

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

html,
body {
    height: 100%;
}

body {
    font-family: 'Russo One', sans-serif;
    color: #000000;
    background-color: var(--bg-body);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

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

.filter-bar {
    min-height: 60px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-panel);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1001;
}

body[data-active-mode="cerrado"] .filter-bar {
    align-items: flex-end;
}

.filter-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 4px 8px 4px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-panel);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.lang-switcher-label {
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
}

.lang-toggle-btn {
    width: 34px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.lang-toggle-btn:focus-visible {
    outline: 2px solid rgba(115, 195, 65, 0.35);
    outline-offset: 2px;
}

.lang-flag {
    width: 28px;
    height: 18px;
    display: none;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.lang-flag-en {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 18'%3E%3Crect width='28' height='18' fill='%23b22234'/%3E%3Cg fill='%23ffffff'%3E%3Crect y='1.38' width='28' height='1.38'/%3E%3Crect y='4.15' width='28' height='1.38'/%3E%3Crect y='6.92' width='28' height='1.38'/%3E%3Crect y='9.69' width='28' height='1.38'/%3E%3Crect y='12.46' width='28' height='1.38'/%3E%3Crect y='15.23' width='28' height='1.38'/%3E%3C/g%3E%3Crect width='12' height='9.7' fill='%233c3b6e'/%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='2' cy='2' r='0.45'/%3E%3Ccircle cx='4.5' cy='2' r='0.45'/%3E%3Ccircle cx='7' cy='2' r='0.45'/%3E%3Ccircle cx='9.5' cy='2' r='0.45'/%3E%3Ccircle cx='2' cy='4.2' r='0.45'/%3E%3Ccircle cx='4.5' cy='4.2' r='0.45'/%3E%3Ccircle cx='7' cy='4.2' r='0.45'/%3E%3Ccircle cx='9.5' cy='4.2' r='0.45'/%3E%3Ccircle cx='2' cy='6.4' r='0.45'/%3E%3Ccircle cx='4.5' cy='6.4' r='0.45'/%3E%3Ccircle cx='7' cy='6.4' r='0.45'/%3E%3Ccircle cx='9.5' cy='6.4' r='0.45'/%3E%3Ccircle cx='2' cy='8.6' r='0.45'/%3E%3Ccircle cx='4.5' cy='8.6' r='0.45'/%3E%3Ccircle cx='7' cy='8.6' r='0.45'/%3E%3Ccircle cx='9.5' cy='8.6' r='0.45'/%3E%3C/g%3E%3C/svg%3E");
}

.lang-flag-pt {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 18'%3E%3Crect width='28' height='18' fill='%23009b3a'/%3E%3Cpolygon points='14,2 24,9 14,16 4,9' fill='%23ffdf00'/%3E%3Ccircle cx='14' cy='9' r='4' fill='%23002776'/%3E%3Cpath d='M10.3 8.45c1.35-0.95 3.2-1.35 7.35-0.2' fill='none' stroke='%23ffffff' stroke-width='0.9' stroke-linecap='round'/%3E%3C/svg%3E");
}

.lang-switcher[data-next-lang='en'] .lang-flag-en,
.lang-switcher[data-next-lang='pt-BR'] .lang-flag-pt {
    display: block;
}

.nav-toggle {
    display: inline-flex;
    align-items: center;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-muted);
    overflow: hidden;
}

.nav-btn {
    border: none;
    background: none;
    color: #94a3b8;
    height: 100%;
    min-width: 120px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: #475569;
}

.nav-btn.active {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.filter-metrics {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter-metrics::-webkit-scrollbar {
    height: 6px;
}

.filter-metrics::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 999px;
}

.filter-metrics input {
    width: 36px;
    min-width: 0;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #475569;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-metrics input:focus {
    width: min(220px, 48vw);
    border-color: var(--accent);
    background-color: var(--bg-muted);
    background-position: 8px center;
    padding: 0 10px 0 34px;
    outline: none;
    cursor: text;
}

.filter-metrics select {
    height: 36px;
    min-width: 104px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #475569;
    background-color: var(--bg-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.filter-metrics select:focus,
.filter-metrics input:focus {
    outline: none;
    border-color: var(--accent);
}

.cerrado-filter-bar {
    display: none;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
}

.cerrado-filter-bar input:focus {
    width: min(180px, 30vw);
}

.cerrado-filter-bar__context {
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.cerrado-filter-bar__eyebrow {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-subtle);
}

.cerrado-filter-bar__caption {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

.cerrado-state-filter--inline {
    min-width: 112px;
    max-width: 150px;
    flex-shrink: 0;
    position: relative;
    height: 36px;
    gap: 0;
    justify-content: center;
}

.cerrado-filter-bar__stats {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-left: auto;
    flex-wrap: nowrap;
}

.cerrado-filter-pill {
    min-width: 92px;
    height: 36px;
    padding: 4px 8px;
    border: 1px solid #dce6ef;
    border-radius: 8px;
    background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cerrado-filter-pill__label {
    display: block;
    font-size: 0.58rem;
    color: #64748b;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cerrado-filter-pill__value {
    display: block;
    margin-top: 1px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

html[lang="en-US"] body[data-active-mode="cerrado"] .nav-btn {
    min-width: 112px;
    padding: 0 12px;
    font-size: 0.82rem;
}

html[lang="en-US"] body[data-active-mode="cerrado"] .lang-switcher-label {
    font-size: 0.82rem;
}

html[lang="en-US"] body[data-active-mode="cerrado"] .cerrado-filter-pill {
    min-width: 110px;
}

html[lang="en-US"] body[data-active-mode="cerrado"] .cerrado-filter-pill__label {
    font-size: 0.52rem;
}

.main-container {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: var(--gap);
    padding: var(--gap);
    min-height: 560px;
}

#view-frig-map,
#view-frig-chart,
.varejo-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--bg-panel);
    box-shadow: var(--shadow);
    min-width: 0;
    min-height: 0;
}

#view-frig-map {
    flex: 55 1 0;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

#view-frig-chart {
    flex: 45 1 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 18px;
}

.ranking-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.ranking-header h3 {
    font-size: 1.1rem;
    line-height: 1.2;
}

.ranking-axis-label {
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-subtle);
    padding-right: 4px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-stats {
    color: var(--text-subtle);
    white-space: nowrap;
    font-size: 0.82rem;
}

#btn-view-table.nav-btn,
#btn-reset-filters,
#btn-cerrado-reset-selection {
    min-width: unset;
    height: 36px;
    padding: 0 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background-color: #e2e8f0;
    color: #1e293b;
    cursor: pointer;
}

#btn-cerrado-reset-selection[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

#btn-view-table.nav-btn:hover,
#btn-reset-filters:hover,
#btn-cerrado-reset-selection:not([disabled]):hover {
    background-color: #cbd5e1;
}

#ranking-scroll-container,
#varejo-scroll-container,
#varejo-direct-indirect-scroll-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: auto;
}

#ranking-inner-wrapper,
#varejo-inner-wrapper,
#varejo-direct-indirect-inner-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
}

#rankingChart,
#varejoChart,
#varejoDirectIndirectChart {
    width: 100%;
    height: 100%;
}

#view-varejistas {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    gap: var(--gap);
    background: transparent;
    overflow: hidden;
}

/* Bioma Cerrado view */
#view-cerrado {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    gap: var(--gap);
    background: transparent;
    overflow: hidden;
}

#view-cerrado-map {
    flex: 55 1 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--bg-panel);
    box-shadow: var(--shadow);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

#cerrado-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

#view-cerrado-chart {
    flex: 45 1 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--bg-panel);
    box-shadow: var(--shadow);
    min-width: 0;
    min-height: 0;
}

#view-cerrado-chart > .ranking-header {
    order: 0;
}

#view-cerrado-chart > .ranking-axis-label {
    order: 2;
}

#cerrado-ranking-scroll-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: auto;
    order: 3;
}

#cerrado-ranking-inner-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
}

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

#cerrado-ranking-scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#cerrado-ranking-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#cerrado-ranking-scroll-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 999px;
}

#btn-cerrado-view-table.nav-btn {
    min-width: unset;
    height: 36px;
    padding: 0 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background-color: #e2e8f0;
    color: #1e293b;
}

#btn-cerrado-view-table.nav-btn:hover {
    background-color: #cbd5e1;
}

#cerrado-ranking-stats {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-subtle);
}

.cerrado-state-summary {
    display: none;
    order: 1;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #d8e1eb;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.cerrado-state-summary__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cerrado-state-summary__eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-subtle);
}

.cerrado-state-summary__caption {
    margin-top: 4px;
    font-size: 0.88rem;
    color: #0f172a;
    line-height: 1.35;
}

.cerrado-state-summary__filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.cerrado-state-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cerrado-state-filter__label {
    font-size: 0.72rem;
    color: #475569;
    line-height: 1;
    white-space: nowrap;
}

.cerrado-state-filter--inline .cerrado-state-filter__label {
    position: absolute;
    top: -12px;
    left: 2px;
}

.cerrado-state-filter__select {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d6e0ea;
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.82rem;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.cerrado-state-filter__select:focus {
    outline: none;
    border-color: #6f7d4f;
    box-shadow: 0 0 0 3px rgba(111, 125, 79, 0.14);
}

.cerrado-state-summary__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.cerrado-state-stat {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px 12px;
}

.cerrado-state-stat__label {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
    margin-bottom: 5px;
}

.cerrado-state-stat__value {
    display: block;
    font-size: 1rem;
    color: #0f172a;
}

.cerrado-selection-card {
    position: absolute;
    top: auto;
    bottom: 16px;
    left: 16px;
    z-index: 700;
    width: min(300px, calc(100% - 32px));
    min-width: 240px;
    min-height: 150px;
    max-width: min(480px, calc(100% - 32px));
    max-height: min(430px, calc(100% - 32px));
    overflow: auto;
    resize: both;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cerrado-selection-card.is-empty {
    border-color: rgba(203, 213, 225, 0.92);
}

.cerrado-selection-card.is-empty .cerrado-selection-metrics,
.cerrado-selection-card.is-empty .cerrado-selection-breakdown {
    display: none;
}

.cerrado-selection-card.is-empty .cerrado-selection-card__reset {
    display: none;
}

.cerrado-selection-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2e8f0;
}

.cerrado-selection-card__eyebrow {
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-subtle);
    margin-bottom: 2px;
}

.cerrado-selection-card__header h4 {
    font-size: 0.82rem;
    line-height: 1.2;
    color: #0f172a;
}

.cerrado-selection-card__actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cerrado-selection-card__reset,
.cerrado-selection-card__close {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 0.66rem;
    cursor: pointer;
    white-space: nowrap;
}

.cerrado-selection-card__close {
    width: 28px;
    height: 26px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.cerrado-selection-card__reset:hover,
.cerrado-selection-card__close:hover {
    background: #f8fafc;
}

.cerrado-selection-card.is-closed {
    display: none;
}

.cerrado-selection-card__helper {
    font-size: 0.7rem;
    line-height: 1.35;
    color: #475569;
}

.cerrado-selection-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.cerrado-selection-metric {
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
    padding: 7px 8px;
}

.cerrado-selection-metric__label {
    display: block;
    font-size: 0.58rem;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 3px;
    line-height: 1.1;
}

.cerrado-selection-metric__value {
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    word-break: break-word;
}

.cerrado-selection-breakdown {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.cerrado-selection-breakdown__section {
    border-top: 1px solid #e2e8f0;
    padding-top: 7px;
}

.cerrado-selection-breakdown__title {
    font-size: 0.58rem;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cerrado-selection-breakdown__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cerrado-selection-breakdown__tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #eef2f7;
    color: #1e293b;
    padding: 3px 7px;
    font-size: 0.65rem;
}

.cerrado-selection-breakdown__rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cerrado-selection-breakdown__row {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 7px;
    align-items: start;
}

.cerrado-selection-breakdown__uf {
    font-size: 0.66rem;
    font-weight: 800;
    color: #0f172a;
}

.cerrado-selection-breakdown__municipios {
    font-size: 0.68rem;
    color: #334155;
    line-height: 1.35;
}

.cerrado-map-tooltip-wrapper {
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.cerrado-map-tooltip-wrapper::before {
    display: none;
}

.cerrado-map-tooltip {
    width: 270px;
    padding: 12px;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
    color: #0f172a;
    font-family: Arial, sans-serif;
}

.cerrado-map-tooltip__eyebrow,
.cerrado-map-tooltip__metric span,
.cerrado-map-tooltip__section span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.cerrado-map-tooltip__title {
    margin-top: 2px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
}

.cerrado-map-tooltip__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.cerrado-map-tooltip__metric {
    min-width: 0;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
}

.cerrado-map-tooltip__metric strong {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.cerrado-map-tooltip__section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.cerrado-map-tooltip__section strong {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.25;
}

.leaflet-marker-icon.cerrado-cluster-wrapper {
    background: transparent;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cerrado-cluster-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(184, 66, 58, 0.82);
    border: 2px solid rgba(132, 38, 33, 0.92);
    color: #fff;
    font-family: 'Russo One', sans-serif;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
}

.cerrado-cluster-icon span {
    line-height: 1;
}

.cerrado-cluster-icon--medium {
    width: 42px;
    height: 42px;
    background: rgba(184, 66, 58, 0.88);
    font-size: 13px;
}

.cerrado-cluster-icon--large {
    width: 48px;
    height: 48px;
    background: rgba(132, 38, 33, 0.9);
    border-color: rgba(102, 28, 24, 0.96);
    font-size: 14px;
}

.cerrado-cluster-popup-wrapper .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.cerrado-cluster-popup-wrapper .leaflet-popup-content {
    margin: 0;
    width: 240px !important;
}

.cerrado-cluster-popup {
    padding: 12px 14px 14px;
    font-family: inherit;
    color: #0f172a;
}

.cerrado-cluster-popup__header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 10px;
}

.cerrado-cluster-popup__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.cerrado-cluster-popup__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cerrado-cluster-popup__stat span {
    font-size: 11px;
    color: #64748b;
    text-transform: capitalize;
}

.cerrado-cluster-popup__stat strong {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.cerrado-cluster-popup__actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cerrado-cluster-popup__btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cerrado-cluster-popup__btn--zoom {
    background: #0f172a;
    color: #ffffff;
}

.cerrado-cluster-popup__btn--zoom:hover {
    background: #1e293b;
}

.cerrado-cluster-popup__btn--filter {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.16);
}

.cerrado-cluster-popup__btn--filter:hover {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.28);
}

.cerrado-legend {
    position: absolute;
    bottom: 24px;
    right: 16px;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.cerrado-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cerrado-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.varejo-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    padding: 18px;
    overflow: hidden;
}

#ranking-scroll-container::-webkit-scrollbar,
#varejo-scroll-container::-webkit-scrollbar,
#varejo-direct-indirect-scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#ranking-scroll-container::-webkit-scrollbar-track,
#varejo-scroll-container::-webkit-scrollbar-track,
#varejo-direct-indirect-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#ranking-scroll-container::-webkit-scrollbar-thumb,
#varejo-scroll-container::-webkit-scrollbar-thumb,
#varejo-direct-indirect-scroll-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 999px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    width: min(980px, 92vw);
    height: min(760px, 86dvh);
    border-radius: var(--radius);
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background-color: var(--bg-muted);
}

.modal-header h2 {
    font-size: 1.1rem;
    color: #1e293b;
}

.close-btn {
    border: none;
    background: none;
    color: #64748b;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.close-btn:hover {
    color: #0f172a;
}

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 0 20px 16px;
}

#risk-table {
    width: 100%;
    min-width: 620px;
    border-collapse: separate;
    border-spacing: 0;
    color: #334155;
}

#risk-table th,
#risk-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#risk-table th {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #f1f5f9;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    padding-top: 16px;
}

#risk-table tbody tr:hover {
    background-color: #f8fafc;
}

#risk-table th:last-child,
#risk-table td:last-child {
    min-width: 240px;
}

.risk-exposure-meter {
    position: relative;
    min-width: 200px;
    height: 34px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.risk-exposure-meter::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid #e2e8f0;
    border-radius: inherit;
    pointer-events: none;
}

.risk-exposure-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--risk-width);
    background: linear-gradient(90deg, rgba(196, 149, 106, 0.88) 0%, rgba(221, 185, 140, 0.96) 100%);
}

.risk-exposure-value {
    position: relative;
    z-index: 1;
    color: #1e293b;
    font-size: 0.82rem;
}

.leaflet-tooltip {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    color: #1e293b;
    border-radius: 4px;
}

.leaflet-popup-content-wrapper {
    background-color: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content {
    margin: 12px 14px;
}

.leaflet-popup-tip {
    background-color: rgba(255, 255, 255, 0.95);
}

.feature-popup {
    min-width: 240px;
    max-width: min(420px, 76vw);
    font-family: 'Russo One', sans-serif;
}

.feature-popup__title {
    margin-bottom: 10px;
    font-size: 0.92rem;
    line-height: 1.35;
    color: #0f172a;
}

.feature-popup__table-wrap {
    max-height: min(300px, 44vh);
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}

.feature-popup__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: #334155;
}

.feature-popup__table th,
.feature-popup__table td {
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
}

.feature-popup__table tr:last-child th,
.feature-popup__table tr:last-child td {
    border-bottom: none;
}

.feature-popup__table th {
    width: 40%;
    color: #475569;
    background: #f8fafc;
    font-weight: normal;
}

.feature-popup__table td {
    line-height: 1.5;
    word-break: break-word;
    white-space: normal;
    background: #ffffff;
}

.leaflet-control-attribution {
    display: none !important;
}

.leaflet-control-layers-toggle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'%3E%3C/polygon%3E%3Cpolyline points='2 17 12 22 22 17'%3E%3C/polyline%3E%3Cpolyline points='2 12 12 17 22 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 20px 20px;
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 36px !important;
    height: 36px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.leaflet-control-layers-toggle:hover {
    background-color: #f1f5f9;
}

/* --- RADAR VERDE LEGEND --- */
.radar-verde-legend {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 0;
    font-family: 'Russo One', sans-serif;
    font-size: 11px;
    color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    border: 1px solid #e2e8f0;
    max-width: 260px;
    line-height: 1.4;
    overflow: hidden;
    transition: max-width 0.2s;
}

.radar-verde-legend.collapsed {
    max-width: 130px;
}

.legend-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.legend-toggle-label {
    font-size: 11px;
    font-weight: bold;
    color: #1e293b;
}

.legend-toggle-btn {
    border: none;
    background: none;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.legend-toggle-btn:hover {
    color: #1e293b;
}

.legend-body {
    padding: 12px 14px;
}

.legend-title {
    font-size: 11px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 10.5px;
}

.legend-circle {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.legend-swatch {
    display: inline-block;
    width: 18px;
    height: 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.legend-separator {
    border-top: 1px solid #e2e8f0;
    margin: 10px 0;
}

.legend-size-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-size-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
}

.legend-size-circle {
    display: inline-block;
    border-radius: 50%;
    border: 2px solid #8a8278;
    background: rgba(180, 170, 150, 0.3);
    flex-shrink: 0;
}

.legend-zone-swatch {
    display: inline-block;
    width: 20px;
    height: 14px;
    background: #e8dfc8;
    border: 1px solid #c4b99a;
    border-radius: 2px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    body {
        overflow: auto;
    }

    .filter-bar {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .filter-logo {
        width: 100%;
    }

    .filter-metrics {
        width: 100%;
        flex: 1 1 100%;
        padding-bottom: 4px;
    }

    .cerrado-filter-bar {
        align-items: flex-start;
        flex-wrap: wrap;
        overflow: visible;
        padding-bottom: 0;
    }

    .cerrado-filter-bar__context {
        min-width: 160px;
    }

    .cerrado-filter-bar__stats {
        width: 100%;
        margin-left: 0;
    }

    .main-container {
        min-height: calc(100dvh - 118px);
        height: auto;
        flex-direction: column;
    }

    #view-frig-map {
        flex: none;
        min-height: 46dvh;
    }

    #view-frig-chart {
        flex: 1;
        min-height: 420px;
    }

    #view-varejistas {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    #view-cerrado {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    #view-cerrado-map {
        min-height: 46dvh;
    }

    #view-cerrado-chart {
        min-height: 420px;
    }

    .varejo-panel {
        width: 100%;
        min-height: 380px;
    }

    .filter-actions {
        justify-content: flex-start;
    }

    .radar-verde-legend {
        max-width: 220px;
        font-size: 10px;
    }

    .legend-body {
        padding: 10px 12px;
    }

    .legend-title {
        font-size: 10px;
    }

    .legend-size-item {
        font-size: 9px;
    }
}

@media (max-width: 768px) {
    :root {
        --gap: 10px;
    }

    .filter-bar {
        padding: 10px;
        gap: 8px;
    }

    .nav-toggle {
        width: 100%;
    }

    .nav-btn {
        flex: 1;
        min-width: 0;
        padding: 0 10px;
        font-size: 0.78rem;
    }

    .filter-metrics select {
        min-width: 92px;
        height: 34px;
        font-size: 0.74rem;
    }

    .cerrado-filter-bar__context {
        min-width: 100%;
    }

    .cerrado-state-filter--inline {
        min-width: 122px;
        max-width: none;
        flex: 1 1 148px;
    }

    .cerrado-filter-pill {
        flex: 1 1 108px;
    }

    .filter-metrics input {
        width: 34px;
        height: 34px;
        background-size: 16px;
    }

    .filter-metrics input:focus {
        width: min(170px, 58vw);
    }

    .main-container {
        padding: 10px;
    }

    #view-frig-map {
        min-height: 42dvh;
    }

    #view-frig-chart {
        padding: 12px;
        min-height: 360px;
    }

    #view-cerrado-chart {
        padding: 12px;
        min-height: 360px;
    }

    .ranking-header {
        margin-bottom: 10px;
    }

    .ranking-header h3 {
        font-size: 0.96rem;
    }

    .varejo-panel {
        padding: 12px;
        min-height: 320px;
    }

    .cerrado-selection-card {
        top: auto;
        bottom: 10px;
        left: 10px;
        width: calc(100% - 20px);
        max-height: calc(100% - 20px);
        padding: 10px;
    }

    .cerrado-state-summary {
        padding: 10px;
    }

    .cerrado-state-summary__header {
        flex-direction: column;
    }

    .cerrado-state-summary__filters {
        grid-template-columns: 1fr;
    }

    .cerrado-state-summary__stats {
        grid-template-columns: 1fr;
    }

    .cerrado-selection-metrics {
        grid-template-columns: 1fr;
    }

    .cerrado-selection-breakdown__row {
        grid-template-columns: 40px 1fr;
    }

    #btn-view-table.nav-btn,
    #btn-reset-filters {
        height: 34px;
        font-size: 0.74rem;
        padding: 0 10px;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 10px;
    }

    .modal-header {
        padding: 12px;
    }

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

    .modal-body {
        padding: 0 12px 12px;
    }

    #risk-table {
        min-width: 560px;
    }

    #risk-table th,
    #risk-table td {
        padding: 10px;
        font-size: 0.78rem;
    }

    #risk-table th:last-child,
    #risk-table td:last-child {
        min-width: 180px;
    }

    .risk-exposure-meter {
        min-width: 150px;
        height: 30px;
        padding: 0 8px;
    }

    .risk-exposure-value {
        font-size: 0.76rem;
    }

    .radar-verde-legend {
        max-width: 190px;
        font-size: 9px;
    }

    .legend-body {
        padding: 8px 10px;
    }

    .legend-title {
        font-size: 9px;
        margin-bottom: 5px;
    }

    .legend-item {
        gap: 5px;
        margin-bottom: 3px;
        font-size: 9px;
    }

    .legend-circle {
        width: 11px;
        height: 11px;
    }

    .legend-size-item {
        font-size: 8px;
        gap: 6px;
    }

    .legend-size-circle {
        transform: scale(0.75);
    }

    .legend-separator {
        margin: 6px 0;
    }
}

@media (max-width: 480px) {
    #view-frig-map {
        min-height: 38dvh;
    }

    #view-frig-chart {
        min-height: 320px;
    }

    #view-cerrado-map {
        min-height: 40dvh;
    }

    #view-cerrado-chart {
        min-height: 320px;
    }

    .varejo-panel {
        min-height: 280px;
    }

    .filter-metrics select {
        min-width: 86px;
    }

    .filter-stats {
        font-size: 0.72rem;
    }

    .cerrado-filter-bar__caption,
    .cerrado-state-summary__caption {
        font-size: 0.8rem;
    }
}
