/* ExamFlow — design system */
:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --ink-900: #0b1f1e;
  --ink-800: #12312f;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --sky-500: #0ea5e9;
  --violet-500: #8b5cf6;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --white: #ffffff;
  --bg: #f4f7f7;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 43, 41, 0.05);
  --shadow: 0 8px 26px -12px rgba(15, 43, 41, 0.18), 0 2px 6px rgba(15, 43, 41, 0.04);
  --shadow-lg: 0 30px 70px -30px rgba(8, 40, 38, 0.45);
  --font: 'Noto Sans Thai', 'Leelawadee UI', 'Tahoma', system-ui, sans-serif;
  --display: 'Kanit', 'Noto Sans Thai', system-ui, sans-serif;
  --sidebar-w: 264px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--slate-800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, p {
  margin: 0;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

a {
  color: var(--teal-700);
  text-decoration: none;
}

button {
  font-family: inherit;
}

svg {
  flex: none;
}

.ico {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.16em;
}

.page-eyebrow .ico {
  width: 15px;
  height: 15px;
  vertical-align: 0;
}

.kicker .ico {
  width: 14px;
  height: 14px;
}

.login-switch a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.login-switch .ico {
  width: 15px;
  height: 15px;
}

::selection {
  background: var(--teal-200);
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--slate-500);
  background: radial-gradient(circle at 50% 30%, #e7f6f3, var(--bg) 65%);
}

.boot-logo,
.brand-word {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: var(--teal-800);
  letter-spacing: -0.03em;
}

.boot-logo span,
.brand-word span {
  color: var(--amber-500);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--teal-100);
  border-top-color: var(--teal-600);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 0.9s linear infinite;
}

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  border-color: var(--slate-300);
  background: var(--slate-50);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--teal-600), var(--teal-700));
  border-color: var(--teal-700);
  color: #fff;
  box-shadow: 0 8px 18px -9px rgba(15, 118, 110, 0.7);
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--teal-500), var(--teal-600));
  border-color: var(--teal-600);
}

.btn-accent {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  border-color: #f59e0b;
  color: #422006;
}

.btn-accent:hover {
  background: #fbbf24;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--slate-600);
}

.btn-ghost:hover {
  background: rgba(15, 118, 110, 0.08);
  border-color: transparent;
  color: var(--teal-800);
}

.btn-outline {
  background: transparent;
  border-color: var(--teal-200);
  color: var(--teal-800);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--teal-50);
  border-color: var(--teal-300);
}

.btn-danger {
  color: var(--rose-600);
  border-color: #fecdd3;
  background: #fff5f6;
}

.btn-danger:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.btn-danger-solid {
  background: var(--rose-600);
  border-color: var(--rose-600);
  color: #fff;
}

.btn-danger-solid:hover {
  background: var(--rose-500);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-sm svg {
  width: 15px;
  height: 15px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
}

.btn-icon svg {
  width: 17px;
  height: 17px;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Forms -------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--slate-600);
}

.label .req {
  color: var(--rose-600);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #fff;
  color: var(--slate-800);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: 0.15s ease;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.02);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--slate-400);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--slate-100);
  color: var(--slate-400);
}

.textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.hint {
  font-size: 12px;
  color: var(--slate-500);
  line-height: 1.5;
}

.error-text {
  font-size: 12.5px;
  color: var(--rose-600);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--slate-200);
  border-radius: 11px;
  background: var(--slate-50);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  border: 1px solid transparent;
  user-select: none;
}

.check-item:hover {
  border-color: var(--teal-200);
}

.check-item input {
  accent-color: var(--teal-600);
  width: 15px;
  height: 15px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: var(--slate-300);
  position: relative;
  transition: 0.2s;
  flex: none;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-track {
  background: var(--teal-600);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-700);
}

.segmented {
  display: inline-flex;
  background: var(--slate-100);
  border-radius: 11px;
  padding: 4px;
  gap: 4px;
}

.segmented label {
  position: relative;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-500);
  transition: 0.15s;
}

.segmented input:checked + span {
  background: #fff;
  color: var(--teal-800);
  box-shadow: var(--shadow-sm);
}

