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

:root {
    --bg-primary: #020205;
    --card-bg: rgba(13, 13, 20, 0.5);
    --card-hover: rgba(20, 20, 30, 0.7);
    --accent: #8b5cf6;
    --accent-light: #c084fc;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.08);
    --shadow-elite: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    --gradient-elite: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --radius: 18px;
}

/* 1. ESTABILIDADE GLOBAL */
* { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none; color: inherit; transition: 0.3s; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 0;
}

/* 2. DYNAMIC MESH BACKGROUND */
.bg-mesh {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; background: var(--bg-primary);
}
.mesh-ball {
    position: absolute; border-radius: 50%; filter: blur(120px);
    opacity: 0.2; animation: flow 20s infinite alternate ease-in-out;
}
.ball-1 { width: 500px; height: 500px; background: #8b5cf6; top: -100px; left: -100px; }
.ball-2 { width: 600px; height: 600px; background: #3b82f6; bottom: -150px; right: -150px; animation-delay: -5s; }
.ball-3 { width: 300px; height: 300px; background: #d946ef; top: 40%; left: 30%; animation-delay: -10s; }

@keyframes flow {
    0% { transform: translate(0,0) scale(1); }
    100% { transform: translate(15%, 10%) scale(1.2); }
}

/* 3. LAYOUT & GLASS */
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 30px 20px; }

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elite);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 4. HEADER */
.header { display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; margin-bottom: 35px; }
.header .brand { display: flex; align-items: center; }
.header .brand h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -1px; background: var(--gradient-elite); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* 5. CARDS DASHBOARD */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
.card { padding: 30px; }
.card:hover { transform: translateY(-8px); border-color: rgba(255,255,255,0.15); background: var(--card-hover); }
.card h3 { color: var(--text-secondary); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; }
.card .valor { font-size: 2rem; font-weight: 800; letter-spacing: -1px; }

/* 6. TABLES & SECTIONS */
.section, .table-container { padding: 30px; margin-top: 30px; }
.section h2 { font-size: 1.3rem; margin-bottom: 25px; font-weight: 700; }
.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 15px; color: var(--text-secondary); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border-glass); }
td { padding: 20px 15px; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 0.9rem; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* 7. BOTÕES */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 24px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
    font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 10px; transition: 0.2s;
}
.btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: scale(0.95); }
.btn-primary { background: var(--gradient-elite); color: white; box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3); }
.btn-secondary { background: rgba(255,255,255,0.05); border-color: var(--border-glass); color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-sm { padding: 7px 15px; font-size: 12px; }

/* 8. MODAL ELITE */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
    display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal { background: #0b0b15; border: 1px solid var(--border-glass); border-radius: 24px; width: 100%; max-width: 480px; padding: 35px; box-shadow: 0 50px 100px rgba(0,0,0,0.9); position: relative; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-close { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-glass); color: var(--text-secondary); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.modal-close:hover { background: #ef4444; color: white; transform: rotate(90deg); }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; }
.form-group input, .form-group select {
    width: 100%; padding: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border-glass);
    border-radius: 12px; color: white; font-size: 0.9rem; transition: 0.3s;
}

/* 9. FILTRO BAR */
.filtro { padding: 25px; margin: 20px 0 30px 0; }
.filtro form { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; }
.filtro .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }
.filtro .btn-primary { height: 45px; }

/* 10. LOGIN PAGE */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; position: relative; z-index: 1; }
.login-box { width: 100%; max-width: 400px; padding: 50px 40px; text-align: center; }
.login-box img { filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.4)); }
.login-box h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; background: var(--gradient-elite); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-box h3 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 35px; font-weight: 400; }

/* 11. SCROLLBAR & UTILS */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }
.grafico { height: 350px; width: 100%; padding-top: 20px; position: relative; }
.grafico canvas { max-height: 100% !important; width: 100% !important; }
.staggered-item { animation: fadeInUp 0.5s ease backwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* 12. RESPONSIVE */
.nav-toggle { display: none; }
@media (max-width: 768px) {
    .header { flex-direction: row; padding: 15px 20px; justify-content: space-between; }
    .nav-toggle { display: block; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }
    .user-info { display: none; width: 100%; flex-direction: column; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-glass); }
    .user-info.active { display: flex; }
    .user-info a, .user-info button { width: 100%; justify-content: center; }
    .cards { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

.footer-elite { 
    margin-top: 60px; 
    border-bottom-left-radius: 0; 
    border-bottom-right-radius: 0;
    width: 100%;
}
@media (max-width: 768px) { 
    .footer-elite div { justify-content: center !important; text-align: center; flex-direction: column; gap: 10px; } 
}

/* 13. TEMA DE IMPRESSÃO */
@media print {
    body { background: white !important; color: black !important; padding: 0 !important; font-size: 10pt; }
    .bg-mesh, .header, .nav-toggle, .btn-primary, .btn-secondary, .btn-danger, .filtro, .swal2-container, .footer-elite { display: none !important; }
    .container { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
    .glass-panel { background: white !important; border: 1px solid #eee !important; box-shadow: none !important; backdrop-filter: none !important; color: black !important; padding: 10px !important; margin-bottom: 20px !important; }
    .cards { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; margin-bottom: 30px !important; }
    .card { border: 1px solid #f0f0f0 !important; padding: 15px !important; text-align: center !important; }
    .card h3 { color: #555 !important; font-size: 9pt !important; margin-bottom: 5px !important; }
    .card .valor { color: #000 !important; font-size: 14pt !important; font-weight: 800 !important; }
    table { width: 100% !important; border: 1px solid #eee !important; border-collapse: collapse !important; margin-top: 10px !important; }
    th { background: #f5f5f5 !important; color: #000 !important; border: 1px solid #eee !important; font-size: 8pt !important; padding: 6px !important; text-transform: uppercase !important; }
    td { border: 1px solid #eee !important; font-size: 8pt !important; padding: 6px !important; color: #333 !important; }
    .grafico { display: none !important; }
    h1, h2 { color: #000 !important; font-size: 16pt !important; margin-bottom: 10px !important; font-weight: 800 !important; }
    .table-container h2 { margin-top: 20px !important; }
    tr:nth-child(even) { background: #fafafa !important; }
    .table-container { border: none !important; }
}