:root {
    --accent-blue: #0b69ff;
    --accent-green: #23c55f;
    --accent-yellow: #ffbf49;
    --accent-red: #ff2a2a;
    --card-radius: 12px;
    --card-shadow: 0 10px 30px rgba(8, 20, 38, 0.06);
    --glass-border: 1px solid rgba(8, 20, 38, 0.06);
}

html.dark-mode {
    --accent-blue: #60a5fa;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --glass-border: 1px solid rgba(148, 163, 184, 0.1);
}

#yearsApi {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1.5px solid #0b69ff;
    background: #fff;
    color: #0b69ff;
    font-weight: 600;
    font-size: 1rem;
    margin-left: 10px;
    min-width: 120px;
    transition: border 0.16s, color 0.16s;
    outline: none;
}

#yearsApi:focus {
    border-color: #0b69ff;
    color: #0854cc;
}

/* === Trend Selector (indicador do gráfico de tendência) — versão mais bonita === */
.trend label[for="trendSelector"] {
    font-size: 1.4rem;
    color: #0b69ff;
    font-weight: 700;
    margin-right: 12px;
    letter-spacing: 0.01em;

}

#trendSelector,
#monthFilter,
#yearFilter,
#searchInput,
.input,
.select {
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1.5px solid #e3eaff;
    background: #f9fafb;
    margin: 8px 0;
    font-size: 0.98rem;
    color: #0b1830;
    font-weight: 300;
    box-shadow: 0 2px 12px 0 #e4eaff44;
    transition: border 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
}

#trendSelector:focus {
    border-color: #0b69ff;
    background: #f4faff;
    box-shadow: 0 0 0 3px #0b69ff33;
}

#trendSelector option {
    background: #fff;
    color: #0b1830;
    font-size: 0.9rem;
}


.header-content,
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
    flex-wrap: wrap;
}

/* Logo Section */
.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: -0.3px;
    line-height: 1;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Navigation */
/* ============================
      NAVIGATION (ULTRA REFINED)
============================ */
.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    margin: 20px 24px;
    flex-wrap: wrap;
}

/* NAV NORMAL */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    text-decoration: none;
    padding: 8px 28px;
    /* 🔥 padding fixo aqui */
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.96rem;
    position: relative;

    background: rgba(11, 105, 255, 0.03);
    border: 1px solid transparent;

    transition:
        background 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        color 0.25s ease,
        border-color 0.3s ease;
}

/* Ícones */
.nav-link i {
    font-size: 1.15rem;
    opacity: 0.85;
    transition: transform 0.3s ease, opacity 0.25s ease;
}

/* Hover premium */
.nav-link:hover {
    background: rgba(11, 105, 255, 0.10);
    transform: translateY(-3px);
    border-color: rgba(11, 105, 255, 0.25);
    color: var(--accent-blue);
}

.nav-link:hover i {
    transform: scale(1.20);
    opacity: 1;
    color: #0080ff;
}

.nav-link.active-link {
    background: rgba(11, 105, 255, 0.15);
    color: var(--accent-blue);
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(11, 105, 255, 0.25);
    border-color: rgba(11, 105, 255, 0.35);


}

/* Barrinha embaixo sem mudar o tamanho do botão */


/* Modo escuro */
html.dark-mode .nav-link,
body[data-theme="dark"] .nav-link {
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
}

html.dark-mode .nav-link:hover,
body[data-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}


/* ============================
        RIGHT SECTION
============================ */
.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

/* Dark mode */
html.dark-mode .search-box,
body[data-theme="dark"] .search-box {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

html.dark-mode .search-box:focus-within,
body[data-theme="dark"] .search-box:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
}


/* Theme Toggle Button */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    background: rgba(11, 105, 255, 0.08);
    color: var(--accent-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease,
        box-shadow 0.3s ease, border-color 0.3s ease;
    padding: 0;
}

.theme-toggle-btn:hover {
    background: var(--accent-blue);
    color: #ffffff;
    transform: rotate(20deg) scale(1.05);
    box-shadow: 0 6px 14px rgba(11, 105, 255, 0.22);
}

.theme-toggle-btn i {
    transition: transform 0.3s ease;
}

html.dark-mode .theme-toggle-btn,
body[data-theme="dark"] .theme-toggle-btn {
    border-color: rgba(11, 105, 255, 0.5);
    background: rgba(11, 105, 255, 0.12);
}

html.dark-mode .theme-toggle-btn:hover,
body[data-theme="dark"] .theme-toggle-btn:hover {
    background: var(--accent-blue);
    color: #0f172a;
}

