@font-face {
  font-family: "Sarabun";
  src: url("/fonts/Sarabun-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sarabun";
  src: url("/fonts/Sarabun-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sarabun";
  src: url("/fonts/Sarabun-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sarabun";
  src: url("/fonts/Sarabun-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sarabun";
  src: url("/fonts/Sarabun-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sarabun";
  src: url("/fonts/Sarabun-Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f7faff;
  --ink: #172033;
  --muted: #657084;
  --line: #d9e1ec;
  --primary: #2447a8;
  --primary-2: #4269d8;
  --primary-soft: #e8efff;
  --success: #16805a;
  --success-soft: #e4f6ef;
  --warning: #a86600;
  --warning-soft: #fff3d6;
  --danger: #c43535;
  --danger-soft: #ffe8e8;
  --neutral-soft: #edf1f6;
  --shadow: 0 24px 70px rgba(18, 34, 68, .16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sarabun", "TH Sarabun PSK", "TH Sarabun New", "Noto Sans Thai", "Tahoma", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  font-weight: 700;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  font-weight: 700;
}

button {
  cursor: pointer;
}

a,
small,
p,
span,
label,
td,
th {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 18px;
  border: 1px solid rgba(22, 128, 90, .28);
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
  box-shadow: var(--shadow);
  transform: translateY(-22px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 24% 36%, rgba(66, 105, 216, .24), transparent 28%),
    linear-gradient(135deg, #071126 0%, #101b3f 52%, #071a23 100%);
}

.testing-login {
  width: 100vw;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  display: block;
  padding: 0;
  background: #f5f7fb;
  overflow-x: hidden;
}

.login-topbar {
  width: 100vw;
  margin: 0;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2 + 24px));
  background: #fff;
  box-shadow: 0 3px 18px rgba(18, 34, 68, .12);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-logo strong,
.login-logo span {
  display: block;
  line-height: 1.2;
}

.login-logo strong {
  color: #f47b20;
  font-size: 1.32rem;
  font-weight: 900;
}

.login-logo span {
  color: #005ca8;
  font-size: 1.38rem;
  font-weight: 900;
}

.school-seal.compact {
  width: 62px;
  height: 62px;
  font-size: 20px;
  box-shadow: none;
  border: 2px solid #d9ecff;
}

.hamburger {
  width: 48px;
  height: 48px;
  display: grid;
  place-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
}

.hamburger span {
  width: 30px;
  height: 3px;
  display: block;
  border-radius: 999px;
  background: #111827;
}

.split-login {
  width: 100vw;
  margin: 0;
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(440px, 42fr);
}

.login-hero-panel {
  position: relative;
  min-height: calc(100vh - 88px);
  overflow: hidden;
  color: #fff;
  background: #dbe9f3;
}

.hero-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(7, 25, 42, .5), rgba(7, 25, 42, .16) 58%, rgba(255, 255, 255, .72)),
    url("/images/login-hero.png?v=20260819") center / cover no-repeat;
}

.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(0, 40, 70, .2));
}

.hero-copy {
  position: absolute;
  left: clamp(24px, 6vw, 94px);
  right: clamp(24px, 6vw, 94px);
  bottom: clamp(32px, 6vh, 70px);
  display: grid;
  gap: 12px;
  text-shadow: 0 3px 18px rgba(0, 0, 0, .24);
}

.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2.25rem, 3.7vw, 3.9rem);
  font-weight: 900;
  line-height: 1.15;
}

.hero-copy p {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 255, 255, .86);
  font-size: 1.22rem;
  font-weight: 700;
}

.login-card {
  width: min(620px, calc(100% - 48px));
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 14px;
  padding: clamp(24px, 3.2vw, 42px);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(18, 34, 68, .1);
}

.role-tabs.large {
  min-height: 66px;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #f3f6fb;
}

.role-tabs.large .role-tab {
  min-height: 50px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1.24rem;
  font-weight: 900;
}

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

.form-heading.center {
  text-align: center;
}

.form-heading.center .eyebrow {
  color: #6b7280;
  opacity: 1;
  font-size: 1.05rem;
  font-weight: 900;
}

.form-heading.center h2 {
  color: #2474e8;
  font-size: clamp(2.18rem, 3.5vw, 3.05rem);
  font-weight: 900;
}

.login-fields {
  display: grid;
  gap: 14px;
}

.input-box.single {
  grid-template-columns: 74px 1fr;
  border-radius: 8px;
}

.input-box.single input {
  font-size: 1.18rem;
  font-weight: 800;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #4b5563;
  font-size: 1.06rem;
  font-weight: 900;
}

