:root {
  color-scheme: light;
  --ink: #17213d;
  --muted: #74809a;
  --soft: #9aa4b8;
  --purple: #7545ed;
  --purple-dark: #6333dc;
  --purple-pale: #f0ebff;
  --line: #e8eaf2;
  --canvas: #f5f4fc;
  --surface: #fff;
  --surface-soft: #f8f9fc;
  --green: #159d73;
  --red: #cc4659;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(ellipse at 82% 12%, rgba(147, 108, 255, .16), transparent 34%),
    radial-gradient(ellipse at 8% 95%, rgba(106, 140, 255, .09), transparent 35%),
    var(--canvas);
}
.auth-card {
  width: min(100%, 440px);
  padding: 38px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 70px rgba(37, 39, 78, .12);
}
.auth-brand, .brand-lockup { display: flex; align-items: center; gap: 12px; }
.auth-brand { margin-bottom: 36px; }
.institute-logo { display: block; width: 100%; max-width: 205px; height: auto; object-fit: contain; }
.institute-logo-auth { max-width: 285px; }
.auth-heading { margin-bottom: 25px; }
.eyebrow { color: #8a65ec; font-size: 10px; font-weight: 750; letter-spacing: 1.25px; }
.auth-heading h1 { margin: 9px 0 7px; font-size: 27px; letter-spacing: -1px; }
.auth-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack label { margin-top: 6px; color: #46516d; font-size: 12px; font-weight: 650; }
.form-stack input, .field-input, .field-select, .field-textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid #dfe3ed;
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  transition: border-color .16s, box-shadow .16s;
}
.form-stack input:focus, .field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: #9a7af0;
  box-shadow: 0 0 0 3px rgba(117, 69, 237, .12);
}
.form-stack input::placeholder, .field-input::placeholder, .field-textarea::placeholder { color: #a4acbd; }
.field-hint { color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.auth-footnote { display: flex; align-items: center; gap: 8px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #45b58b; box-shadow: 0 0 0 3px #e8f7f1; }
.login-role-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: -8px 0 17px; padding: 4px; border-radius: 11px; background: #f4f4f9; }
.login-role-toggle button { min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: #74809a; font-size: 11px; font-weight: 650; cursor: pointer; }
.login-role-toggle button.active { background: #fff; color: var(--purple); box-shadow: 0 2px 8px rgba(37, 39, 78, .08); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  width: 252px;
  height: 100vh;
  flex: 0 0 252px;
  flex-direction: column;
  padding: 26px 17px 18px;
  border-right: 1px solid #e9e9f1;
  background: #fff;
}
.brand-lockup { padding: 0 8px 29px; text-decoration: none; color: inherit; }
.workspace-label, .nav-section-label { padding: 0 11px; color: #a0a9ba; font-size: 9px; font-weight: 750; letter-spacing: 1.15px; }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.workspace-label { margin-bottom: 12px; }
.nav-section-label { margin: 25px 0 7px; }
.nav-link {
  display: flex;
  width: 100%;
  min-height: 43px;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #68748e;
  text-align: left;
  cursor: pointer;
  transition: .15s ease;
}
.nav-link:hover { background: #f8f7fc; color: var(--ink); }
.nav-link.active { background: #f1edff; color: #7144e5; font-weight: 650; }
.nav-icon { display: grid; width: 19px; place-items: center; font-size: 18px; line-height: 1; }
.nav-count { margin-left: auto; padding: 3px 7px; border-radius: 8px; background: #fff; color: #79849b; font-size: 10px; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 8px 3px; border-top: 1px solid var(--line); }
.sidebar-help-icon { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: #8572c4; font-weight: 700; }
.sidebar-footer strong, .sidebar-footer span { display: block; }
.sidebar-footer strong { font-size: 11px; }
.sidebar-footer span { margin-top: 3px; color: var(--muted); font-size: 10px; }

.main-column { min-width: 0; flex: 1; }
.topbar {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px clamp(22px, 3vw, 46px);
  border-bottom: 1px solid rgba(228, 230, 239, .8);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
}
.breadcrumb { display: flex; flex-direction: column; gap: 5px; }
.breadcrumb span { color: #8993a8; font-size: 10px; }
.breadcrumb strong { color: #36415b; font-size: 12px; font-weight: 650; }
.global-search { display: flex; width: min(335px, 32vw); min-height: 40px; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid #eaebf2; border-radius: 22px; background: #fff; box-shadow: 0 4px 14px rgba(31, 39, 66, .04); color: var(--purple); }
.global-search > span { font-size: 23px; line-height: 1; transform: rotate(-20deg); }
.global-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); font-size: 12px; }
.global-search input::placeholder { color: #94a0b7; }
.global-search kbd { flex: 0 0 auto; padding: 3px 5px; border: 1px solid #ececf3; border-radius: 5px; color: #9da5b5; font-size: 9px; }
.admin-profile { position: relative; display: flex; align-items: center; gap: 12px; }
.admin-badge { padding: 7px 10px; border-radius: 18px; background: #f1edff; color: #7545e9; font-size: 11px; font-weight: 650; }
.profile-button { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #f0edff; color: #7164a0; font-size: 10px; font-weight: 700; }
.profile-name { color: #57637d; font-size: 11px; }
.chevron { color: #929cb0; }
.profile-menu { position: absolute; z-index: 7; top: 45px; right: 0; width: 220px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 14px 40px rgba(31, 39, 66, .14); }
.profile-menu strong, .profile-menu span { display: block; }
.profile-menu strong { font-size: 12px; }
.profile-menu span { margin: 5px 0 12px; color: var(--muted); font-size: 10px; }
.profile-menu button { width: 100%; padding: 9px 0 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--red); text-align: left; font-size: 11px; cursor: pointer; }

.page-content { width: min(1500px, 100%); margin: 0 auto; padding: 30px clamp(22px, 3vw, 46px) 25px; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 2px 0 23px; }
.page-intro .eyebrow { font-size: 9px; }
.page-intro h1 { margin: 7px 0 7px; font-size: clamp(24px, 2.2vw, 31px); letter-spacing: -1.3px; line-height: 1.18; }
.page-intro p { margin: 0; color: #707d98; font-size: 12px; line-height: 1.6; }
.page-intro #page-actions { display: flex; gap: 9px; flex: 0 0 auto; }
.tabs { display: flex; gap: 5px; margin-bottom: 20px; border-bottom: 1px solid #e4e6f0; }
.tabs button { padding: 11px 14px 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #77839b; cursor: pointer; }
.tabs button.active { border-bottom-color: #8650f4; color: #7545ed; }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid #e1e4ee; border-radius: 11px; background: #fff; color: #48536d; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; transition: .16s ease; }
.button:hover { border-color: #c9c0eb; background: #fcfbff; }
.button:disabled { opacity: .58; cursor: wait; }
.button-primary { border-color: #7444e8; background: linear-gradient(115deg, #7242ea, #8446ec); color: #fff; box-shadow: 0 5px 13px rgba(117, 69, 237, .18); }
.button-primary:hover { border-color: var(--purple-dark); background: var(--purple-dark); color: #fff; }
.button-danger { border-color: #f1d8dd; color: #bf4255; }
.button-quiet { border-color: transparent; background: transparent; color: #77839b; }
.button-small { min-height: 33px; padding: 0 11px; border-radius: 9px; font-size: 11px; }
.button-wide { width: 100%; min-height: 45px; margin-top: 5px; }
.button-icon { font-size: 15px; }

.card { overflow: hidden; border: 1px solid rgba(230,232,241,.88); border-radius: 19px; background: var(--surface); box-shadow: 0 7px 25px rgba(37, 39, 78, .055); }
.card + .card { margin-top: 20px; }
.section-spaced { margin-top: 19px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 22px; border-bottom: 1px solid #eceef4; }
.card-heading h2, .card-heading h3 { margin: 0; font-size: 15px; letter-spacing: -.35px; }
.card-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.card-body { padding: 20px 22px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.stat-card { min-height: 78px; padding: 15px 16px; border: 1px solid #f1f2f6; border-radius: 14px; background: #f8f9fb; }
.stat-value { display: block; font-size: 22px; font-weight: 750; letter-spacing: -.8px; }
.stat-label { display: block; margin-top: 4px; color: #73809b; font-size: 10px; }
.stat-accent { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 10px; background: #f0ecff; color: #8055ea; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .75fr); gap: 19px; margin-top: 19px; }
.dashboard-grid .card + .card { margin-top: 0; }
.quick-list { display: flex; flex-direction: column; gap: 8px; }
.quick-link { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px; border: 1px solid #eeeff5; border-radius: 12px; background: #fff; text-align: left; cursor: pointer; }
.quick-link:hover { border-color: #d7cdf8; background: #fcfbff; }
.quick-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 11px; background: #f2efff; color: #7545ed; font-size: 17px; }
.quick-link strong, .quick-link span { display: block; }
.quick-link strong { font-size: 11px; }
.quick-link span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.quick-arrow { margin-left: auto; color: #a1aabe; font-size: 17px; }
.lesson-list, .test-list { display: flex; flex-direction: column; }
.test-list-spaced { margin-top: 17px; }
.student-list { display: flex; flex-direction: column; }
.student-row { display: flex; align-items: center; gap: 13px; min-height: 74px; padding: 13px 2px; border-bottom: 1px solid #eff0f5; }
.student-row:last-child { border-bottom: 0; }
.student-avatar { display: grid; width: 39px; height: 39px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #f0edff; color: #7164a0; font-size: 11px; font-weight: 700; }
.student-main { min-width: 0; flex: 1; }
.student-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 650; }
.student-email { margin: 5px 0 0; overflow-wrap: anywhere; color: #7d89a1; font-size: 11px; }
.student-generated-password { margin: 7px 0 0; color: #53607a; font-size: 11px; }
.student-generated-password code { margin-left: 4px; padding: 3px 7px; border-radius: 6px; background: #f1edff; color: #6333dc; font-size: 12px; font-weight: 750; letter-spacing: .5px; }
.student-status { display: inline-flex; padding: 4px 8px; border-radius: 20px; font-size: 9px; font-weight: 600; }
.status-active { background: #eaf8f1; color: #288d67; }
.status-disabled { background: #f0f2f6; color: #73809a; }
.student-row-actions { flex: 0 0 auto; }
.student-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.student-row-actions .button { white-space: nowrap; }
.student-review-list { display: flex; flex-direction: column; gap: 14px; }
.student-review-question { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.student-review-question h3 { margin: 0 0 11px; color: var(--muted); font-size: 11px; }
.student-review-options > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: #53607a; }
.student-review-options > div + div { margin-top: 7px; }
.student-review-options strong { color: inherit; font-size: 10px; white-space: nowrap; }
.student-review-options .review-correct { border-color: #9cddc4; background: #eefaf4; color: #19774f; }
.student-review-options .review-incorrect { border-color: #f0b5bf; background: #fff4f5; color: #b13d50; }
.student-review-outcome { margin: 11px 0 0; font-size: 11px; font-weight: 700; }
.review-outcome-correct { color: #19774f; }
.review-outcome-incorrect { color: #b13d50; }
.student-review-evidence { margin: 8px 0 0; color: #53607a; font-size: 11px; line-height: 1.6; }
.student-review-explanation { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.student-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.student-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.student-toolbar > p { margin: 0; color: var(--muted); font-size: 11px; }
.student-filter { display: flex; min-width: 150px; flex-direction: row; align-items: center; gap: 8px; }
.student-filter > label { color: #48546e; font-size: 10px; font-weight: 650; }
.student-filter .field-select { min-height: 36px; padding: 7px 10px; font-size: 11px; }
.attendance-date-picker { display: flex; min-width: 170px; flex-direction: column; gap: 6px; }
.attendance-date-picker label { color: #48546e; font-size: 10px; font-weight: 650; }
.attendance-date-picker .field-input { min-height: 37px; padding: 8px 10px; font-size: 11px; }
.attendance-stats { margin-bottom: 15px; }
.attendance-list { display: flex; flex-direction: column; }
.attendance-row { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 2px; border-bottom: 1px solid #eff0f5; }
.attendance-row:last-child { border-bottom: 0; }
.attendance-student { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }
.attendance-student strong { font-size: 12px; font-weight: 650; }
.attendance-status { width: min(100%, 190px); min-height: 38px; padding: 8px 10px; font-size: 11px; }
.attendance-status:disabled { background: #f3f4f7; color: #8791a5; }
.attendance-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 16px; }
.attendance-history-wrap { overflow-x: auto; }
.attendance-history-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-bottom: 10px; }
.attendance-history-toolbar label { color: #48546e; font-size: 10px; font-weight: 650; }
.attendance-history-toolbar .field-select { width: 140px; min-height: 36px; padding: 7px 10px; font-size: 11px; }
.attendance-history { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.attendance-history th { padding: 10px 12px; color: #74809a; font-size: 10px; font-weight: 650; }
.attendance-history td { padding: 11px 12px; border-top: 1px solid #eff0f5; color: #48536d; font-size: 11px; }
.attendance-history-date { padding: 0; border: 0; background: transparent; color: #7044e2; font-size: 11px; font-weight: 650; cursor: pointer; }
.attendance-history-date:hover, .attendance-history-date.selected { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.result-paper-card { margin-top: 19px; }
.result-paper-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.result-paper-stats > div { min-width: 0; }
.result-paper-stats strong, .result-paper-stats span { display: block; }
.result-paper-stats strong { font-size: 19px; letter-spacing: -.5px; }
.result-paper-stats span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.result-students { display: flex; flex-direction: column; }
.result-student-row { display: grid; grid-template-columns: minmax(125px, 1.2fr) minmax(80px, 4fr) 55px; min-height: 43px; align-items: center; gap: 14px; border-bottom: 1px solid #eff0f5; }
.result-student-row:last-child { border-bottom: 0; }
.result-student-name { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.result-progress { display: block; width: 100%; height: 7px; overflow: hidden; appearance: none; border: 0; border-radius: 8px; background: #e9eaf0; }
.result-progress::-webkit-progress-bar { border-radius: 8px; background: #e9eaf0; }
.result-progress::-webkit-progress-value { border-radius: 8px; background: currentColor; }
.result-progress::-moz-progress-bar { border-radius: 8px; background: currentColor; }
.result-progress-high { color: #27bd69; }
.result-progress-medium { color: #1685ee; }
.result-progress-low { color: #ef9b27; }
.result-bar-unrecorded { background: #f3f4f7; }
.student-dashboard-grid { align-items: start; }
.student-dashboard-grid .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.student-performance-list { display: flex; flex-direction: column; }
.student-performance-row { display: grid; grid-template-columns: minmax(125px, 1.4fr) minmax(85px, 3fr) 64px; min-height: 52px; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px solid #eff0f5; }
.student-performance-row:last-child { border-bottom: 0; }
.student-performance-row > div strong, .student-performance-row > div span { display: block; }
.student-performance-row > div strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.student-performance-row > div span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.student-performance-row > span { color: #48536d; font-size: 10px; text-align: right; white-space: nowrap; }
.student-question-card { margin-bottom: 15px; }
.student-question-prompt { margin: 0 0 16px; font-size: 14px; font-weight: 650; line-height: 1.55; }
.student-question-options { display: grid; gap: 9px; }
.student-question-options label { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid #eceef4; border-radius: 10px; color: #48536d; cursor: pointer; }
.student-question-options label:has(input:checked) { border-color: #b7a3f4; background: #faf8ff; }
.student-question-options input { margin-top: 2px; accent-color: var(--purple); }
.student-exam-toolbar { position: sticky; z-index: 3; top: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 13px 17px; border: 1px solid #e8eaf2; border-radius: 13px; background: rgba(255,255,255,.96); box-shadow: 0 6px 20px rgba(37, 39, 78, .08); }
.student-exam-toolbar > strong { color: #48536d; font-size: 12px; }
.student-exam-countdown { min-width: 82px; padding: 7px 10px; border-radius: 9px; background: #f1edff; color: #7144e5; font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 750; text-align: center; }
.student-exam-submit { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.student-exam-result { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.student-exam-result strong { color: var(--purple); font-size: 35px; letter-spacing: -1px; }
.student-exam-result span { color: var(--muted); }
.temporary-password { margin: 12px 0; padding: 15px; border: 1px dashed #c9baf4; border-radius: 10px; background: #faf8ff; color: #4a2ca1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; user-select: all; }
.result-score { color: #48536d; font-size: 10px; font-weight: 650; text-align: right; white-space: nowrap; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; padding: 14px 2px; border-bottom: 1px solid #eff0f5; }
.list-row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 650; }
.row-meta { margin: 5px 0 0; color: #7d89a1; font-size: 10px; line-height: 1.5; }
.row-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.week-chip, .status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 20px; background: #f1edff; color: #7862b4; font-size: 10px; font-weight: 550; white-space: nowrap; }
.status-chip::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; opacity: .72; }
.status-draft { background: #f1edff; color: #7a64b9; }
.status-published { background: #eaf8f1; color: #288d67; }
.status-closed { background: #f0f2f6; color: #73809a; }
.lesson-file { display: inline-flex; align-items: center; gap: 6px; color: #7650dd; text-decoration: none; font-size: 10px; font-weight: 600; }
.lesson-file:hover { text-decoration: underline; }
.empty-state { padding: 43px 18px; text-align: center; }
.empty-icon { display: grid; width: 46px; height: 46px; margin: 0 auto 13px; place-items: center; border-radius: 15px; background: #f2efff; color: #7952e5; font-size: 21px; }
.empty-state h3 { margin: 0 0 6px; font-size: 14px; }
.empty-state p { max-width: 370px; margin: 0 auto 15px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.upload-full-field { grid-column: 1 / -1; }
.field-group { display: flex; flex-direction: column; gap: 7px; }
.field-group > label, .field-label { color: #48546e; font-size: 11px; font-weight: 650; }
.field-textarea { min-height: 82px; resize: vertical; }
.field-select { appearance: auto; }
.lesson-picker { position: relative; }
.lesson-picker summary { display: flex; min-height: 44px; align-items: center; justify-content: space-between; padding: 11px 13px; border: 1px solid #dfe3ed; border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; list-style: none; }
.lesson-picker summary::-webkit-details-marker { display: none; }
.lesson-picker summary::after { content: "▾"; color: var(--muted); }
.lesson-picker[open] summary { border-color: #9a7af0; border-radius: 10px 10px 0 0; }
.lesson-picker-menu { position: absolute; z-index: 5; top: 100%; right: 0; left: 0; padding: 10px; border: 1px solid #dfe3ed; border-top: 0; border-radius: 0 0 10px 10px; background: #fff; box-shadow: 0 12px 24px rgba(28, 35, 54, .12); }
.lesson-picker-menu .field-input { min-height: 38px; padding: 8px 10px; font-size: 11px; }
.lesson-picker-actions { display: flex; gap: 7px; padding: 8px 0; }
.lesson-picker-options { max-height: 220px; overflow-y: auto; }
.lesson-picker-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 5px; border-top: 1px solid #f0f1f5; color: #48546e; font-size: 11px; line-height: 1.45; cursor: pointer; }
.lesson-picker-option input { margin-top: 2px; accent-color: #7952e5; }
.upload-file { padding: 15px; border: 1px dashed #d6d5e5; border-radius: 12px; background: #fbfaff; color: #64708a; font-size: 11px; }
.upload-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; }
.help-text { color: #8b95a9; font-size: 10px; line-height: 1.5; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.filter-row p { margin: 0; color: var(--muted); font-size: 11px; }
.search-empty { padding: 30px; color: var(--muted); text-align: center; font-size: 12px; }
.lesson-count { color: var(--muted); font-size: 10px; }
.settings-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.settings-status .status-dot { flex: 0 0 auto; }
.key-form { display: flex; align-items: flex-end; gap: 8px; }
.key-form .field-group { flex: 1; }
.gemini-model-form { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.gemini-model-form .field-group { flex: 1; min-width: 180px; }
.key-state { margin: 0 0 15px; color: #78849c; font-size: 11px; }
.key-state strong { color: #46526b; }
.callout { padding: 12px 14px; border-radius: 11px; background: #f7f5ff; color: #73648f; font-size: 10px; line-height: 1.55; }
.callout strong { color: #5a4881; }
.loading { padding: 30px 12px; color: #8a94a9; text-align: center; font-size: 12px; }
.loading::before { display: inline-block; width: 11px; height: 11px; margin-right: 8px; border: 2px solid #d8d1ee; border-top-color: #7545ed; border-radius: 50%; content: ""; vertical-align: -2px; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-footer { display: flex; justify-content: space-between; gap: 15px; padding: 6px clamp(22px, 3vw, 46px) 18px; color: #8b95a9; font-size: 10px; }

.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(24, 28, 48, .42); backdrop-filter: blur(4px); }
.modal { display: flex; width: min(100%, 720px); max-height: min(88vh, 900px); flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.75); border-radius: 18px; background: #fff; box-shadow: 0 24px 80px rgba(22, 23, 45, .25); }
.modal-wide { width: min(100%, 900px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 17px; letter-spacing: -.4px; }
.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.modal-close { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; color: #737e93; font-size: 17px; cursor: pointer; }
.modal-body { overflow: auto; padding: 20px 22px; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fdfdfe; }
.modal-footer .footer-actions { display: flex; gap: 8px; }
.question-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.question-review { margin-top: 18px; }
.question-review-title { margin: 0 0 5px; font-size: 13px; }
.question-add { margin-top: 11px; }
.test-status-line { margin: 14px 0 0; }
.question-card { padding: 15px; border: 1px solid #ebedf4; border-radius: 13px; background: #fcfcfe; }
.question-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.question-card-head strong { font-size: 11px; }
.question-card .field-group { margin-top: 9px; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.modal-error { margin: 10px 0 0; color: var(--red); font-size: 11px; }
.generation-progress { display: flex; align-items: center; gap: 10px; padding: 16px; border: 1px solid #e9e3fb; border-radius: 12px; background: #f9f7ff; color: #6d5b9e; font-size: 11px; }
.generation-progress .loading { padding: 0; text-align: left; }
.modal-question { margin: 0 0 6px; font-size: 12px; font-weight: 650; line-height: 1.5; }
.modal-option { margin: 5px 0; color: #66728b; font-size: 11px; }
.correct-answer { color: #20805f; font-weight: 650; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 23px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #e6e8f0; border-radius: 12px; background: #fff; box-shadow: 0 10px 35px rgba(30, 34, 62, .14); color: #46516b; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.toast-error { border-color: #f0d7dc; color: #b13d50; }

@media (max-width: 1050px) {
  .sidebar { width: 215px; flex-basis: 215px; padding-inline: 12px; }
  .profile-name { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { position: fixed; z-index: 6; top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: 64px; flex-direction: row; align-items: center; padding: 5px 7px; border-top: 1px solid var(--line); border-right: 0; }
  .brand-lockup, .workspace-label, .nav-section-label, .sidebar-footer { display: none; }
  .side-nav { width: 100%; flex-direction: row; justify-content: space-around; gap: 2px; }
  .nav-link { min-height: 48px; flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 3px; font-size: 9px; }
  .nav-icon { font-size: 15px; }
  .nav-count { display: none; }
  .topbar { min-height: 59px; gap: 10px; padding: 8px 15px; }
  .global-search { width: min(45vw, 260px); min-height: 36px; padding-inline: 9px; }
  .global-search kbd { display: none; }
  .admin-profile { gap: 7px; }
  .admin-badge { padding: 6px 8px; font-size: 9px; }
  .avatar { width: 31px; height: 31px; }
  .profile-button .chevron { display: none; }
  .page-content { padding: 23px 15px 95px; }
  .page-intro { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .page-intro #page-actions { width: 100%; }
  .page-intro #page-actions .button { flex: 1; }
  .card-heading, .card-body { padding-inline: 16px; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 69px; padding: 12px; }
  .stat-value { font-size: 19px; }
  .list-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .row-actions { width: 100%; flex-wrap: wrap; }
  .student-row { align-items: flex-start; }
  .student-row-actions { margin-left: 52px; }
  .student-exam-toolbar { top: 65px; }
  .student-exam-submit { align-items: stretch; flex-direction: column; }
  .student-toolbar { align-items: stretch; flex-direction: column; }
  .student-filter { justify-content: space-between; }
  .student-form-footer { align-items: stretch; flex-direction: column; }
  .attendance-date-picker { width: 100%; }
  .attendance-row { align-items: flex-start; }
  .attendance-status { width: 145px; flex: 0 0 145px; }
  .attendance-footer { align-items: stretch; flex-direction: column; }
  .attendance-history-toolbar { align-items: stretch; flex-direction: column; }
  .attendance-history-toolbar .field-select { width: 100%; }
  .result-paper-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .result-student-row { grid-template-columns: minmax(90px, 1.2fr) minmax(45px, 2fr) 48px; gap: 8px; }
  .upload-grid, .options-grid { grid-template-columns: 1fr; }
  .key-form { align-items: stretch; flex-wrap: wrap; }
  .key-form .field-group { flex: 1 1 100%; }
  .gemini-model-form { align-items: stretch; flex-wrap: wrap; }
  .gemini-model-form .field-group { flex: 1 1 100%; }
  .page-footer { padding-inline: 15px; font-size: 9px; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 94vh; }
  .modal-header, .modal-body { padding-inline: 16px; }
  .modal-footer { align-items: stretch; flex-direction: column; padding-inline: 16px; }
  .modal-footer .footer-actions { justify-content: flex-end; }
}
