:root {
    --bg: #0F172A;
    --card: #1E293B;
    --card-hover: #273549;
    --border: #334155;
    --text: #F8FAFC;
    --text-muted: #94A3B8;
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #0B1120;
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #FFF;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary);
    color: #FFF;
}

.user-panel {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info { font-size: 13px; font-weight: 600; }
.btn-logout {
    color: var(--danger);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.15); }

/* Main Content */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
}

.page-title { font-size: 20px; font-weight: 700; }

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.content-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.kpi-title { font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }
.kpi-val { font-size: 26px; font-weight: 800; margin-top: 6px; }

/* Tables */
.table-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title { font-size: 16px; font-weight: 700; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    background: #141E30;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    color: var(--text);
}

tr:hover td { background: var(--card-hover); }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-pagado { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.badge-emitido { background: rgba(37, 99, 235, 0.2); color: #60A5FA; }
.badge-borrador { background: rgba(148, 163, 184, 0.2); color: #CBD5E1; }
.badge-vencido { background: rgba(239, 68, 68, 0.2); color: #F87171; }

/* Responsive */
@media (max-width: 850px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    .content-body { padding: 16px; }
}