.login-options span {
  color: #3f3f46;
}

.primary-action.orange {
  min-height: 56px;
  color: #fff;
  background: #f47b20;
  box-shadow: 0 16px 30px rgba(244, 123, 32, .22);
  font-size: 1.22rem;
  font-weight: 900;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  color: #c1c7d0;
  font-weight: 800;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  background: #d8dde5;
}

.outline-action {
  justify-self: center;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 36px;
  border: 1px solid #d3d9e3;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  text-decoration: none;
}

.login-note {
  margin: 0;
  color: #0067b1;
  font-weight: 900;
  font-size: 1rem;
  text-align: center;
}

.admin-pill {
  position: absolute;
  top: 26px;
  right: 32px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px);
}

.login-shell {
  width: min(1180px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .32);
}

.brand-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 54px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 52% 47%, rgba(70, 196, 160, .42), transparent 11%),
    linear-gradient(135deg, rgba(15, 29, 74, .92), rgba(42, 72, 173, .92));
}

.school-seal {
  width: 122px;
  height: 122px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f8fbff;
  color: var(--primary);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 0 38px rgba(114, 229, 201, .72);
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  opacity: .72;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.brand-panel h1,
.form-heading h2,
.topbar h2,
.panel h3,
.exam-header h3,
.question-panel h3 {
  margin: 0;
  line-height: 1.2;
}

.brand-panel h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.school-name {
  margin: 14px 0 0;
  font-size: 1.45rem;
  opacity: .9;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.feature-row span {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
}

.brand-note {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, .72);
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 58px;
  background: var(--surface);
}

.login-panel::before,
.login-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: .68;
  pointer-events: none;
}

.login-panel::before {
  top: 42px;
  left: 70px;
  width: 126px;
  height: 126px;
}

.login-panel::after {
  right: -42px;
  bottom: 34px;
  width: 210px;
  height: 210px;
}

.login-panel > * {
  position: relative;
  z-index: 1;
}

