:root {
    --primary: #002b6b;
    --primary-light: #003d99;
    --primary-dark: #001d45;
    --secondary: #712ae2;
    --surface: #f8f9ff;
    --ink: #1a1a2e;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--surface); color: var(--ink); font-size: 14px; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: 0; width: 256px; height: 100vh; background: var(--primary); color: #fff; z-index: 100; display: flex; flex-direction: column; transition: transform .2s; }
.sidebar-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo { width: 36px; height: 36px; background: rgba(255,255,255,.15); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.sidebar-brand { font-size: 13px; font-weight: 600; margin: 0; }
.sidebar-sub { font-size: 11px; color: rgba(255,255,255,.6); margin: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 11px; color: rgba(255,255,255,.5); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }

/* Nav Links */
.nav-link, .nav-link-parent { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: rgba(255,255,255,.7); text-decoration: none; font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: none; width: 100%; text-align: left; transition: background .15s; }
.nav-link:hover, .nav-link-parent:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active, .nav-link-parent.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-link svg, .nav-link-parent svg, .nav-link-child svg { flex-shrink: 0; }
.nav-chevron { margin-left: auto; width: 14px !important; height: 14px !important; transition: transform .2s; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-group.open .nav-children { display: block; }
.nav-children { display: none; margin-left: 16px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.15); }
.nav-children.show { display: block; }
.nav-link-child { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; color: rgba(255,255,255,.6); text-decoration: none; font-size: 13px; transition: background .15s; }
.nav-link-child:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link-child.active { background: rgba(255,255,255,.15); color: #fff; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--border); min-height: 56px; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.topbar-name { font-weight: 600; font-size: 13px; }
.topbar-role { font-size: 11px; }

/* Main Content */
.main-content { margin-left: 256px; min-height: 100vh; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: block; }
    .main-content { margin-left: 0; }
    .sidebar-overlay.d-none { display: none !important; }
}

/* Cards & Tables */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-header p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; justify-content: space-between; align-items: flex-start; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-card .stat-value { font-size: 20px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); }
.table-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-card .table-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.table-card table { width: 100%; margin: 0; }
.table-card th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table-card td { font-size: 13px; vertical-align: middle; }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }

/* Forms */
.form-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.form-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Badges */
.badge-status { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.login-logo { width: 56px; height: 56px; background: var(--primary); color: #fff; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin: 0 auto 16px; }
.login-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-footer { text-align: center; color: var(--muted); font-size: 11px; margin-top: 20px; }

/* Flash Messages */
.flash-message { padding: 12px 20px; margin: 16px 24px 0; border-radius: 8px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }
.flash-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; }

/* Quick Links */
.quick-link { display: block; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: 13px; font-weight: 500; color: var(--primary); text-decoration: none; transition: all .15s; }
.quick-link:hover { background: var(--primary); color: #fff; }

/* Text Helpers */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary-color { color: var(--primary) !important; }