/* Shell -------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  background:
    radial-gradient(circle at 15% 0%, rgba(20, 184, 166, 0.28), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(251, 191, 36, 0.12), transparent 45%),
    linear-gradient(180deg, #0b2f2d, #072321 70%);
  color: #d8f3ef;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 18px;
}

.brand-mark {
  width: 41px;
  height: 41px;
  border-radius: 12px;
  background: linear-gradient(145deg, #2dd4bf, #0f766e);
  display: grid;
  place-items: center;
  color: #062c2a;
  box-shadow: 0 8px 20px -8px rgba(45, 212, 191, 0.7);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.sidebar-brand .name {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.sidebar-brand .name span {
  color: var(--amber-400);
}

.sidebar-brand .sub {
  font-size: 10.5px;
  color: #7fb9b2;
  letter-spacing: 0.04em;
}

.school-chip {
  margin: 0 4px 18px;
  padding: 11px 12px;
  border: 1px solid rgba(153, 246, 228, 0.16);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 11px;
  font-size: 12px;
}

.school-chip .school {
  font-weight: 700;
  color: #ecfdf5;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.school-chip .year {
  color: #8ac7c0;
  font-size: 11px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #639f99;
  padding: 14px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #b6dcd6;
  font-size: 13.5px;
  font-weight: 500;
  transition: 0.15s;
  position: relative;
}

.nav-link svg {
  width: 19px;
  height: 19px;
  opacity: 0.85;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.28), rgba(20, 184, 166, 0.08));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(153, 246, 228, 0.14);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: var(--amber-400);
}

.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--amber-400), #f97316);
  color: #3b2703;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex: none;
}

.avatar.lg {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 17px;
}

.sidebar-user .meta {
  min-width: 0;
  flex: 1;
}

.sidebar-user .meta b {
  display: block;
  font-size: 12.5px;
  color: #effefb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .meta span {
  font-size: 10.5px;
  color: #82bcb5;
}

.sidebar-user .logout {
  color: #8ac7c0;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 5px;
  border-radius: 7px;
  display: grid;
  place-items: center;
}

.sidebar-user .logout:hover {
  color: #fff;
  background: rgba(244, 63, 94, 0.25);
}

.sidebar-user .logout svg {
  width: 17px;
  height: 17px;
}

.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 32px;
  min-height: 62px;
  background: rgba(244, 247, 247, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.menu-btn {
  display: none;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 9px;
  width: 36px;
  height: 36px;
  place-items: center;
  cursor: pointer;
  color: var(--slate-600);
}

.topbar-crumb {
  font-size: 12.5px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 7px;
}

.topbar-crumb b {
  color: var(--ink-900);
  font-weight: 700;
}

.topbar-spacer {
  flex: 1;
}

.topbar-date {
  font-size: 12.5px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 7px;
}

.topbar-date svg {
  width: 16px;
  height: 16px;
  color: var(--teal-600);
}

.page {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 32px 64px;
  animation: page-in 0.25s ease;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head .grow {
  flex: 1;
  min-width: 220px;
}

.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-700);
  margin-bottom: 5px;
}

.page-title {
  font-size: clamp(23px, 2.4vw, 31px);
  line-height: 1.15;
}

.page-sub {
  color: var(--slate-500);
  font-size: 13.5px;
  margin-top: 5px;
  max-width: 720px;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--slate-500);
  margin-bottom: 9px;
  font-weight: 600;
}

.back-link:hover {
  color: var(--teal-700);
}

.back-link svg {
  width: 15px;
  height: 15px;
}

/* Cards & stats ------------------------------------------------------------ */
.card {
  background: var(--white);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-bottom: 1px solid var(--slate-100);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  width: 19px;
  height: 19px;
  color: var(--teal-600);
}

.card-sub {
  font-size: 12px;
  color: var(--slate-500);
}

.card-head .spacer {
  flex: 1;
}

.card-body {
  padding: 18px;
}

.card-body.tight {
  padding: 12px;
}

.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--slate-100);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.card.note {
  background: linear-gradient(135deg, #f0fdfa, #fff);
  border-color: var(--teal-100);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -22px;
  top: -26px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--teal-50);
  opacity: 0.9;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--teal-50);
  color: var(--teal-700);
  flex: none;
  position: relative;
  z-index: 1;
}

.stat-icon svg {
  width: 21px;
  height: 21px;
}

