/* ==========================================================================
   智考 SmartExam — product styles
   A calm, editorial interface for teachers and students.
   ========================================================================== */

:root {
  --ink: #0f1f2e;
  --ink-2: #33475b;
  --muted: #6b7c8f;
  --muted-2: #94a3b8;
  --bg: #f4f7f9;
  --card: #ffffff;
  --line: #e4ebf0;
  --line-strong: #d5e0e7;
  --brand: #0f766e;
  --brand-2: #0d9488;
  --brand-dark: #0b4f4a;
  --brand-soft: #e7f6f2;
  --brand-soft-2: #d4f0e9;
  --accent: #f59e0b;
  --accent-soft: #fff4dc;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --violet: #7c3aed;
  --violet-soft: #f2ecff;
  --success: #059669;
  --success-soft: #e6f7f0;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --sidebar: #0b1c2b;
  --sidebar-2: #102a3b;
  --radius-xs: 10px;
  --radius-sm: 13px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 46, .04), 0 6px 18px rgba(15, 31, 46, .04);
  --shadow: 0 14px 40px rgba(15, 31, 46, .07);
  --shadow-lg: 0 30px 70px rgba(15, 31, 46, .14);
  --font: "Inter", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sidebar-w: 252px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
svg { width: 18px; height: 18px; flex: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: #b9ebe2; color: var(--ink); }

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8d5de; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #a8bac7; border: 2px solid transparent; background-clip: padding-box; }

/* --------------------------------------------------------------------------
   Boot
   -------------------------------------------------------------------------- */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(circle at 30% 20%, rgba(15, 118, 110, .12), transparent 34%),
    radial-gradient(circle at 75% 70%, rgba(245, 158, 11, .10), transparent 30%),
    var(--bg);
  color: var(--muted);
  font-size: 14px;
}
.boot-mark {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: grid; place-items: center;
  color: var(--brand);
  background: #fff;
  box-shadow: var(--shadow);
  animation: bootPulse 1.6s ease-in-out infinite;
}
.boot-mark svg { width: 40px; height: 40px; }
@keyframes bootPulse {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 10px 30px rgba(15,118,110,.10); }
  50% { transform: translateY(-5px) scale(1.02); box-shadow: 0 22px 48px rgba(15,118,110,.16); }
}

