:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff6ff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --bg: #f4f6fb;
    --sidebar-w: 268px;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: .925rem;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.1rem 1.15rem;
    border-bottom: 1px solid var(--line);
}

.app-brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex: 0 0 auto;
}

.app-brand-name { font-weight: 700; line-height: 1.15; font-size: .95rem; }
.app-brand-sub { font-size: .72rem; color: var(--muted); }

.app-nav {
    padding: .8rem .7rem 1.4rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

.app-nav::-webkit-scrollbar { width: 6px; }
.app-nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }

.nav-heading {
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    padding: 1rem .55rem .4rem;
}

.app-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #475569;
    font-weight: 500;
    font-size: .875rem;
    padding: .5rem .6rem;
    border-radius: 10px;
    margin-bottom: 2px;
}

.app-nav .nav-link i { font-size: 1.02rem; width: 1.2rem; text-align: center; color: #94a3b8; }
.app-nav .nav-link:hover { background: #f1f5f9; color: var(--brand); }
.app-nav .nav-link:hover i { color: var(--brand); }
.app-nav .nav-link.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.app-nav .nav-link.active i { color: var(--brand); }

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1.4rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.app-topbar-title { font-weight: 650; font-size: 1rem; margin: 0; }
.app-topbar-sub { font-size: .75rem; color: var(--muted); }

.app-content { padding: 1.4rem; flex: 1 0 auto; }
.app-footer { padding: 1rem 1.4rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); }

.sidebar-toggle { display: none; }

/* ---------- Cards & common ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    padding: .9rem 1.1rem;
    font-weight: 650;
}

.card-body { padding: 1.1rem; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: 1.1rem;
}

.page-head h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }
.page-head p { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; }

.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.05rem;
    box-shadow: var(--shadow);
    height: 100%;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    margin-bottom: .7rem;
}

.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.15; }
.stat-label { color: var(--muted); font-size: .78rem; }

.soft-blue { background: #eff6ff; color: #2563eb; }
.soft-green { background: #ecfdf5; color: #059669; }
.soft-amber { background: #fffbeb; color: #d97706; }
.soft-red { background: #fef2f2; color: #dc2626; }
.soft-purple { background: #f5f3ff; color: #7c3aed; }
.soft-slate { background: #f1f5f9; color: #475569; }

.table { --bs-table-border-color: var(--line); margin-bottom: 0; }
.table > thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    font-weight: 700;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table > tbody > tr > td { vertical-align: middle; font-size: .86rem; }
.table-hover > tbody > tr:hover > * { background: #f8fbff; }

.btn { border-radius: 9px; font-weight: 550; font-size: .85rem; padding: .45rem .85rem; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; border-radius: 8px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-icon { padding: .28rem .45rem; line-height: 1; }

.form-label { font-weight: 600; font-size: .8rem; margin-bottom: .3rem; color: #334155; }
.form-control, .form-select { border-radius: 9px; border-color: #d7dee8; font-size: .87rem; padding: .48rem .7rem; }
.form-control:focus, .form-select:focus { border-color: #93b4f8; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .1); }
.form-text { font-size: .74rem; }
.invalid-feedback { font-size: .74rem; }
.required::after { content: " *"; color: #dc2626; }

.badge { font-weight: 600; font-size: .72rem; padding: .35em .6em; border-radius: 7px; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: .78rem;
    flex: 0 0 auto;
}

.avatar-lg { width: 68px; height: 68px; font-size: 1.25rem; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #f1f5f9;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .18rem .6rem;
    font-size: .75rem;
    color: #475569;
}

.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2rem; color: #cbd5e1; display: block; margin-bottom: .5rem; }

.alert { border-radius: 11px; border: 1px solid transparent; font-size: .85rem; }

.table-responsive { border-radius: 10px; }

.progress { height: 7px; border-radius: 99px; background: #eef2f7; }
.progress-bar { border-radius: 99px; }

.quick-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #334155;
    font-size: .84rem;
    font-weight: 550;
    background: #fff;
    transition: .15s ease;
}
.quick-link:hover { border-color: #bfdbfe; background: #f8fbff; color: var(--brand-dark); }
.quick-link i { color: var(--brand); }

.list-clean { list-style: none; margin: 0; padding: 0; }
.list-clean li { padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .84rem; }
.list-clean li:last-child { border-bottom: 0; }

.nav-tabs .nav-link { border-radius: 9px 9px 0 0; font-size: .84rem; font-weight: 600; color: #64748b; }
.nav-tabs .nav-link.active { color: var(--brand-dark); }

.modal-content { border-radius: var(--radius); border: 0; }

/* ---------- Auth ---------- */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: #fff;
}

.auth-aside {
    position: relative;
    padding: 3rem;
    color: #fff;
    background: radial-gradient(1200px 600px at 10% 10%, #3b82f6 0%, #1e3a8a 45%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
.auth-aside::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -140px;
    bottom: -160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}
.auth-aside-brand { display: flex; align-items: center; gap: .8rem; font-weight: 700; }
.auth-aside h2 { font-size: 2rem; font-weight: 700; line-height: 1.25; max-width: 26ch; }
.auth-aside p { color: #cbd5e1; max-width: 40ch; }
.auth-feature { display: flex; gap: .6rem; align-items: flex-start; margin-top: .9rem; color: #dbeafe; font-size: .86rem; }
.auth-feature i { color: #93c5fd; margin-top: .15rem; }

.auth-main { display: grid; place-items: center; padding: 2rem 1.4rem; background: #f8fafc; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.4rem; font-weight: 700; }
.auth-card .card { box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }

.otp-input { letter-spacing: .55em; font-size: 1.3rem; font-weight: 700; text-align: center; }

/* ---------- Print ---------- */
.print-page { background: #eef2f7; padding: 1.4rem 0; }
.print-sheet {
    background: #fff;
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 16mm 15mm;
    box-shadow: 0 10px 40px rgba(15, 23, 42, .12);
}
.print-head { display: flex; align-items: center; gap: 1rem; border-bottom: 3px double #0f172a; padding-bottom: .8rem; }
.print-head h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.print-head p { margin: 0; font-size: .78rem; color: #475569; }
.print-title { text-align: center; margin: 1.2rem 0 .3rem; font-weight: 700; text-decoration: underline; }
.print-table th, .print-table td { border: 1px solid #334155 !important; padding: .35rem .45rem; font-size: .8rem; }
.signature { margin-top: 2rem; display: flex; justify-content: space-between; gap: 2rem; font-size: .82rem; }
.signature .sign-box { width: 45%; text-align: center; }
.signature .sign-space { height: 62px; }

/* ---------- Exam ---------- */
.exam-shell { background: #eef2f7; min-height: 100vh; }
.exam-topbar { background: #0f172a; color: #fff; padding: .7rem 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.exam-question { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; background: #fff; }
.exam-question + .exam-question { margin-top: .9rem; }
.exam-option { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem .2rem; font-size: .88rem; }
.exam-option input { margin-top: .22rem; }
.timer-pill { font-variant-numeric: tabular-nums; font-weight: 700; background: rgba(255,255,255,.12); padding: .3rem .7rem; border-radius: 99px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(15,23,42,.2); }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .app-content { padding: 1rem; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

@media print {
    .no-print, .app-sidebar, .app-topbar, .app-footer { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .print-page { background: #fff; padding: 0; }
    .print-sheet { box-shadow: none; width: auto; min-height: auto; margin: 0; padding: 0; }
    body { background: #fff; }
}