.stat-icon.amber { background: #fffbeb; color: #b45309; }
.stat-icon.sky { background: #f0f9ff; color: #0369a1; }
.stat-icon.violet { background: #f5f3ff; color: #6d28d9; }
.stat-icon.rose { background: #fff1f2; color: #be123c; }

.stat-card .num {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink-900);
}

.stat-card .lbl {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 2px;
}

.stat-card .trend {
  font-size: 11px;
  color: var(--teal-700);
  font-weight: 700;
  margin-top: 5px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row.tight {
  gap: 6px;
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--slate-500);
}

.small {
  font-size: 12.5px;
}

.tiny {
  font-size: 11.5px;
}

.mono {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.nowrap {
  white-space: nowrap;
}

/* Badges ------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--slate-100);
  color: var(--slate-600);
}

.badge.green { background: #ecfdf5; color: #047857; }
.badge.teal { background: var(--teal-50); color: var(--teal-800); }
.badge.amber { background: #fffbeb; color: #b45309; }
.badge.rose { background: #fff1f2; color: #be123c; }
.badge.sky { background: #f0f9ff; color: #0369a1; }
.badge.violet { background: #f5f3ff; color: #6d28d9; }
.badge.dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Tables ------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--slate-500);
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

table.data th:first-child { border-radius: 9px 0 0 0; }
table.data th:last-child { border-radius: 0 9px 0 0; }

table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover {
  background: #fbfdfd;
}

table.data .name-cell {
  font-weight: 600;
  color: var(--ink-900);
}

table.data .sub-cell {
  display: block;
  font-size: 11.5px;
  color: var(--slate-500);
  font-weight: 400;
}

table.data td.num,
table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data tr.is-missing td {
  background: #fffdf5;
}

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* Empty state -------------------------------------------------------------- */
.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 38px 20px;
  gap: 7px;
}

.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--teal-50);
  color: var(--teal-600);
  margin-bottom: 4px;
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty h3 {
  font-size: 16px;
}

.empty p {
  font-size: 12.5px;
  color: var(--slate-500);
  max-width: 380px;
}

/* Tabs --------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-500);
  white-space: nowrap;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tab svg {
  width: 17px;
  height: 17px;
}

.tab:hover {
  color: var(--teal-700);
}

.tab.active {
  color: var(--teal-800);
}

.tab.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2.5px;
  border-radius: 99px 99px 0 0;
  background: var(--teal-600);
}

.tab .count {
  background: var(--slate-100);
  color: var(--slate-500);
  border-radius: 99px;
  padding: 0 6px;
  font-size: 10.5px;
}

/* Progress ----------------------------------------------------------------- */
.progress {
  height: 7px;
  background: var(--slate-100);
  border-radius: 99px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-600));
  transition: width 0.3s;
}

.progress.amber > span { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.progress.rose > span { background: linear-gradient(90deg, #fb7185, #e11d48); }

/* Modal -------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 30, 28, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.16s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
  overflow: hidden;
}

.modal.lg { width: min(820px, 100%); }
.modal.xl { width: min(1060px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--slate-100);
}

.modal-head h3 {
  font-size: 18px;
  line-height: 1.3;
}

.modal-head p {
  font-size: 12.5px;
  color: var(--slate-500);
  margin-top: 2px;
}

.modal-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 0;
  background: var(--slate-50);
  color: var(--slate-500);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.modal-close:hover {
  background: var(--slate-100);
  color: var(--slate-800);
}

.modal-close svg {
  width: 17px;
  height: 17px;
}

.modal-body {
  padding: 20px;
  overflow: auto;
}

.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--slate-100);
  background: var(--slate-50);
}

/* Toasts ------------------------------------------------------------------- */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(390px, calc(100vw - 36px));
}

.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--teal-600);
  border-radius: 11px;
  padding: 11px 13px;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 0.22s ease;
}

.toast.error { border-left-color: var(--rose-500); }
.toast.warn { border-left-color: var(--amber-500); }

.toast svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--teal-600);
}

.toast.error svg { color: var(--rose-500); }
.toast.warn svg { color: var(--amber-500); }

.toast .close {
  border: 0;
  background: none;
  color: var(--slate-400);
  cursor: pointer;
  padding: 2px;
  margin-left: auto;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Class cards -------------------------------------------------------------- */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.class-card {
  padding: 17px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: 0.16s;
}

.class-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--teal-200);
}

