:root {
  color-scheme: light;
  --navy: #153f68;
  --navy-2: #0a2948;
  --blue: #216f9f;
  --teal: #147d75;
  --gold: #d19a2a;
  --paper: #f3f6fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #17212b;
  --muted: #5d6b78;
  --line: #d9e2eb;
  --line-strong: #b7c4d0;
  --danger: #a9232b;
  --success: #17633a;
  --warning: #7a4b00;
  --radius: 14px;
  --radius-small: 9px;
  --shadow: 0 8px 24px rgba(10, 41, 72, .07);
  --shadow-raised: 0 16px 40px rgba(10, 41, 72, .12);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); font-size: 90%; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 100% 0, rgba(33,111,159,.06), transparent 28rem), var(--paper); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--navy); }
:where(h1, h2, h3, p) { overflow-wrap: break-word; }
::selection { color: #fff; background: var(--blue); }
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 1000; padding: .7rem 1rem; background: #fff; color: #000; }
.skip-link:focus { top: 1rem; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 1fr) minmax(340px, 520px); }
.auth-brand { position: relative; overflow: hidden; padding: clamp(2rem, 7vw, 7rem); color: white; background: radial-gradient(circle at 80% 78%, rgba(39,183,169,.28), transparent 24rem), linear-gradient(145deg, var(--navy-2), var(--navy) 55%, var(--teal)); display: flex; flex-direction: column; justify-content: center; }
.auth-brand h1 { max-width: 12ch; margin: 0 0 1rem; font-size: clamp(2.4rem, 5vw, 4.8rem); line-height: .98; }
.auth-brand p { max-width: 42rem; font-size: 1.08rem; line-height: 1.6; color: #e9f3fb; }
.auth-panel { display: flex; align-items: center; padding: clamp(1.5rem, 5vw, 4rem); background: var(--surface); }
.auth-panel > div { width: 100%; max-width: 440px; margin-inline: auto; }
.auth-panel h2 { margin: 0; font-size: clamp(1.65rem, 3vw, 2rem); }
.auth-panel form { margin-top: 1.4rem; }
.auth-panel form > .btn:last-child { width: 100%; justify-self: stretch; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.25rem 1rem; color: white; background: linear-gradient(180deg, var(--navy-2), #0d3558 68%, #0e405b); box-shadow: 8px 0 30px rgba(10,41,72,.08); }
.brand { display: flex; gap: .75rem; align-items: center; padding: .3rem .4rem 1.4rem; font-weight: 750; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(145deg, #1a9187, var(--teal)); box-shadow: 0 8px 20px rgba(0,0,0,.18); font-size: 1.25rem; }
.nav-list { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.nav-button { position: relative; width: 100%; min-height: 44px; padding: .72rem .85rem .72rem 1rem; border: 0; border-radius: 9px; text-align: left; color: #d9e7f3; background: transparent; cursor: pointer; transition: color .16s ease, background .16s ease, transform .16s ease; }
.nav-button:hover { color: #fff; background: rgba(255,255,255,.09); transform: translateX(2px); }
.nav-button[aria-current="page"] { color: #fff; background: rgba(255,255,255,.15); box-shadow: inset 3px 0 0 #4ec8bc; font-weight: 700; }
.sidebar-footer { margin-top: 2rem; padding: 1rem .5rem; border-top: 1px solid rgba(255,255,255,.18); color: #c6d5e2; font-size: .88rem; }
.sidebar-sign-out { width: 100%; margin-top: .9rem; border-color: rgba(255,255,255,.62); color: #fff; background: rgba(255,255,255,.08); }
.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 70px; padding: .8rem clamp(1rem, 3vw, 2.2rem); border-bottom: 1px solid rgba(183,196,208,.75); background: rgba(255,255,255,.94); box-shadow: 0 3px 16px rgba(10,41,72,.04); backdrop-filter: blur(12px); }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.notification-button { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 999px; color: var(--ink); background: transparent; cursor: pointer; }
.notification-button:hover, .notification-button:focus-visible { color: var(--blue); background: rgba(33, 111, 159, .09); }
.notification-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-count { position: absolute; top: -3px; right: -5px; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; color: #fff; background: var(--danger); font-size: .62rem; line-height: 1; font-weight: 800; }
.user-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border: 3px solid #dff4ef; border-radius: 50%; color: white; background: linear-gradient(145deg, #1b9187, var(--teal)); font-weight: 750; }
.content { max-width: 1500px; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.5rem); }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.65rem; }
.page-header h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.35rem); }
.page-header p { max-width: 70ch; margin: .45rem 0 0; color: var(--muted); }
.page-actions { justify-content: flex-end; }
.page-alert { margin-bottom: 1.25rem; }
.status-summary { margin-bottom: 1rem; }
#assignment-register { scroll-margin-top: 5.5rem; }
.section-heading { margin: 1.75rem 0 1rem; color: var(--navy-2); font-size: 1.3rem; }

.card { padding: clamp(1.15rem, 2vw, 1.5rem); border: 1px solid rgba(183,196,208,.72); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; color: var(--navy-2); }
.card h2 { margin-bottom: 1rem; font-size: 1.3rem; }
.card h3 { margin-bottom: .75rem; }
.card > :last-child { margin-bottom: 0; }
.section-card, .section-stack { margin-top: 1.25rem; }
.grid { display: grid; gap: 1.2rem; }
.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)); }
.stack { display: grid; gap: 1.1rem; }
.stat { position: relative; min-height: 126px; overflow: hidden; }
.stat::after { position: absolute; right: -24px; bottom: -32px; width: 92px; height: 92px; border-radius: 50%; background: rgba(20,125,117,.08); content: ""; }
.stat-value { display: block; margin-top: .7rem; color: var(--navy); font-size: 2rem; font-weight: 800; }
.stat-link { display: block; color: inherit; text-decoration: none; transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.stat-link:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: var(--shadow-raised); }
.stat-detail { position: relative; z-index: 1; display: block; margin-top: .45rem; color: var(--blue); font-size: .82rem; font-weight: 700; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .4rem; color: var(--teal); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.field { display: grid; gap: .45rem; align-content: start; }
.field label, .field-label { font-weight: 650; }
.field small { color: var(--muted); }
input, select, textarea { width: 100%; min-height: 46px; padding: .68rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--radius-small); color: var(--ink); background: #fff; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
input:hover, select:hover, textarea:hover { border-color: #8496a7; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px rgba(33,111,159,.14); }
textarea { min-height: 110px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #edf1f4; }
input[type="file"] { padding: .4rem; }
input[type="file"]::file-selector-button { min-height: 36px; margin-right: .65rem; padding: .45rem .75rem; border: 0; border-radius: 7px; color: var(--navy); background: #e7eff6; font-weight: 700; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.2rem; row-gap: 1.1rem; }
.full { grid-column: 1 / -1; }
.form-span { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.question-header { justify-content: space-between; margin-bottom: 1rem; }
form > .actions:last-child { align-self: end; margin-top: .25rem; }
form.card > .btn:last-child, form.stack > .btn:last-child { justify-self: start; margin-top: .2rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .62rem 1rem; border: 1px solid transparent; border-radius: var(--radius-small); color: #fff; background: linear-gradient(180deg, #194b79, var(--navy)); box-shadow: 0 3px 8px rgba(10,41,72,.13); font-weight: 700; line-height: 1.15; cursor: pointer; text-align: center; text-decoration: none; white-space: nowrap; transition: transform .14s ease, box-shadow .14s ease, filter .14s ease; }
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(10,41,72,.16); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 5px rgba(10,41,72,.12); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled:hover { filter: none; transform: none; box-shadow: none; }
.btn-secondary { color: var(--navy); border-color: #9db0c1; background: #fff; box-shadow: none; }
.btn-danger { background: linear-gradient(180deg, #bc3037, var(--danger)); }
.btn-quiet { color: var(--navy); border-color: var(--line); background: #fff; box-shadow: none; }
.icon-btn { border: 0; background: transparent; cursor: pointer; }

.badge { display: inline-flex; align-items: center; min-height: 26px; margin: .1rem .15rem .1rem 0; padding: .2rem .6rem; border: 1px solid rgba(33,111,159,.08); border-radius: 999px; background: #e5edf5; color: var(--navy-2); font-size: .78rem; font-weight: 750; line-height: 1.2; }
.badge-success { background: #dff4e7; color: var(--success); }
.badge-warning { background: #fff0ca; color: var(--warning); }
.badge-danger { background: #f9dddd; color: var(--danger); }
.alert { padding: 1rem 1.1rem; border: 1px solid #cce0ef; border-left: 4px solid var(--blue); border-radius: var(--radius-small); background: #e9f3fa; }
.alert-danger { border-color: var(--danger); background: #fae7e7; }
.alert-warning { border-color: var(--gold); background: #fff5dc; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 4px 14px rgba(10,41,72,.04); scrollbar-color: #9db0c1 transparent; }
.table-wrap table { min-width: 720px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .82rem .9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #eaf1f6; color: var(--navy-2); font-size: .8rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
tbody tr { transition: background .14s ease; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f5f9fc; }
.table-wrap td > .actions { flex-wrap: nowrap; min-width: max-content; }
.table-wrap .btn { min-height: 36px; padding: .48rem .72rem; font-size: .86rem; box-shadow: none; }
.table-wrap code, .card code { overflow-wrap: anywhere; }
.audit-intro { margin-bottom: 1rem; }
.audit-filter-card { margin-bottom: 1rem; }
.audit-activity-card { margin-top: 1rem; }
.audit-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.audit-section-heading h2, .audit-section-heading p { margin: 0; }
.audit-section-heading p { margin-top: .35rem; }
.audit-advanced { padding: .75rem; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.audit-advanced > summary, .audit-technical > summary { color: var(--navy); font-weight: 700; cursor: pointer; }
.audit-advanced[open] > summary { margin-bottom: 1rem; }
.audit-table { min-width: 1040px !important; }
.audit-table th:nth-child(1) { width: 14%; }
.audit-table th:nth-child(2) { width: 20%; }
.audit-table th:nth-child(3), .audit-table th:nth-child(4) { width: 17%; }
.audit-table th:nth-child(5) { width: 10%; }
.audit-table th:nth-child(6) { width: 12%; }
.audit-table time { white-space: normal; }
.audit-area { margin-top: .4rem; font-weight: 650; }
.audit-view-details { white-space: nowrap; }
.audit-detail-row[hidden] { display: none; }
.audit-detail-row td { padding: 0; background: #f8fafc; }
.audit-details-panel { width: 100%; padding: 1.2rem; border-left: 4px solid var(--teal); background: #f8fafc; }
.audit-details-panel h3 { margin-top: 0; }
.audit-change-summary { padding: .8rem; border-left: 4px solid var(--teal); border-radius: 5px; background: #eaf7f5; }
.audit-change-summary dl, .audit-evidence-list { display: grid; gap: .5rem; margin: .65rem 0 0; }
.audit-change-summary dl > div, .audit-evidence-list > div { display: grid; grid-template-columns: minmax(9rem, 34%) 1fr; gap: .75rem; }
.audit-change-summary dt, .audit-evidence-list dt { color: var(--muted); font-weight: 700; }
.audit-change-summary dd, .audit-evidence-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.audit-technical { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.audit-technical pre { max-height: 18rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.audit-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.row-button { padding: 0; border: 0; color: var(--navy); background: transparent; font-weight: 700; cursor: pointer; text-align: left; }
.empty { padding: 2.25rem 1.5rem; border: 1px dashed #aebbc6; border-radius: var(--radius); text-align: center; color: var(--muted); background: linear-gradient(180deg, #fff, #f9fbfd); }
.empty p { margin: .55rem 0 0; }
.loading { padding: 2rem; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 25px; height: 25px; margin-right: .5rem; border: 3px solid #d2dce5; border-top-color: var(--navy); border-radius: 50%; animation: spin .75s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: grid; gap: .5rem; width: min(420px, calc(100vw - 2rem)); }
.toast { padding: 1rem 1.1rem; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; color: #fff; background: var(--navy-2); box-shadow: 0 14px 36px rgba(0,0,0,.22); line-height: 1.45; white-space: pre-line; }
.toast.error { background: var(--danger); }
.pdf-frame { width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #eef2f5; }
.question-card { padding: 1.2rem; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; box-shadow: 0 3px 12px rgba(10,41,72,.04); }
#question-list { display: grid; gap: 1rem; }
.question-create-grid { align-items: start; }
.question-paper-upload { border-top: 4px solid var(--teal); }
.question-paper-review { overflow: hidden; }
.question-paper-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.question-paper-heading h2 { margin-bottom: .35rem; }
.question-paper-heading p { margin: 0; }
.question-paper-frame { min-height: 58vh; margin-top: 1rem; }
.notification-card { border-left: 4px solid var(--line-strong); }
.notification-card.is-unread { border-left-color: var(--teal); background: #f5fbfa; }
.notification-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.notification-heading h2 { margin-bottom: .35rem; }
.hash-line { overflow-wrap: anywhere; }
.hash-line code { font-size: .82rem; }
.answer-key-list { display: grid; gap: .9rem; }
.answer-key-card { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-subtle); }
.answer-key-card .eyebrow { margin-top: .8rem; }
.answer-options { display: grid; gap: .5rem; margin-top: .75rem; }
.answer-option { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.answer-option.is-correct { border-color: #8bc9a5; background: #effaf3; }
.question-number { display: inline-grid; place-items: center; width: 29px; height: 29px; margin-right: .5rem; border-radius: 50%; color: #fff; background: var(--navy); font-weight: 800; }
.option-list { display: grid; gap: .55rem; margin: .8rem 0; }
.radio-row, .check-row { display: flex; gap: .65rem; align-items: flex-start; line-height: 1.4; }
.radio-row input, .check-row input { width: auto; min-height: auto; margin-top: .2rem; }
fieldset { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 11px; }
legend { padding-inline: .4rem; color: var(--navy-2); }
fieldset .check-row { padding: .55rem .65rem; border-radius: 8px; }
fieldset .check-row:hover { background: var(--surface-subtle); }
.mobile-menu { display: none; }

@media (max-width: 1050px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { min-height: 32vh; padding: 2rem 1.4rem; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; z-index: 40; width: min(290px, 88vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 8px 0 30px rgba(0,0,0,.22); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1.1rem; }
  .page-header { display: grid; gap: 1rem; margin-bottom: 1.35rem; }
  .page-actions { width: 100%; justify-content: stretch; }
  .page-actions .btn { flex: 1 1 10rem; }
  .topbar { padding-inline: .75rem; }
  .topbar #current-section { display: block; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-user > div:last-child { display: none; }
  .card { padding: 1rem; }
  form > .actions:last-child { width: 100%; }
  form > .actions:last-child .btn, form.card > .btn:last-child { width: 100%; }
  .table-wrap td > .actions { align-items: stretch; flex-direction: column; }
  .table-wrap td > .actions .btn { width: 100%; min-height: 42px; }
  .toast-region { right: .75rem; bottom: .75rem; width: calc(100vw - 1.5rem); }
  .audit-section-heading, .audit-pagination { align-items: stretch; flex-direction: column; }
  .audit-table-wrap { overflow: visible; border: 0; }
  .audit-table { min-width: 0; background: transparent; }
  .audit-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .audit-table tbody, .audit-table tr, .audit-table td { display: block; }
  .audit-table tr { margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 4px 14px rgba(18, 60, 105, .06); overflow: hidden; }
  .audit-table td { display: grid; grid-template-columns: minmax(8rem, 38%) 1fr; gap: .75rem; border-bottom: 1px solid var(--line); }
  .audit-table td::before { content: attr(data-label); color: var(--navy-2); font-size: .82rem; font-weight: 750; }
  .audit-table td:last-child { border-bottom: 0; }
  .audit-detail-row td { display: block; padding: 0; }
  .audit-detail-row td::before { display: none; }
  .audit-details-panel { width: 100%; }
  .audit-change-summary dl > div, .audit-evidence-list > div { grid-template-columns: 1fr; gap: .15rem; }
  .answer-option { align-items: flex-start; flex-direction: column; }
  .question-paper-heading { align-items: stretch; flex-direction: column; }
  .question-paper-frame { min-height: 65vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
