:root {
    --bg: #0f1a2b; --bg-2: #0a1322; --panel: #14223a; --panel-2: #1b2c47;
    --border: #243756; --text: #e7ecf3; --text-dim: #95a3b8; --muted: #6b7a93;
    /* Accent = SmartGov welcome-page blue (kept under the --gold names so the whole theme picks it up). */
    --gold: #38bdf8; --gold-soft: #7dd3fc; --gold-dark: #0ea5e9;
    --primary: #3b82f6; --success: #22c55e; --warning: #f59e0b; --danger: #ef4444;
    --info: #06b6d4; --purple: #8b5cf6; --pink: #ec4899;
    --sidebar-w: 260px; --topbar-h: 72px; --radius: 12px; --radius-sm: 8px;
    --shadow: 0 8px 24px rgba(0,0,0,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
    -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-soft); }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: var(--bg-2); border-right: 1px solid var(--border);
    flex-shrink: 0; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.sidebar-brand .brand-name {
    color: var(--gold); font-weight: 700; font-size: 18px; letter-spacing: .3px;
    font-family: 'Playfair Display', Georgia, serif;
}
.sidebar-brand .brand-sub {
    color: var(--text-dim); font-size: 11px; letter-spacing: 2px;
    text-transform: uppercase; margin-top: 4px;
}
.sidenav { padding: 14px 12px 24px; }
.sidenav-group { margin-top: 18px; }
.sidenav-heading {
    color: var(--muted); font-size: 10.5px; letter-spacing: 2px;
    text-transform: uppercase; padding: 6px 14px; margin-bottom: 4px;
}
.sidenav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    color: var(--text-dim); border-radius: var(--radius-sm); margin-bottom: 2px;
    transition: background .15s ease, color .15s ease; font-weight: 500; position: relative;
}
.sidenav-link:hover { background: var(--panel); color: var(--text); }
.sidenav-link.active { background: var(--panel); color: var(--gold); }
.sidenav-link.active::before {
    content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.sidenav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidenav-badge {
    margin-left: auto; background: var(--gold); color: #1a1206;
    font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--topbar-h); padding: 16px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    border-bottom: 1px solid var(--border); background: var(--bg);
    position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-family: 'Playfair Display', Georgia, serif; color: var(--text); font-size: 24px; margin: 0; font-weight: 700; }