.class-card .top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.class-avatar {
  width: 45px;
  height: 45px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  background: linear-gradient(145deg, #ccfbf1, #f0fdfa);
  color: var(--teal-800);
  flex: none;
}

.class-card h3 {
  font-size: 16px;
  line-height: 1.25;
}

.class-card .level {
  font-size: 11.5px;
  color: var(--slate-500);
}

.class-card .stats {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px dashed var(--slate-200);
  border-bottom: 1px dashed var(--slate-200);
}

.class-card .stats div {
  font-size: 11.5px;
  color: var(--slate-500);
}

.class-card .stats b {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  color: var(--ink-900);
  font-weight: 600;
}

.class-card .actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.class-card .actions .btn:first-child {
  flex: 1;
}

/* Exam cards --------------------------------------------------------------- */
.exam-card {
  padding: 17px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exam-card .top {
  display: flex;
  gap: 9px;
  align-items: center;
}

.exam-card h3 {
  font-size: 16px;
  line-height: 1.3;
}

.exam-card .subject {
  font-size: 11.5px;
  color: var(--teal-700);
  font-weight: 700;
}

.exam-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--slate-500);
}

.exam-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.exam-meta svg {
  width: 14px;
  height: 14px;
  color: var(--slate-400);
}

.exam-card .foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px dashed var(--slate-200);
}

/* Answer key editor -------------------------------------------------------- */
.key-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 11px;
  margin-bottom: 14px;
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.key-q {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--slate-200);
  border-radius: 9px;
  background: #fff;
}

.key-q.missing {
  border-color: #fde68a;
  background: #fffdf5;
}

.key-q .qno {
  width: 29px;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-500);
  text-align: right;
  flex: none;
}

.key-choices {
  display: flex;
  gap: 3px;
  flex: 1;
}

.key-choice {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1.5px solid var(--slate-300);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.12s;
  padding: 0;
}

.key-choice:hover {
  border-color: var(--teal-500);
  color: var(--teal-700);
}

.key-choice.on {
  background: var(--teal-600);
  border-color: var(--teal-600);
  color: #fff;
  box-shadow: 0 3px 9px -3px rgba(15, 118, 110, 0.6);
}

/* Option cards (print layout) --------------------------------------------- */
.option-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-card {
  position: relative;
  border: 1.5px solid var(--slate-200);
  border-radius: 12px;
  padding: 13px;
  cursor: pointer;
  background: #fff;
  transition: 0.15s;
}

.option-card:hover {
  border-color: var(--teal-300);
}

.option-card input {
  position: absolute;
  opacity: 0;
}

.option-card .mini-sheet {
  display: grid;
  gap: 2px;
  width: 34px;
  height: 46px;
  background: #f8fafc;
  border: 1px solid var(--slate-300);
  border-radius: 3px;
  padding: 2px;
  margin-bottom: 9px;
}

.option-card .mini-sheet i {
  display: block;
  background: var(--slate-300);
  border-radius: 1px;
}

.option-card b {
  display: block;
  font-size: 13px;
  color: var(--ink-900);
}

.option-card span {
  display: block;
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 2px;
}

.option-card.selected {
  border-color: var(--teal-600);
  background: var(--teal-50);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.option-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.batch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #fff;
  flex-wrap: wrap;
}

.batch-row + .batch-row {
  margin-top: 8px;
}

.batch-row .code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 3px 7px;
  color: var(--slate-600);
}

/* Dashboard lists ---------------------------------------------------------- */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--slate-100);
}

.activity:last-child { border-bottom: 0; }

.activity .avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 11px;
}

.activity .meta {
  flex: 1;
  min-width: 0;
}

.activity .meta b {
  display: block;
  font-size: 12.8px;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity .meta span {
  font-size: 11px;
  color: var(--slate-500);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity .score {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--teal-700);
}

.steps-guide {
  display: grid;
  gap: 10px;
}

.step-guide {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--slate-100);
}

.step-guide .n {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--teal-50);
  color: var(--teal-800);
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex: none;
}

.step-guide b {
  font-size: 13px;
  display: block;
}

.step-guide span {
  font-size: 11.5px;
  color: var(--slate-500);
}

