/* === SISTEMA DE TEMAS COM DEGRADÊS SUAVES E NÃO AGRESSIVOS === */
:root, [data-theme="sky"] { 
    --bg-body: linear-gradient(145deg, #eef7fc 0%, #e3f2fd 50%, #f0fdf9 100%);
    --bg-surface: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --bg-surface-light: #f0f7ff;
    --bg-card: #ffffff;
    --text-main: #1e293b; 
    --text-muted: #64748b; 
    --border-color: #e2e8f0;
    --primary: #0284c7; 
    --primary-hover: #0369a1; 
    --highlight: #0284c7;
    --title-gradient: linear-gradient(135deg, #0369a1 0%, #0284c7 60%, #0d9488 100%);
    --shadow-card: 0 8px 30px rgba(15, 23, 42, 0.05);
}

[data-theme="lavender"] { 
    --bg-body: linear-gradient(145deg, #f8f6fc 0%, #f3edf9 50%, #faf5ff 100%);
    --bg-surface: linear-gradient(180deg, #ffffff 0%, #faf8fc 100%);
    --bg-surface-light: #f5effe;
    --bg-card: #ffffff;
    --text-main: #332d41; 
    --text-muted: #756a85; 
    --border-color: #ece4f5;
    --primary: #8b5cf6; 
    --primary-hover: #7c3aed; 
    --highlight: #8b5cf6;
    --title-gradient: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 60%, #c026d3 100%);
    --shadow-card: 0 8px 30px rgba(139, 92, 246, 0.05);
}

[data-theme="coral"] { 
    --bg-body: linear-gradient(145deg, #fdf6f6 0%, #fef0ee 50%, #fff7ed 100%);
    --bg-surface: linear-gradient(180deg, #ffffff 0%, #fdf9f8 100%);
    --bg-surface-light: #feebe8;
    --bg-card: #ffffff;
    --text-main: #3d2d2d; 
    --text-muted: #826e6e; 
    --border-color: #f8e1dc;
    --primary: #f43f5e; 
    --primary-hover: #e11d48; 
    --highlight: #f43f5e;
    --title-gradient: linear-gradient(135deg, #be123c 0%, #f43f5e 60%, #ea580c 100%);
    --shadow-card: 0 8px 30px rgba(244, 63, 94, 0.05);
}

[data-theme="mint"] { 
    --bg-body: linear-gradient(145deg, #f0fbf7 0%, #e6f7f2 50%, #f0fdf9 100%);
    --bg-surface: linear-gradient(180deg, #ffffff 0%, #f6fcfa 100%);
    --bg-surface-light: #e4f7f1;
    --bg-card: #ffffff;
    --text-main: #233835; 
    --text-muted: #5e7975; 
    --border-color: #d1ece5;
    --primary: #0d9488; 
    --primary-hover: #0f766e; 
    --highlight: #0d9488;
    --title-gradient: linear-gradient(135deg, #0f766e 0%, #0d9488 60%, #059669 100%);
    --shadow-card: 0 8px 30px rgba(13, 148, 136, 0.05);
}

[data-theme="dark"] { 
    --bg-body: linear-gradient(145deg, #0f172a 0%, #151f33 50%, #0f172a 100%);
    --bg-surface: linear-gradient(180deg, #1e293b 0%, #172033 100%);
    --bg-surface-light: #25334a;
    --bg-card: #1e293b;
    --text-main: #f8fafc; 
    --text-muted: #94a3b8; 
    --border-color: #2e3d55;
    --primary: #6366f1; 
    --primary-hover: #4f46e5; 
    --highlight: #6366f1; 
    --title-gradient: linear-gradient(135deg, #ffffff 0%, #c7d2fe 60%, #818cf8 100%);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
}

[data-theme="midnight"] { 
    --bg-body: linear-gradient(145deg, #070d17 0%, #0c182a 50%, #070d17 100%);
    --bg-surface: linear-gradient(180deg, #101c2e 0%, #0c1626 100%);
    --bg-surface-light: #182a44;
    --bg-card: #111a2e;
    --text-main: #f1f5f9; 
    --text-muted: #94a3b8; 
    --border-color: #1e3352;
    --primary: #38bdf8; 
    --primary-hover: #0284c7; 
    --highlight: #38bdf8; 
    --title-gradient: linear-gradient(135deg, #ffffff 0%, #7dd3fc 60%, #38bdf8 100%);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at 8% 4%, color-mix(in srgb, var(--primary) 18%, transparent) 0%, transparent 34%),
        radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--primary-hover) 14%, transparent) 0%, transparent 38%),
        var(--bg-body) !important;
    background-attachment: fixed !important;
    background-size: cover !important;
    color: var(--text-main);
    margin: 0; 
    padding: 0; 
    min-height: 100vh;
    transition: color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 30px 60px 30px;
}

/* --- CABEÇALHO --- */
.custom-header { 
    margin-bottom: 24px; 
    display: grid; 
    grid-template-columns: 1fr auto 1fr; 
    align-items: center; 
    gap: 20px;
    padding-bottom: 16px;
    padding: 14px 18px;
    background:
        linear-gradient(120deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent 46%),
        var(--bg-surface);
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border-color));
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 10px 28px rgba(15,23,42,0.1);
}

.header-left { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
    justify-content: flex-start;
}
.logo-header { 
    height: 48px; 
    width: auto; 
    object-fit: contain; 
    border-radius: 8px; 
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}

.title-area { 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    text-align: center;
}
.title-area h1 { 
    margin: 0; 
    font-size: 26px; 
    font-weight: 800; 
    letter-spacing: -0.5px; 
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
    white-space: nowrap;
}
.title-area span {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.header-actions { 
    display: flex; 
    align-items: center; 
    justify-content: flex-end;
    gap: 12px; 
}

.btn-voltar {
    background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 9%, transparent), transparent), var(--bg-surface);
    color: var(--text-main);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border-color));
    padding: 9px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 5px 14px rgba(15,23,42,0.1);
    backdrop-filter: blur(8px);
}
.btn-voltar:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

/* --- SELETOR DE TEMAS --- */
.theme-picker {
    display: inline-flex; 
    gap: 7px; 
    align-items: center;
    background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent), var(--bg-surface);
    padding: 6px 12px;
    border-radius: 30px; 
    border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border-color));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 5px 16px rgba(15,23,42,0.11);
    opacity: 0.9;
    transition: opacity 0.3s, transform 0.2s;
}
.theme-picker:hover { 
    opacity: 1; 
    transform: translateY(-1px);
}
.dot { 
    width: 15px; 
    height: 15px; 
    border-radius: 50%; 
    cursor: pointer; 
    border: 1.5px solid rgba(0,0,0,0.1); 
    transition: transform 0.2s, box-shadow 0.2s; 
}
.dot:hover { 
    transform: scale(1.3); 
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.dot.sky { background: linear-gradient(135deg, #38bdf8, #0284c7); border-color: #38bdf8; }
.dot.lavender { background: linear-gradient(135deg, #c084fc, #8b5cf6); border-color: #a78bfa; }
.dot.coral { background: linear-gradient(135deg, #fb7185, #f43f5e); border-color: #f43f5e; }
.dot.mint { background: linear-gradient(135deg, #2dd4bf, #0d9488); border-color: #2dd4bf; }
.dot.dark { background: linear-gradient(135deg, #6366f1, #0f172a); border-color: #6366f1; }
.dot.midnight { background: linear-gradient(135deg, #38bdf8, #0a0f1d); border-color: #38bdf8; }

/* --- CARDS & PAINÉIS --- */
.card {
    background:
        radial-gradient(circle at 5% 0%, color-mix(in srgb, var(--primary) 11%, transparent), transparent 38%),
        radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--primary-hover) 8%, transparent), transparent 42%),
        var(--bg-surface);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border-color));
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.52), 0 14px 36px rgba(15,23,42,0.12), 0 0 0 1px color-mix(in srgb, var(--primary) 7%, transparent);
    backdrop-filter: blur(10px);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* --- FILTROS --- */
.filtros-grid {
    margin-bottom: 16px; 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: 10px;
    align-items: flex-end;
}

label { 
    display: block; 
    font-weight: 700; 
    font-size: 11px; 
    margin-bottom: 6px; 
    color: var(--text-muted); 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input { 
    width: 100%; 
    padding: 6px 8px; 
    background: linear-gradient(145deg, var(--bg-surface-light), color-mix(in srgb, var(--bg-surface-light) 84%, var(--primary)));
    color: var(--text-main); 
    border: 1px solid color-mix(in srgb, var(--primary) 27%, var(--border-color));
    border-radius: 8px; 
    box-sizing: border-box; 
    font-size: 13px; 
    font-family: inherit;
    box-shadow: inset 0 1px 3px rgba(15,23,42,0.08), 0 2px 7px rgba(15,23,42,0.05);
}
input:focus { 
    outline: none; 
    border-color: var(--primary); 
}

/* --- CARDS DE RESUMO --- */
.resumo-metricas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.card-metrica {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.card-title { 
    font-size: 11px; 
    color: var(--text-muted); 
    font-weight: 700; 
    text-transform: uppercase; 
    margin-bottom: 2px; 
    display: block; 
    letter-spacing: 0.5px;
}
.card-value { 
    font-size: 24px; 
    font-weight: 800; 
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}
.card-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 22px;
    margin-bottom: 28px;
}

.chart-container {
    position: relative;
    min-height: 380px;
    height: 380px;
}

.chart-container h3, .tabela-card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- TABELA DE DADOS REAIS --- */
.tabela-card {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}
th {
    background: linear-gradient(145deg, var(--bg-surface-light), color-mix(in srgb, var(--bg-surface-light) 84%, var(--primary)));
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}
tr:hover td {
    background-color: var(--bg-surface-light);
}
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background-color: var(--bg-surface-light);
    background-image: linear-gradient(145deg, rgba(255,255,255,0.24), rgba(15,23,42,0.08));
    border: 1px solid color-mix(in srgb, var(--primary) 27%, var(--border-color));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.42), 0 3px 8px rgba(15,23,42,0.07);
}
.badge-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    border: none;
}

/* === RESPONSIVIDADE === */
@media (max-width: 900px) {
    .container {
        padding: 14px;
    }
    .custom-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    .header-actions {
        width: 100%;
        justify-content: stretch;
    }
    .btn-voltar {
        width: 100%;
        justify-content: center;
    }
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .chart-container {
        min-height: 0;
        height: 280px;
        padding: 16px;
    }
    .chart-container h3 {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

}

@media (max-width: 480px) {
    .container {
        padding: 8px 8px 32px;
    }

    .custom-header {
        gap: 8px;
        margin-bottom: 12px;
        padding: 10px 12px;
        border-radius: 12px;
    }

    .header-left {
        gap: 8px;
    }

    .logo-header {
        height: 38px;
        max-width: 160px;
    }

    .theme-picker {
        gap: 5px;
        padding: 5px 8px;
    }

    .dot {
        width: 13px;
        height: 13px;
    }

    .title-area h1 {
        font-size: 20px;
        white-space: normal;
        line-height: 1.15;
    }

    .title-area span {
        margin-top: 2px;
        font-size: 11px;
        line-height: 1.3;
    }

    .btn-voltar {
        min-height: 34px;
        padding: 7px 12px;
        font-size: 12px;
    }

    .card {
        padding: 12px;
        border-radius: 12px;
    }

    .filtros-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 12px;
    }

    .filtros-grid > div:nth-child(1),
    .filtros-grid > div:nth-child(6) {
        grid-column: 1 / -1;
    }

    .filtros-grid label {
        margin-bottom: 4px;
        font-size: 9px;
        line-height: 1.2;
    }

    .filtros-grid input,
    .filtros-grid .btn-voltar {
        min-height: 36px;
        height: 36px !important;
        padding: 7px 9px;
        font-size: 11px;
    }

    .resumo-metricas {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 12px;
    }

    .card-metrica {
        min-height: 104px;
        padding: 12px 10px;
    }

    .card-title {
        font-size: 9px;
        line-height: 1.25;
    }

    .card-value {
        font-size: 27px;
    }

    .card-sub {
        font-size: 10px;
        line-height: 1.3;
    }

    .charts-grid {
        gap: 10px;
        margin-bottom: 12px;
    }

    .chart-container {
        height: 210px;
        padding: 10px 9px;
    }

    .chart-container h3 {
        margin-bottom: 6px;
        padding-bottom: 6px;
        font-size: 12px;
        line-height: 1.25;
    }

    .tabela-card {
        padding: 12px 0 0;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .tabela-card h3 {
        position: sticky;
        left: 0;
        padding: 0 12px 8px;
        margin-bottom: 0;
        font-size: 12px;
        line-height: 1.3;
    }

    .tabela-card table {
        min-width: 760px;
        font-size: 11px;
    }

    .tabela-card th,
    .tabela-card td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    .tabela-card th {
        font-size: 9px;
    }

    .tabela-card td:nth-child(2) {
        min-width: 220px;
        white-space: normal;
    }
}

/* ====================================================
   MODAL DE ACESSO RESTRITO (SENHA) & BOTÃO DE SAIR
   ==================================================== */
.btn-bloquear-sessao {
    background: linear-gradient(145deg, color-mix(in srgb, #ef4444 8%, transparent), transparent), var(--bg-surface);
    color: #ef4444; 
    border: 1px solid color-mix(in srgb, #ef4444 28%, var(--border-color));
    border-radius: 8px;
    padding: 9px 14px; 
    font-size: 13px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.2s; 
    text-decoration: none;
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 6px;
    backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 5px 14px rgba(15,23,42,0.1);
    height: 38px;
}
.btn-bloquear-sessao:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
    transform: translateY(-1px);
}

.modal-acesso-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.modal-acesso-card {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border-color));
    border-top: 5px solid var(--primary);
    border-radius: 20px;
    padding: 34px 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    animation: modalAcessoEntrada 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

@keyframes modalAcessoEntrada {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-acesso-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px auto;
}

.modal-acesso-card h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 6px 0;
    color: var(--text-main);
}

.modal-acesso-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 22px 0;
    line-height: 1.4;
}

.modal-acesso-field {
    text-align: left;
    margin-bottom: 16px;
}

.modal-acesso-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 6px;
}

.modal-acesso-field .input-com-icone {
    position: relative;
    display: flex;
    align-items: center;
}

.modal-acesso-field .input-com-icone i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
}

.modal-acesso-field .input-com-icone input {
    width: 100%;
    padding: 12px 14px 12px 38px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-light);
    color: var(--text-main);
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
}

.modal-acesso-field .input-com-icone input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.erro-acesso {
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    margin: -8px 0 14px 0;
}

.btn-acessar {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-acessar:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-acessar:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Estado bloqueado para conteúdo antes de digitar a senha */
.conteudo-bloqueado {
    filter: blur(10px);
    pointer-events: none;
    user-select: none;
}

