:root {
    /* Cores Light Mode (Padrão) */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #ffffff;
    
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

/* Dark Mode Variables */
body.dark-mode {
    --primary: #6366f1;
    --primary-dark: #818cf8;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --input-bg: #0f172a;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; font-family: 'Inter', sans-serif; transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
body { background-color: var(--bg-body); color: var(--text-main); line-height: 1.6; min-height: 100vh; }
a { text-decoration: none; color: var(--primary); }
ul { list-style: none; }

/* Utilities */
.hidden { display: none !important; }
.text-right { text-align: right; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.mt-4 { margin-top: 1.5rem; }
.p-4 { padding: 1.5rem; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-2 { gap: 0.5rem; }
.cursor-pointer { cursor: pointer; }
.admin-only { display: none; } /* Controlado via JS */

/* Buttons & Inputs */
.btn-primary, .btn-outline, .btn-small {
    padding: 0.75rem 1.5rem; border-radius: var(--radius); border: none; 
    font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; background: var(--primary); color: white; }
.icon-btn { background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; padding: 8px; border-radius: 50%; }
.icon-btn:hover { background: rgba(255,255,255,0.1); }
.full { width: 100%; }

input, select {
    width: 100%; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--input-bg); color: var(--text-main); font-size: 1rem;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); }

/* Header */
header {
    background: var(--primary); color: white; padding: 0 2rem; height: 70px;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.logo { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
nav { display: flex; gap: 5px; height: 100%; }
.nav-btn {
    background: transparent; border: none; color: rgba(255,255,255,0.7); 
    padding: 0 15px; cursor: pointer; height: 100%; font-weight: 500; display: flex; align-items: center; gap: 8px;
    border-bottom: 3px solid transparent;
}
.nav-btn:hover, .nav-btn.active { color: white; background: rgba(255,255,255,0.05); }
.nav-btn.active { border-bottom-color: white; }

/* Main Layout */
main { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; animation: fadeUp 0.5s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.card {
    background: var(--bg-card); padding: 1.5rem; border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 1.5rem;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 1.1rem; color: var(--text-main); }

/* Auth Screen */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.auth-box { width: 100%; max-width: 400px; background: var(--bg-card); padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.brand { text-align: center; margin-bottom: 2rem; }
.logo-circle { width: 60px; height: 60px; background: var(--primary); color: white; font-size: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; margin: 0 auto 1rem; }
.input-group { position: relative; margin-bottom: 1rem; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-group input, .input-group select { padding-left: 45px; }
.auth-toggle { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; }

/* Dashboard */
.header-view { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.filters { display: flex; gap: 1rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.card.kpi { display: flex; align-items: center; gap: 1.5rem; padding: 1.5rem; }
.card.kpi .icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: white; }
.bg-blue { background: #3b82f6; } .bg-green { background: #10b981; } .bg-purple { background: #8b5cf6; }
.card.kpi h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 5px; }
.card.kpi p { font-size: 1.5rem; font-weight: 700; }

.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Lists & Tables */
.list-group { display: flex; flex-direction: column; gap: 0.5rem; }
.list-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 1rem; background: var(--bg-body); border-radius: 8px; cursor: pointer; border: 1px solid transparent; 
}
.list-item:hover, .list-item.active { border-color: var(--primary); background: var(--bg-card); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 1rem; color: var(--text-muted); font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.table td { padding: 1rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: #333; color: white; padding: 12px 24px; border-radius: 8px; z-index: 1000; animation: slideIn 0.3s; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Mobile */
@media (max-width: 768px) {
    .desktop-only { display: none; }
    .grid-2-1, .grid-1-1 { grid-template-columns: 1fr; }
    header { padding: 0 1rem; }
    .nav-btn { padding: 0 10px; }
}