/* DOIM University Platform — portal styles (administration, lecturer, student, parent, applicant).
   Brand: navy #1B2A4A + gold #C9A24D, matching the public website. */
:root {
    --navy: #1B2A4A;
    --navy-2: #14203A;
    --navy-3: #0E172B;
    --gold: #C9A24D;
    --gold-dark: #8C6D2C;
    --gold-soft: #F7EFDC;
    --bg: #F4F6FA;
    --card: #FFFFFF;
    --line: #DDE3EE;
    --line-2: #EBEFF6;
    --ink: #172033;
    --muted: #5F6B80;
    --ok: #1E7B4F;
    --ok-bg: #E6F4EC;
    --warn: #8A5A00;
    --warn-bg: #FFF4DC;
    --bad: #B42318;
    --bad-bg: #FDECEA;
    --info: #1D4ED8;
    --info-bg: #E8EEFD;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    --sidebar: 268px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.6 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold-dark); }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--navy); margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
:focus-visible { outline: 3px solid rgba(201, 162, 77, .55); outline-offset: 2px; }

/* ── Layout ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
    background: var(--navy); color: #C9D2E3; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #33476d transparent;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 10px; padding: 4px; }
.sidebar-brand strong { display: block; color: #fff; font: 800 16px/1.1 var(--display); letter-spacing: .5px; }
.sidebar-brand small { color: var(--gold); font-size: 11px; }
.portal-switch { padding: 12px 16px 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.portal-switch a { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: #C9D2E3; }
.portal-switch a.is-active { background: var(--gold); color: var(--navy-3); }
.nav-section { padding: 14px 12px 4px; }
.nav-section > span { display: block; padding: 0 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #7f8db0; }
.nav-section a {
    display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: #D5DCEA; font-weight: 500; font-size: 13.5px;
}
.nav-section a i { width: 18px; text-align: center; color: #8c9bbd; font-size: 14px; }
.nav-section a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-section a.is-active { background: rgba(201, 162, 77, .16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-section a.is-active i { color: var(--gold); }
.sidebar-foot { margin-top: auto; padding: 16px 20px; font-size: 12px; color: #7f8db0; border-top: 1px solid rgba(255, 255, 255, .08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.topbar-title { font: 700 15px var(--display); color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { display: block; font: 500 12px var(--font); color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
    position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer;
}
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; font: 700 12px var(--display); overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }
.user-chip strong { display: block; font-size: 12.5px; line-height: 1.2; }
.user-chip small { font-size: 11px; }
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 6px; display: none; z-index: 50;
}
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }

.content { padding: 26px 28px 48px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* ── Cards & grids ──────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 18px; }

.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-dark); font-size: 18px; flex-shrink: 0; }
.stat-icon.navy { background: #E7EBF3; color: var(--navy); }
.stat-icon.ok { background: var(--ok-bg); color: var(--ok); }
.stat-icon.bad { background: var(--bad-bg); color: var(--bad); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat strong { display: block; font: 800 22px/1.15 var(--display); color: var(--navy); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }
a.stat:hover { border-color: var(--gold); }

.welcome {
    background: linear-gradient(120deg, var(--navy) 0%, #24385f 100%); color: #DDE4F1; border-radius: var(--radius); padding: 22px 24px;
    display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px;
}
.welcome h1 { color: #fff; margin: 0 0 4px; }
.welcome p { margin: 0; }
.welcome .kv { display: flex; gap: 22px; flex-wrap: wrap; }
.welcome .kv div small { color: #9fb0cf; display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }
.welcome .kv div strong { color: var(--gold); font: 700 15px var(--display); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); background: #F8FAFC; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFD; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .sub { display: block; font-size: 12px; color: var(--muted); }
.table tfoot td { font-weight: 700; background: #F8FAFC; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #EEF1F6; color: #3c4a63; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gold { background: var(--gold-soft); color: var(--gold-dark); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
    font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy-3); }
.btn-gold:hover { background: #b8913e; color: var(--navy-3); }
.btn-light { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-light:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f2c4bf; }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #17633f; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-link { background: none; border: 0; color: var(--navy); padding: 0; font-weight: 600; cursor: pointer; font: inherit; }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.inline { display: inline; }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: #2b3650; }
.field .help { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .error { display: block; font-size: 12px; color: var(--bad); margin-top: 4px; }
.input, select.input, textarea.input {
    width: 100%; padding: 9px 12px; border: 1px solid #CDD5E2; border-radius: 9px; font: 14px var(--font); color: var(--ink); background: #fff;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27, 42, 74, .12); }
.input.is-invalid { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--navy); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); background: #FBFCFE; }
.filters .input { width: auto; min-width: 170px; padding: 7px 10px; }
.filters .search { min-width: 240px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert i { margin-top: 3px; }
.alert-success { background: var(--ok-bg); color: #145c3a; border-color: #bfe3cf; }
.alert-error { background: var(--bad-bg); color: #8f1c13; border-color: #f4c7c2; }
.alert-warn { background: var(--warn-bg); color: #6b4600; border-color: #f1dca8; }
.alert-info { background: var(--info-bg); color: #1e3a8a; border-color: #cbd8fb; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ── Misc components ────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty i { font-size: 30px; color: #b7c1d3; display: block; margin-bottom: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.is-active { color: var(--navy); border-bottom-color: var(--gold); }
.progress { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.progress.ok > span { background: var(--ok); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 18px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: 12px; color: var(--muted); }
.list-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--bg); color: var(--navy); flex-shrink: 0; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.kpi-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kpi-line:last-child { border-bottom: 0; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 18px; }
.step { padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--muted); font-size: 11px; flex-shrink: 0; }
.step.done { color: var(--ok); }
.step.done b { background: var(--ok); color: #fff; }
.step.current { border-color: var(--gold); color: var(--navy); }
.step.current b { background: var(--gold); color: var(--navy-3); }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 12px; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; padding: 12px 18px; align-items: center; border-top: 1px solid var(--line-2); }
.pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 9px; border-radius: 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); font-size: 13px; background: #fff; }
.pagination .is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination .disabled { color: #b1bacb; }
.pagination .summary { border: 0; margin-left: auto; color: var(--muted); }

/* Timetable grid */
.tt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tt-day { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tt-day h3 { margin: 0; padding: 10px 12px; background: var(--navy); color: #fff; font-size: 13px; }
.tt-slot { padding: 10px 12px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.tt-slot:last-child { border-bottom: 0; }
.tt-slot strong { display: block; color: var(--navy); }
.tt-slot .time { color: var(--gold-dark); font-weight: 700; }
.tt-empty { padding: 14px 12px; color: #a3adbf; font-size: 12px; }

/* Online examination */
.exam-shell { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.exam-side { position: sticky; top: 76px; }
.timer { font: 800 30px var(--display); color: var(--navy); text-align: center; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
.question { padding: 18px; border-bottom: 1px solid var(--line-2); }
.question:last-child { border-bottom: 0; }
.question .qhead { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.question .qtext { font-size: 15px; font-weight: 500; white-space: pre-wrap; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-top: 8px; cursor: pointer; }
.option:hover { border-color: var(--navy); }
.option input { margin-top: 3px; accent-color: var(--navy); }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qnav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.qnav a { display: grid; place-items: center; height: 32px; border-radius: 7px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.qnav a.answered { background: var(--navy); color: #fff; border-color: var(--navy); }
.proctor-cam { width: 100%; aspect-ratio: 4/3; background: #0e172b; border-radius: 10px; object-fit: cover; }
.save-state { font-size: 12px; color: var(--muted); text-align: center; }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-side {
    background: linear-gradient(160deg, rgba(14, 23, 43, .88), rgba(27, 42, 74, .92)), url('https://images.unsplash.com/photo-1523240795612-9a054b0db644?auto=format&fit=crop&w=1400&q=70') center/cover;
    color: #DDE4F1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side h2 { color: #fff; font-size: 34px; line-height: 1.15; }
.auth-side h2 em { color: var(--gold); font-style: normal; }
.auth-side a { color: #fff; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: 26px; }
.auth-logo img { height: 52px; margin-bottom: 20px; }

/* Print */
@media print {
    .sidebar, .topbar, .page-actions, .no-print, .filters, .pagination { display: none !important; }
    .app { display: block; }
    .content { padding: 0; }
    .card { box-shadow: none; border-color: #ccc; }
}

/* Responsive */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main, .exam-shell { grid-template-columns: 1fr; }
    .exam-side { position: static; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar); z-index: 60; transform: translateX(-100%); transition: transform .2s; }
    .app.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(14, 23, 43, .45); }
    .topbar { padding: 10px 16px; }
    .topbar .menu-btn { display: inline-grid; }
    .content { padding: 18px 16px 40px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .user-chip div { display: none; }
}
@media (max-width: 600px) {
    .grid-4, .form-grid { grid-template-columns: 1fr; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; }
    .dl dd { margin-bottom: 8px; }
    .filters .input, .filters .search { min-width: 0; width: 100%; }
}