/* Login Button */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--accent-blue), #0854cc);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(11, 105, 255, 0.22);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(11, 105, 255, 0.28);
}

.login-btn i {
    font-size: 1rem;
}

html.dark-mode .login-btn,
body[data-theme="dark"] .login-btn {
    background: linear-gradient(135deg, var(--accent-blue), #0854cc);
}

body[data-theme="dark"] .header,
html.dark-mode .header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--glass-border);
}

/* Main/hero spacing */
.main-dashboard-content {
    padding-bottom: 40px;
}

.dashboard-hero {
    padding: 32px 0;
    background: linear-gradient(135deg, rgba(11, 105, 255, 0.05) 0%, rgba(23, 162, 184, 0.05) 100%);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 32px;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-hero h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    font-weight: 400;
    opacity: 0.8;
}

/* Controls bar */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: var(--glass-border);
    margin-bottom: 24px;
}

.controls-left {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.input-group {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    /* aqui força alinhamento igual */
    padding: 8px;
    flex-wrap: wrap;
}


.input-group {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.input,
.btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
    transition: border .2s;
    min-width: auto;
    width: auto;
    max-width: 100%;
}

.input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

body[data-theme="dark"] .input,
html.dark-mode .input {
    background: #334155;
    border-color: #000000;
    color: #ffffff;
}

body[data-theme="dark"] .input:focus,
html.dark-mode .input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(11, 105, 255, 0.2);
}


/* Filters / menu */
.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.select {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
}

body[data-theme="dark"] .select,
html.dark-mode .select {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

.menu-dropdown {
    position: relative;
}

.menu-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f9fafb;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .2s;
}

.menu-btn:hover {
    background: #f0f4ff;
}

.menu-content {
    display: none;
    position: absolute;
    top: 45px;
    left: 0;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    min-width: 180px;
    z-index: 10;
    flex-direction: column;
}

.menu-dropdown:hover .menu-content {
    display: flex;
}

.menu-content a {
    padding: 10px 14px;
    color: #111827;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s;
}

.menu-content a:hover {
    background: #f0f4ff;
}

/* Controls right */
.controls-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.status {
    font-size: 0.95rem;
    font-weight: 600;
}

.status strong {
    color: var(--accent-blue);
    font-size: 0.85rem;
}

/* KPI cards (4 across desktop) */
/* --- MOBILE FIRST RESPONSIVE BREAKPOINTS --- */
/* Mobile (0–599px) */
@media (max-width: 599px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 8px 0;
    }

    .logo-section {
        width: 100%;
    }

    .nav {
        width: 100%;
        margin: 8px 0;
        gap: 6px;
        flex-wrap: wrap;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.85rem;
        flex: 0 1 auto;
    }

    .nav-right {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }

    .input-group {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    .input,
    .select,
    .btn {
        width: 100%;
        padding: 10px 12px;
        font-size: 0.95rem;
        min-width: 0;
    }

    #trendSelector {
        width: 100%;
        min-width: 0;
        margin: 8px 0;
        padding: 10px 12px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .kpi-card {
        padding: 12px;
        font-size: 0.9rem;
    }

    .card.trend,
    .card.donut,
    .table-box,
    .summary,
    .card.full {
        grid-column: 1 / -1 !important;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }

    .charts-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .chart-card {
        min-height: 280px;
        flex: 1 !important;
    }

    .chart-card h3 {
        font-size: 0.95rem;
    }

    .chart-card canvas {
        height: 240px !important;
    }

    table {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 6px 4px;
    }

    .table-container {
        max-height: 300px;
    }

    .dashboard-hero {
        padding: 20px 0;
        margin-bottom: 16px;
    }

    .dashboard-hero h1 {
        font-size: 1.4rem;
    }

    .dashboard-hero p {
        font-size: 0.9rem;
    }

    .controls {
        flex-direction: column;
        gap: 6px;
    }

    .muted {
        font-size: 0.8rem;
    }

    .module-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .module-actions input {
        width: 100%;
    }

    .bottom-bar {
        flex-direction: column;
        gap: 6px;
    }
}