/* Analysis ----------------------------------------------------------------- */
.dist-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 130px;
  padding: 10px 4px 0;
}

.dist-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 5px;
}

.dist-bar .fill {
  width: 100%;
  max-width: 44px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
  min-height: 3px;
  transition: height 0.4s;
}

.dist-bar .n {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-600);
}

.dist-bar .lab {
  font-size: 10.5px;
  color: var(--slate-400);
  white-space: nowrap;
}

.qbars {
  display: grid;
  gap: 5px;
  max-height: 460px;
  overflow: auto;
  padding-right: 4px;
}

.qbar {
  display: grid;
  grid-template-columns: 34px 1fr 44px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

.qbar .q {
  color: var(--slate-500);
  font-weight: 700;
  text-align: right;
}

.qbar .track {
  height: 16px;
  background: var(--slate-100);
  border-radius: 5px;
  overflow: hidden;
}

.qbar .fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #5eead4, #0d9488);
}

.qbar.low .fill { background: linear-gradient(90deg, #fda4af, #e11d48); }
.qbar.mid .fill { background: linear-gradient(90deg, #fde68a, #f59e0b); }

.qbar .pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--slate-600);
  font-weight: 600;
}

/* Scan --------------------------------------------------------------------- */
.scan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 17px;
  align-items: start;
}

.camera-card {
  overflow: hidden;
}

.camera-stage {
  position: relative;
  background:
    radial-gradient(circle at 50% 40%, #164e4a, #072321 75%);
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.camera-stage canvas.capture {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  color: #9fd6cf;
  text-align: center;
  padding: 20px;
}

.camera-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.75;
}

.camera-placeholder b {
  color: #e6fffb;
  font-size: 14px;
}

.camera-placeholder span {
  font-size: 11.5px;
  max-width: 290px;
  line-height: 1.6;
}

.frame-guide {
  position: absolute;
  inset: 6.5%;
  border: 2px dashed rgba(153, 246, 228, 0.55);
  border-radius: 8px;
  pointer-events: none;
}

.frame-guide::before,
.frame-guide::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid var(--amber-400);
}

.frame-guide::before {
  left: -2px;
  top: -2px;
  border-right: 0;
  border-bottom: 0;
  border-radius: 6px 0 0 0;
}

.frame-guide::after {
  right: -2px;
  bottom: -2px;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 6px 0;
}

.camera-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  flex-wrap: wrap;
  background: #fff;
}

.camera-hint {
  font-size: 11px;
  color: var(--slate-500);
  line-height: 1.5;
}

.scan-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: rgba(6, 30, 28, 0.72);
  color: #e6fffb;
  font-size: 13px;
  z-index: 3;
  backdrop-filter: blur(2px);
}

.scan-status .spinner {
  width: 30px;
  height: 30px;
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #5eead4;
}

.corner-handle {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid #fbbf24;
  background: rgba(251, 191, 36, 0.25);
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 4;
  touch-action: none;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25);
}

.corner-handle::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fbbf24;
}

.scan-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scan-result-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.scan-result-banner.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.scan-result-banner.error {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.scan-result-banner svg {
  width: 21px;
  height: 21px;
  margin-top: 1px;
  flex: none;
}

.scan-result-banner b {
  display: block;
  font-size: 13.5px;
}

.scan-result-banner span {
  font-size: 11.5px;
  display: block;
  margin-top: 2px;
  opacity: 0.85;
}

.review-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.meta-box {
  padding: 9px 11px;
  border: 1px solid var(--slate-200);
  border-radius: 9px;
  background: var(--slate-50);
}

.meta-box .k {
  font-size: 10px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-box .v {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
  margin-top: 1px;
  word-break: break-word;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 6px;
  max-height: 330px;
  overflow: auto;
  padding: 4px;
}

.ans-q {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #fff;
}

.ans-q.ambiguous {
  border-color: #fcd34d;
  background: #fffdf5;
}

.ans-q .no {
  width: 24px;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  text-align: right;
}

.ans-q .choices {
  display: flex;
  gap: 2px;
  flex: 1;
}

.ans-choice {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.4px solid var(--slate-300);
  background: #fff;
  color: var(--slate-400);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}

.ans-choice.on {
  background: var(--teal-600);
  border-color: var(--teal-600);
  color: #fff;
}

.ans-choice.blank.on {
  background: var(--slate-400);
  border-color: var(--slate-400);
}

.ans-choice:hover {
  border-color: var(--teal-500);
}

.score-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 99px;
  background: linear-gradient(135deg, #ccfbf1, #ecfdf5);
  color: var(--teal-900);
  font-weight: 700;
  font-size: 15px;
  font-family: var(--display);
}

.score-pill small {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--teal-700);
}

.dropzone {
  border: 2px dashed var(--slate-300);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: var(--slate-50);
  transition: 0.15s;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--teal-500);
  background: var(--teal-50);
}