.topbar .subtitle { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
    background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
}
.topbar-btn:hover { background: var(--panel-2); color: var(--text); }
.topbar-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg); }
.avatar-circle {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--panel); color: var(--text); font-weight: 600; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); cursor: pointer;
}
.avatar-mini { width: 30px; height: 30px; font-size: 11px; }
.content { padding: 22px 28px 40px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.dark { background: var(--bg-2); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { color: var(--muted); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; margin: 0; }
.card-title-large { font-family: 'Playfair Display', Georgia, serif; color: var(--text); font-size: 20px; margin: 0; font-weight: 700; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.kpi-label { color: var(--muted); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.kpi-value { font-family: 'Playfair Display', Georgia, serif; color: var(--text); font-size: 36px; font-weight: 700; margin-top: 6px; line-height: 1.05; }
.kpi-foot { color: var(--text-dim); font-size: 12px; margin-top: 8px; }
.kpi-foot.up { color: #86efac; } .kpi-foot.down { color: #fca5a5; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #1a1206; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.list-row .meta { flex: 1; min-width: 0; }
.list-row .meta .name { color: var(--text); font-weight: 600; }
.list-row .meta .sub { color: var(--text-dim); font-size: 12px; }
.list-row .right { color: var(--text-dim); font-size: 12px; }

.bar-row { margin-bottom: 12px; }
.bar-row .label { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--text-dim); font-size: 12.5px; }
.bar-row .label .val { color: var(--text); font-weight: 600; }
.bar-track { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--gold); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; background: var(--bg-2); }
.table tbody tr:hover td { background: rgba(56,189,248,.04); }
.table tbody tr:last-child td { border-bottom: none; }
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }
.table-toolbar h2 { font-family: 'Playfair Display', Georgia, serif; margin: 0; font-size: 20px; }
.table-toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 800px) { .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; } }
.field label { display: block; color: var(--text-dim); font-size: 12.5px; margin-bottom: 6px; font-weight: 500; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="date"], .field input[type="time"], .field input[type="number"],
.field input[type="search"], .field input[type="tel"], .field input[type="url"],
.field input[type="file"], .field select, .field textarea {
    width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
    padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.field .error { color: #fca5a5; font-size: 12px; margin-top: 4px; }
.field input[disabled], .field select[disabled], .field textarea[disabled] { opacity: .6; cursor: not-allowed; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--gold); color: #1a1206; border: none; padding: 10px 16px;
    border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-size: 14px;
    text-decoration: none; transition: background .15s ease, transform .05s ease; font-family: inherit;
}
.btn:hover { background: var(--gold-soft); color: #1a1206; }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--panel); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid transparent; }
.btn-ghost:hover { color: var(--text); background: var(--panel); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.35); }
.btn-success:hover { background: rgba(34,197,94,.2); color: #bbf7d0; }
.btn-reject { background: rgba(239,68,68,.10); color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }
.btn-reject:hover { background: rgba(239,68,68,.18); color: #fecaca; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; }
.badge-pending { background: rgba(56,189,248,.10); color: var(--gold); border-color: rgba(56,189,248,.35); }
.badge-success { background: rgba(34,197,94,.10); color: #86efac; border-color: rgba(34,197,94,.30); }
.badge-danger { background: rgba(239,68,68,.10); color: #fca5a5; border-color: rgba(239,68,68,.30); }
.badge-info { background: rgba(59,130,246,.10); color: #93c5fd; border-color: rgba(59,130,246,.30); }
.badge-warning { background: rgba(245,158,11,.10); color: #fcd34d; border-color: rgba(245,158,11,.30); }
.badge-muted { background: rgba(107,122,147,.10); color: var(--text-dim); border-color: rgba(107,122,147,.30); }
.badge-role { background: rgba(56,189,248,.10); color: var(--gold); border-color: rgba(56,189,248,.30); }

.flash-stack { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.flash { border-radius: var(--radius-sm); padding: 12px 16px; border: 1px solid; font-weight: 500; display: flex; gap: 10px; align-items: flex-start; }
.flash.success { background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.40); color: #86efac; }
.flash.error { background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.40); color: #fca5a5; }
.flash.warning { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.40); color: #fcd34d; }
.flash.info { background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.40); color: #93c5fd; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-aside { display: none; } }
.auth-aside { background: linear-gradient(160deg, #0a1322 0%, #14223a 100%); padding: 60px 60px; color: var(--text); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::before { content: ''; position: absolute; inset: -120px -120px auto auto; width: 360px; height: 360px; background: radial-gradient(circle, rgba(56,189,248,.22), transparent 60%); }
.auth-aside .brand-large { font-family: 'Playfair Display', Georgia, serif; color: var(--gold); font-size: 36px; font-weight: 700; }
.auth-aside .lead { font-family: 'Playfair Display', Georgia, serif; font-size: 30px; line-height: 1.2; max-width: 480px; color: var(--text); }
.auth-aside .points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: var(--text-dim); }
.auth-aside .points li::before { content: '✓'; color: var(--gold); margin-right: 10px; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.auth-card h2 { font-family: 'Playfair Display', Georgia, serif; margin: 0 0 8px; font-size: 26px; }
.auth-card .sub { color: var(--text-dim); margin-bottom: 22px; }

.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: flex; gap: 14px; padding: 12px; border-left: 2px solid var(--border); margin-left: 8px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -7px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--panel); }
.timeline-item .who { color: var(--text); font-weight: 600; }
.timeline-item .when { color: var(--text-dim); font-size: 12px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; text-align: center; padding: 8px 0; }
.cal-cell { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; min-height: 88px; padding: 6px; position: relative; }
.cal-cell .num { color: var(--text-dim); font-size: 12px; }
.cal-cell.today { border-color: var(--gold); }
.cal-cell.today .num { color: var(--gold); font-weight: 700; }
.cal-cell.muted { opacity: .35; }
.cal-event { display: block; background: rgba(59,130,246,.18); color: #93c5fd; border-radius: 4px; padding: 1px 6px; font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-dim { color: var(--text-dim); }
.text-muted { color: var(--muted); }
.text-gold { color: var(--gold); }
.text-danger { color: #fca5a5; }
.text-warning { color: #fcd34d; }
.text-success { color: #86efac; }
.text-info { color: #93c5fd; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.fw-700 { font-weight: 700; }
.mt-0{margin-top:0}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:16px}.mt-4{margin-top:24px}.mt-5{margin-top:32px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:16px}.mb-4{margin-bottom:24px}
.gap-2{gap:8px}.gap-3{gap:16px}.gap-4{gap:24px}
.d-flex{display:flex}.align-center{align-items:center}.justify-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}
.w-100{width:100%}.hidden{display:none!important}

.toolbar-search { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); min-width: 240px; font-family: inherit; font-size: 13px; }
.toolbar-search:focus { outline: none; border-color: var(--gold); }

.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); }
.pager a, .pager span { padding: 6px 11px; border-radius: 6px; background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--border); font-size: 12.5px; }
.pager .current { background: var(--gold); color: #1a1206; border-color: var(--gold); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--panel-2); }

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .content { padding: 0; }
    .card, .table-wrap { border: 1px solid #ccc; background: #fff; color: #000; }
    .table th { background: #f3f3f3; color: #555; }
    .table td, .table th { border-color: #eee; color: #222; }
}