/* Tablet (600px–899px) */
@media (min-width: 600px) and (max-width: 899px) {
    .header-content {
        gap: 16px;
    }

    .nav {
        gap: 8px;
        margin: 12px 16px;
    }

    .nav-link {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .controls-bar {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .input-group {
        flex-direction: column;
    }

    .input,
    .select,
    .btn {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card.trend,
    .card.donut,
    .table-box {
        grid-column: 1 / -1;
    }

    .grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .charts-wrapper {
        flex-direction: column;
    }

    .chart-card {
        flex: 1 !important;
    }

    table {
        font-size: 0.9rem;
    }
}

/* Desktop (≥900px) */
@media (min-width: 900px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
    }

    .card.trend {
        grid-column: span 8;
    }

    .card.donut {
        grid-column: span 4;
    }

    .table-box {
        grid-column: span 8;
    }

    .summary {
        grid-column: span 4;
    }

    .charts-wrapper {
        flex-direction: row;
    }

    .chart-card:first-child {
        flex: 2;
    }

    .chart-card:last-child {
        flex: 1;
    }
}

.kpi {

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 16px;
    gap: 6px;

    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.kpi:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.kpi .label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;

}

.kpi .value {
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icon circle inside KPI */
.icon-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

#kpiGrid {
    display: grid;

    gap: 28px;
    padding: 20px;
}

.kpi-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow);
}

html.dark-mode .kpi-card {
    background: var(--surface);
    border-color: var(--border);
}

html.dark-mode .kpi-card:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.kpi-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

html.dark-mode .kpi-header h4 {
    color: #f1f5f9;
}

.valor {
    font-size: 1.9rem;
    font-weight: 700;
    color: #111;
    letter-spacing: 0.5px;
}

.muted {
    font-size: 0.85rem;
    color: #666;
    margin-top: 6px;
}

.icon-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.8s ease, box-shadow 0.8s ease;
}