.dropzone svg {
  width: 30px;
  height: 30px;
  color: var(--teal-600);
  margin-bottom: 5px;
}

.dropzone b {
  display: block;
  font-size: 13px;
}

.dropzone span {
  font-size: 11.5px;
  color: var(--slate-500);
}

.scan-queue {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
}

.queue-item {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 9px;
  font-size: 12px;
  background: #fff;
}

.queue-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-500);
  flex: none;
}

.queue-item .dot.warn { background: var(--amber-500); }
.queue-item .dot.error { background: var(--rose-500); }

/* Login -------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  background: #fff;
}

.login-brand {
  position: relative;
  overflow: hidden;
  padding: 42px clamp(30px, 5vw, 74px);
  color: #eafffb;
  background:
    radial-gradient(circle at 80% 15%, rgba(251, 191, 36, 0.2), transparent 35%),
    radial-gradient(circle at 15% 85%, rgba(45, 212, 191, 0.28), transparent 45%),
    linear-gradient(145deg, #0b3835, #062523 75%);
  display: flex;
  flex-direction: column;
}

.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(153, 246, 228, 0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.35;
  pointer-events: none;
}

.login-brand .brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.login-brand .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.login-brand .brand-word {
  color: #fff;
  font-size: 30px;
}

.login-brand .brand-tag {
  font-size: 11px;
  color: #8ac7c0;
  letter-spacing: 0.05em;
}

.hero-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding: 38px 0;
  max-width: 520px;
}

.hero-copy .kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-400);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 16px;
}

.hero-copy h1 {
  color: #fff;
  font-size: clamp(30px, 3.6vw, 45px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.hero-copy h1 em {
  font-style: normal;
  color: var(--amber-400);
}

.hero-copy p {
  color: #a8d8d2;
  font-size: 14px;
  line-height: 1.7;
  margin-top: 14px;
  max-width: 450px;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 16px;
  margin-top: 26px;
}

.feature-list div {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: #c9eae5;
}

.feature-list svg {
  width: 17px;
  height: 17px;
  color: #34d399;
  margin-top: 1px;
  flex: none;
}

.login-foot {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: #6ba8a1;
}

.login-side {
  display: grid;
  place-items: center;
  padding: 34px 24px;
  background:
    radial-gradient(circle at 100% 0%, #f0fdfa, transparent 42%),
    #fbfdfd;
}

.login-card {
  width: min(410px, 100%);
}

.login-card .hello {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-700);
  margin-bottom: 6px;
}

.login-card h2 {
  font-size: 28px;
  line-height: 1.2;
}

.login-card .desc {
  font-size: 12.5px;
  color: var(--slate-500);
  margin: 6px 0 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .btn {
  margin-top: 4px;
}

.login-note {
  margin-top: 20px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 11.5px;
  line-height: 1.6;
}

.login-note b {
  color: #78350f;
}

.login-switch {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--slate-500);
}

.login-switch a {
  font-weight: 700;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--slate-100);
  border-radius: 11px;
  padding: 4px;
  margin-bottom: 18px;
}

.login-tabs button {
  border: 0;
  background: none;
  padding: 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--slate-500);
  cursor: pointer;
}

.login-tabs button.active {
  background: #fff;
  color: var(--teal-800);
  box-shadow: var(--shadow-sm);
}

/* Portal ------------------------------------------------------------------- */
.portal-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0%, rgba(204, 251, 241, 0.55), transparent 38%),
    radial-gradient(circle at 0% 100%, rgba(254, 243, 199, 0.4), transparent 35%),
    var(--bg);
}

.portal-head {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: sticky;
  top: 0;
  z-index: 20;
}