/* --------------------------------------------------------------------------
   Shared primitives
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: #fff;
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--btn-line);
  border-radius: 11px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(15, 31, 46, .08); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn svg.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-line: var(--brand); box-shadow: 0 8px 18px rgba(15, 118, 110, .16); }
.btn-primary:hover { --btn-bg: #0d6a62; box-shadow: 0 10px 24px rgba(15, 118, 110, .22); }
.btn-dark { --btn-bg: #12283a; --btn-fg: #fff; --btn-line: #12283a; }
.btn-dark:hover { --btn-bg: #0b1c2b; }
.btn-soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-dark); --btn-line: transparent; }
.btn-soft:hover { --btn-bg: var(--brand-soft-2); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-line: transparent; }
.btn-ghost:hover { --btn-bg: #edf3f4; box-shadow: none; }
.btn-outline { --btn-bg: transparent; --btn-fg: var(--ink-2); }
.btn-outline:hover { --btn-bg: #fff; }
.btn-danger { --btn-bg: #fff; --btn-fg: var(--danger); --btn-line: #f3c9c9; }
.btn-danger:hover { --btn-bg: var(--danger-soft); }
.btn-white { --btn-bg: #fff; --btn-fg: var(--brand-dark); --btn-line: #fff; }
.btn-sm { min-height: 33px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 14.5px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 10px; }
.btn-icon svg { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
.icon-btn:hover { background: #eef4f5; color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 23px; padding: 0 9px;
  border-radius: 99px;
  background: #f0f4f6; color: var(--muted);
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge-green { background: var(--success-soft); color: #047857; }
.badge-teal { background: var(--brand-soft); color: var(--brand-dark); }
.badge-amber { background: var(--accent-soft); color: #b45309; }
.badge-red { background: var(--danger-soft); color: #b91c1c; }
.badge-blue { background: var(--blue-soft); color: #1d4ed8; }
.badge-violet { background: var(--violet-soft); color: #6d28d9; }
.badge-slate { background: #edf2f6; color: #536579; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: 7px;
  background: #f5f8fa;
  border: 1px solid #eaf0f4;
  color: #607282;
  font-size: 11.5px;
  white-space: nowrap;
}
.chip-teal { background: #effaf7; border-color: #d8f2eb; color: #0d6a62; }

.section-label {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.section-label::before {
  content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--brand);
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-amber { color: #b45309 !important; }

/* Forms */
.field { display: grid; gap: 7px; }
.field label, .field-label {
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.field label.checkbox-row { justify-content: flex-start; align-items: flex-start; gap: 9px; font-weight: 500; }
.field-hint { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  padding: 10px 13px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.input::placeholder, .textarea::placeholder { color: #a7b5c2; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #79c9bd;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .10);
}
.input:disabled, .select:disabled { background: #f5f8f9; color: var(--muted); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.select {
  appearance: none;
  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='%236b7c8f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
}
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 40px; }
.input-wrap > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted-2); pointer-events: none; }
.input-wrap .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.checkbox-line { margin-top: 2px; }
.checkbox-line .checkbox-row { width: fit-content; max-width: 100%; }
.checkbox-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.checkbox-row strong { color: var(--ink); font-weight: 650; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-stack { display: grid; gap: 18px; }

.segmented {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: #edf3f5;
  border: 1px solid #e3ecef;
}
.segmented button {
  min-height: 32px; padding: 0 13px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 650;
  transition: all .16s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 7px rgba(15,31,46,.08); }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  background: #fff;
}
.login-visual {
  position: relative;
  overflow: hidden;
  padding: 42px clamp(36px, 5vw, 76px) 38px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(circle at 13% 5%, rgba(45, 212, 191, .23), transparent 30%),
    radial-gradient(circle at 94% 92%, rgba(245, 158, 11, .13), transparent 33%),
    linear-gradient(145deg, #0b1c2b 0%, #0c2735 50%, #0a3a3a 100%);
}
.login-visual::before {
  content: "";
  position: absolute; inset: 0;
  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: 46px 46px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.6), transparent 82%);
  pointer-events: none;
}
.login-visual::after {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  border: 1px solid rgba(153, 246, 228, .13);
  border-radius: 50%;
  right: -140px; top: 90px;
  box-shadow: 0 0 0 56px rgba(153, 246, 228, .035), 0 0 0 112px rgba(153, 246, 228, .02);
  pointer-events: none;
}
.login-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: #0b1c2b;
  background: linear-gradient(145deg, #a7f3d0, #5eead4);
  box-shadow: 0 12px 28px rgba(45, 212, 191, .18);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text { display: grid; gap: 2px; }
.brand-text strong { font-size: 18px; letter-spacing: .01em; font-weight: 750; }
.brand-text span { font-size: 10.5px; color: rgba(255,255,255,.55); letter-spacing: .2em; text-transform: uppercase; }
.login-brand .brand-mark { color: #052e2b; }

.login-copy { position: relative; z-index: 2; margin-top: clamp(48px, 8vh, 92px); max-width: 640px; }
.login-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 11px;
  border: 1px solid rgba(153,246,228,.22);
  border-radius: 99px;
  background: rgba(153,246,228,.08);
  color: #99f6e4;
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em;
}
.login-eyebrow .pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 0 4px rgba(94,234,212,.11); }
.login-copy h1 {
  margin-top: 20px;
  font-size: clamp(38px, 4.4vw, 62px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 760;
}
.login-copy h1 em { font-style: normal; color: #5eead4; }
.login-copy p {
  margin-top: 20px;
  max-width: 505px;
  color: rgba(226, 245, 243, .68);
  font-size: 14.5px;
  line-height: 1.85;
}
.login-features { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.login-feature {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px;
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.075);
  color: rgba(232, 248, 246, .75);
  font-size: 11.5px;
  backdrop-filter: blur(6px);
}
.login-feature svg { width: 14px; height: 14px; color: #5eead4; }

.login-preview {
  position: relative; z-index: 2;
  margin-top: auto;
  padding-top: 38px;
  display: flex; align-items: flex-end; gap: 16px;
}
.preview-card {
  width: min(330px, 52%);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 17px;
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(16px);
  padding: 16px;
  box-shadow: 0 24px 55px rgba(0,0,0,.16);
}
.preview-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.preview-title { display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.74); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.preview-title svg { width: 14px; height: 14px; color: #5eead4; }
.preview-live { color: #5eead4; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; }
.preview-question { color: #f0fdfa; font-size: 13px; line-height: 1.65; }
.preview-options { display: grid; gap: 6px; margin-top: 11px; }
.preview-option { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; background: rgba(255,255,255,.045); color: rgba(240,253,250,.72); font-size: 11px; }
.preview-option b { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 5px; background: rgba(255,255,255,.08); font-size: 9px; }
.preview-option.correct { background: rgba(94,234,212,.13); color: #ccfbf1; }
.preview-option.correct b { background: #5eead4; color: #0b3b36; }
.preview-note {
  flex: 1;
  min-width: 190px;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(245, 158, 11, .09);
  border: 1px solid rgba(245, 158, 11, .15);
  color: rgba(255, 245, 226, .78);
  font-size: 11px; line-height: 1.65;
}
.preview-note svg { width: 16px; height: 16px; flex: none; color: #fbbf24; margin-top: 1px; }
.preview-note strong { display: block; color: #fde68a; font-size: 11.5px; margin-bottom: 2px; }

.login-footer {
  position: relative; z-index: 2;
  margin-top: 30px;
  display: flex; align-items: center; justify-content: space-between;
  color: rgba(226,245,243,.38);
  font-size: 10.5px;
  letter-spacing: .03em;
}
.login-footer .dotline { display: flex; align-items: center; gap: 7px; }
.login-footer .dotline i { width: 5px; height: 5px; border-radius: 50%; background: rgba(94,234,212,.55); display: block; }

.login-panel {
  position: relative;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 40px clamp(28px, 5vw, 84px);
  background:
    radial-gradient(circle at 70% 12%, rgba(15,118,110,.055), transparent 32%),
    #fbfcfc;
}
.login-box { width: 100%; min-width: 0; max-width: 404px; }
.login-box-head { margin-bottom: 26px; }
.login-box-head .mobile-brand { display: none; }
.login-box-head h2 { font-size: 27px; letter-spacing: -.03em; font-weight: 750; }
.login-box-head p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #eef3f4; border-radius: 13px; margin-bottom: 24px; }
.login-role-single { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; margin-bottom: 24px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12.5px; font-weight: 650; }
.login-role-single svg { width: 17px; height: 17px; }
.login-portal-note { margin: 15px 0 0; padding: 11px 12px; border-radius: 10px; background: #f5f9f8; border: 1px solid #e4efec; color: var(--muted); font-size: 11px; line-height: 1.65; }
.login-role-switch button {
  min-width: 0;
  min-height: 42px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12.5px; font-weight: 650;
  transition: all .18s ease;
}
.login-role-switch button svg { width: 16px; height: 16px; }
.login-role-switch button.active { background: #fff; color: var(--ink); box-shadow: 0 3px 10px rgba(15,31,46,.08); }
.login-form { display: grid; gap: 16px; }
.login-form .field label { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.login-form .input { min-height: 46px; border-radius: 12px; background: #fff; }
.login-submit { min-height: 48px; margin-top: 2px; border-radius: 12px; font-size: 14px; }
.login-submit svg { width: 18px; height: 18px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 15px; color: #9aa9b7; font-size: 10.5px; letter-spacing: .06em; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.demo-btn {
  text-align: left;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: all .16s ease;
}
.demo-btn:hover { border-color: #b9dbd6; background: #f8fdfc; transform: translateY(-1px); }
.demo-btn .demo-role { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 11.5px; font-weight: 700; }
.demo-btn .demo-role svg { width: 13px; height: 13px; color: var(--brand); }
.demo-btn .demo-creds { margin-top: 4px; color: var(--muted-2); font-size: 10px; font-family: var(--mono); }
.login-register { margin-top: 20px; text-align: center; color: var(--muted); font-size: 12px; }
.login-register button { border: 0; background: none; color: var(--brand); font-weight: 700; padding: 0 2px; }
.login-register button:hover { text-decoration: underline; }
.login-legal { margin-top: 28px; display: flex; align-items: center; justify-content: center; gap: 6px; color: #a3b1bd; font-size: 10px; }
.login-legal svg { width: 12px; height: 12px; }
.login-error {
  display: none;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid #f7d2d2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.5;
}
.login-error.show { display: block; animation: shake .3s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 20px 16px 15px;
  color: #dbe9ee;
  background:
    radial-gradient(circle at 18% 0%, rgba(45,212,191,.10), transparent 26%),
    linear-gradient(180deg, #0b1c2b 0%, #0b2130 62%, #0a1b27 100%);
  border-right: 1px solid rgba(255,255,255,.045);
  transition: transform .23s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 0; }
.sidebar-brand .brand-mark { width: 37px; height: 37px; border-radius: 11px; box-shadow: none; }
.sidebar-brand .brand-mark svg { width: 23px; height: 23px; }
.sidebar-brand .brand-name { font-size: 16px; font-weight: 750; letter-spacing: -.01em; color: #f3fbfa; }
.sidebar-brand .brand-sub { margin-top: 2px; color: rgba(219,233,238,.42); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; }
.sidebar-context {
  margin-top: 23px;
  padding: 11px 12px;
  display: flex; align-items: center; gap: 9px;
  border-radius: 11px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.06);
  color: rgba(219,233,238,.72);
  font-size: 11px;
}
.sidebar-context .context-icon { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: rgba(94,234,212,.1); color: #5eead4; }
.sidebar-context .context-icon svg { width: 15px; height: 15px; }
.sidebar-context strong { display: block; color: #dff7f2; font-size: 11px; font-weight: 650; }
.sidebar-context span { display: block; margin-top: 1px; color: rgba(219,233,238,.4); font-size: 9.5px; }
.sidebar-nav { margin-top: 23px; display: grid; gap: 3px; }
.nav-label { padding: 0 11px 8px; color: rgba(219,233,238,.3); font-size: 9px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 41px; padding: 0 11px;
  border-radius: 10px;
  color: rgba(219,233,238,.62);
  font-size: 12.5px; font-weight: 550;
  transition: all .16s ease;
}
.nav-link svg { width: 17px; height: 17px; opacity: .82; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #eefaf8; }
.nav-link.active { background: linear-gradient(90deg, rgba(45,212,191,.16), rgba(45,212,191,.055)); color: #f0fdfa; box-shadow: inset 0 0 0 1px rgba(94,234,212,.08); }
.nav-link.active::before { content: ""; position: absolute; left: -16px; top: 11px; bottom: 11px; width: 3px; border-radius: 0 3px 3px 0; background: #5eead4; }
.nav-link.active svg { color: #5eead4; opacity: 1; }
.nav-link .nav-badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border-radius: 6px; background: rgba(94,234,212,.14); color: #99f6e4; font-size: 9.5px; font-weight: 750; }
.sidebar-spacer { flex: 1; min-height: 26px; }
.sidebar-tip {
  margin: 0 1px 14px;
  padding: 13px;
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(245,158,11,.11), rgba(245,158,11,.035));
  border: 1px solid rgba(245,158,11,.13);
  color: rgba(255,245,226,.68);
  font-size: 10.5px; line-height: 1.65;
}
.sidebar-tip .tip-head { display: flex; align-items: center; gap: 7px; color: #fde68a; font-size: 10.5px; font-weight: 700; margin-bottom: 5px; }
.sidebar-tip .tip-head svg { width: 14px; height: 14px; }
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 9px;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 2px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, #5eead4, #2dd4bf);
  color: #073b36;
  font-size: 12px; font-weight: 800;
  letter-spacing: -.02em;
}
.avatar-teacher { background: linear-gradient(145deg, #fcd34d, #f59e0b); color: #4a2b00; }
.sidebar-user .user-meta { min-width: 0; flex: 1; }
.sidebar-user .user-name { color: #f0fdfa; font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { margin-top: 2px; color: rgba(219,233,238,.38); font-size: 9.5px; }
.sidebar-user .icon-btn { color: rgba(219,233,238,.45); }
.sidebar-user .icon-btn:hover { color: #fff; background: rgba(255,255,255,.06); }

.main-wrap { min-height: 100vh; margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 34px;
  background: rgba(244,247,249,.86);
  border-bottom: 1px solid rgba(218,229,235,.7);
  backdrop-filter: blur(14px);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 17px; letter-spacing: -.015em; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin-top: 3px; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.engine-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 29px; padding: 0 10px;
  border-radius: 99px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.engine-pill .pulse-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(5,150,105,.1); }
.topbar-avatar { display: flex; align-items: center; gap: 8px; padding-left: 6px; }
.topbar-avatar .avatar { width: 31px; height: 31px; border-radius: 9px; font-size: 11px; }
.topbar-avatar .name { color: var(--ink-2); font-size: 11.5px; font-weight: 650; }
.mobile-menu { display: none; }
.sidebar-backdrop { display: none; }
.view { width: 100%; max-width: 1460px; margin: 0 auto; padding: 26px 34px 64px; }
.view-enter { animation: fadeUp .28s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h2 { font-size: 24px; font-weight: 750; letter-spacing: -.035em; }
.page-head p { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.page-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 30px 34px;
  min-height: 236px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr);
  gap: 22px;
  align-items: center;
  color: #f0fdfa;
  background:
    radial-gradient(circle at 88% 10%, rgba(94,234,212,.18), transparent 28%),
    radial-gradient(circle at 0% 100%, rgba(245,158,11,.11), transparent 33%),
    linear-gradient(125deg, #0b1c2b 0%, #0c3434 60%, #0b4f4a 100%);
  box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  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: 38px 38px;
  mask-image: linear-gradient(100deg, rgba(0,0,0,.5), transparent 72%);
  pointer-events: none;
}
.hero::after {
  content: ""; position: absolute;
  width: 260px; height: 260px; right: 28px; top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  border: 1px solid rgba(94,234,212,.12);
  box-shadow: 0 0 0 36px rgba(94,234,212,.035), 0 0 0 72px rgba(94,234,212,.02);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; max-width: 650px; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: #99f6e4; font-size: 9.5px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.hero-eyebrow .pulse-dot { width: 5px; height: 5px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 0 3px rgba(94,234,212,.12); }
.hero h2 { margin-top: 13px; font-size: clamp(27px, 3vw, 39px); line-height: 1.16; letter-spacing: -.045em; font-weight: 760; }
.hero h2 em { font-style: normal; color: #5eead4; }
.hero p { margin-top: 11px; max-width: 540px; color: rgba(226,245,243,.62); font-size: 12.5px; line-height: 1.75; }
.hero-actions { display: flex; align-items: center; gap: 9px; margin-top: 21px; flex-wrap: wrap; }
.hero-actions .btn { min-height: 38px; font-size: 12.5px; }
.hero-meta { display: flex; align-items: center; gap: 14px; margin-top: 18px; color: rgba(226,245,243,.48); font-size: 10.5px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-meta svg { width: 13px; height: 13px; }
.hero-visual { position: relative; z-index: 2; display: flex; justify-content: flex-end; }
.hero-glass {
  width: 100%; max-width: 252px;
  border-radius: 17px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.065);
  backdrop-filter: blur(14px);
  padding: 15px;
  box-shadow: 0 24px 50px rgba(0,0,0,.14);
}
.hero-glass-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; color: rgba(226,245,243,.54); font-size: 9.5px; letter-spacing: .05em; }
.hero-glass-head svg { width: 14px; height: 14px; color: #5eead4; }
.hero-score { display: flex; align-items: baseline; gap: 4px; }
.hero-score strong { font-size: 34px; font-weight: 760; letter-spacing: -.04em; }
.hero-score span { color: rgba(226,245,243,.43); font-size: 11px; }
.hero-bars { display: flex; align-items: flex-end; gap: 5px; height: 44px; margin-top: 12px; }
.hero-bars i { flex: 1; border-radius: 3px 3px 1px 1px; background: rgba(94,234,212,.22); }
.hero-bars i:nth-child(4), .hero-bars i:nth-child(5) { background: rgba(94,234,212,.52); }
.hero-bars i:nth-child(6) { background: #5eead4; }
.hero-glass-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); color: rgba(226,245,243,.45); font-size: 9.5px; }
.hero-glass-foot b { color: #a7f3d0; font-size: 10px; }
.hero-user { display: flex; align-items: center; gap: 12px; }
.hero-user .avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }
.hero-greeting { color: rgba(226,245,243,.5); font-size: 11px; letter-spacing: .06em; }
.hero-student h2 { margin-top: 7px; }
.hero-student .hero-visual { align-items: center; }
.ring-card { display: flex; align-items: center; gap: 14px; padding: 14px 15px; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(12px); }
.score-ring {
  --ring: 70;
  --ring-color: #5eead4;
  --ring-size: 112px;
  width: var(--ring-size); height: var(--ring-size);
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring-color) calc(var(--ring) * 1%), rgba(255,255,255,.1) 0);
  position: relative;
  flex: none;
}
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #0d3034; }
.score-ring > div { position: relative; z-index: 1; text-align: center; }
.score-ring strong { display: block; font-size: 25px; font-weight: 760; letter-spacing: -.04em; color: #f0fdfa; }
.score-ring span { display: block; margin-top: 1px; color: rgba(226,245,243,.44); font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; }
.ring-meta { display: grid; gap: 7px; }
.ring-meta .ring-line { color: rgba(226,245,243,.46); font-size: 9.5px; }
.ring-meta strong { color: #f0fdfa; font-size: 12.5px; font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d8e6e8; }
.stat-card::after { content: ""; position: absolute; width: 76px; height: 76px; border-radius: 50%; right: -24px; top: -26px; background: var(--stat-tint, #f1f7f6); opacity: .7; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: var(--stat-tint, var(--brand-soft)); color: var(--stat-color, var(--brand)); position: relative; z-index: 1; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-delta { position: relative; z-index: 1; color: var(--muted-2); font-size: 9.5px; display: inline-flex; align-items: center; gap: 3px; }
.stat-delta svg { width: 12px; height: 12px; }
.stat-value { position: relative; z-index: 1; margin-top: 13px; font-size: 28px; font-weight: 760; letter-spacing: -.05em; line-height: 1; }
.stat-value small { font-size: 12px; color: var(--muted-2); font-weight: 550; letter-spacing: 0; margin-left: 3px; }
.stat-label { position: relative; z-index: 1; margin-top: 7px; color: var(--muted); font-size: 11.5px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .85fr); gap: 16px; margin-top: 16px; align-items: start; }
.stack { display: grid; gap: 16px; align-content: start; }
.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 19px 20px 0; }
.card-head h3 { font-size: 14.5px; font-weight: 720; letter-spacing: -.015em; }
.card-head p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.card-head-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.card-body { padding: 15px 20px 20px; }
.card-link { color: var(--brand); font-size: 11.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.card-link svg { width: 13px; height: 13px; transition: transform .16s ease; }
.card-link:hover svg { transform: translateX(2px); }

.exam-perf { display: grid; gap: 3px; }
.perf-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 38px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f4f6; }
.perf-row:last-child { border-bottom: 0; }
.perf-title { min-width: 0; }
.perf-title strong { display: block; color: var(--ink); font-size: 12px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf-title span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9.5px; }
.perf-bar { height: 6px; border-radius: 99px; background: #edf2f4; overflow: hidden; }
.perf-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.perf-score { text-align: right; color: var(--ink-2); font-family: var(--mono); font-size: 11px; font-weight: 650; }
.perf-empty { padding: 18px 0; text-align: center; color: var(--muted); font-size: 11.5px; }

.weak-list { display: grid; gap: 11px; }
.weak-row { display: flex; align-items: center; gap: 10px; }
.weak-index { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; background: #f4f7f9; color: var(--muted-2); font-size: 9.5px; font-weight: 700; }
.weak-main { flex: 1; min-width: 0; }
.weak-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weak-top strong { color: var(--ink-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weak-top span { color: var(--muted-2); font-size: 9.5px; flex: none; }
.weak-meter { margin-top: 6px; height: 4px; border-radius: 99px; background: #eef3f5; overflow: hidden; }
.weak-meter i { display: block; height: 100%; border-radius: 99px; background: var(--danger); }
.weak-meter i.mid { background: var(--accent); }
.weak-meter i.good { background: var(--success); }
.empty-mini { padding: 18px 0; text-align: center; color: var(--muted); font-size: 11.5px; line-height: 1.7; }

.submission-list { display: grid; }
.submission-row { display: grid; grid-template-columns: 32px minmax(0,1.4fr) minmax(0,1fr) 70px 72px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f4f6; }
.submission-row:last-child { border-bottom: 0; }
.submission-row .avatar { width: 30px; height: 30px; border-radius: 8px; font-size: 10px; }
.submission-student strong { display: block; font-size: 11.5px; font-weight: 650; }
.submission-student span { display: block; margin-top: 2px; color: var(--muted-2); font-size: 9px; }
.submission-exam { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.submission-score { text-align: right; font-family: var(--mono); font-size: 11px; font-weight: 650; }
.submission-score small { color: var(--muted-2); font-weight: 500; }
.submission-time { text-align: right; color: var(--muted-2); font-size: 9.5px; white-space: nowrap; }

.exam-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.mini-exam {
  position: relative;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfdfd;
  transition: all .16s ease;
}
.mini-exam:hover { border-color: #b9dbd6; background: #f7fcfb; }
.mini-exam-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-exam h4 { font-size: 12px; font-weight: 650; line-height: 1.4; }
.mini-exam-meta { display: flex; align-items: center; gap: 9px; margin-top: 7px; color: var(--muted-2); font-size: 9.5px; }
.mini-exam-meta span { display: inline-flex; align-items: center; gap: 4px; }
.mini-exam-meta svg { width: 11px; height: 11px; }
.mini-exam-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.mini-exam-foot .btn { min-height: 28px; padding: 0 10px; font-size: 10.5px; border-radius: 8px; }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.quick-action {
  display: flex; align-items: center; gap: 9px;
  padding: 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  transition: all .16s ease;
}
.quick-action:hover { border-color: #cfe3e1; background: #f8fcfb; transform: translateY(-1px); }
.quick-action .qa-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.quick-action .qa-icon svg { width: 15px; height: 15px; }
.quick-action strong { display: block; font-size: 10.5px; font-weight: 650; }
.quick-action span { display: block; margin-top: 2px; color: var(--muted-2); font-size: 9px; }

/* --------------------------------------------------------------------------
   Materials
   -------------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.searchbox { position: relative; width: 240px; }
.searchbox svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); }
.searchbox input { width: 100%; height: 36px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; padding: 0 12px 0 33px; font-size: 11.5px; outline: none; }
.searchbox input:focus { border-color: #79c9bd; box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.filter-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: #eaf0f2; }
.filter-tabs button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.filter-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15,31,46,.08); }

.material-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.material-card {
  position: relative;
  overflow: hidden;
  padding: 17px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.material-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #d6e5e8; }
.material-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--file-color, #0f766e), transparent 70%); opacity: .75; }
.material-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.file-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--file-soft, var(--brand-soft)); color: var(--file-color, var(--brand)); flex: none; }
.file-icon svg { width: 21px; height: 21px; }
.material-card h3 { margin-top: 13px; font-size: 13.5px; font-weight: 680; line-height: 1.45; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.material-subject { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--brand-dark); font-size: 9.5px; font-weight: 650; }
.material-subject svg { width: 12px; height: 12px; }
.material-owner { margin-top: 5px; color: var(--muted-2); font-size: 9.5px; display: flex; align-items: center; gap: 5px; }
.material-owner svg { width: 11px; height: 11px; }
.material-stats { display: flex; align-items: center; gap: 13px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e9eff2; }
.material-stats div { display: flex; align-items: baseline; gap: 4px; color: var(--muted-2); font-size: 9.5px; }
.material-stats b { color: var(--ink-2); font-family: var(--mono); font-size: 12.5px; font-weight: 650; }
.material-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 11px; max-height: 48px; overflow: hidden; }
.material-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #f1f5f7; }
.material-actions .btn { min-height: 30px; font-size: 11px; padding: 0 10px; }
.material-actions .icon-btn { width: 30px; height: 30px; }
.material-actions .icon-btn svg { width: 15px; height: 15px; }
.material-date { color: var(--muted-2); font-size: 9px; }

.upload-drop {
  position: relative;
  padding: 27px 18px;
  border: 1.5px dashed #cbdde0;
  border-radius: 14px;
  background: #f9fcfc;
  text-align: center;
  transition: all .16s ease;
  cursor: pointer;
}
.upload-drop:hover, .upload-drop.dragover { border-color: #58b8a9; background: #f2fbf8; }
.upload-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-drop .drop-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.upload-drop .drop-icon svg { width: 22px; height: 22px; }
.upload-drop strong { display: block; font-size: 12.5px; font-weight: 650; }
.upload-drop span { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.upload-drop .file-selected { margin-top: 9px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 7px; background: #fff; border: 1px solid #dcebe8; color: var(--brand-dark); font-size: 10.5px; }
.upload-drop .file-selected svg { width: 13px; height: 13px; }
.upload-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; }

.chunk-preview { display: grid; gap: 10px; }
.chunk-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfd; }
.chunk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.chunk-head strong { font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.chunk-head span { color: var(--muted-2); font-size: 9px; font-family: var(--mono); }
.chunk-card p { color: var(--muted); font-size: 11.5px; line-height: 1.75; }
.chunk-card .chunk-tags { margin-top: 7px; display: flex; gap: 4px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Generate
   -------------------------------------------------------------------------- */
.generate-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); gap: 16px; align-items: start; }
.form-card { padding: 24px; }
.form-section { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid #eef3f5; }
.form-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; }
.form-section-title .step-no { width: 23px; height: 23px; border-radius: 7px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-size: 10px; font-weight: 750; flex: none; }
.form-section-title h3 { font-size: 13.5px; font-weight: 720; }
.form-section-title p { margin-left: auto; color: var(--muted-2); font-size: 10px; }
.material-picker { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; max-height: 215px; overflow-y: auto; padding: 1px; }
.pick-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: all .15s ease;
}
.pick-card:hover { border-color: #c6dfdb; background: #fbfefd; }
.pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.pick-card .pick-check { width: 17px; height: 17px; flex: none; margin-top: 1px; border-radius: 5px; border: 1.5px solid #c7d4dc; background: #fff; display: grid; place-items: center; transition: all .15s ease; }
.pick-card .pick-check svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.pick-card input:checked ~ .pick-check { background: var(--brand); border-color: var(--brand); }
.pick-card input:checked ~ .pick-check svg { opacity: 1; }
.pick-card input:checked ~ .pick-content strong { color: var(--brand-dark); }
.pick-card:has(input:checked) { border-color: #85cec1; background: #f4fcf9; box-shadow: 0 0 0 2px rgba(15,118,110,.05); }
.pick-content { min-width: 0; }
.pick-content strong { display: block; font-size: 11.5px; font-weight: 650; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-content span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9px; }
.type-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.type-check { position: relative; }
.type-check input { position: absolute; opacity: 0; pointer-events: none; }
.type-check span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  transition: all .15s ease;
  cursor: pointer;
}
.type-check span::before { content: ""; width: 7px; height: 7px; border-radius: 2px; border: 1.5px solid #c7d4dc; }
.type-check input:checked + span { border-color: #89cfc2; background: #f2fbf8; color: var(--brand-dark); }
.type-check input:checked + span::before { background: var(--brand); border-color: var(--brand); }
.range-row { display: grid; grid-template-columns: 1fr 48px; gap: 12px; align-items: center; }
.range { width: 100%; accent-color: var(--brand); height: 5px; }
.range-output { height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 650; color: var(--ink-2); background: #fbfdfd; }
.difficulty-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.diff-option { position: relative; }
.diff-option input { position: absolute; opacity: 0; pointer-events: none; }
.diff-option span { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; transition: all .15s ease; }
.diff-option span strong { font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.diff-option span small { font-size: 9px; color: var(--muted-2); }
.diff-option input:checked + span { border-color: #89cfc2; background: #f2fbf8; box-shadow: 0 0 0 2px rgba(15,118,110,.05); }
.diff-option input:checked + span strong { color: var(--brand-dark); }
.generate-submit { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.generate-submit .btn { flex: 1; }
.form-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; border-radius: 9px; background: #f6f9fa; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.form-note svg { width: 14px; height: 14px; flex: none; color: var(--brand); margin-top: 1px; }

.ai-engine-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfd; }
.ai-engine-card.is-on { border-color: #b9dfd6; background: linear-gradient(105deg, #f4fcf9, #fbfdfd); }
.ai-engine-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.ai-orb { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: var(--brand); background: var(--brand-soft); }
.ai-orb svg { width: 18px; height: 18px; }
.ai-engine-main strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.ai-engine-main p { margin-top: 4px; color: var(--muted); font-size: 9.5px; line-height: 1.6; }
.ai-engine-actions { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.ai-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.ai-toggle input { width: 14px; height: 14px; accent-color: var(--brand); }
@media (max-width: 620px) {
  .ai-engine-card { align-items: flex-start; flex-direction: column; }
  .ai-engine-actions { width: 100%; justify-content: space-between; }
}

.side-panel { display: grid; gap: 14px; position: sticky; top: calc(var(--topbar-h) + 18px); }
.side-card { padding: 18px; }
.side-card h3 { font-size: 12.5px; font-weight: 720; display: flex; align-items: center; gap: 7px; }
.side-card h3 svg { width: 15px; height: 15px; color: var(--brand); }
.side-steps { display: grid; gap: 14px; margin-top: 15px; }
.side-step { display: flex; gap: 10px; }
.side-step .step-dot { width: 25px; height: 25px; border-radius: 8px; flex: none; display: grid; place-items: center; background: #f2f7f8; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 700; }
.side-step strong { display: block; color: var(--ink-2); font-size: 10.5px; font-weight: 650; }
.side-step p { margin-top: 3px; color: var(--muted-2); font-size: 9.5px; line-height: 1.65; }
.saved-rules { display: grid; gap: 8px; margin-top: 13px; }
.saved-rule { padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fcfefe; transition: border-color .15s ease; }
.saved-rule:hover { border-color: #c8e2de; }
.saved-rule-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.saved-rule strong { display: block; font-size: 10.5px; font-weight: 650; line-height: 1.4; }
.saved-rule p { margin-top: 4px; color: var(--muted-2); font-size: 9px; line-height: 1.5; }
.saved-rule-actions { display: flex; gap: 4px; margin-top: 7px; }
.saved-rule-actions button { height: 23px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 9px; }
.saved-rule-actions button:hover { color: var(--brand); border-color: #bbded8; }

.generating-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(8, 22, 32, .5); backdrop-filter: blur(5px); }
.generating-card { width: min(92vw, 390px); padding: 28px; border-radius: 20px; background: #fff; box-shadow: var(--shadow-lg); text-align: center; }
.generating-orb { width: 70px; height: 70px; margin: 0 auto 16px; border-radius: 22px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); position: relative; }
.generating-orb svg { width: 32px; height: 32px; position: relative; z-index: 1; }
.generating-orb::after { content: ""; position: absolute; inset: -8px; border-radius: 28px; border: 1px solid rgba(15,118,110,.18); animation: orbPulse 1.6s ease-out infinite; }
@keyframes orbPulse { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.18); opacity: 0; } }
.generating-card h3 { font-size: 16px; font-weight: 720; }
.generating-card p { margin-top: 7px; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.generating-steps { margin-top: 18px; display: grid; gap: 7px; text-align: left; }
.generating-step { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 10.5px; }
.generating-step .gs-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #d9e4e8; display: grid; place-items: center; flex: none; }
.generating-step .gs-dot svg { width: 8px; height: 8px; color: #fff; opacity: 0; }
.generating-step.done { color: var(--ink-2); }
.generating-step.done .gs-dot { background: var(--success); border-color: var(--success); }
.generating-step.done .gs-dot svg { opacity: 1; }
.generating-step.active { color: var(--brand-dark); font-weight: 600; }
.generating-step.active .gs-dot { border-color: var(--brand); background: var(--brand-soft); }

/* --------------------------------------------------------------------------
   Quiz preview
   -------------------------------------------------------------------------- */
.paper-header {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0%, rgba(45,212,191,.1), transparent 34%),
    linear-gradient(135deg, #fff, #f9fcfc);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.paper-header::after { content: ""; position: absolute; width: 210px; height: 210px; right: -70px; bottom: -110px; border-radius: 50%; border: 1px solid rgba(15,118,110,.09); box-shadow: 0 0 0 30px rgba(15,118,110,.025); }
.paper-head-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.paper-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.paper-header h1 { margin-top: 12px; font-size: 25px; font-weight: 750; letter-spacing: -.035em; line-height: 1.25; }
.paper-sub { margin-top: 8px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.paper-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 17px; padding-top: 15px; border-top: 1px dashed #e3ecef; position: relative; z-index: 1; }
.paper-meta span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; }
.paper-meta svg { width: 13px; height: 13px; color: var(--muted-2); }
.paper-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.paper-take-banner {
  margin-top: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 17px 20px;
  border-radius: 14px;
  background: linear-gradient(100deg, #0d3337, #0f4f49);
  color: #f0fdfa;
}
.paper-take-banner .banner-copy strong { display: block; font-size: 13.5px; font-weight: 700; }
.paper-take-banner .banner-copy p { margin-top: 4px; color: rgba(226,245,243,.58); font-size: 10.5px; line-height: 1.6; }
.paper-take-banner .btn { flex: none; }
.notice-strip { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 11px 13px; border-radius: 10px; background: var(--accent-soft); color: #8a4b05; font-size: 10.5px; line-height: 1.6; }
.notice-strip svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

.paper-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; }
.paper-toolbar h2 { font-size: 15px; font-weight: 720; }
.paper-toolbar p { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.question-preview {
  padding: 20px 22px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 11px;
  transition: border-color .16s ease;
}
.question-preview:hover { border-color: #d5e5e5; }
.qp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qp-left { display: flex; align-items: center; gap: 8px; }
.qp-number { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.qp-type { color: var(--muted); font-size: 10px; font-weight: 600; }
.qp-score { color: var(--muted-2); font-size: 10px; font-family: var(--mono); }
.qp-stem { margin-top: 12px; color: var(--ink); font-size: 13px; line-height: 1.8; white-space: pre-line; }
.qp-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.qp-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid #edf2f4; background: #fbfdfd; color: var(--ink-2); font-size: 11px; line-height: 1.55; }
.qp-option b { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex: none; background: #eef4f5; color: var(--muted); font-size: 9px; font-weight: 700; margin-top: 1px; }
.qp-option.correct { border-color: #bce8d8; background: #f0fbf6; color: #065f46; }
.qp-option.correct b { background: var(--success); color: #fff; }
.qp-answer { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: #f7fafb; color: var(--muted); font-size: 10.5px; line-height: 1.65; }
.qp-answer svg { width: 14px; height: 14px; flex: none; color: var(--brand); margin-top: 1px; }
.qp-answer strong { color: var(--ink-2); }
.qp-kps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.qp-explanation { margin-top: 10px; padding: 11px 12px; border-radius: 9px; background: #faf8f2; border: 1px solid #f3ecdc; color: #7a5a20; font-size: 10.5px; line-height: 1.75; white-space: pre-line; }
.answer-hidden { display: none; }

.paper-empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.paper-empty svg { width: 34px; height: 34px; color: var(--muted-2); margin: 0 auto 10px; }

/* --------------------------------------------------------------------------
   Exam mode
   -------------------------------------------------------------------------- */
.exam-mode { background: #f2f6f7; }
.exam-mode .sidebar, .exam-mode .topbar { display: none; }
.exam-mode .main-wrap { margin-left: 0; width: 100%; }
.exam-mode .view { max-width: none; padding: 0; }
.exam-page { min-height: 100vh; display: flex; flex-direction: column; }
.exam-topbar {
  position: sticky; top: 0; z-index: 50;
  min-height: 67px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.exam-topbar .brand-mark { width: 33px; height: 33px; border-radius: 10px; box-shadow: none; background: var(--brand); color: #fff; }
.exam-topbar .brand-mark svg { width: 21px; height: 21px; }
.exam-bar-title { min-width: 0; }
.exam-bar-title strong { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-bar-title span { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.exam-bar-spacer { flex: 1; }
.save-indicator { display: flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 10px; }
.save-indicator svg { width: 13px; height: 13px; }
.save-indicator.saving { color: var(--accent); }
.save-indicator.saved { color: var(--success); }
.exam-integrity { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 9px; background: #f4f7f7; color: var(--muted); font-size: 10px; white-space: nowrap; }
.exam-integrity b { color: var(--ink-2); font-family: var(--mono); font-size: 11px; }
.exam-integrity svg { width: 14px; height: 14px; color: var(--brand); }
.exam-integrity.warn { background: #fff8e7; color: #a16207; }
.exam-integrity.warn svg { color: #d97706; }
.exam-integrity.danger { background: var(--danger-soft); color: var(--danger); }
.exam-integrity.danger svg { color: var(--danger); }
.exam-integrity.danger b { color: var(--danger); }
.exam-timer { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-family: var(--mono); font-size: 13px; font-weight: 700; }
.exam-timer svg { width: 16px; height: 16px; }
.exam-timer.urgent { background: var(--danger-soft); color: var(--danger); animation: urgentPulse 1.2s ease-in-out infinite; }
@keyframes urgentPulse { 50% { box-shadow: 0 0 0 4px rgba(220,38,38,.08); } }
.exam-exit { color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.exam-exit:hover { color: var(--danger); }
.exam-exit svg { width: 14px; height: 14px; }

.exam-body { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 28px 44px; display: grid; grid-template-columns: minmax(0,1fr) 256px; gap: 18px; align-items: start; }
.exam-main { display: grid; gap: 13px; }
.exam-progress { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 10.5px; }
.exam-progress .progress-track { flex: 1; height: 5px; border-radius: 99px; background: #e2ebee; overflow: hidden; }
.exam-progress .progress-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #2dd4bf, #0f766e); transition: width .25s ease; }
.exam-progress strong { color: var(--ink-2); font-family: var(--mono); font-size: 10.5px; }
.question-card { padding: 27px 29px 24px; border-radius: 17px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); min-height: 440px; display: flex; flex-direction: column; }
.question-card .q-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q-head-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-index { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--muted-2); letter-spacing: .06em; }
.q-type { display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-dark); font-size: 9.5px; font-weight: 650; }
.q-points { color: var(--muted-2); font-size: 9.5px; font-family: var(--mono); }
.q-stem { margin-top: 19px; color: var(--ink); font-size: 15.5px; line-height: 1.85; white-space: pre-line; font-weight: 520; }
.q-hint { margin-top: 9px; color: var(--muted-2); font-size: 10.5px; display: flex; align-items: flex-start; gap: 5px; line-height: 1.6; }
.q-hint svg { width: 13px; height: 13px; margin-top: 1px; flex: none; }
.q-options { display: grid; gap: 9px; margin-top: 21px; }
.option-card {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%; padding: 12px 14px;
  border: 1px solid #e6edf1;
  border-radius: 11px;
  background: #fff;
  color: var(--ink-2);
  text-align: left;
  font-size: 12.5px;
  line-height: 1.65;
  transition: all .14s ease;
}
.option-card:hover { border-color: #b8ddd7; background: #fbfefd; }
.option-card .option-mark { width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; flex: none; background: #f1f5f7; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 700; transition: all .14s ease; margin-top: 1px; }
.option-card.selected { border-color: #66beae; background: #f2fbf8; color: var(--brand-dark); box-shadow: 0 0 0 2px rgba(15,118,110,.06); }
.option-card.selected .option-mark { background: var(--brand); color: #fff; }
.option-card.multi .option-mark { border-radius: 6px; }
.option-card.multi.selected .option-mark::after { content: "✓"; font-size: 12px; }
.option-card.multi.selected .option-mark { font-size: 0; }
.option-card.tf { align-items: center; padding: 17px; justify-content: center; font-size: 14px; font-weight: 600; }
.option-card.tf .option-mark { width: 27px; height: 27px; border-radius: 50%; }
.option-card.tf.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.option-card.tf.selected .option-mark { background: rgba(255,255,255,.2); color: #fff; }
.fill-wrap { margin-top: 22px; }
.fill-wrap .input, .fill-wrap .textarea { font-size: 13px; }
.answer-count { margin-top: 7px; text-align: right; color: var(--muted-2); font-size: 9.5px; font-family: var(--mono); }
.question-card .q-footer { margin-top: auto; padding-top: 25px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.q-footer-left { display: flex; align-items: center; gap: 7px; }
.q-footer .btn { min-height: 38px; font-size: 12px; }
.exam-nav-card { position: sticky; top: 84px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); }
.exam-nav-card h3 { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exam-nav-card h3 span { color: var(--muted-2); font-size: 9px; font-family: var(--mono); font-weight: 500; }
.qnav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 13px; }
.qnav-btn { aspect-ratio: 1; border: 1px solid #e5edf0; border-radius: 7px; background: #fff; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 600; transition: all .14s ease; }
.qnav-btn:hover { border-color: #b5d9d3; color: var(--brand); }
.qnav-btn.answered { background: var(--brand-soft); border-color: #c9eae3; color: var(--brand-dark); }
.qnav-btn.current { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 9px rgba(15,118,110,.22); }
.qnav-legend { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; color: var(--muted-2); font-size: 8.5px; }
.qnav-legend span { display: inline-flex; align-items: center; gap: 4px; }
.qnav-legend i { width: 8px; height: 8px; border-radius: 3px; border: 1px solid #dce6ea; background: #fff; }
.qnav-legend i.answered { background: var(--brand-soft); border-color: #c9eae3; }
.qnav-legend i.current { background: var(--brand); border-color: var(--brand); }
.exam-submit-card { margin-top: 14px; padding-top: 13px; border-top: 1px solid #eef3f5; }
.exam-submit-card p { color: var(--muted-2); font-size: 9px; line-height: 1.55; margin-bottom: 9px; }
.exam-submit-card .btn { width: 100%; min-height: 38px; font-size: 11.5px; }

/* --------------------------------------------------------------------------
   Result
   -------------------------------------------------------------------------- */
.result-hero { display: grid; grid-template-columns: 170px minmax(0,1fr) auto; gap: 28px; align-items: center; padding: 27px 30px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.result-hero::after { content: ""; position: absolute; width: 280px; height: 280px; right: -130px; top: -150px; border-radius: 50%; background: radial-gradient(circle, rgba(45,212,191,.1), transparent 68%); pointer-events: none; }
.result-ring { width: 158px; height: 158px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--result-color, var(--success)) calc(var(--result-percent) * 1%), #edf2f4 0); position: relative; margin: 0 auto; }
.result-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.result-ring > div { position: relative; z-index: 1; text-align: center; }
.result-ring strong { display: block; font-size: 38px; font-weight: 780; letter-spacing: -.06em; line-height: 1; color: var(--ink); }
.result-ring strong small { font-size: 13px; color: var(--muted-2); font-weight: 600; margin-left: 1px; }
.result-ring span { display: block; margin-top: 6px; color: var(--muted-2); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.result-copy { min-width: 0; }
.result-copy .result-eyebrow { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.result-copy .result-eyebrow svg { width: 13px; height: 13px; color: var(--brand); }
.result-copy h2 { margin-top: 8px; font-size: 23px; font-weight: 760; letter-spacing: -.035em; line-height: 1.3; }
.result-copy p { margin-top: 7px; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.result-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 14px; color: var(--muted); font-size: 10px; }
.result-meta span { display: inline-flex; align-items: center; gap: 4px; }
.result-meta svg { width: 12px; height: 12px; }
.result-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; position: relative; z-index: 1; }
.result-actions .btn { min-height: 36px; font-size: 11px; }

.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.result-stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.result-stat span { display: block; color: var(--muted); font-size: 9.5px; }
.result-stat strong { display: block; margin-top: 5px; font-size: 18px; font-weight: 740; letter-spacing: -.03em; }
.result-stat strong small { font-size: 9.5px; color: var(--muted-2); font-weight: 500; }
.mastery-strip { margin-top: 14px; padding: 15px 17px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.mastery-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mastery-strip-head h3 { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.mastery-strip-head h3 svg { width: 14px; height: 14px; color: var(--brand); }
.mastery-strip-head span { color: var(--muted-2); font-size: 9.5px; }
.mastery-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.mastery-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 7px; background: #f7fafb; border: 1px solid #edf2f4; color: var(--muted); font-size: 9.5px; }
.mastery-chip b { color: var(--ink-2); font-weight: 650; }
.mastery-chip .mini-bar { width: 34px; height: 4px; border-radius: 99px; background: #e8eef1; overflow: hidden; }
.mastery-chip .mini-bar i { display: block; height: 100%; border-radius: 99px; background: var(--success); }
.mastery-chip.low .mini-bar i { background: var(--danger); }
.mastery-chip.mid .mini-bar i { background: var(--accent); }

.review-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; flex-wrap: wrap; }
.review-toolbar h2 { font-size: 15px; font-weight: 720; }
.review-toolbar p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.review-toolbar .filter-tabs { background: #e9eff2; }
.review-card { margin-bottom: 11px; border-radius: 15px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.review-card.wrong { border-left: 3px solid var(--danger); }
.review-card.correct { border-left: 3px solid var(--success); }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.review-head-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-no { font-family: var(--mono); font-size: 10px; color: var(--muted-2); font-weight: 700; }
.review-status { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 7px; border-radius: 5px; font-size: 9.5px; font-weight: 650; }
.review-status.ok { background: var(--success-soft); color: #047857; }
.review-status.bad { background: var(--danger-soft); color: #b91c1c; }
.review-status svg { width: 11px; height: 11px; }
.review-score { color: var(--muted-2); font-size: 10px; font-family: var(--mono); }
.review-body { padding: 12px 20px 19px; }
.review-stem { color: var(--ink); font-size: 12.5px; line-height: 1.8; white-space: pre-line; }
.review-options { display: grid; gap: 6px; margin-top: 12px; }
.review-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid #edf2f4; background: #fbfdfd; color: var(--ink-2); font-size: 11px; line-height: 1.55; }
.review-option .ro-mark { width: 18px; height: 18px; flex: none; border-radius: 5px; display: grid; place-items: center; background: #eef4f5; color: var(--muted); font-size: 9px; font-weight: 700; margin-top: 1px; }
.review-option.is-correct { border-color: #bfe8d7; background: #f3fcf7; color: #065f46; }
.review-option.is-correct .ro-mark { background: var(--success); color: #fff; }
.review-option.is-user-wrong { border-color: #f3caca; background: #fff7f7; color: #991b1b; }
.review-option.is-user-wrong .ro-mark { background: var(--danger); color: #fff; }
.review-answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.answer-box { padding: 10px 12px; border-radius: 9px; background: #f8fafb; border: 1px solid #edf2f4; }
.answer-box span { display: block; color: var(--muted-2); font-size: 9px; margin-bottom: 4px; }
.answer-box strong { color: var(--ink-2); font-size: 11px; font-weight: 600; line-height: 1.6; word-break: break-word; }
.answer-box.correct-answer { background: #f3fcf7; border-color: #d4f0e4; }
.answer-box.correct-answer strong { color: #065f46; }
.answer-box.user-answer.wrong { background: #fff7f7; border-color: #f7dddd; }
.answer-box.user-answer.wrong strong { color: #991b1b; }
.review-explanation { margin-top: 12px; padding: 13px 14px; border-radius: 10px; background: #fbfaf5; border: 1px solid #f2ecdd; }
.review-explanation .re-title { display: flex; align-items: center; gap: 6px; color: #8a5b12; font-size: 10px; font-weight: 700; margin-bottom: 6px; }
.review-explanation .re-title svg { width: 13px; height: 13px; }
.review-explanation p { color: #6f5a30; font-size: 10.5px; line-height: 1.75; white-space: pre-line; }
.review-kps { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.review-kps .kps-label { color: var(--muted-2); font-size: 9px; margin-right: 1px; }
.source-quote { margin-top: 10px; padding: 10px 12px; border-left: 2px solid #a7dcd3; background: #f7fcfb; color: var(--muted); font-size: 10px; line-height: 1.7; border-radius: 0 7px 7px 0; }
.source-quote b { display: block; color: var(--brand); font-size: 9px; font-weight: 650; margin-bottom: 3px; letter-spacing: .06em; }
.feedback-line { margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.feedback-line strong { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Scores / tables
   -------------------------------------------------------------------------- */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-radius: 13px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); margin-bottom: 14px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-group .select { height: 35px; padding-top: 0; padding-bottom: 0; font-size: 11px; min-width: 180px; width: auto; }
.filter-group .searchbox { width: 190px; }
.filter-group .searchbox input { height: 35px; }
.score-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.score-stat { padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.score-stat span { color: var(--muted); font-size: 9.5px; display: flex; align-items: center; gap: 5px; }
.score-stat span svg { width: 12px; height: 12px; color: var(--muted-2); }
.score-stat strong { display: block; margin-top: 6px; font-size: 22px; font-weight: 750; letter-spacing: -.04em; }
.score-stat strong small { font-size: 10px; color: var(--muted-2); font-weight: 500; }
.score-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.table-card { border-radius: 14px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 17px; border-bottom: 1px solid #eef3f5; }
.table-head h3 { font-size: 12.5px; font-weight: 720; }
.table-head span { color: var(--muted-2); font-size: 9.5px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; text-align: left; color: var(--muted-2); font-size: 9px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; background: #fbfcfd; border-bottom: 1px solid #edf2f4; white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid #f1f5f7; color: var(--ink-2); font-size: 11px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .14s ease; }
.data-table tbody tr:hover { background: #fbfefd; }
.cell-student { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.cell-student .avatar { width: 27px; height: 27px; border-radius: 7px; font-size: 9px; }
.cell-student strong { display: block; font-size: 11px; font-weight: 620; }
.cell-student span { display: block; margin-top: 1px; color: var(--muted-2); font-size: 8.5px; }
.cell-exam { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.cell-score { font-family: var(--mono); font-size: 11px; font-weight: 650; white-space: nowrap; }
.cell-score small { color: var(--muted-2); font-weight: 500; }
.score-inline { display: flex; align-items: center; gap: 8px; min-width: 95px; }
.score-inline .score-bar { flex: 1; height: 5px; border-radius: 99px; background: #edf2f4; overflow: hidden; }
.score-inline .score-bar i { display: block; height: 100%; border-radius: 99px; background: var(--success); }
.score-inline .score-bar i.mid { background: var(--accent); }
.score-inline .score-bar i.low { background: var(--danger); }
.score-inline span { width: 34px; text-align: right; font-family: var(--mono); font-size: 9px; color: var(--muted); }
.table-empty { padding: 35px 20px; text-align: center; color: var(--muted); font-size: 11px; }
.table-empty svg { width: 28px; height: 28px; color: var(--muted-2); margin: 0 auto 8px; }

.analysis-card { padding: 18px; }
.analysis-card h3 { font-size: 12.5px; font-weight: 720; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.analysis-card h3 span { color: var(--muted-2); font-size: 9px; font-weight: 500; }
.distribution { display: grid; gap: 8px; margin-top: 16px; }
.dist-row { display: grid; grid-template-columns: 38px 1fr 24px; gap: 7px; align-items: center; }
.dist-label { color: var(--muted-2); font-family: var(--mono); font-size: 8.5px; }
.dist-track { height: 6px; border-radius: 99px; background: #eef3f5; overflow: hidden; }
.dist-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #f59e0b, #ef4444); }
.dist-track i.good { background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.dist-count { text-align: right; color: var(--muted); font-size: 8.5px; font-family: var(--mono); }
.score-trend { display: flex; align-items: flex-end; gap: 5px; height: 82px; margin-top: 15px; padding-bottom: 1px; }
.score-trend .trend-col { flex: 1; height: 100%; max-width: 54px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.score-trend .trend-bar { width: 100%; border-radius: 4px 4px 2px 2px; background: #d7efeb; min-height: 4px; position: relative; }
.score-trend .trend-bar i { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.score-trend .trend-label { color: var(--muted-2); font-size: 7.5px; font-family: var(--mono); white-space: nowrap; }
.analysis-foot { margin-top: 15px; padding-top: 13px; border-top: 1px solid #eef3f5; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted-2); font-size: 9px; }
.analysis-foot b { color: var(--ink-2); font-size: 11px; }

.exam-list { display: grid; gap: 10px; }
.exam-list-card { padding: 17px 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; transition: border-color .16s ease, transform .16s ease; }
.exam-list-card:hover { border-color: #d3e5e5; transform: translateY(-1px); }
.exam-list-card h3 { font-size: 13px; font-weight: 680; }
.exam-list-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 7px; color: var(--muted-2); font-size: 9.5px; }
.exam-list-meta span { display: inline-flex; align-items: center; gap: 4px; }
.exam-list-meta svg { width: 11px; height: 11px; }
.exam-list-tags { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.exam-list-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

/* --------------------------------------------------------------------------
   Modals / toasts / misc
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(8, 22, 32, .48);
  backdrop-filter: blur(4px);
  animation: overlayIn .18s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  display: flex; flex-direction: column;
  border-radius: 19px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
  overflow: hidden;
}
.modal-lg { width: min(100%, 720px); }
.modal-xl { width: min(100%, 920px); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 0; }
.modal-head h2 { font-size: 17px; font-weight: 740; letter-spacing: -.02em; }
.modal-head p { margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.modal-close { width: 31px; height: 31px; min-height: 31px; border-radius: 9px; }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid #eef3f5; background: #fbfcfd; }
.modal-foot .btn { min-height: 37px; font-size: 12px; }
.modal-foot .foot-note { margin-right: auto; color: var(--muted-2); font-size: 9.5px; }

.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: #edf3f5; }
.tabs button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15,31,46,.08); }

.toast-root { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 380px;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #0f2433;
  color: #e9f6f4;
  box-shadow: 0 16px 36px rgba(8,22,32,.22);
  font-size: 11.5px;
  line-height: 1.55;
  animation: toastIn .22s ease both;
  pointer-events: auto;
}
.toast svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: #5eead4; }
.toast.error { background: #3a1717; color: #fef2f2; }
.toast.error svg { color: #fca5a5; }
.toast.warn { background: #3b2b11; color: #fffbeb; }
.toast.warn svg { color: #fcd34d; }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

.empty-state { padding: 52px 24px; border-radius: 16px; border: 1px dashed #d7e4e8; background: rgba(255,255,255,.55); text-align: center; }
.empty-state .empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 15px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty-state .empty-icon svg { width: 25px; height: 25px; }
.empty-state h3 { font-size: 14px; font-weight: 700; }
.empty-state p { margin: 6px auto 0; max-width: 360px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.empty-state .btn { margin-top: 15px; }

.skeleton { position: relative; overflow: hidden; background: #eaf0f2; border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: shimmer 1.25s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-page { display: grid; gap: 14px; }
.skeleton-hero { height: 220px; border-radius: var(--radius-lg); }
.skeleton-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.skeleton-card { height: 103px; border-radius: 16px; }
.skeleton-block { height: 260px; border-radius: var(--radius); }

.error-state { padding: 60px 24px; text-align: center; }
.error-state svg { width: 38px; height: 38px; color: var(--danger); margin: 0 auto 12px; }
.error-state h3 { font-size: 15px; font-weight: 700; }
.error-state p { margin: 6px auto 0; max-width: 420px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.error-state .btn { margin-top: 15px; }

.help-list { display: grid; gap: 11px; }
.help-item { display: flex; gap: 10px; }
.help-item .help-num { width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-family: var(--mono); font-size: 9px; font-weight: 700; }
.help-item strong { display: block; font-size: 11.5px; font-weight: 650; }
.help-item p { margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.65; }
.code-pill { font-family: var(--mono); background: #f1f5f7; border: 1px solid #e6edf0; border-radius: 5px; padding: 1px 5px; font-size: 9.5px; color: var(--ink-2); }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 5px; border: 1px solid #dfe8ec; border-bottom-width: 2px; background: #fff; color: var(--muted); font-size: 9px; font-family: var(--mono); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .view { padding: 24px 26px 56px; }
  .topbar { padding: 0 26px; }
  .material-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat-grid { gap: 11px; }
  .hero { padding: 28px; }
}
@media (max-width: 1080px) {
  :root { --sidebar-w: 228px; }
  .dash-grid { grid-template-columns: 1fr; }
  .generate-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; grid-template-columns: 1fr 1fr; display: grid; }
  .score-layout { grid-template-columns: 1fr; }
  .stat-card { padding: 15px; }
  .stat-value { font-size: 25px; }
  .hero { grid-template-columns: minmax(0,1.25fr) minmax(210px,.7fr); }
  .hero-glass { max-width: 225px; }
  .result-hero { grid-template-columns: 150px minmax(0,1fr); }
  .result-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .result-ring { width: 140px; height: 140px; }
  .login-preview { display: none; }
  .login-visual { padding-bottom: 32px; }
  .login-copy { margin-top: 13vh; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 50px rgba(8,22,32,.18); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8,22,32,.42); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main-wrap { margin-left: 0; width: 100%; }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 0 18px; gap: 10px; }
  .topbar-title h1 { font-size: 15px; }
  .engine-pill { display: none; }
  .topbar .engine-pill { display: none; }
  .filter-bar .engine-pill { display: inline-flex; }
  .view { padding: 20px 18px 50px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .material-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr; padding: 25px; }
  .hero-visual { justify-content: flex-start; }
  .hero-glass { max-width: 280px; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 36px 24px; background: radial-gradient(circle at 50% 0%, rgba(15,118,110,.08), transparent 38%), #fbfcfc; }
  .login-box-head .mobile-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 26px; color: var(--ink); }
  .login-box-head .mobile-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg, #0f766e, #0b4f4a); color: #fff; }
  .login-box-head .mobile-brand strong { font-size: 15px; }
  .login-panel::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(#dce9e8 1px, transparent 1px); background-size: 22px 22px; opacity: .35; pointer-events: none; }
  .login-box { position: relative; z-index: 1; }
  .exam-body { grid-template-columns: 1fr; padding: 18px 16px 38px; }
  .exam-nav-card { position: static; order: 2; }
  .exam-topbar { padding: 0 16px; gap: 8px; }
  .exam-bar-title { display: none; }
  .exam-timer { height: 33px; font-size: 12px; }
  .save-indicator { display: none; }
  .exam-integrity { height: 30px; padding: 0 8px; font-size: 9px; }
  .question-card { padding: 22px 20px 20px; min-height: 420px; }
  .result-stats { grid-template-columns: repeat(2,1fr); }
  .score-stats { grid-template-columns: repeat(2,1fr); }
  .paper-head-top { flex-direction: column; }
  .paper-actions { justify-content: flex-start; }
  .qp-options { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr; }
  .submission-row { grid-template-columns: 32px minmax(0,1.5fr) 62px 62px; }
  .submission-row .submission-exam { display: none; }
  .result-hero { grid-template-columns: 1fr; gap: 18px; text-align: center; }
  .result-copy .result-eyebrow, .result-meta { justify-content: center; }
  .result-actions { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .result-ring { margin: 0 auto; }
}
@media (max-width: 620px) {
  .view { padding: 17px 13px 44px; }
  .topbar { padding: 0 13px; height: 62px; }
  .topbar-actions .topbar-avatar .name { display: none; }
  .topbar-title p { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
  .page-head h2 { font-size: 21px; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
  .hero { padding: 22px 19px; border-radius: 18px; }
  .hero h2 { font-size: 26px; }
  .hero p { font-size: 11.5px; }
  .hero-visual { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 13px; border-radius: 13px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-value { font-size: 22px; margin-top: 11px; }
  .stat-label { font-size: 10px; }
  .stat-delta { display: none; }
  .card-head { padding: 15px 15px 0; }
  .card-body { padding: 12px 15px 15px; }
  .material-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .searchbox { width: 100%; flex: 1; }
  .form-card { padding: 18px 15px; }
  .material-picker { grid-template-columns: 1fr; max-height: 240px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .difficulty-row { gap: 5px; }
  .diff-option span { padding: 8px; }
  .quick-actions { grid-template-columns: 1fr; }
  .exam-cards { grid-template-columns: 1fr; }
  .paper-header { padding: 20px 17px; }
  .paper-header h1 { font-size: 21px; }
  .paper-actions { width: 100%; }
  .paper-actions .btn { flex: 1; }
  .paper-take-banner { flex-direction: column; align-items: flex-start; }
  .paper-take-banner .btn { width: 100%; }
  .question-preview { padding: 16px; }
  .qp-options { grid-template-columns: 1fr; }
  .exam-topbar .brand-mark { display: none; }
  .exam-timer { margin-left: auto; }
  .exam-exit span { display: none; }
  .question-card { padding: 19px 15px 16px; border-radius: 14px; }
  .q-stem { font-size: 14.5px; }
  .q-options { gap: 7px; }
  .option-card { padding: 11px 12px; font-size: 12px; }
  .qnav-grid { grid-template-columns: repeat(6,1fr); }
  .result-hero { padding: 21px 17px; }
  .result-ring { width: 130px; height: 130px; }
  .result-ring strong { font-size: 32px; }
  .result-copy h2 { font-size: 20px; }
  .result-stats { grid-template-columns: 1fr 1fr; gap: 7px; }
  .result-stat { padding: 11px 12px; }
  .score-stats { grid-template-columns: 1fr 1fr; gap: 7px; }
  .score-stat { padding: 12px 13px; }
  .filter-bar { padding: 11px; }
  .filter-group { width: 100%; }
  .filter-group .select, .filter-group .searchbox { width: 100%; min-width: 0; }
  .filter-group .btn { flex: 1; }
  .review-head, .review-body { padding-left: 15px; padding-right: 15px; }
  .review-answer-grid { grid-template-columns: 1fr; }
  .exam-list-card { grid-template-columns: 1fr; gap: 10px; }
  .exam-list-actions { justify-content: flex-start; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px 18px 0 0; }
  .modal-head { padding: 17px 17px 0; }
  .modal-body { padding: 15px 17px 18px; }
  .modal-foot { padding: 12px 17px; }
  .demo-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 28px 20px; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
  .result-actions .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .result-actions, .toast-root, .review-toolbar .tabs, .exam-topbar { display: none !important; }
  .main-wrap { margin: 0; width: 100%; }
  .view { max-width: none; padding: 0; }
  .result-hero, .review-card, .result-stat, .mastery-strip { box-shadow: none; break-inside: avoid; }
  .review-card { margin-bottom: 10px; }
  .review-card.wrong .review-body, .review-card.correct .review-body { break-inside: avoid; }
}

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