:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #e8f0ff;
  --accent: #7c3aed;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --sidebar: #0b1220;
  --sidebar-soft: #141d31;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: .94rem;
}
a { text-decoration: none; }
h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -.02em; }
.text-muted { color: var(--muted) !important; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 268px;
  background: linear-gradient(180deg, #0b1220 0%, #0d1729 100%);
  color: #cbd5e1;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 16px;
  color: #fff;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  display: grid;
  place-items: center;
  font-size: 21px;
  color: #fff;
  box-shadow: 0 8px 22px rgba(59, 130, 246, .35);
  flex: 0 0 auto;
}
.brand-mark.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.brand-mark-lg { width: 58px; height: 58px; border-radius: 18px; font-size: 27px; }
.brand-mark-logo { background: #fff; padding: 4px; border: 1px solid rgba(15, 23, 42, .08); }
.brand-mark-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; display: block; }
.school-logo-preview { width: 74px; height: 74px; object-fit: contain; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.sidebar-brand strong { font-size: 1.08rem; letter-spacing: -.02em; display: block; line-height: 1.15; }
.sidebar-brand span { font-size: .7rem; color: #7f8ea8; display: block; }
.sidebar-scroll { overflow-y: auto; flex: 1; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #334155; border-radius: 9px; }
.nav-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: #64748b; padding: 18px 12px 7px; font-weight: 700; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #a9b6c9;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.25;
  transition: .18s ease;
  position: relative;
}
.sidebar-link i { font-size: 1.02rem; width: 20px; text-align: center; opacity: .9; }
.sidebar-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar-link.active { color: #fff; background: linear-gradient(90deg, rgba(37, 99, 235, .3), rgba(37, 99, 235, .08)); box-shadow: inset 3px 0 0 #3b82f6; }
.sidebar-link .badge { margin-left: auto; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .78rem; color: #64748b; }
.sidebar-user { display: flex; align-items: center; gap: 10px; color: #cbd5e1; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #334155, #475569);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; flex: 0 0 auto;
}
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar.brand-avatar { background: linear-gradient(135deg, var(--brand), var(--accent)); }

.app-main { margin-left: 268px; min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
  height: 70px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-title { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.topbar-title small { display: block; color: var(--muted); font-weight: 400; font-size: .74rem; margin-top: 3px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 0; background: transparent;
  display: grid; place-items: center; color: #475569; font-size: 1.14rem; position: relative;
}
.icon-btn:hover { background: #eef2f7; color: var(--ink); }
.notif-dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .62rem; display: grid; place-items: center; font-weight: 700; border: 2px solid #fff; padding: 0 3px; }
.app-content { padding: 26px; flex: 1; }
.app-footer { padding: 14px 26px; color: #94a3b8; font-size: .75rem; border-top: 1px solid var(--line); background: #fff; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 1039; backdrop-filter: blur(2px); }

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.55rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .ms-auto { margin-left: auto; }

.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 16px 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-header .ms-auto { margin-left: auto; }
.card-body { padding: 20px; }
.card-footer { background: #fbfcfe; border-top: 1px solid var(--line); padding: 14px 20px; }

.stat-card { position: relative; overflow: hidden; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); height: 100%; }
.stat-card .stat-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; margin-top: 6px; }
.stat-card .stat-icon { position: absolute; right: 16px; top: 16px; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; background: var(--brand-soft); color: var(--brand); }
.stat-card .stat-foot { color: var(--muted); font-size: .78rem; margin-top: 10px; }
.stat-card.accent .stat-icon { background: #f3e8ff; color: var(--accent); }
.stat-card.success .stat-icon { background: #dcfce7; color: var(--success); }
.stat-card.warning .stat-icon { background: #fef3c7; color: #b45309; }
.stat-card.danger .stat-icon { background: #fee2e2; color: var(--danger); }

.hero-card {
  border: 0;
  border-radius: 20px;
  background: linear-gradient(120deg, #1e3a8a 0%, #1d4ed8 45%, #6d28d9 100%);
  color: #fff;
  padding: 26px;
  box-shadow: 0 18px 40px rgba(30, 58, 138, .28);
  position: relative;
  overflow: hidden;
}
.hero-card::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .08); right: -80px; top: -100px; }
.hero-card h2 { font-size: 1.45rem; margin-bottom: 6px; }
.hero-card p { color: #dbeafe; margin-bottom: 0; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 700; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; padding: 11px 14px; }
.table tbody td { padding: 12px 14px; vertical-align: middle; border-color: #eef2f7; }
.table-hover tbody tr:hover { background: #f8fbff; }
.table-wrap { border-radius: var(--radius); overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.student-card-list { display: none; }
.table-responsive { overflow-x: auto; }

.btn { border-radius: 10px; font-weight: 600; font-size: .86rem; padding: .54rem .95rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: #bfdbfe; }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-soft { background: #eef2f7; color: #334155; border: 0; }
.btn-soft:hover { background: #e2e8f0; color: #0f172a; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; }
.btn-sm { font-size: .78rem; padding: .4rem .7rem; }

.badge { font-weight: 600; font-size: .72rem; padding: .38em .62em; border-radius: 7px; }
.badge-soft-primary { background: #e0eaff; color: #1d4ed8; }
.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-warning { background: #fef3c7; color: #b45309; }
.badge-soft-danger { background: #fee2e2; color: #b91c1c; }
.badge-soft-secondary { background: #eef2f7; color: #475569; }
.badge-soft-neutral { background: #eef2f7; color: #475569; }
.badge-soft-info { background: #e0f2fe; color: #0369a1; }
.badge-soft-dark { background: #e2e8f0; color: #1e293b; }

.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); animation: loginPulse 2s infinite; vertical-align: middle; }
.table-row-live > td { background: #f6fef9; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none !important; } }

.form-label { font-weight: 600; font-size: .82rem; color: #334155; margin-bottom: .38rem; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe3ee; padding: .55rem .8rem; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: #93b4fb; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12); }
.form-control-sm, .form-select-sm { font-size: .8rem; border-radius: 8px; padding: .35rem .55rem; }
.form-text { font-size: .76rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.input-group-text { border-radius: 10px; background: #f8fafc; border-color: #dbe3ee; color: #64748b; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 160px; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state i { font-size: 2.4rem; color: #cbd5e1; display: block; margin-bottom: 10px; }

.dropdown-menu { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15, 23, 42, .14); padding: 8px; }
.dropdown-item { border-radius: 8px; padding: 8px 11px; font-size: .86rem; }
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-header { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; font-weight: 700; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; color: var(--ink); white-space: normal; }
.notif-item:hover { background: #f8fafc; }
.notif-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: 0 0 auto; }
.notif-item.read .dot { background: #cbd5e1; }
.notif-item small { color: var(--muted); }

.modal-content { border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(15, 23, 42, .3); }
.modal-header { border-color: var(--line); padding: 18px 22px; }
.modal-body { padding: 22px; }
.modal-footer { border-color: var(--line); padding: 14px 22px; }

.nav-tabs { border-bottom: 1px solid var(--line); gap: 4px; }
.nav-tabs .nav-link { border: 0; color: var(--muted); font-weight: 600; border-radius: 9px 9px 0 0; padding: 10px 16px; font-size: .86rem; }
.nav-tabs .nav-link.active { color: var(--brand); background: transparent; border-bottom: 2px solid var(--brand); }

.alert { border: 0; border-radius: 12px; font-size: .88rem; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info { background: #eff6ff; color: #1e40af; }

.progress { border-radius: 99px; background: #eef2f7; height: 8px; }
.progress-bar { background: linear-gradient(90deg, var(--brand), var(--accent)); }

.section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: #94a3b8; font-weight: 800; margin: 24px 0 10px; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid #e2e8f0; margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #93c5fd; border: 2px solid #fff; }

.question-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 18px; margin-bottom: 14px; }
.question-card .q-number { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: .82rem; padding: 0 8px; }
.answer-option { display: flex; gap: 11px; align-items: flex-start; border: 1px solid #e2e8f0; border-radius: 11px; padding: 11px 13px; cursor: pointer; transition: .15s; margin-bottom: 8px; background: #fff; }
.answer-option:hover { border-color: #93b4fb; background: #f8fbff; }
.answer-option.selected { border-color: var(--brand); background: #eff6ff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .1); }
.answer-option .form-check-input { margin-top: .22rem; }
.qnav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.qnav-btn { border: 1px solid #dbe3ee; background: #fff; border-radius: 8px; height: 34px; font-size: .78rem; font-weight: 700; color: #475569; }
.qnav-btn.answered { background: #dcfce7; border-color: #86efac; color: #166534; }
.qnav-btn.current { outline: 2px solid var(--brand); }
.save-status { font-size: .76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-status.saved { color: var(--success); }
.save-status.saving { color: #b45309; }
.save-status.error { color: var(--danger); }

.timer-pill { display: inline-flex; align-items: center; gap: 8px; background: #0f172a; color: #fff; border-radius: 99px; padding: .5rem 1rem; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .92rem; }
.timer-pill.warning { background: #b45309; }
.timer-pill.danger { background: #b91c1c; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

.exam-shell { background: #eef2f7; min-height: 100vh; }
.exam-topbar { background: #0b1220; color: #fff; padding: 12px 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 1020; box-shadow: 0 4px 20px rgba(2, 6, 23, .25); }
.exam-topbar .title { font-weight: 700; }
.exam-topbar .meta { color: #94a3b8; font-size: .76rem; }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; padding: 20px; max-width: 1320px; margin: 0 auto; }
.exam-side { position: sticky; top: 84px; align-self: start; }
.instruction-box { background: var(--bs-tertiary-bg); border-left: 4px solid var(--bs-primary); border-radius: .5rem; padding: 1rem; margin-bottom: 14px; }
.passage-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.passage-box h6 { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; color: #64748b; }
.exam-block-preview { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.exam-block-preview .instruction-box, .exam-block-preview .passage-box { border: 0; padding: 0; margin: 0; background: transparent; }
.exam-block-title { color: var(--bs-primary); }

/* Collapsible repeat of a passage/instruction already shown above */
.exam-block-dropdown { border: 1px solid #dbe3ee; border-radius: .65rem; background: #f8fafc; }
.exam-block-summary { display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem; cursor: pointer; font-size: .86rem; font-weight: 600; color: #334155; list-style: none; }
.exam-block-summary::-webkit-details-marker { display: none; }
.exam-block-summary::marker { content: ""; }
.exam-block-summary:hover { color: #0f172a; }
.exam-block-summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: .65rem; }
.exam-block-chevron { font-size: .78rem; transition: transform .2s ease; }
.exam-block-dropdown[open] .exam-block-chevron { transform: rotate(180deg); }
.exam-block-dropdown-body { padding: 0 .8rem .8rem; }
.exam-block-dropdown-body .instruction-box, .exam-block-dropdown-body .passage-box { background: #fff; margin-bottom: 0; }

/* Proctoring: warning shown when the student leaves the live exam page */
.exam-proctor-alert { position: sticky; top: .5rem; z-index: 1029; display: flex; gap: .65rem; align-items: center; margin: 0 0 .85rem; padding: .6rem .9rem; border: 1px solid #f59e0b; border-radius: .65rem; background: #fffbeb; color: #92400e; box-shadow: 0 .35rem .9rem rgba(15, 23, 42, .12); }
.exam-proctor-alert .btn-close { font-size: .7rem; }
.disqualified-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 2.1rem; box-shadow: 0 0 .9rem rgba(220, 38, 38, .45); }

.doc-content { line-height: 1.75; font-size: .95rem; overflow-wrap: anywhere; }
.doc-content img { max-width: 100%; height: auto; }
.doc-content table, .doc-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .88rem; }
.doc-content table td, .doc-content table th, .doc-table td, .doc-table th { border: 1px solid #dbe3ee; padding: 7px 10px; vertical-align: top; }
.doc-content table th, .doc-table th { background: #f8fafc; }
.doc-content math { font-size: 1.05em; }
/* Stacked fractions rebuilt from PDF text (numerator over denominator). */
.pdf-frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.1; margin: 0 .12em; font-size: .86em; }
.pdf-frac-n { border-bottom: 1px solid currentColor; padding: 0 .18em; }
.pdf-frac-d { padding: 0 .18em; }

/* Option rows: keep the letter and content on the same line and use the remaining width */
.option-body { display: grid; grid-template-columns: 1.7rem minmax(0, 1fr); gap: .35rem; align-items: start; flex: 1 1 auto; min-width: 0; }
.option-content { min-width: 0; }
.option-content > p, .option-content > .doc-p { display: inline; margin: 0; }
.option-content > p + p::before, .option-content > .doc-p + .doc-p::before { content: " "; }
.option-content > .doc-math-block { display: inline; }
.option-content math[display="block"] { display: inline math; }
.option-preview { display: grid; grid-template-columns: 1.7rem minmax(0, 1fr) auto; gap: .35rem; align-items: start; }
.review-option .opt-body > p, .review-option .opt-body > .doc-p { display: inline; margin: 0; }
.review-option .opt-body > p + p::before, .review-option .opt-body > .doc-p + .doc-p::before { content: " "; }
.review-option .opt-body > .doc-math-block { display: inline; }
.review-option .opt-body math[display="block"] { display: inline math; }
.matching-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.matching-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: center; }
.matching-row .idx { width: 28px; height: 28px; border-radius: 8px; background: #eef2f7; display: grid; place-items: center; font-weight: 700; font-size: .76rem; color: #475569; }

.login-body { background: #eef2f7; overflow-x: hidden; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: #f8fafc; }
.login-art { background: linear-gradient(125deg, #07111f 0%, #0d1b34 42%, #172554 72%, #3b0764 100%); background-size: 180% 180%; color: #fff; padding: clamp(32px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; isolation: isolate; animation: loginGradient 18s ease infinite; }
.login-art::before { content: ""; position: absolute; width: 460px; height: 460px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; right: -150px; bottom: -170px; }
.login-art::after { content: ""; position: absolute; width: 280px; height: 280px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; right: 30px; bottom: -40px; }
.login-grid { position: absolute; inset: 0; z-index: -2; background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px); background-size: 52px 52px; mask-image: radial-gradient(circle at 30% 35%, #000 0, transparent 72%); }
.login-orb { position: absolute; border-radius: 50%; filter: blur(6px); opacity: .55; z-index: -1; animation: loginFloat 11s ease-in-out infinite; }
.login-orb-1 { width: 300px; height: 300px; top: -80px; right: -70px; background: radial-gradient(circle, rgba(37, 99, 235, .9), transparent 68%); }
.login-orb-2 { width: 250px; height: 250px; bottom: 10%; left: -100px; background: radial-gradient(circle, rgba(124, 58, 237, .8), transparent 68%); animation-delay: -3.5s; }
.login-orb-3 { width: 190px; height: 190px; top: 45%; right: 16%; background: radial-gradient(circle, rgba(14, 165, 233, .55), transparent 68%); animation-delay: -7s; }
.login-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; animation: loginUp .7s both; }
.login-brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.03em; }
.login-brand-school { font-size: .76rem; color: #93a4bf; margin-top: 2px; }
.login-copy { position: relative; z-index: 2; max-width: 570px; margin: 40px 0; animation: loginUp .8s .08s both; }
.login-eyebrow { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(191, 219, 254, .2); background: rgba(255, 255, 255, .07); backdrop-filter: blur(10px); font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: #bfdbfe; padding: .42rem .72rem; border-radius: 99px; font-weight: 700; }
.login-copy h1 { font-size: clamp(2.15rem, 4.2vw, 3.65rem); line-height: 1.03; letter-spacing: -.055em; margin: 20px 0 0; font-weight: 800; color: #fff; }
.login-copy h1 span { background: linear-gradient(90deg, #93c5fd, #c4b5fd, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-copy p { color: #b8c6dc; max-width: 510px; font-size: 1.01rem; line-height: 1.7; }
.login-copy .feature-list { margin-top: 22px; }
.feature-list { display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 2; }
.feature-list div { display: flex; gap: 12px; align-items: center; color: #dbeafe; font-size: .9rem; border: 1px solid rgba(255, 255, 255, .07); background: rgba(15, 23, 42, .34); backdrop-filter: blur(10px); padding: 10px 13px; border-radius: 14px; width: fit-content; min-width: min(100%, 370px); animation: loginUp .55s both; }
.feature-list div:nth-child(1) { animation-delay: .18s; }
.feature-list div:nth-child(2) { animation-delay: .26s; }
.feature-list div:nth-child(3) { animation-delay: .34s; }
.feature-icon { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, rgba(59, 130, 246, .3), rgba(124, 58, 237, .3)); display: grid; place-items: center; color: #dbeafe; flex: 0 0 auto; }
.feature-list strong { display: block; font-size: .86rem; letter-spacing: -.01em; }
.feature-list small { display: block; color: #94a3b8; font-size: .74rem; margin-top: 1px; }
.login-trust { position: relative; z-index: 2; display: flex; align-items: center; gap: 9px; font-size: .75rem; color: #8ca0bc; animation: loginUp .8s .2s both; }
.login-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 5px rgba(52, 211, 153, .12); animation: loginPulse 2s infinite; }
.login-trust-year { margin-left: auto; color: #64748b; }
.login-form-wrap { display: grid; place-items: center; padding: clamp(24px, 4vw, 56px); position: relative; background: radial-gradient(circle at 82% 18%, rgba(37, 99, 235, .09), transparent 36%), #f8fafc; }
.login-form-wrap::before { content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%; background: rgba(124, 58, 237, .05); filter: blur(10px); left: -140px; bottom: -120px; pointer-events: none; }
.login-card { width: 100%; max-width: 430px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(18px); border: 1px solid rgba(255, 255, 255, .8); border-radius: 26px; padding: clamp(28px, 4vw, 42px); box-shadow: 0 30px 80px rgba(15, 23, 42, .13), 0 2px 12px rgba(15, 23, 42, .04); position: relative; overflow: hidden; animation: loginCardIn .75s cubic-bezier(.2, .8, .2, 1) both; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, #2563eb, #7c3aed, #db2777); }
.login-kicker { display: inline-block; font-size: .69rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); font-weight: 800; margin-bottom: 8px; }
.login-card h2 { font-size: 1.75rem; letter-spacing: -.04em; margin: 0 0 6px; }
.login-card .form-label { font-size: .78rem; }
.login-input .input-group-text { background: #f8fafc; border-color: #dbe3ee; color: #64748b; padding-left: .9rem; padding-right: .9rem; }
.login-input .form-control { border-left: 0; padding-left: .25rem; }
.login-input .form-control:focus { box-shadow: none; border-color: #dbe3ee; }
.login-input:focus-within .input-group-text, .login-input:focus-within .form-control, .login-input:focus-within .btn { border-color: #93b4fb; }
.login-input .btn { border-color: #dbe3ee; color: #64748b; border-left: 0; }
.login-input .btn:hover { background: #eef4ff; color: var(--brand); }
.login-submit { display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, var(--brand), var(--accent)); border: 0; box-shadow: 0 14px 30px rgba(37, 99, 235, .24); transition: .2s; padding: .85rem 1rem; }
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 18px 36px rgba(37, 99, 235, .32); background: linear-gradient(135deg, var(--brand-dark), #6d28d9); }
.login-submit i { transition: transform .2s; }
.login-submit:hover i { transform: translateX(3px); }
.login-card-foot { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; text-align: center; color: #94a3b8; font-size: .72rem; }
.form-floating > label { color: #94a3b8; }
.divider { display: flex; align-items: center; gap: 12px; color: #94a3b8; font-size: .75rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
@keyframes loginGradient { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes loginFloat { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(0, -22px, 0) scale(1.06); } }
@keyframes loginUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes loginCardIn { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes loginPulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, .12); } 50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, .03); } }
@media (prefers-reduced-motion: reduce) {
  .login-art, .login-orb, .login-brand, .login-copy, .feature-list div, .login-trust, .login-card, .login-status-dot { animation: none !important; }
}

.review-answer { border-radius: 11px; padding: 10px 12px; margin-top: 8px; font-size: .86rem; }
.review-answer.correct { background: #ecfdf5; border: 1px solid #a7f3d0; }
.review-answer.incorrect { background: #fef2f2; border: 1px solid #fecaca; }
.review-answer.pending { background: #fffbeb; border: 1px solid #fde68a; }
.mark-chip { font-size: .76rem; font-weight: 700; background: #eef2f7; color: #334155; border-radius: 7px; padding: .25rem .55rem; }

.data-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 4px; }
.check-item { border: 1px solid #e2e8f0; border-radius: 10px; padding: 9px 11px; background: #fff; display: flex; gap: 9px; align-items: flex-start; font-size: .84rem; }
.check-item:hover { border-color: #93b4fb; background: #f8fbff; }
.check-item .form-check-input { margin-top: .18rem; }
.selected-count { font-size: .76rem; color: var(--muted); background: #f1f5f9; border-radius: 99px; padding: 3px 9px; }

.import-preview { max-height: 480px; overflow: auto; }
.import-preview tr.invalid td { background: #fef2f2; }
.import-preview tr.valid td { background: #f0fdf4; }
.import-preview td { font-size: .78rem; }

.notification-row.unread { background: #f0f7ff; }
.profile-head { display: flex; gap: 16px; align-items: center; }

.exam-editor-toolbar { position: sticky; top: 64px; z-index: 1010; background: rgba(255,255,255,.95); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(15,23,42,.06); }
.editor-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: 16px; overflow: hidden; }
.editor-card .editor-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid #eef2f7; }
.editor-card .editor-body { padding: 16px; }
.editable { min-height: 42px; border: 1px dashed transparent; border-radius: 9px; padding: 8px 10px; transition: .15s; outline: none; }
.editable:hover { border-color: #cbd5e1; }
.editable:focus { border-color: var(--brand); background: #f8fbff; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.editable[contenteditable="false"] { padding-left: 0; padding-right: 0; }
.option-editor-row { display: grid; grid-template-columns: 44px minmax(0,1fr) 34px 30px; gap: 8px; align-items: start; margin-bottom: 8px; }
.option-editor-row .opt-label { text-align: center; font-weight: 800; color: #475569; background: #f1f5f9; border-radius: 8px; height: 38px; display: grid; place-items: center; }
.pair-editor-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) 34px; gap: 8px; margin-bottom: 8px; }
.editor-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; font-weight: 800; margin-bottom: 4px; }
.block-card { border-left: 4px solid #93c5fd; }
.block-card.passage { border-left-color: #a78bfa; }
.readonly-strip { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 10px 12px; font-size: .82rem; color: #64748b; }
.doc-p { margin-bottom: .55rem; }
.doc-heading { font-weight: 800; letter-spacing: -.01em; margin: .2rem 0 .5rem; }
.doc-list { padding-left: .25rem; }
.doc-bullet { color: var(--brand); font-weight: 800; }
.doc-page-break { height: 1px; background: #cbd5e1; margin: 18px 0; position: relative; }
.doc-page-break::after { content: "Page break"; position: absolute; right: 0; top: -9px; background: #fff; color: #94a3b8; font-size: .62rem; padding: 0 6px; }
.doc-placeholder { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 7px 10px; color: #64748b; font-size: .78rem; margin: 4px 0; }
.doc-placeholder-icon { font-size: 1rem; }
.doc-shape-text { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 8px 10px; margin: 4px 0; }
.doc-table-wrap { overflow-x: auto; }
.doc-image { display: block; margin: 6px 0; border-radius: 6px; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .sidebar-backdrop.show { display: block; }
  .app-content { padding: 18px; }
  .app-topbar { padding: 0 16px; height: 64px; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .exam-layout { grid-template-columns: 1fr; }
  .exam-side { position: static; }
}
@media (max-width: 767.98px) {
  .app-content { padding: 14px; }
  .student-card-list { display: grid; gap: 10px; }
  .student-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); padding: 14px; }
  .student-card .min-w-0 { min-width: 0; }
  .student-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 10px; font-size: .82rem; }
  .student-card-meta > div { display: flex; justify-content: space-between; gap: 8px; }
  .student-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
  .student-card-actions form { display: inline-flex; }
  .page-head { gap: 10px; }
  .page-head .ms-auto { margin-left: 0; width: 100%; }
  .page-head .ms-auto > .btn,
  .page-head .ms-auto > a.btn { flex: 1 1 auto; }
  .filter-bar { gap: 8px; }
  .filter-bar > div { flex: 1 1 100%; min-width: 0; }
  .filter-bar .form-control,
  .filter-bar .form-select { min-width: 0; width: 100%; }
  .filter-bar > .btn,
  .filter-bar > a.btn { flex: 1 1 auto; }
  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .table thead th,
  .table tbody td { padding: 10px 12px; }
}

@media (max-width: 575.98px) {
  .app-content { padding: 14px; }
  .page-head h1 { font-size: 1.28rem; }
  .stat-card .stat-value { font-size: 1.65rem; }
  .card-body { padding: 16px; }
  .matching-grid { grid-template-columns: 1fr; }
  .qnav-grid { grid-template-columns: repeat(6, 1fr); }
  .exam-topbar { padding: 10px 14px; }
  .exam-layout { padding: 12px; }
  .login-form-wrap { padding: 16px; }
  .login-card { padding: 26px 22px; border-radius: 22px; }
  .login-card h2 { font-size: 1.5rem; }
}

@media print {
  .app-sidebar, .app-topbar, .app-footer, .no-print, .sidebar-backdrop { display: none !important; }
  .app-main { margin-left: 0; }
  .app-content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
  a { color: inherit; }
}

/* One-time student welcome shown on the first dashboard load after signing in. */
.student-welcome {
  position: fixed;
  top: 82px;
  left: 50%;
  z-index: 1080;
  width: min(calc(100% - 32px), 430px);
  pointer-events: none;
  animation: studentWelcomeToast 4s cubic-bezier(.2, .8, .2, 1) forwards;
}
.student-welcome-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid rgba(191, 219, 254, .9);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  box-shadow: 0 22px 55px rgba(30, 58, 138, .24);
  color: #0f172a;
}
.student-welcome-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .3);
}
.student-welcome-copy { min-width: 0; }
.student-welcome-kicker {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #2563eb;
}
.student-welcome-name {
  margin-top: 2px;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.student-welcome-note { margin-top: 3px; font-size: .78rem; color: #64748b; }

@keyframes studentWelcomeToast {
  0% { opacity: 0; transform: translate(-50%, -14px) scale(.96); }
  12%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(.98); visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .student-welcome { animation: studentWelcomeReduced 2.8s linear forwards; }
}
@keyframes studentWelcomeReduced {
  0%, 80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); visibility: hidden; }
}
@media print {
  .student-welcome { display: none !important; }
}

/* ------------------------------------------------------------------ *
 * Rich question editor toolbar (assets/js/editor.js)
 * ------------------------------------------------------------------ */
.oes-rich-toolbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 12px);
  z-index: 1600;
  display: none;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 24px);
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, .55);
  border-radius: 14px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
  backdrop-filter: blur(8px);
  overflow: visible;
}
.oes-rich-toolbar.is-visible { display: flex; animation: oesToolbarIn .16s ease-out; }
@keyframes oesToolbarIn { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }
.oes-rich-group { display: flex; align-items: center; gap: 2px; }
.oes-rich-divider { width: 1px; height: 26px; background: #e2e8f0; margin: 0 4px; flex: 0 0 auto; }
.oes-rich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #334155;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.oes-rich-btn:hover { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.oes-rich-btn.is-active { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.oes-rich-btn sup, .oes-rich-btn sub { font-size: .62em; line-height: 0; }
.oes-rich-btn-wide { min-width: auto; }
.oes-rich-close { margin-left: 2px; color: #64748b; }
.oes-symbol-panel {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 10px);
  width: min(560px, calc(100vw - 40px));
  max-height: 300px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .2);
}
.oes-symbol-panel[hidden] { display: none !important; }
.oes-symbol-label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #64748b; margin: 4px 0 6px; }
.oes-symbol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; margin-bottom: 8px; }
.oes-symbol-chip {
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 1rem;
  cursor: pointer;
}
.oes-symbol-chip:hover { background: #dbeafe; border-color: #93c5fd; }
body.oes-editor-busy { cursor: progress; }

/* Drawing modal */
.oes-draw-overlay {
  position: fixed;
  inset: 0;
  z-index: 1700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .55);
}
.oes-draw-overlay[hidden] { display: none !important; }
.oes-draw-modal {
  width: min(980px, 100%);
  max-height: 95vh;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
}
.oes-draw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.oes-draw-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.oes-draw-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
@media (max-width: 575.98px) {
  .oes-rich-toolbar { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; overflow-x: auto; }
  .oes-rich-toolbar.is-visible { animation: none; }
  .oes-rich-btn-wide span { display: none !important; }
}

/* Hint preview and editor styling */
.q-hint-preview, .hint-preview {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
  border-radius: .5rem;
  padding: .55rem .75rem;
}
.q-hint-preview > :last-child, .hint-preview > :last-child { margin-bottom: 0; }
.q-hint-preview > :first-child, .hint-preview > :first-child { margin-top: 0; }
.hint-editor {
  min-height: 42px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  border-radius: 9px;
  padding: 8px 10px;
}
.hint-editor:focus { border-color: #f59e0b; background: #fffdf5; box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }

.hint-editor:empty::before { content: attr(data-placeholder); color: #9ca3af; pointer-events: none; }
@media print {
  .oes-rich-toolbar, .oes-draw-overlay { display: none !important; }
}