.icon-circle:hover {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.icon-circle i::before {
    transition: content 0.8s ease;
}

.icon-circle:hover i::before {
    content: "\f080";
}



/* Responsive breakpoints */
@media (max-width:1100px) {
    .kpi {
        grid-column: span 6;
    }

    .trend {
        grid-column: span 12;
    }

    .donut {
        grid-column: span 12;
    }

    .summary {
        width: 100%;
    }
}

@media (max-width:900px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .controls-left {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-right {
        justify-content: flex-end;
    }
}

@media (max-width:700px) {
    .kpi {
        grid-column: span 12;
    }

    .grid {
        padding: 0 12px;
    }

    .controls-bar {
        padding: 0 12px;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* ====== Controls bar ====== */


.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    background: var(--surface);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: none;
    margin-bottom: 20px;
}

.controls-left {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.input-group {
    display: flex;
    gap: 6px;
}

.input {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
    min-width: 220px;
    transition: border 0.2s;
}

.input:focus {
    outline: none;
    border-color: #0b69ff;
}



@media (max-width: 900px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .controls-left {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-right {
        justify-content: flex-end;
    }
}


/* responsive */
@media (max-width:1100px) {
    .kpi {
        grid-column: span 6;
    }

    .trend {
        grid-column: span 12;
    }

    .donut {
        grid-column: span 12;
    }

    .summary {
        width: 100%;
    }
}

@media (max-width:700px) {
    .kpi {
        grid-column: span 12;
    }

    .grid {
        padding: 0 12px;
    }

    .controls-bar {
        padding: 0 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}


.menu-dropdown {
    position: relative;
    display: inline-block;
}

.menu-button {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    background: var(--accent-blue);
    color: #fff;
    transition: background .2s;
}

.menu-button:hover {
    background: #0854cc;
}

.menu-content {
    display: none;
    position: absolute;
    background: #fff;
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    overflow: hidden;
    z-index: 99;
}

html.dark-mode .menu-content {
    background: var(--surface);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.menu-content a {
    color: #081426;
    padding: 10px 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s ease;
    font-size: 14px;
}

html.dark-mode .menu-content a {
    color: var(--text);
}

.menu-content a:hover {
    background: #e4eeff;
}

html.dark-mode .menu-content a:hover {
    background: rgba(11, 105, 255, 0.2);
}

.menu-dropdown.show .menu-content {
    display: block;
}

.trend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filters label {
    font-size: 13px;
    color: #666;
    margin-right: 4px;
}

.filters select,
.filters button {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
}


#kpiGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    position: relative;
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-3px);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.valor {
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 12px;
}

.muted {
    font-size: 0.9em;
    color: #888;
}

/* ===== MODAL ===== */
.chart-modal {
    position: absolute;
    top: 60px;
    right: 10px;
    width: 450px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    padding: 20px;
    z-index: 1000;
    display: none;
    border: 1px solid #e5e7eb;
    animation: slideDown 0.25s ease-out;
    max-height: 600px;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-modal.active {
    display: block;
}

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f4f6;
}

.chart-modal-header h5 {
    font-size: 14px;
    margin: 0;
    color: #1f2937;
    font-weight: 700;
    flex: 1;
}

.close-btn {
    cursor: pointer;
    color: #9ca3af;
    font-size: 24px;
    font-weight: bold;
    transition: color 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.chart-modal canvas {
    max-width: 100%;
    height: 300px;
}

@media (max-width: 768px) {
    .chart-modal {
        width: 95vw;
        max-width: 600px;
        right: 50%;
        transform: translateX(50%);
        top: 50%;
        max-height: 70vh;
    }
}



.card.table-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: none;
    padding: 16px;
    border: 1px solid var(--border);
}

html.dark-mode .card.table-box {
    background: var(--surface);
    border-color: var(--border);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#searchInput {
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    padding: 8px 10px;
    outline: none;
    font-size: 14px;
    width: 220px;
    transition: 0.2s;
}

#searchInput:focus {
    border-color: #4e8ef7;
    box-shadow: 0 0 4px rgba(78, 142, 247, 0.3);
}

.table-container {
    margin-top: 12px;
    overflow: auto;
    max-height: 500px;
    border-radius: 8px;
    border: 1px solid #cfd6e2;
}

/* ====== TABELA ====== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #2a2f3a;
    min-width: 1200px;
}

html.dark-mode table {
    color: var(--text);
}

th,
td {
    border: 1px solid #d9dee8;
    text-align: center;
    padding: 10px 12px;
    vertical-align: middle;
}

html.dark-mode th,
html.dark-mode td {
    border-color: var(--glass-border);
}

/* ====== CABEÇALHO ====== */
thead th {
    background: var(--surface-2);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

html.dark-mode thead th {
    background: var(--surface-2);
    color: var(--text-3);
}

thead th:hover {
    background: var(--border);
    cursor: pointer;
    color: var(--text-2);
}

html.dark-mode thead th:hover {
    background: var(--surface-2);
}

.sort-icon {
    font-size: 13px;
    margin-left: 4px;
    color: #8b96a5;
}

html.dark-mode .sort-icon {
    color: #64748b;
}

/* ====== HOVER ====== */
tbody tr:nth-child(even) {
    background: #fafbfe;
}

html.dark-mode tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.05);
}

tbody tr:hover {
    background: var(--surface-2);
}

/* ====== BOTÕES ====== */
.btn {
    padding: 8px 16px;
    background: #0b69ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn:hover {
    background: #0a5ce0;
}

.btn.ghost {
    background: transparent;
    color: #0b69ff;
    border: 1px solid #0b69ff;
}

.btn.ghost:hover {
    background: #f0f4ff;
    color: #0854cc;
}

html.dark-mode .btn.ghost {
    background: transparent;
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

html.dark-mode .btn.ghost:hover {
    background: rgba(11, 105, 255, 0.15);
}

/* ============================================
   MODAL OVERLAY - BONITO E VISÍVEL
   ============================================ */
/* ============================================
   MODAL DE COMPARAÇÃO — REDESIGN v2
   ============================================ */

/* Overlay: sem backdrop-filter para não travar */
.chart-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 40, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.chart-modal-overlay.active {
    display: flex !important;
    animation: cmoFadeIn 0.18s ease-out both;
}

@keyframes cmoFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Caixa do modal: layout flex coluna, sem overflow no próprio content */
.chart-modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    width: 96%;
    max-width: 1280px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cmoSlideUp 0.22s ease-out both;
    will-change: transform, opacity;
}

@keyframes cmoSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header fixo no topo */
.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
    gap: 16px;
}

.chart-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.close-btn {
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Body: sidebar + área de gráficos, cada um com seu próprio scroll */
.chart-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── SIDEBAR ─────────────────────────────── */
.comparison-controls {
    width: 270px;
    min-width: 220px;
    flex-shrink: 0;
    border-right: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.comparison-controls>label {
    display: block;
    font-weight: 600;
    color: #64748b;
    padding: 14px 18px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    margin: 0;
}

.indicators-list {
    flex: 1;
    overflow-y: auto !important;
    padding: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    grid-template-columns: unset !important;
}

.indicators-list::-webkit-scrollbar {
    width: 4px;
}

.indicators-list::-webkit-scrollbar-track {
    background: transparent;
}

.indicators-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.indicators-list label {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 8px 10px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    margin: 0 !important;
    font-weight: 400;
    transition: background 0.12s;
    transform: none !important;
}

.indicators-list label:hover {
    background: #e0e7ff !important;
    border-color: transparent !important;
    transform: none !important;
}

.indicators-list label:has(input:checked) {
    background: #eff6ff !important;
}

.indicators-list input[type="checkbox"] {
    width: 15px !important;
    height: 15px !important;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
    margin-top: 2px;
}

.indicators-list span {
    font-size: 0.8rem;
    color: #374151;
    line-height: 1.45;
}

/* ── ÁREA DE GRÁFICOS ─────────────────────── */
.charts-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-width: 0;
    background: #f1f5f9;
}

.charts-area::-webkit-scrollbar {
    width: 6px;
}

.charts-area::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 10px;
}

.charts-area::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

.charts-area::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.charts-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)) !important;
    gap: 16px !important;
    margin-top: 0 !important;
}

