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

:root {
    --primary: #1a6fa0;
    --primary-dark: #155d87;
    --secondary: #2196c9;
    --bg: #f5f7fb;
    --sidebar-bg: #0d2137;
    --sidebar-text: #b0c4d8;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-muted: #718096;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --border: #e2e8f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

#app-screen {
    width: 100%;
    display: flex;
}

#search-area,
#admin-area {
    width: 100%;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.5rem 1.5rem 2rem 1.5rem;
    overflow-y: auto;
    opacity: 1;
    transition: opacity 0.2s ease;
    min-width: 280px;
}

.sidebar.collapsed {
    width: 48px;
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.sidebar-chevron {
    width: 100%;
    height: 48px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.75rem;
    transition: all 0.3s ease;
    z-index: 2;
    flex-shrink: 0;
}

.sidebar-chevron svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.sidebar-chevron:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar.collapsed .sidebar-chevron {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-chevron svg {
    transform: rotate(180deg);
}

.sidebar-logo {
    display: block;
    max-width: 140px;
    margin: 0 auto 0.5rem auto;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.sidebar hr {
    border: none;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.sidebar-label {
    font-weight: 600;
    color: #e0e0e0;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.sidebar-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--sidebar-text);
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-version {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.btn-logout {
    background: rgba(220, 53, 69, 0.2) !important;
    color: #ff8a95 !important;
    border-color: rgba(220, 53, 69, 0.35) !important;
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.4) !important;
    color: #fff !important;
}

.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem 2.5rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 48px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 0.35rem;
    box-shadow: var(--shadow);
    width: fit-content;
}

.tab-btn {
    padding: 0.7rem 2rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.5rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 600;
}

.tab-btn:hover:not(.active) {
    background: rgba(26, 111, 160, 0.08);
    color: var(--primary);
}

.search-section {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 2;
    min-width: 250px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.input-group input {
    padding: 0.7rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.alert {
    padding: 0.8rem 1.2rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.alert-info {
    background: #ebf5fb;
    color: #1a6fa0;
    border: 1px solid #b3d7f5;
}

.alert-warning {
    background: #fff8e1;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.alert-error {
    background: #fde8e8;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #e8f5e9;
    color: #28a745;
    border: 1px solid #c8e6c9;
}

.section-divider {
    border: none;
    height: 2px;
    background: linear-gradient(to right, var(--primary), transparent);
    margin: 1.5rem 0;
}

.result-header {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 1.2rem;
    border-radius: 0.8rem;
    color: #fff;
    text-align: center;
}

.metric-card h3 {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-card p {
    font-size: 1.2rem;
    font-weight: 700;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.info-card {
    background: var(--card-bg);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.2rem;
    border-radius: 0 0.5rem 0.5rem 0;
    box-shadow: var(--shadow);
}

.info-card .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.info-card .value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.info-card.status-ativa {
    border-left-color: var(--success);
}

.info-card.status-ativa .value {
    color: var(--success);
    font-weight: 600;
}

.info-card.status-inativa {
    border-left-color: var(--danger);
}

.info-card.status-inativa .value {
    color: var(--danger);
    font-weight: 600;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.data-table thead th {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tbody td {
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr:hover {
    background: rgba(26, 111, 160, 0.04);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.socio-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    padding: 0.8rem 1.2rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
}

.socio-info {
    flex: 1;
}

.socio-nome {
    font-weight: 600;
    font-size: 0.95rem;
}

.socio-doc {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.socio-tipo {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 500;
}

.socio-ingresso {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.socio-saida {
    color: #c62828;
}

.socio-faixa-badge {
    background: linear-gradient(135deg, #1a6fa0, #2196c9);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.socio-perse-container {
    margin-top: 4px;
}

.socio-perse-badge {
    background: linear-gradient(135deg, #e65100, #ff9800);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-block;
    transition: all 0.2s ease;
}

.socio-perse-badge:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.socio-perse-badge.active {
    background: linear-gradient(135deg, #bf360c, #e65100);
}

.socio-perse-detail {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    animation: perseSlideDown 0.2s ease;
}

@keyframes perseSlideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

.socio-perse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.socio-perse-table thead tr {
    background: linear-gradient(135deg, #1a6fa0, #2196c9);
    color: #fff;
}

.socio-perse-table th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
}

.socio-perse-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.78rem;
}

.socio-perse-table tbody tr:hover {
    background: rgba(26, 111, 160, 0.05);
}

.perse-principal-tag {
    background: #2e7d32;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 6px;
    margin-left: 4px;
}

.perse-secundario-tag {
    background: #757575;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 6px;
    margin-left: 4px;
}

.regime-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0.5rem;
}

.regime-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
}

.regime-ano {
    font-weight: 700;
    font-size: 0.95rem;
}

.regime-simples {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4caf50;
    color: #2e7d32;
}

.regime-presumido {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: #ff9800;
    color: #e65100;
}

.regime-real {
    background: rgba(33, 150, 243, 0.1);
    border-left-color: #2196f3;
    color: #1565c0;
}

.regime-outros {
    background: rgba(158, 158, 158, 0.1);
    border-left-color: #9e9e9e;
    color: #616161;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.8rem;
}


.spinner-sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(26, 111, 160, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

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

.contato-secao {
    margin-bottom: 1rem;
}

.contato-titulo {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.contato-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    padding: 0.6rem 1rem;
    border-radius: 0.4rem;
    margin-bottom: 0.4rem;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 4px;
}

.contato-valor {
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-all;
}

.contato-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.contato-tipo-badge {
    background: #e8eaf6;
    color: #3949ab;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.contato-valid-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f5f5f5;
    color: #666;
}

.contato-valid-badge.contato-valido {
    background: #e8f5e9;
    color: #2e7d32;
}

.contato-valid-badge.contato-invalido {
    background: #ffebee;
    color: #c62828;
}

.filial-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filial-badge {
    background: var(--card-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    font-family: monospace;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.chart-container {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    max-height: 350px;
}

.chart-container canvas {
    max-height: 280px;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.loading-content {
    text-align: center;
}

.rel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    padding: 0.8rem 1.2rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
}

.rel-info {
    flex: 1;
}

.rel-empresa {
    font-weight: 600;
    font-size: 0.95rem;
}

.rel-cnpj {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.rel-detalhes {
    color: var(--primary);
    font-size: 0.8rem;
}

.perse-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success), #20c997);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.perse-anexo2 {
    background: linear-gradient(135deg, #e6a817, #f0c040);
    color: #fff;
}

.perse-cnaes-card {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.06), rgba(32, 201, 151, 0.06));
    border: 1px solid rgba(40, 167, 69, 0.25);
    border-radius: 0.75rem;
    padding: 1rem;
}

.perse-cnaes-card .data-table {
    margin-bottom: 0;
}

.eq-badge-card {
    flex: 1;
    min-width: 180px;
    padding: 1rem 1.2rem;
    border-radius: 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    box-shadow: var(--shadow);
}

.eq-badge-yes {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.08), rgba(32, 201, 151, 0.08));
    border: 2px solid #28a745;
}

.eq-badge-no {
    background: var(--card-bg);
    border: 2px solid var(--border);
}

.eq-badge-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.eq-badge-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

.eq-badge-yes .eq-badge-value {
    color: #28a745;
}

.eq-badge-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.eq-faixa-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.data-table tfoot td {
    padding: 0.8rem 1rem;
    border-top: 2px solid var(--primary);
    background: rgba(26, 111, 160, 0.04);
}

.json-viewer {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 1.2rem;
    border-radius: 0.75rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.sort-icon {
    font-size: 0.8em;
    opacity: 0.5;
    margin-left: 5px;
}

.data-table th:hover {
    background: rgba(26, 111, 160, 0.1);
}

.bi-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bi-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-align: center;
}

.bi-card-total {
    border-left: 4px solid var(--danger);
}

.bi-card-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.bi-card-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

.bi-val-danger {
    color: var(--danger);
}

.bi-card-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.bi-pct {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.8;
}

.bi-charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bi-chart-box {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.bi-chart-box h4 {
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.bi-chart-wrap {
    height: 260px;
    position: relative;
}

.bi-chart-full {
    margin-bottom: 1.5rem;
}

.ge-map-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}
.ge-map-container svg {
    width: 100%;
    height: auto;
    display: block;
}
.ge-map-container svg path {
    cursor: pointer;
    transition: opacity 0.15s, stroke-width 0.15s;
    stroke: #fff;
    stroke-width: 0.8;
}
.ge-map-container svg path:hover {
    opacity: 0.8;
    stroke: #333;
    stroke-width: 1.5;
}
.ge-map-tooltip {
    position: fixed;
    background: #1e1e2f;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: none;
}
.ge-map-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
}
.ge-map-legend-bar {
    width: 120px;
    height: 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .bi-summary-cards {
        grid-template-columns: 1fr 1fr;
    }
    .bi-charts-row {
        grid-template-columns: 1fr;
    }
    .bi-card-value {
        font-size: 1rem;
    }
    .ge-map-container {
        max-width: 300px;
    }
}

.tab-content {
    display: none;
}

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

.cache-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.cache-banner-cached {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.cache-banner-fresh {
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

.cache-icon {
    font-size: 1.1rem;
}

.btn-atualizar {
    margin-left: auto;
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}

.btn-atualizar:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #0d2137, var(--primary), var(--secondary));
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 500;
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 420px;
}

.login-logo {
    display: block;
    max-width: 160px;
    margin: 0 auto 1rem auto;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.login-info {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: center;
}

.top-bar {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    margin-right: 0.75rem;
    color: var(--text);
    flex-shrink: 0;
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

.mobile-menu-btn:hover {
    background: rgba(26, 111, 160, 0.1);
}

.sidebar-user {
    font-size: 0.82rem;
    color: var(--sidebar-text);
    margin-bottom: 1rem;
    word-break: break-all;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-sidebar {
    width: 100%;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-sidebar:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.sidebar-admin-divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.25rem 0;
}

.sidebar-admin-divider::before,
.sidebar-admin-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-admin-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 190, 70, 0.85);
    white-space: nowrap;
}

.sidebar-admin-label svg {
    stroke: rgba(255, 190, 70, 0.85);
}

.btn-sidebar-admin {
    border-left: 3px solid rgba(255, 190, 70, 0.6);
    padding-left: calc(1rem - 3px);
    background: rgba(255, 190, 70, 0.07);
    color: #e0c88a;
}

.btn-sidebar-admin:hover {
    background: rgba(255, 190, 70, 0.15);
    border-left-color: rgba(255, 190, 70, 0.9);
    color: #ffd57a;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}


.admin-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.admin-add-form {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.admin-form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.admin-select {
    padding: 0.7rem 0.8rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
    min-width: 110px;
}

.admin-input {
    flex: 1;
    padding: 0.7rem 0.8rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
}

.admin-input:focus,
.admin-select:focus {
    outline: none;
    border-color: var(--primary);
}

.historico-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    align-items: center;
}

.historico-toolbar .input {
    flex: 1;
    min-width: 200px;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.historico-toolbar .input:focus {
    outline: none;
    border-color: var(--primary);
}

.historico-filtros {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.historico-select {
    width: auto;
    min-width: 140px;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.historico-select:focus {
    outline: none;
    border-color: var(--primary);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem;
}

.admin-table th.sortable:hover {
    opacity: 0.85;
}

.admin-table th.sortable::after {
    content: '\2195';
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    opacity: 0.6;
}

.admin-table th.sortable.sort-asc::after {
    content: '\2191';
    opacity: 1;
}

.admin-table th.sortable.sort-desc::after {
    content: '\2193';
    opacity: 1;
}

.btn-pesquisar-hist {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    border: none;
    border-radius: 0.3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}

.btn-pesquisar-hist:hover {
    opacity: 0.85;
}

.historico-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.historico-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.hist-page-btn {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    border-radius: 0.35rem;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.2s, color 0.2s;
}

.hist-page-btn:hover:not(:disabled):not(.active) {
    background: var(--primary);
    color: #fff;
}

.hist-page-btn.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-color: var(--primary);
}

.hist-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.hist-page-dots {
    padding: 0.4rem 0.3rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}

.admin-table thead th {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
}

.admin-table tbody td {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

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

.btn-danger:hover {
    opacity: 0.85;
}

@media (max-width: 768px) {
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.collapsed {
        width: 280px;
        transform: translateX(-100%);
    }
    .sidebar.collapsed .sidebar-content {
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar-chevron {
        display: none;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .main-content {
        margin-left: 0;
        padding: 1rem 0.75rem;
        max-width: 100vw;
        overflow-x: hidden;
    }
    .main-content.expanded {
        margin-left: 0;
    }
    .page-title {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    .tab-bar {
        width: 100%;
        margin-bottom: 1.2rem;
    }
    .tab-btn {
        flex: 1;
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
        text-align: center;
    }
    .search-section {
        flex-direction: column;
    }
    .input-group {
        min-width: 100%;
    }
    .input-group input {
        width: 100%;
        font-size: 1rem;
        padding: 0.75rem 0.8rem;
    }
    .btn-group {
        margin-bottom: 1rem;
    }
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    .btn.btn-sm {
        width: auto;
    }
    .admin-header {
        flex-wrap: wrap;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .metric-card {
        padding: 0.7rem 0.8rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    .metric-card h3 {
        font-size: 0.75rem;
        margin-bottom: 0;
        margin-right: 0.5rem;
        white-space: nowrap;
    }
    .metric-card p {
        font-size: 0.95rem;
        word-break: break-all;
        text-align: right;
    }
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .info-card {
        padding: 0.75rem 0.8rem;
    }
    .info-card .value {
        font-size: 0.88rem;
        word-break: break-word;
    }
    .result-header {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .tab-content {
        max-width: 100%;
        overflow-x: hidden;
    }
    .cache-banner {
        max-width: 100%;
        box-sizing: border-box;
    }
    .metrics-grid,
    .info-grid,
    .filial-list {
        max-width: 100%;
    }
    .section-title {
        font-size: 1rem;
    }
    .section-divider {
        margin: 1rem 0;
    }
    .socio-row,
    .rel-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.7rem 0.8rem;
    }
    .socio-row .btn-sm,
    .rel-row .btn-sm {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table thead th,
    .data-table tbody td {
        padding: 0.5rem 0.6rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }
    .filial-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }
    .chart-container {
        padding: 0.8rem;
        max-height: 280px;
    }
    .chart-container canvas {
        max-height: 220px;
    }
    .cache-banner {
        flex-direction: column;
        align-items: flex-start;
        font-size: 0.82rem;
        padding: 0.6rem 0.8rem;
        gap: 0.4rem;
    }
    .btn-atualizar {
        margin-left: 0;
        width: 100%;
        text-align: center;
        padding: 0.5rem 1rem;
    }
    .alert {
        font-size: 0.82rem;
        padding: 0.6rem 0.8rem;
    }
    .login-card {
        padding: 1.5rem 1.2rem;
    }
    .login-title {
        font-size: 1.4rem;
    }
    .top-bar {
        gap: 0;
    }
    .page-title {
        flex: 1;
    }
    .admin-form-row {
        flex-direction: column;
    }
    .admin-select {
        width: 100%;
    }
    .admin-input {
        width: 100%;
    }
    .admin-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .historico-toolbar {
        flex-direction: column;
    }
    .historico-toolbar .input {
        min-width: unset;
        width: 100%;
    }
    .historico-filtros {
        width: 100%;
    }
    .historico-select {
        flex: 1;
        min-width: 0;
    }
    .usuarios-toolbar {
        flex-direction: column;
    }
    .usuarios-toolbar .input {
        min-width: unset;
        width: 100%;
        max-width: unset;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.8rem;
}

.modal-text {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.modal-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-actions .btn {
    width: 100%;
    justify-content: center;
}

.papel-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.papel-admin {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

.papel-usuario {
    background: #e2e8f0;
    color: var(--text);
}

.btn-papel {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-papel:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.admin-fixo-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.active-filter {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.usuarios-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    align-items: center;
}

.usuarios-toolbar .input {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.usuarios-toolbar .input:focus {
    outline: none;
    border-color: var(--primary);
}

.usuarios-table td {
    font-size: 0.85rem;
}

.usuario-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.status-ativo {
    color: var(--success);
    font-weight: 600;
}

.status-inativo {
    color: var(--text-muted);
}

/* Reservation System */
.reserva-banner {
    margin-bottom: 1rem;
}

.reserva-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    gap: 12px;
    flex-wrap: wrap;
}

.reserva-disponivel {
    background: #e8f5e9;
    border: 1px solid #4caf50;
}

.reserva-solicitada {
    background: #fff3e0;
    border: 1px solid #ff9800;
}

.reserva-confirmada {
    background: #fce4ec;
    border: 1px solid #e53935;
}

.reserva-info {
    flex: 1;
    min-width: 200px;
}

.reserva-info strong {
    color: #333;
}

.reserva-info small {
    color: #666;
}

.reserva-icon {
    font-size: 1.2rem;
    margin-right: 4px;
}

.reserva-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background: #fff3e0;
    color: #e65100;
}

.badge-danger {
    background: #fce4ec;
    color: #c62828;
}

.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

.historico-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 0.5rem;
}

.historico-table thead th {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.historico-table tbody td {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}

.historico-table tbody tr:last-child td {
    border-bottom: none;
}

.historico-table tbody tr:hover {
    background: rgba(26, 111, 160, 0.04);
}

.imported-nav-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid var(--border);
}

.imported-nav-btn {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.imported-nav-btn:hover {
    color: var(--primary);
    background: rgba(26, 111, 160, 0.04);
}

.imported-nav-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.imported-batch-textarea {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    font-family: 'Inter', monospace;
    font-size: 0.88rem;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    line-height: 1.5;
}

.imported-batch-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 111, 160, 0.1);
}

.imported-batch-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    min-height: 1.2em;
}

.imported-batch-info strong {
    color: var(--primary);
}

.imported-filters {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}

.imported-filters-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.imported-filter-item {
    flex: 1;
    min-width: 150px;
}

.imported-filter-wide {
    flex: 2;
    min-width: 250px;
}

.imported-filter-item label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    display: block;
}

.imported-filter-item .input {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    background: var(--bg);
}

.imported-summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.imported-row {
    transition: background 0.15s;
    cursor: pointer;
}

.imported-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

.imported-status-ativa {
    background: rgba(46, 160, 67, 0.12);
    color: #1a7f37;
}

.imported-status-baixada, .imported-status-inapta, .imported-status-inativa {
    background: rgba(207, 34, 46, 0.12);
    color: #cf222e;
}

.imported-status-suspensa, .imported-status-nula {
    background: rgba(191, 135, 0, 0.12);
    color: #9a6700;
}

.imported-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.8rem;
}

.imported-page-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.imported-no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.95rem;
}

.perse-removido-badge {
    background: linear-gradient(135deg, #cf222e, #e74c3c);
    color: #fff;
}

@media (max-width: 768px) {
    .imported-filters-row {
        flex-direction: column;
    }
    .imported-filter-item {
        min-width: 100%;
    }
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.section-title-row .section-title {
    margin-bottom: 0;
}

.tree-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    font-size: 0.82rem;
}

.socio-empresas-count {
    margin-top: 0.3rem;
}

.tree-qtd-zero {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.tree-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
}

.tree-dd-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.tree-dd-item:last-child {
    border-bottom: none;
}

.tree-dd-item:hover {
    background: rgba(26, 111, 160, 0.07);
}

.tree-dd-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

.tree-dd-cnpj {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.tree-dd-empty {
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    text-align: center;
}

.tree-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.tree-root {
    padding: 0.5rem 0 1rem 0;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
}

.tree-node-matriz {
    background: linear-gradient(135deg, #0d2137 0%, #1a4d72 100%);
    color: #fff;
    border-color: transparent;
    padding: 1rem 1.3rem;
}

.tree-node-matriz .tree-node-title {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
}

.tree-node-matriz .tree-node-meta {
    opacity: 0.9;
}

.tree-node-matriz .tree-cnpj {
    color: rgba(255,255,255,0.8);
}

.tree-node-socio {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3fb 100%);
    border-color: rgba(26, 111, 160, 0.25);
}

.tree-node-socio:hover, .tree-node-socio.tree-node-expanded {
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(26, 111, 160, 0.15);
}

.tree-node-highlight {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

.tree-node-body {
    flex: 1;
    min-width: 0;
}

.tree-node-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-node-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.3rem;
    font-size: 0.8rem;
}

.tree-node-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    line-height: 1;
}

.tree-icon-empresa {
    opacity: 0.95;
}

.tree-icon-socio {
    font-size: 1.2rem;
}

.tree-icon-empresa-sm {
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.75;
}

.tree-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tree-badge-matriz {
    background: rgba(26, 111, 160, 0.15);
    color: var(--primary);
}

.tree-node-matriz .tree-badge-matriz {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.tree-badge-filial {
    background: rgba(108, 117, 125, 0.12);
    color: #555;
}

.tree-cnpj {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: monospace;
}

.tree-doc {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: monospace;
}

.tree-faixa {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.06);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.tree-qtd-badge {
    font-size: 0.75rem;
    background: rgba(26, 111, 160, 0.1);
    color: var(--primary);
    padding: 0.15rem 0.5rem;
    border-radius: 5px;
    font-weight: 600;
}

.tree-chevron {
    font-size: 1.3rem;
    color: var(--primary);
    transition: transform 0.25s;
    flex-shrink: 0;
    line-height: 1;
    margin-left: 0.25rem;
}

.tree-children {
    margin-left: 2.2rem;
    margin-top: 0.5rem;
    position: relative;
}

.tree-socio-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
    margin-bottom: 0.6rem;
    flex-direction: column;
    padding-left: 1.5rem;
}

.tree-connector-v {
    width: 2px;
    height: 0.5rem;
    background: var(--border);
    margin-left: 1.5rem;
}

.tree-connector-h {
    position: absolute;
    left: 0;
    top: 1.3rem;
    width: 1.4rem;
    height: 2px;
    background: var(--border);
}

.tree-empresas-list {
    margin-top: 0.5rem;
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tree-empresa-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.tree-empresa-item:hover {
    background: rgba(26, 111, 160, 0.05);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(26, 111, 160, 0.1);
}

.tree-empresa-item.tree-node-highlight {
    border-color: var(--secondary);
    background: rgba(33, 150, 201, 0.06);
}

.tree-empresa-body {
    flex: 1;
    min-width: 0;
}

.tree-empresa-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-detail-arrow {
    font-size: 1rem;
    color: var(--primary);
    flex-shrink: 0;
    opacity: 0.6;
}

.tree-empresa-item:hover .tree-detail-arrow {
    opacity: 1;
}

.tree-empty-msg {
    font-size: 0.88rem;
    color: var(--text-muted);
    padding: 0.8rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .tree-children {
        margin-left: 0.5rem;
    }
    .tree-socio-wrap {
        padding-left: 1rem;
    }
    .tree-node-title {
        font-size: 0.85rem;
    }
}

/* ===================== MAPA DE EMPRESAS ===================== */

/* Nav bar: breadcrumb + info */
.mapa-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

/* Breadcrumb */
.mapa-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--surface, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.mapa-bc-item {
    font-family: 'Inter', sans-serif;
}

.mapa-bc-link {
    color: var(--primary, #3b82f6);
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
}

.mapa-bc-link:hover {
    text-decoration: underline;
}

.mapa-bc-current {
    color: var(--text, #1e293b);
    font-weight: 600;
}

.mapa-bc-sep {
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}

/* Info right side */
.mapa-info-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.mapa-info-text {
    font-size: 0.83rem;
    color: var(--text-muted, #64748b);
    font-style: italic;
    max-width: 420px;
}

.mapa-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}

.mapa-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border, #e2e8f0);
    border-top-color: var(--primary, #3b82f6);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.mapa-svg-container {
    width: 100%;
    max-width: 800px;
    margin: 0.5rem auto 0;
    position: relative;
}

.mapa-svg-container svg {
    width: 100%;
    height: auto;
    display: block;
}

.mapa-svg-container svg path {
    stroke: #fff;
    stroke-width: 0.8;
    transition: opacity 0.15s, stroke-width 0.15s;
}

.mapa-svg-container svg path:hover {
    opacity: 0.8;
    stroke: #333;
    stroke-width: 1.5;
}

.mapa-svg-tooltip {
    position: fixed;
    display: none;
    background: rgba(15, 23, 42, 0.94);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    line-height: 1.5;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.mapa-svg-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    font-family: 'Inter', sans-serif;
}

.mapa-svg-legend-bar {
    width: 140px;
    height: 10px;
    border-radius: 5px;
}

.mapa-cidades-container {
    max-width: 800px;
    margin: 0.5rem auto 0;
}

.mapa-estado-svg {
    width: 100%;
    max-width: 700px;
    margin: 0 auto 1rem;
    position: relative;
}

.mapa-estado-svg svg {
    width: 100%;
    height: auto;
    display: block;
}

.mapa-estado-svg svg path {
    stroke: #fff;
    stroke-width: 0.3;
    transition: opacity 0.15s, stroke-width 0.15s;
}

.mapa-estado-svg svg path:hover {
    opacity: 0.8;
    stroke: #333;
    stroke-width: 1;
}

.mapa-cidades-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.mapa-cidades-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text, #1e293b);
    margin: 0;
}

.mapa-cidades-count {
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
}

.mapa-cidades-list {
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--surface, #fff);
}

.mapa-cidade-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid var(--border, #f1f5f9);
}

.mapa-cidade-row:last-child {
    border-bottom: none;
}

.mapa-cidade-row:hover {
    background: var(--hover-bg, #f0f7ff);
}

.mapa-cidade-rank {
    width: 28px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    flex-shrink: 0;
}

.mapa-cidade-info {
    flex: 1;
    min-width: 0;
}

.mapa-cidade-nome {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text, #1e293b);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mapa-cidade-bar-wrap {
    height: 6px;
    background: var(--border, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}

.mapa-cidade-bar {
    height: 100%;
    background: linear-gradient(to right, rgb(147,197,233), rgb(26,100,160));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.mapa-cidade-total {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text, #475569);
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

.mapa-cidades-more {
    text-align: center;
    padding: 0.75rem;
}

.mapa-btn-more {
    background: none;
    border: 1px solid var(--primary, #3b82f6);
    color: var(--primary, #3b82f6);
    padding: 0.4rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.mapa-btn-more:hover {
    background: var(--primary, #3b82f6);
    color: #fff;
}

.mapa-filtros {
    max-width: 800px;
    margin: 1rem auto 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
}

.mapa-filtros-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    cursor: pointer;
    background: var(--surface, #f8fafc);
    border-bottom: 1px solid var(--border, #e2e8f0);
    user-select: none;
    transition: background 0.15s;
}

.mapa-filtros-header:hover {
    background: var(--hover-bg, #f0f7ff);
}

.mapa-filtros-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text, #1e293b);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mapa-filtros-toggle {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    transition: transform 0.2s;
}

.mapa-filtros-toggle.open {
    transform: rotate(180deg);
}

.mapa-filtros-body {
    padding: 1rem;
    display: none;
}

.mapa-filtros-body.open {
    display: block;
}

.mapa-filtros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

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

.mapa-filtro-group.full-width {
    grid-column: 1 / -1;
}

.mapa-filtro-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mapa-filtro-select,
.mapa-filtro-input {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    color: var(--text, #1e293b);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.mapa-filtro-select:focus,
.mapa-filtro-input:focus {
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}

.mapa-filtros-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.mapa-btn-buscar {
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, #1a6aa0, #2d8fd5);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity 0.15s;
}

.mapa-btn-buscar:hover {
    opacity: 0.9;
}

.mapa-btn-limpar {
    padding: 0.5rem 1.2rem;
    background: none;
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.mapa-btn-limpar:hover {
    background: var(--hover-bg, #f0f7ff);
    color: var(--text, #1e293b);
}

.mapa-resultados {
    max-width: 800px;
    margin: 1rem auto 0;
}

.mapa-resultados-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.mapa-resultados-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text, #1e293b);
}

.mapa-resultados-count {
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
}

.mapa-resultados-wrap {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    overflow-x: auto;
    background: var(--surface, #fff);
}

.mapa-resultados-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
}

.mapa-resultados-table thead th {
    background: linear-gradient(135deg, #1a6aa0, #2d8fd5);
    color: #fff;
    padding: 0.55rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.mapa-resultados-table tbody tr {
    border-bottom: 1px solid var(--border, #f1f5f9);
    transition: background 0.1s;
}

.mapa-resultados-table tbody tr:hover {
    background: var(--hover-bg, #f0f7ff);
}

.mapa-resultados-table td {
    padding: 0.5rem 0.6rem;
    color: var(--text, #334155);
    vertical-align: top;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mapa-resultados-table td.wrap {
    white-space: normal;
    word-break: break-word;
}

.mapa-resultado-situacao {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.mapa-resultado-situacao.ativa {
    background: #dcfce7;
    color: #16a34a;
}

.mapa-resultado-situacao.baixada,
.mapa-resultado-situacao.inapta {
    background: #fee2e2;
    color: #dc2626;
}

.mapa-resultado-status-cnae {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.mapa-resultado-status-cnae.mantido {
    background: #dcfce7;
    color: #16a34a;
}

.mapa-resultado-status-cnae.removido {
    background: #fee2e2;
    color: #dc2626;
}

.mapa-paginacao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    flex-wrap: wrap;
}

.mapa-paginacao button {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border, #e2e8f0);
    background: #fff;
    border-radius: 5px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    color: var(--text, #334155);
    transition: background 0.12s, border-color 0.12s;
}

.mapa-paginacao button:hover:not(:disabled) {
    background: var(--hover-bg, #f0f7ff);
    border-color: var(--primary, #3b82f6);
}

.mapa-paginacao button:disabled {
    opacity: 0.4;
    cursor: default;
}

.mapa-paginacao button.active {
    background: var(--primary, #3b82f6);
    color: #fff;
    border-color: var(--primary, #3b82f6);
}

.mapa-paginacao-info {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.mapa-resultados-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted, #94a3b8);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .mapa-nav-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .mapa-info-text {
        max-width: 100%;
    }
    .mapa-filtros-grid {
        grid-template-columns: 1fr;
    }
    .mapa-resultados-wrap {
        max-height: 60vh;
    }
}

.dash-period-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.dash-period-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.dash-period-btn {
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    padding: 0.35rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-period-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.dash-period-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-color: transparent;
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    transition: opacity 0.3s;
}

.dash-kpi-card {
    background: var(--card-bg);
    border-radius: 0.85rem;
    padding: 1.2rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dash-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.dash-kpi-blue { border-left-color: #1a6fa0; }
.dash-kpi-indigo { border-left-color: #4f46e5; }
.dash-kpi-purple { border-left-color: #8b5cf6; }
.dash-kpi-green { border-left-color: #28a745; }
.dash-kpi-amber { border-left-color: #f59e0b; }
.dash-kpi-teal { border-left-color: #14b8a6; }
.dash-kpi-cyan { border-left-color: #06b6d4; }
.dash-kpi-rose { border-left-color: #f43f5e; }
.dash-kpi-sky { border-left-color: #0ea5e9; }

.dash-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-kpi-blue .dash-kpi-icon { background: rgba(26, 111, 160, 0.12); color: #1a6fa0; }
.dash-kpi-indigo .dash-kpi-icon { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }
.dash-kpi-purple .dash-kpi-icon { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
.dash-kpi-green .dash-kpi-icon { background: rgba(40, 167, 69, 0.12); color: #28a745; }
.dash-kpi-amber .dash-kpi-icon { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.dash-kpi-teal .dash-kpi-icon { background: rgba(20, 184, 166, 0.12); color: #14b8a6; }
.dash-kpi-cyan .dash-kpi-icon { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }
.dash-kpi-rose .dash-kpi-icon { background: rgba(244, 63, 94, 0.12); color: #f43f5e; }
.dash-kpi-sky .dash-kpi-icon { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }

.dash-kpi-icon svg {
    width: 22px;
    height: 22px;
}

.dash-kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-kpi-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.dash-kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.dash-growth-positive {
    color: #28a745 !important;
}

.dash-growth-negative {
    color: #dc3545 !important;
}

.dash-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dash-charts-row:nth-child(even) {
    grid-template-columns: 1fr 1fr;
}

.dash-chart-card {
    background: var(--card-bg);
    border-radius: 0.85rem;
    padding: 1.2rem 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    min-height: 280px;
}

.dash-chart-card canvas {
    max-height: 260px;
}

.dash-chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.dash-api-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem 0;
}

.dash-api-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 0.6rem;
}

.dash-api-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.dash-api-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

.dash-section {
    background: var(--card-bg);
    border-radius: 0.85rem;
    padding: 1.2rem 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.dash-table-wrapper {
    overflow-x: auto;
}

.dash-table-wrapper .data-table {
    margin-bottom: 0;
}

@media (max-width: 1200px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dash-kpi-grid {
        grid-template-columns: 1fr;
    }
    .dash-charts-row,
    .dash-charts-row:nth-child(even) {
        grid-template-columns: 1fr;
    }
    .dash-chart-card {
        min-height: 220px;
    }
    .dash-api-stats {
        grid-template-columns: 1fr;
    }
}

