:root {
    --sidebar-w: 260px;
    --brand: #0d4f8b;
    --brand-dark: #093a66;
    --sidebar-bg: #1d2733;
    --sidebar-fg: #c7d0da;
    --sidebar-active: #0d6efd;
}

html { font-size: 14px; }
body {
    margin: 0;
    background: #f4f6f9;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,.2);
}

/* ---- App shell ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .2s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.25rem;
    font-size: 1.15rem; font-weight: 600; color: #fff;
    background: var(--brand-dark);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.4rem; }

.sidebar-nav { padding: .5rem 0 2rem; }
.sidebar-nav .nav-section {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
    color: #6c7a8a; padding: 1rem 1.25rem .35rem;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem 1.25rem;
    color: var(--sidebar-fg); font-size: .9rem;
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { width: 1.2rem; text-align: center; font-size: 1.05rem; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-nav .nav-link.active {
    background: rgba(13,110,253,.15);
    color: #fff; border-left-color: var(--sidebar-active);
}
.sidebar-nav .nav-link.disabled { opacity: .45; cursor: not-allowed; }

/* ---- Main ---- */
.app-main {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column; min-width: 0;
}
.topbar {
    height: 56px; background: #fff;
    border-bottom: 1px solid #e3e8ee;
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; color: #2a3744; }
.topbar-right { margin-left: auto; }
.app-content { padding: 1.5rem; flex: 1; }
.app-footer {
    padding: .85rem 1.5rem; color: #8995a3; font-size: .8rem;
    border-top: 1px solid #e3e8ee; background: #fff;
}

/* ---- Cards / tables ---- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}
.page-header h1 { font-size: 1.35rem; margin: 0; color: #2a3744; }
.card { border: 1px solid #e3e8ee; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6c7a8a; }

/* ---- Stat cards (dashboard) ---- */
.stat-card { border-radius: .5rem; padding: 1.1rem 1.25rem; color: #fff; display:flex; align-items:center; justify-content:space-between; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { opacity: .9; font-size: .85rem; }
.stat-card i { font-size: 2rem; opacity: .35; }
.bg-grad-1 { background: linear-gradient(135deg,#0d6efd,#0a58ca); }
.bg-grad-2 { background: linear-gradient(135deg,#198754,#146c43); }
.bg-grad-3 { background: linear-gradient(135deg,#fd7e14,#dc6502); }
.bg-grad-4 { background: linear-gradient(135deg,#6f42c1,#59359a); }

/* ---- Auth pages (login/register) ---- */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg,#0d4f8b,#1d2733); padding: 1rem;
}
.auth-card { width: 100%; max-width: 440px; }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
}