.chart-container {
    background: #ffffff !important;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

.chart-container:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transform: none;
}

.chart-container h4 {
    margin: 0 0 10px 0 !important;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.canvas-wrap {
    width: 100%;
    height: 260px;
    display: block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── RESPONSIVO ───────────────────────────── */
@media (max-width: 900px) {
    .chart-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        border-radius: 0;
    }

    .chart-modal-body {
        flex-direction: column;
    }

    .comparison-controls {
        width: 100%;
        min-width: 0;
        max-height: 190px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .indicators-list {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        overflow-y: auto !important;
    }

    .indicators-list label {
        flex-basis: calc(50% - 8px);
    }

    .charts-grid {
        grid-template-columns: 1fr !important;
    }

    .chart-modal-header {
        padding: 14px 18px;
    }
}

@media (max-width: 480px) {
    .indicators-list label {
        flex-basis: 100%;
    }

    .charts-area {
        padding: 12px;
    }
}

/* SVG Footer Animation */
.footer-svg-background {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-height: 120vh;
    z-index: -1;
    pointer-events: none;
}

.light-mode-waves {
    display: block;
}

.dark-mode-waves {
    display: none;
}

html.dark-mode .light-mode-waves,
body[data-theme="dark"] .light-mode-waves {
    display: none;
}

html.dark-mode .dark-mode-waves,
body[data-theme="dark"] .dark-mode-waves {
    display: block;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 0;
    grid-column: 1 / -1;
    align-items: stretch;
}

.kpi-divider {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #e3eaff 0%, #0b69ff 100%);
    margin: 32px 0 24px 0;
    border-radius: 9999px;
    opacity: 0.7;
}

.kpi-card {
    width: 100%;
    min-width: 0;
    margin-bottom: 0;
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: none;
    padding: 12px 14px;
    transition: border-color 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card:hover {
    border-color: var(--border-2);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.kpi-header h4 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-3);
    margin: 0;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.valor {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 8px 0 0 0;
    color: var(--text);
    letter-spacing: -0.02em;
}

.muted {
    font-size: 0.95rem;
    color: var(--muted);
}

.icon-circle {
    background: var(--surface-2);
    color: var(--text-2);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    transition: background 0.15s;
    flex-shrink: 0;
}

.kpi-card[data-good="false"] .valor {
    color: var(--accent-red);
}

.kpi-card[data-good="false"] .icon-circle {
    background: var(--accent-red);
}

/* Modo escuro */
html.dark-mode .kpi-card,
body[data-theme="dark"] .kpi-card {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 4px 18px rgba(11, 105, 255, 0.18);
}

html.dark-mode .kpi-header h4,
body[data-theme="dark"] .kpi-header h4 {
    color: var(--text-3);
}

html.dark-mode .valor,
body[data-theme="dark"] .valor {
    color: var(--text);
}

html.dark-mode .kpi-card[data-good="false"] .valor,
body[data-theme="dark"] .kpi-card[data-good="false"] .valor {
    color: #ef4444;
}

html.dark-mode .icon-circle,
body[data-theme="dark"] .icon-circle {
    background: #0b69ff;
    color: #fff;
}

html.dark-mode .kpi-card[data-good="false"] .icon-circle,
body[data-theme="dark"] .kpi-card[data-good="false"] .icon-circle {
    background: #ef4444;
}

@media (max-width: 1024px) {
    .kpi-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .kpi-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #btnClearFilters {
        display: none !important;
    }

    .input-group {
        display: none !important;
    }
}


/* Ensure group titles and dividers span full width of the grid */
.kpi-group-title,
.kpi-group-divider {
    grid-column: 1 / -1;
}



@media (max-width: 768px) {
    #dashboard-filter-debug {
        display: none !important;
    }
}

/* Titulos e divisores dos grupos de KPIs */
.kpi-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    margin: 20px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.kpi-group-divider {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 16px 0;
    border-radius: 0;
    opacity: 1;
}