.portal-head-inner {
  max-width: 1050px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.portal-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.portal-brand .brand-word {
  font-size: 21px;
}

.portal-brand small {
  display: block;
  font-size: 9.5px;
  color: var(--slate-500);
  letter-spacing: 0.03em;
}

.portal-main {
  max-width: 1050px;
  margin: 0 auto;
  padding: 26px 22px 64px;
}

.portal-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 90% 10%, rgba(251, 191, 36, 0.18), transparent 35%),
    linear-gradient(140deg, #0f766e, #0b3b38);
  color: #fff;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.portal-hero .avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 19px;
}

.portal-hero h1 {
  color: #fff;
  font-size: 23px;
}

.portal-hero p {
  color: #a7d8d2;
  font-size: 12.5px;
  margin-top: 2px;
}

.portal-hero .side {
  margin-left: auto;
  text-align: right;
}

.portal-hero .side .pct {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  color: var(--amber-400);
  line-height: 1;
}

.portal-hero .side span {
  font-size: 11px;
  color: #a7d8d2;
}

.portal-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px 18px;
}

.portal-login-card {
  width: min(430px, 100%);
  padding: 26px;
}

.portal-login-card .brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.portal-login-card h2 {
  font-size: 22px;
}

.portal-login-card .desc {
  font-size: 12.5px;
  color: var(--slate-500);
  margin: 4px 0 18px;
}

.result-card {
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: 0.15s;
}

.result-card:hover {
  border-color: var(--teal-200);
  box-shadow: var(--shadow);
}

.result-card .score-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--teal-500) calc(var(--pct, 0) * 1%), var(--slate-100) 0);
  flex: none;
  position: relative;
}

.result-card .score-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff;
}

.result-card .score-ring b {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: 14px;
  color: var(--teal-900);
}

.result-card .meta {
  flex: 1;
  min-width: 0;
}

.result-card h3 {
  font-size: 14.5px;
  line-height: 1.3;
}

.result-card .sub {
  font-size: 11.5px;
  color: var(--slate-500);
  margin-top: 2px;
}

.result-card .score-side {
  text-align: right;
  flex: none;
}

.result-card .score-side .big {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.1;
}

.result-card .score-side span {
  font-size: 10.5px;
  color: var(--slate-500);
}

.attempt-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--slate-100);
  font-size: 12.5px;
}

.attempt-line:last-child { border-bottom: 0; }

.attempt-line .score {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.answer-bubble-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.answer-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  border: 1.5px solid var(--slate-200);
  color: var(--slate-400);
  background: #fff;
}

.answer-bubble.correct {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.answer-bubble.wrong {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #9f1239;
}

.answer-bubble.key {
  background: #ecfdf5;
  border-color: var(--teal-400);
  color: var(--teal-800);
}

/* Misc --------------------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--slate-100);
  margin: 16px 0;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  color: var(--teal-900);
}

.notice svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  color: var(--teal-600);
}

.notice.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.notice.warn svg { color: var(--amber-500); }

.notice.rose {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.notice.rose svg { color: var(--rose-500); }

.notice b { font-weight: 700; }

.code-box {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.12em;
  font-weight: 700;
  background: var(--slate-50);
  border: 1px dashed var(--slate-300);
  border-radius: 9px;
  padding: 9px 12px;
  text-align: center;
  color: var(--ink-900);
}

.search-box {
  position: relative;
  min-width: 200px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--slate-400);
  pointer-events: none;
}

.search-box .input {
  padding-left: 33px;
}

.file-input {
  display: none;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 22px; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-grid { grid-template-columns: 1fr; }
  .scan-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.2);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 30, 28, 0.45);
    z-index: 45;
  }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 18px; }
  .page { padding: 22px 18px 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-side { min-height: 100vh; }
  .option-cards { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 12px; gap: 9px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .stat-card .num { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .scan-side { grid-template-columns: 1fr; }
  .review-meta { grid-template-columns: 1fr 1fr; }
  .page-head { gap: 12px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .toasts { right: 10px; bottom: 10px; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .login-side { padding: 24px 18px; }
  .portal-hero .side { text-align: left; margin-left: 0; }
  .key-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
}

@media print {
  .sidebar, .topbar, .head-actions, .no-print { display: none !important; }
  .app-shell { display: block; }
  .page { padding: 0; }
}
