:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --background: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
}

/* ====================== LOGIN ====================== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 50%, #1e293b 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 48px 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
    text-align: center;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-card h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 20px;
    font-size: 20px;
}

.auth-switch {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ====================== INPUTS ====================== */
.input-field {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px;
    margin-top: 4px;
    transition: border-color 0.2s;
    background: white;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.login-card .input-field {
    margin-bottom: 12px;
}

/* ====================== LAYOUT ====================== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    overflow: hidden;
    min-height: 0;
}

.logo {
    padding: 0 24px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: bold;
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.menu {
    flex: 1;
    padding: 0 12px;
    overflow-y: auto;
    min-height: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s;
}

.menu-item:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.menu-item.active {
    background-color: #eff6ff;
    color: var(--primary);
}

.menu-divider {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin: 24px 16px 8px;
    letter-spacing: 0.05em;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--secondary);
}

.details .name {
    font-size: 14px;
    font-weight: 600;
}

.details .role {
    font-size: 12px;
    color: var(--text-muted);
}

/* ====================== MAIN ====================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-bar {
    padding: 24px 40px;
    background-color: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-bar h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
}

/* ====================== BOTÕES ====================== */
.btn {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-logout {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid var(--border);
    width: 100%;
    text-align: center;
}

.btn-logout:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #fee2e2;
}

/* ====================== CONTEÚDO ====================== */
.content-area {
    padding: 40px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
}

.kpi-trend {
    font-size: 12px;
    font-weight: 600;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.neutral { color: var(--secondary); }

/* ====================== TABELAS ====================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

/* ====================== DROP ZONE ====================== */
.drop-zone {
    padding: 40px;
    border: 2px dashed var(--border);
    text-align: center;
    border-radius: 12px;
    transition: border-color 0.2s;
}

.drop-zone:hover {
    border-color: var(--primary);
}

/* ====================== MODAL ====================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.modal-box h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 4px;
}

.modal-box label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

/* ====================== BADGES ====================== */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ====================== SUB-ABAS (TABS) ====================== */
.tabs-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

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

.tab-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 700;
}

/* ====================== RELATÓRIOS (DFC/DRE) ====================== */
.report-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.report-table th {
    padding: 10px 12px;
    text-align: right;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: white;
}

.report-table th:first-child {
    text-align: left;
    min-width: 220px;
    position: sticky;
    left: 0;
    z-index: 2;
}

.report-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.report-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

.report-table tbody tr:hover td {
    background: #f8fafc;
}

/* Linhas totalizadoras */
.row-summary td {
    font-weight: 700;
    background: #f1f5f9 !important;
}

.row-summary td:first-child {
    background: #f1f5f9 !important;
}

.row-grand-total td {
    font-weight: 700;
    border-top: 2px solid var(--text-main);
    background: #e2e8f0 !important;
    font-size: 14px;
}

.row-grand-total td:first-child {
    background: #e2e8f0 !important;
}

/* Indentação hierárquica */
.indent-1 { padding-left: 24px !important; }
.indent-2 { padding-left: 48px !important; }
.indent-3 { padding-left: 72px !important; }

/* Porcentagem sobre receita */
.pct-cell {
    color: var(--text-muted);
    font-size: 11px;
}

/* ====================== FILTROS ====================== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-bar .input-field {
    width: auto;
    min-width: 80px;
}

.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    min-width: 250px;
    padding: 8px;
}

.filter-dropdown-content.show {
    display: block;
}

.filter-dropdown-content label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
}

.filter-dropdown-content label:hover {
    background: #f1f5f9;
}

/* ====================== ANIMAÇÃO ====================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