.role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.role-tab {
  position: relative;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.role-tab.active {
  color: #fff;
  background: var(--primary);
}

.role-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.role-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.role-card strong {
  color: var(--primary);
  font-size: 1.05rem;
}

.role-card span {
  color: var(--muted);
  font-size: .9rem;
}

.role-card.teacher {
  border-color: rgba(36, 71, 168, .42);
  background: linear-gradient(135deg, #fff, #eef4ff);
}

.role-card.student {
  border-color: rgba(22, 128, 90, .32);
  background: linear-gradient(135deg, #fff, #edf9f4);
}

.form-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.form-heading p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 9px;
  font-weight: 700;
}

.field.compact {
  font-weight: 600;
}

.input-box {
  min-height: 60px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cbd5e4;
  border-radius: 12px;
  background: #fff;
}

.input-icon {
  height: 100%;
  display: grid;
  place-items: center;
  color: #5b6880;
  background: #f5f7fb;
  border-right: 1px solid #e3e8f0;
  font-size: .9rem;
}

.input-box input,
.field select,
.field input,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.input-box input {
  min-height: 58px;
  border: 0;
  padding: 0 20px;
}

.field select,
.field input,
.field textarea {
  min-height: 44px;
  padding: 10px 12px;
}

.field textarea {
  resize: vertical;
}

.icon-button {
  width: 48px;
  height: 48px;
  margin-right: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7a879a;
}

.primary-action,
.primary,
.secondary,
.ghost-action,
.text-button {
  border: 0;
  border-radius: 8px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.primary-action,
.primary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  box-shadow: 0 14px 28px rgba(36, 71, 168, .22);
  font-weight: 700;
}

.primary-action {
  min-height: 68px;
  border-radius: 999px;
  font-size: 1.12rem;
}

.primary.danger {
  background: linear-gradient(135deg, #d94f4f, var(--danger));
  box-shadow: 0 14px 28px rgba(196, 53, 53, .2);
}

.secondary {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

.small {
  min-height: 38px;
  padding-inline: 14px;
  font-size: .92rem;
}

.ghost-action,
.text-button {
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

.ghost-action {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, .18);
  color: rgba(255, 255, 255, .84);
}

.primary:hover,
.primary-action:hover,
.secondary:hover {
  transform: translateY(-1px);
}

.login-help {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  color: #929db0;
  text-align: center;
}

.login-help a {
  color: var(--primary);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  grid-template-rows: 78px minmax(0, 1fr);
  background: #f3f6fb;
}

.admin-topbar {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 282px auto 1fr;
  align-items: center;
  min-height: 78px;
  padding: 0 26px;
  color: #fff;
  background: linear-gradient(90deg, #2f96ee, #68b3f8);
  box-shadow: 0 6px 18px rgba(18, 34, 68, .16);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
}

.admin-logo {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, .86);
  border-radius: 14px;
  font-weight: 900;
}

.admin-brand strong,
.admin-brand small {
  display: block;
  color: #fff;
}

.admin-brand strong {
  font-size: 1.45rem;
  line-height: 1.1;
}

.admin-brand small {
  opacity: .86;
}

.admin-menu-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
}

.admin-menu-button span {
  width: 30px;
  height: 3px;
  display: block;
  border-radius: 999px;
  background: #fff;
}

.admin-user {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
  color: #1d5ca1;
  background: #fff7d8;
  font-weight: 900;
}

.admin-sidebar {
  position: sticky;
  top: 78px;
  height: calc(100vh - 78px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid #d7dee9;
  background: #fff;
}

.admin-nav {
  display: grid;
  padding: 22px 0;
}

.admin-nav-heading {
  margin: 22px 26px 10px;
  color: #1d2736;
  font-size: .94rem;
}

.admin-nav-item {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  border-left: 4px solid transparent;
  color: #3f4b5d;
  text-decoration: none;
}

.admin-nav-item span {
  min-width: 28px;
  color: #344153;
  text-align: center;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  border-left-color: #3d9bf3;
  color: #1d5ca1;
  background: #edf5ff;
}

.admin-logout {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
}

.admin-main {
  min-width: 0;
  padding: 44px 34px 28px;
}

.admin-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.admin-page-head h1 {
  margin: 0 0 4px;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  line-height: 1.15;
}

.admin-page-head p {
  margin: 0;
  color: #5a6475;
}

.admin-page-head a {
  color: #1d5ca1;
  text-decoration: none;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.admin-action-card {
  min-height: 126px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  border-radius: 18px;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 16px 34px rgba(18, 34, 68, .14);
}

.admin-action-card strong,
.admin-action-card small {
  display: block;
  color: #fff;
}

.admin-action-card strong {
  font-size: clamp(1.45rem, 2vw, 2.05rem);
  line-height: 1.2;
}

.admin-action-card small {
  margin-top: 8px;
  opacity: .92;
  font-size: 1.03rem;
}

.admin-action-card b {
  font-size: 3rem;
  opacity: .92;
}

.admin-action-card.blue {
  background: linear-gradient(135deg, #3695f4, #2775df);
}

.admin-action-card.green {
  background: linear-gradient(135deg, #31d7ba, #18b58f);
}

.admin-action-card.cyan {
  background: linear-gradient(135deg, #12bed0, #0b9fb9);
}

.admin-action-card.orange {
  background: linear-gradient(135deg, #ffbd55, #f59b22);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  color: #fff;
  background: linear-gradient(180deg, #0e1d41, #172c68);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--primary);
  background: #fff;
  font-weight: 800;
}

.app-brand strong,
.app-brand span {
  display: block;
}

.app-brand span {
  color: rgba(255, 255, 255, .68);
  font-size: .88rem;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, .78);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .13);
}

.sidebar .ghost-action {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.mobile-menu {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-status,
.user-chip,
.trust-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.user-chip {
  color: var(--ink);
  font-weight: 700;
}

.trust-chip {
  border-color: rgba(36, 71, 168, .22);
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 800;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.product-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.product-headline h1 {
  margin: 0;
  color: #092d6e;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.2;
}

.product-headline p {
  margin: 8px 0 0;
  color: var(--muted);
}

.security-callout {
  display: grid;
  gap: 4px;
  min-width: 300px;
  padding: 16px 18px;
  border: 1px solid #bdd2ef;
  border-radius: 8px;
  color: #0b397f;
  background: #edf6ff;
}

.security-callout span {
  color: #496178;
  font-size: .9rem;
}

.page-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-grid {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.monitor-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-card,
.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(18, 34, 68, .06);
}

.summary-card,
.metric-card {
  padding: 20px;
}

.primary-summary {
  background: linear-gradient(135deg, #fff, #eef4ff);
}

.summary-card h3 {
  margin: 12px 0 8px;
  font-size: 1.35rem;
}

.summary-card p,
.metric-card small,
.section-head p,
.muted,
.policy-item span,
.export-item span {
  color: var(--muted);
}

.metric-card {
  display: grid;
  align-content: center;
  gap: 8px;
}

.metric-card strong {
  font-size: 2rem;
}

.metric-card.warning strong {
  color: var(--warning);
}

.content-grid,
.control-layout,
.student-gate {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 16px;
}

.grading-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .7fr);
}

.panel {
  padding: 20px;
}

.section-head,
.toolbar,
.action-row,
.exam-header,
.question-meta,
.score-summary,
.progress-item > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar h3 {
  margin: 0;
}

.action-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.action-row.end {
  justify-content: flex-end;
}

.action-row.spread {
  justify-content: space-between;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.success {
  color: var(--success);
  background: var(--success-soft);
}

.status-badge.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-badge.neutral {
  color: #4d5a6d;
  background: var(--neutral-soft);
}

.progress-list,
.activity-list,
.check-list,
.export-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-item {
  display: grid;
  gap: 8px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f6;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.progress-track.green span {
  background: var(--success);
}

.activity-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.monitor-detail {
  margin-top: 16px;
}

.incident-bars {
  display: grid;
  gap: 12px;
}

.incident-bars div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.incident-bars i {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--warning), #f3b34d);
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.success {
  background: var(--success);
}

.dot.warning {
  background: var(--warning);
}

.filter-group,
.room-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.room {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.chip.active,
.room.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: #4d5a6d;
  background: var(--surface-2);
  font-size: .88rem;
}

.student-cell {
  display: grid;
  gap: 2px;
}

.student-cell small {
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions form {
  display: inline-flex;
}

.inline-details {
  display: inline-grid;
  gap: 10px;
  width: 100%;
}

.inline-details summary {
  list-style: none;
  cursor: pointer;
}

.inline-details summary::-webkit-details-marker {
  display: none;
}

.inline-details[open] {
  grid-column: 1 / -1;
}

.inline-details[open] summary {
  justify-self: start;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.switch input {
  appearance: none;
  width: 54px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: #b7c2d2;
  position: relative;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: .18s ease;
}

.switch input:checked {
  background: var(--success);
}

.switch input:checked::after {
  transform: translateX(24px);
}

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

.compact-form {
  margin: 14px 0 0;
}

.option-editor,
.checkbox-section,
.grading-card,
.exam-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.option-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 110px;
  gap: 10px;
  align-items: end;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 800;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.question-picker,
.exam-list {
  display: grid;
  gap: 10px;
}

.question-picker {
  max-height: 320px;
  overflow: auto;
}

.check-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.check-card small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 500;
}

.grading-card,
.exam-card {
  margin-top: 14px;
  background: #fff;
}

.essay-score-form {
  display: grid;
  gap: 12px;
}

.policy-panel {
  align-self: start;
}

.policy-panel h3 {
  margin-bottom: 16px;
}

.policy-item {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.student-surface,
.exam-screen {
  color: var(--ink);
}

.gate-panel {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
}

.gate-panel h3 {
  font-size: 1.6rem;
}

.muted-panel {
  opacity: .82;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 700;
}

.check-item span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: .8rem;
}

.check-item.pass span {
  background: var(--success);
}

.check-item.fail span {
  background: var(--danger);
}

.exam-screen {
  position: relative;
  overflow: hidden;
}

.watermark {
  position: absolute;
  inset: 90px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  place-items: center;
  transform: rotate(-22deg);
  color: rgba(36, 71, 168, .08);
  font-size: 2rem;
  font-weight: 800;
  pointer-events: none;
  z-index: 0;
}

.exam-header,
.exam-layout {
  position: relative;
  z-index: 1;
}

.exam-header {
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.save-state {
  color: var(--success);
  font-weight: 700;
}

.timer {
  min-width: 104px;
  padding: 9px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--danger);
  text-align: center;
  font-size: 1.4rem;
}

.exam-progress {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-progress div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.exam-progress strong {
  color: var(--ink);
}

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

.question-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-nav button {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.question-nav button:last-child {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  min-height: 44px;
}

.question-nav .active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.question-nav .answered {
  color: var(--success);
  background: var(--success-soft);
}

.question-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.choice.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.offline-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(168, 102, 0, .28);
  border-radius: 8px;
  color: var(--warning);
  background: var(--warning-soft);
}

.offline-alert span {
  color: #6f5a2b;
}

.offline-alert button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.2rem;
}

.answer-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: #39455a;
}

.score-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.score-summary div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.score-summary span {
  color: var(--muted);
  font-size: .9rem;
}

.score-summary strong {
  font-size: 1.25rem;
}

.export-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.export-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 17, 38, .54);
}

.confirm-modal {
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.confirm-modal h3 {
  margin: 0 0 8px;
}

.confirm-modal p {
  margin: 0 0 20px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .page-grid,
  .admin-action-grid,
  .content-grid,
  .control-layout,
  .student-gate,
  .grading-grid {
    grid-template-columns: 1fr;
  }

  .page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .monitor-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .admin-topbar {
    grid-template-columns: 230px auto 1fr;
  }

  .admin-sidebar {
    width: 230px;
  }

  .admin-nav-item {
    padding: 0 18px;
  }

  .primary-summary {
    grid-column: 1 / -1;
  }

  .product-headline {
    align-items: stretch;
    flex-direction: column;
  }

  .security-callout {
    min-width: 0;
  }

  .split-login {
    grid-template-columns: 1fr;
  }

  .login-hero-panel {
    min-height: 430px;
  }

  .login-card {
    width: min(760px, calc(100% - 32px));
    margin: 28px 0;
  }
}

@media (max-width: 860px) {
  .login-screen {
    padding: 18px;
  }

  .testing-login {
    padding: 0;
  }

  .login-topbar {
    height: 82px;
    padding: 0 18px;
  }

  .login-logo span {
    font-size: .96rem;
  }

  .login-logo strong {
    font-size: .98rem;
  }

  .school-seal.compact {
    width: 52px;
    height: 52px;
    font-size: 17px;
  }

  .login-hero-panel {
    min-height: 340px;
  }

  .hero-copy {
    left: 22px;
    right: 22px;
    bottom: 28px;
  }

  .hero-keyboard {
    width: 96%;
  }

  .admin-pill {
    position: static;
    justify-self: end;
    margin-bottom: 16px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .brand-panel {
    padding: 36px 22px;
  }

  .login-panel {
    padding: 32px 22px;
  }

  .login-card {
    padding: 28px 20px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .admin-topbar {
    position: static;
    grid-template-columns: 1fr auto;
    gap: 14px;
    min-height: auto;
    padding: 14px 18px;
  }

  .admin-menu-button {
    order: 3;
    grid-column: 1 / -1;
    justify-self: start;
  }

  .admin-user {
    font-size: .92rem;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 10px;
  }

  .admin-nav-heading {
    grid-column: 1 / -1;
    margin: 12px 10px 8px;
  }

  .admin-nav-item {
    min-height: 48px;
    padding: 0 12px;
    border-left: 0;
    border-radius: 8px;
  }

  .admin-main {
    padding: 20px 16px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 280px;
    transform: translateX(-100%);
    transition: .2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .workspace {
    padding: 16px;
  }

  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .sync-status {
    display: none;
  }

  .trust-chip {
    display: none;
  }

  .exam-layout {
    grid-template-columns: 1fr;
  }

  .question-nav {
    grid-template-columns: repeat(8, minmax(42px, 1fr));
    overflow-x: auto;
  }

  .question-nav button:last-child {
    grid-column: auto;
    aspect-ratio: auto;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .page-grid,
  .admin-action-grid,
  .dashboard-grid,
  .form-grid,
  .score-summary,
  .role-choice,
  .monitor-stats {
    grid-template-columns: 1fr;
  }

  .option-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .checkbox-grid,
  .question-picker {
    grid-template-columns: 1fr;
  }

  .section-head,
  .toolbar,
  .exam-header,
  .question-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    display: none;
  }

  .admin-brand strong {
    font-size: 1.12rem;
  }

  .admin-brand small,
  .admin-user span:first-child {
    display: none;
  }

  .admin-logo,
  .admin-avatar {
    width: 42px;
    height: 42px;
  }

  .admin-nav {
    grid-template-columns: 1fr;
  }

  .admin-action-card {
    min-height: 104px;
    padding: 20px;
  }

  .admin-action-card b {
    font-size: 2.25rem;
  }

  .input-box {
    grid-template-columns: 56px 1fr auto;
  }

  .input-box.single {
    grid-template-columns: 58px 1fr;
  }

  .role-tabs.large {
    min-height: 60px;
  }

  .role-tabs.large .role-tab {
    min-height: 46px;
    font-size: .98rem;
  }

  .login-options {
    align-items: flex-start;
    flex-direction: column;
  }

  .hamburger {
    width: 42px;
  }

  .hamburger span {
    width: 26px;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
  }

  .data-table td {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }

  .watermark {
    grid-template-columns: 1fr;
    font-size: 1.35rem;
  }

  .action-row.spread {
    justify-content: stretch;
  }

  .action-row.spread button,
  .gate-panel .primary {
    width: 100%;
  }
}
