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

:root {
  --page: #f3f5f6;
  --paper: #ffffff;
  --ink: #17222b;
  --muted: #66737d;
  --line: #dce3e6;
  --line-strong: #c9d3d7;
  --teal: #0b4b6f;
  --teal-dark: #083752;
  --teal-soft: #e6eff3;
  --gold: #9a6b09;
  --gold-soft: #fff6df;
  --red: #b42318;
  --red-soft: #fff0ee;
  --green: #16865c;
  --green-soft: #e8f7f1;
  --blue: #1faf7a;
  --blue-soft: #e9f8f2;
  --radius: 8px;
  --shadow: 0 12px 28px rgba(23, 34, 43, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "AlmaraiLocal", "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.6;
}

body.attempt-active { overflow: hidden; }
body.attempt-active .language-toggle { display: none; }

button,
input,
select,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

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

.muted { color: var(--muted); font-size: 0.84rem; }

.section-kicker,
.eyebrow {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 700;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(480px, 1.1fr);
  background: var(--paper);
}

.auth-brand {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 6vw, 84px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(5, 38, 58, 0.95), rgba(11, 75, 111, 0.9)),
    url("../images/implicit-thinking-logo.png") center 76% / 420px auto no-repeat;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 8px;
  background: linear-gradient(90deg, #d9a52d 0 32%, #e7ecee 32% 66%, #4fa49e 66%);
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
}

.brand-lockup .eyebrow { color: #bdebdc; }

.brand-lockup h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 3.25rem);
  line-height: 1.35;
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.brand-copy > p { margin: 0 0 28px; color: #dcefed; font-size: 1.02rem; }

.brand-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-block: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-stats div { padding: 18px 0; }
.brand-stats dt { font-size: 1.05rem; font-weight: 800; }
.brand-stats dd { margin: 1px 0 0; color: #bcd7d4; font-size: 0.75rem; }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 32px;
  background: #f7f9f9;
}

.auth-form { width: min(420px, 100%); }
.form-heading { margin-bottom: 30px; }
.form-heading h2 { margin: 0; font-size: 1.8rem; }
.form-heading p { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }

.field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.field > span { font-size: 0.82rem; font-weight: 700; }
.field small { color: var(--muted); font-size: 0.7rem; }

.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea { resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 107, 103, 0.12);
}

.auth-form .field + .field { margin-top: 18px; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: var(--teal-dark); }
.button-secondary { color: var(--teal-dark); border-color: #8ebeb9; background: var(--teal-soft); }
.button-quiet { color: var(--ink); border-color: var(--line); background: var(--paper); }
.button-danger { color: var(--red); border-color: #e7b8b3; background: var(--red-soft); }
.button-wide { width: 100%; margin-top: 24px; min-height: 47px; }

.text-button {
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-weight: 700;
}

.form-error { margin: 12px 0 0; color: var(--red); font-size: 0.82rem; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-rows: 72px minmax(0, 1fr);
  grid-template-areas: "top top" "side work";
}

.language-toggle {
  position: fixed;
  inset-block-end: 18px;
  inset-inline-start: 18px;
  z-index: 80;
  min-width: 78px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--teal-dark);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(29, 45, 54, 0.09);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

[dir="ltr"] .sidebar { border-right: 1px solid var(--line); border-left: 0; }
[dir="ltr"] .nav-item { text-align: left; }
[dir="ltr"] .topbar-user > div { text-align: right; }
[dir="ltr"] .result-report-metric,
[dir="ltr"] .exam-card,
[dir="ltr"] .toast { border-right-width: 1px; border-left: 4px solid var(--teal); }

.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-brand { display: flex; flex: 0 1 auto; min-width: 0; align-items: center; gap: 12px; font-size: 0.95rem; font-weight: 800; }
.topbar-brand img { width: 40px; height: 40px; object-fit: contain; }
.topbar-user { display: flex; min-width: 0; align-items: center; gap: 18px; }
.topbar-user > div { display: grid; min-width: 0; text-align: left; }
.topbar-user strong { overflow: hidden; font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user span { color: var(--muted); font-size: 0.68rem; }

.sidebar {
  grid-area: side;
  position: sticky;
  top: 72px;
  align-self: start;
  display: flex;
  height: calc(100vh - 72px);
  flex-direction: column;
  padding: 24px 14px;
  border-left: 1px solid var(--line);
  background: #202c34;
  color: #fff;
}

.nav-list { display: grid; gap: 5px; }

.nav-item {
  display: flex;
  width: 100%;
  min-height: 45px;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  color: #cdd6dc;
  background: transparent;
  text-align: right;
  font-weight: 700;
  font-size: 0.82rem;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); }
.nav-item.is-active { color: #fff; background: var(--teal); }
.nav-mark { width: 8px; height: 8px; flex: 0 0 auto; border: 2px solid currentColor; border-radius: 50%; }
.nav-item.is-active .nav-mark { background: #fff; }

.sidebar-note {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-note strong { color: #fff; font-size: 0.76rem; }
.sidebar-note span { color: #9eabb3; font-size: 0.66rem; }

.workspace {
  grid-area: work;
  min-width: 0;
  padding: 32px clamp(20px, 4vw, 52px) 64px;
}

.view { display: none; max-width: 1440px; margin: 0 auto; }
.view.is-visible { display: block; animation: appear 0.18s ease-out; }

@keyframes appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header,
.panel-heading,
.picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.page-header { min-height: 70px; margin-bottom: 24px; }
.page-header h2 { margin: 0; font-size: 1.65rem; line-height: 1.4; }
.page-header p:not(.section-kicker) { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

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

.metric-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  border-radius: var(--radius);
  background: var(--paper);
}

.metric-card:nth-child(2) { border-top-color: var(--gold); }
.metric-card:nth-child(3) { border-top-color: var(--blue); }
.metric-card:nth-child(4) { border-top-color: var(--green); }
.metric-card span { color: var(--muted); font-size: 0.74rem; }
.metric-card strong { display: block; margin-top: 8px; font-size: 1.65rem; line-height: 1; }

.overview-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; margin-top: 18px; }

.branding-form { display: grid; grid-template-columns: 280px minmax(0, 1fr); max-width: 1040px; overflow: hidden; }
.branding-logo-column { padding: 22px; border-left: 1px solid var(--line); background: #f8faf9; }
.logo-preview { display: grid; place-items: center; aspect-ratio: 1; margin-bottom: 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--paper); }
.logo-preview img { width: 74%; height: 74%; object-fit: contain; }
.branding-fields { min-width: 0; }
.brand-color-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 20px 20px; }
.color-field { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 4px 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfb; }
.learning-outcomes-editor { margin: 0 20px 20px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfb; overflow: hidden; }
.learning-outcomes-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.learning-outcomes-heading h3 { margin: 0 0 4px; font-size: 1rem; }
.learning-outcomes-heading p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.learning-outcome-labels, .learning-outcome-row { display: grid; grid-template-columns: minmax(110px, 0.35fr) minmax(240px, 1fr) 44px; align-items: center; gap: 10px; }
.learning-outcome-labels { padding: 9px 14px; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.learning-outcome-row { padding: 10px 14px; border-top: 1px solid var(--line); }
.learning-outcome-row input { width: 100%; }
.learning-outcome-row [data-remove-learning-outcome] { width: 40px; height: 40px; padding: 0; font-size: 1.2rem; }
.learning-outcome-empty { padding: 18px; color: var(--muted); text-align: center; }
.color-field span { grid-column: 1 / -1; color: var(--muted); font-size: 0.68rem; }
.color-field input { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--paper); }
.color-field strong { direction: ltr; font-size: 0.72rem; }
.extracted-palette { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 20px 16px; color: var(--muted); font-size: 0.7rem; }
.palette-swatch { width: 30px; height: 30px; border: 1px solid rgba(23, 34, 43, 0.18); border-radius: 5px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 2px 6px rgba(23, 34, 43, 0.025);
}

.panel-heading { min-height: 74px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 0; font-size: 1rem; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.72rem; }

.stack-list { display: grid; }
.stack-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.stack-item:last-child { border-bottom: 0; }
.stack-item strong { display: block; font-size: 0.82rem; }
.stack-item small { color: var(--muted); font-size: 0.68rem; }
.stack-value { text-align: left; font-weight: 800; font-size: 0.84rem; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #f7f9fa;
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.success { border-color: #b8ddc9; color: var(--green); background: var(--green-soft); }
.badge.warning { border-color: #ead0a3; color: var(--gold); background: var(--gold-soft); }
.badge.info { border-color: #bfd2e6; color: var(--blue); background: var(--blue-soft); }
.badge.danger { border-color: #e8bbb6; color: var(--red); background: var(--red-soft); }

.empty-state { padding: 38px 20px; color: var(--muted); text-align: center; font-size: 0.82rem; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line-strong); overflow-x: auto; }
.user-tabs { margin-top: 22px; }
.user-policy-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 16px; padding: 16px 20px; border-right: 4px solid var(--secondary, var(--green)); }
.user-policy-panel h3 { margin: 0; font-size: 0.9rem; }
.user-policy-panel p { margin: 3px 0 0; color: var(--muted); font-size: 0.7rem; }
.random-group-panel { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(430px, 1.7fr); align-items: end; gap: 16px 24px; margin-top: 12px; padding: 16px 20px; border-right: 4px solid var(--gold); }
.random-group-copy h3 { margin: 0; font-size: 0.9rem; }
.random-group-copy p { margin: 3px 0 0; color: var(--muted); font-size: 0.7rem; }
.random-group-controls { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 10px; }
.random-group-controls .button { min-height: 44px; }
.random-group-summary { grid-column: 1 / -1; min-height: 18px; margin: 0; color: var(--teal-dark); font-size: 0.7rem; font-weight: 700; }
.switch-control { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; cursor: pointer; }
.switch-control > input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { display: flex; align-items: center; width: 46px; height: 26px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: #dfe5e7; transition: background 0.16s ease, border-color 0.16s ease; }
.switch-track span { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgba(23, 34, 43, 0.25); transition: transform 0.16s ease; }
.switch-control > input:checked + .switch-track { border-color: var(--teal); background: var(--teal); }
.switch-control > input:checked + .switch-track span { transform: translateX(-20px); }
.switch-control > input:focus-visible + .switch-track { outline: 3px solid var(--teal-soft); outline-offset: 2px; }
.switch-control strong { min-width: 52px; color: var(--muted); font-size: 0.7rem; }
.switch-control > input:checked ~ strong { color: var(--teal); }
.tab { min-height: 42px; padding: 8px 15px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; font-weight: 700; font-size: 0.78rem; white-space: nowrap; }
.tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-pane { display: none; }
.tab-pane.is-visible { display: block; }

.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 210px 180px; gap: 10px; margin-bottom: 14px; }
.user-toolbar { grid-template-columns: minmax(260px, 1fr) 200px 180px; }
.search-field { position: relative; }

.bank-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.bank-chip { display: flex; min-width: 0; min-height: 170px; padding: 14px; border: 1px solid var(--line); border-top: 3px solid var(--teal); border-radius: 6px; background: var(--paper); flex-direction: column; }
.bank-chip.is-archived { border-top-color: var(--gold); background: #fbfaf5; }
.bank-chip-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bank-chip strong { display: block; font-size: 0.78rem; }
.bank-chip > span { margin-top: 6px; color: var(--muted); font-size: 0.66rem; }
.bank-chip p { margin: 10px 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.7; }
.bank-chip-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 14px; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.bounded-table { max-height: min(68vh, 720px); overscroll-behavior: contain; scrollbar-gutter: stable; }
.bounded-scroll { max-height: min(50vh, 520px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; font-size: 0.74rem; }
th { position: sticky; top: 0; z-index: 1; color: #53616b; background: #f2f5f6; font-size: 0.68rem; }
tr:last-child td { border-bottom: 0; }
td strong { display: block; max-width: 520px; font-size: 0.76rem; }
td small { display: block; margin-top: 2px; color: var(--muted); }
.correct-text { color: var(--green); font-weight: 700; direction: ltr; text-align: right; }

.form-panel { max-width: 1040px; }
.form-grid { display: grid; gap: 16px; padding: 20px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-span { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 10px; min-height: 68px; padding: 14px 20px; border-top: 1px solid var(--line); }
.compact-form { max-width: 660px; }
.compact-form-wide { max-width: 1040px; }
.compact-form > .field { margin: 18px 20px 0; }
.compact-form > .field:last-of-type { margin-bottom: 20px; }

.preview-panel { margin-top: 18px; overflow: hidden; }
.preview-summary { display: flex; flex-wrap: wrap; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.preview-actions { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.row-error { color: var(--red); }
.row-valid { color: var(--green); }
.credential-panel { max-width: 820px; margin-top: 18px; overflow: hidden; }
.credential-content { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.credential-values { display: flex; flex-wrap: wrap; gap: 18px; }
.credential-values span { display: grid; color: var(--muted); font-size: 0.68rem; }
.credential-values strong { color: var(--ink); font-size: 0.85rem; direction: ltr; }
.table-action { min-height: 32px; padding: 4px 10px; font-size: 0.68rem; }
.user-disabled { opacity: 0.62; }
.user-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 210px; }
.user-edit-row { background: #f5faf8; }
.user-edit-row td { vertical-align: top; }
.user-inline-field { display: block; width: 100%; min-width: 130px; min-height: 34px; margin-bottom: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font: inherit; font-size: 0.7rem; }
.multi-select-menu { min-width: 170px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.multi-select-menu > summary { padding: 9px 11px; color: var(--ink); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.multi-select-options { display: grid; max-height: 190px; overflow: auto; padding: 6px 10px 10px; border-top: 1px solid var(--line); }
.multi-select-options label { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 0.7rem; cursor: pointer; }
.multi-select-options input { width: 17px; height: 17px; accent-color: var(--teal); }
.site-permissions { margin-top: 18px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.site-permissions .learning-outcomes-heading { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.permissions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 16px; }

.exam-list { display: grid; gap: 12px; }
.exam-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-right: 4px solid var(--teal); border-radius: var(--radius); background: var(--paper); }
.exam-card h3 { margin: 0; font-size: 0.95rem; }
.exam-card p { margin: 5px 0 0; color: var(--muted); font-size: 0.72rem; }
.exam-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; color: #53616b; font-size: 0.68rem; }
.exam-card-side { display: grid; justify-items: end; gap: 8px; }
.exam-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.exam-form { max-width: none; margin-top: 18px; }

.settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 20px 20px; }
.check-setting { display: flex; align-items: flex-start; gap: 10px; min-height: 85px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfb; cursor: pointer; }
.check-setting input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--teal); }
.check-setting span { display: grid; }
.check-setting strong { font-size: 0.74rem; }
.check-setting small { color: var(--muted); font-size: 0.64rem; }

.question-picker { margin: 0 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.picker-toolbar { padding: 14px 16px; border-bottom: 1px solid var(--line); background: #f8faf9; }
.picker-toolbar h4 { margin: 0; font-size: 0.86rem; }
.picker-toolbar p { margin: 2px 0 0; color: var(--muted); font-size: 0.66rem; }
.picker-toolbar select { min-width: 210px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); }
.random-picker { display: grid; grid-template-columns: 1.4fr 0.65fr 0.9fr 0.9fr; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--gold-soft); }
.picker-list { max-height: 420px; overflow: auto; }
.picker-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) 100px; align-items: start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: #f7faf9; }
.picker-item input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--teal); }
.picker-item strong { font-size: 0.73rem; }
.picker-item small { color: var(--muted); font-size: 0.64rem; }
.picker-points { color: var(--gold); text-align: left; font-weight: 800; font-size: 0.68rem; }
.participant-toolbar { align-items: flex-end; }
.participant-controls { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.participant-controls > input { width: min(280px, 42vw); min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); }
.participant-controls > select { width: 170px; min-width: 0; }
.picker-select-all { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); font-size: 0.7rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.picker-select-all input { width: 17px; height: 17px; accent-color: var(--teal); }
.student-picker-list { max-height: 330px; }
.student-picker-list .picker-item { grid-template-columns: 24px minmax(0, 1fr) 110px; }
.student-picker-list .picker-points { display: grid; direction: ltr; gap: 2px; }
.student-picker-list .picker-points small { color: var(--muted); direction: rtl; font-size: 0.58rem; font-weight: 600; }
.sticky-actions { position: sticky; bottom: 0; z-index: 4; background: rgba(255,255,255,0.97); }

.results-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.grade-center-filters { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px; flex: 1; }
.grade-center-filters .field { margin: 0; }
.grade-center-filters select { width: 100%; }
.grade-center-table { min-width: 1500px; }
.grade-not-started { background: #fafbfb; color: var(--muted); }
.connection-details { display: grid; min-width: 155px; font-size: 0.68rem; line-height: 1.6; }
.connection-details small { color: var(--muted); font-size: 0.62rem; }
.grade-improvement.is-positive { color: var(--green); }
.grade-improvement.is-negative { color: var(--red); }
.inline-stats { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 0.7rem; }
.inline-stats strong { margin-right: 4px; color: var(--ink); font-size: 0.92rem; }
.result-report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 18px; }
.result-report-metric { padding: 14px 16px; border: 1px solid var(--line); border-right: 4px solid var(--teal); border-radius: 6px; background: var(--paper); }
.result-report-metric span { display: block; color: var(--muted); font-size: 0.64rem; }
.result-report-metric strong { display: block; margin-top: 3px; font-size: 1rem; }
.result-question-section { margin-top: 18px; }
.section-result-section { margin: 0 0 18px; }
.section-performance-table { min-width: 1280px; }
.answer-count { display: inline-grid; min-width: 42px; min-height: 28px; place-items: center; border-radius: 5px; font-weight: 800; }
.answer-count.is-correct { color: var(--green); background: var(--green-soft); }
.answer-count.is-incorrect { color: var(--red); background: var(--red-soft); }
.answer-count.is-unanswered { color: #76581a; background: var(--gold-soft); }

.analysis-controls { margin-bottom: 18px; overflow: hidden; }
.analysis-select-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 20px; }
.analysis-actions { flex-wrap: wrap; }
.agent-status { margin-inline-start: auto; padding: 6px 10px; border-right: 3px solid var(--gold); color: var(--muted); background: var(--gold-soft); font-size: 0.68rem; font-weight: 700; }
.agent-status.is-connected { border-right-color: var(--green); color: var(--teal-dark); background: var(--green-soft); }
.analysis-empty { margin-top: 18px; }
.analysis-output { display: grid; gap: 18px; }
.analysis-privacy { padding: 11px 14px; border-right: 4px solid var(--blue); color: #35566c; background: var(--blue-soft); font-size: 0.7rem; }
.analysis-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.analysis-summary-item { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 17px; border: 1px solid var(--line); border-top: 4px solid var(--teal); border-radius: 6px; background: var(--paper); }
.analysis-summary-item > span { grid-column: 1 / -1; color: var(--teal); font-size: 0.66rem; font-weight: 800; }
.analysis-summary-item h3 { grid-column: 1 / -1; min-height: 44px; margin: 0; font-size: 0.86rem; line-height: 1.55; }
.analysis-summary-item div { min-width: 0; padding-top: 9px; border-top: 1px solid var(--line); }
.analysis-summary-item strong { display: block; overflow-wrap: anywhere; font-size: 0.86rem; }
.analysis-summary-item small { color: var(--muted); font-size: 0.58rem; }
.analysis-section { overflow: hidden; border-top: 3px solid var(--teal); background: var(--paper); }
.analysis-section > .panel-heading { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.analysis-section h3 { margin: 0; font-size: 0.92rem; }
.analysis-section .panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.66rem; }
.analysis-section > .table-wrap { border: 0; border-radius: 0; }
.analysis-section td small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.58rem; }
.analysis-plan-section { border-top-color: var(--gold); }
.analysis-readiness-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; padding: 16px; background: #f8faf9; }
.analysis-readiness-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-inline-start: 4px solid var(--muted); border-radius: 6px; background: var(--paper); }
.analysis-readiness-card.is-ready { border-inline-start-color: var(--green); }
.analysis-readiness-card.is-partial { border-inline-start-color: var(--gold); }
.analysis-readiness-card.is-missing { border-inline-start-color: var(--red); }
.analysis-readiness-card span { display: block; color: var(--muted); font-size: 0.6rem; font-weight: 800; }
.analysis-readiness-card strong { display: block; margin: 4px 0; font-size: 0.84rem; }
.analysis-readiness-card small { display: block; color: var(--muted); font-size: 0.61rem; line-height: 1.65; }
.analysis-plan-table-secondary { border-top: 1px solid var(--line) !important; }
.analysis-plan-section .badge { white-space: nowrap; }
.analysis-test-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 13px 18px; border-top: 1px solid var(--line); color: var(--muted); background: #f8faf9; font-size: 0.68rem; }
.analysis-test-note strong { color: var(--ink); }
.analysis-item-heading select { width: min(390px, 48vw); min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); }
.quality-meter { width: 90px; height: 7px; border-radius: 4px; background: #dfe6e7; overflow: hidden; }
.quality-meter span { display: block; height: 100%; background: var(--green); }
.agent-report-section { border-top-color: var(--gold); }
.analysis-report { min-height: 180px; padding: 20px; white-space: pre-wrap; color: #263740; background: #fbfcfc; font-size: 0.76rem; line-height: 1.95; }
.analysis-charts-section { border-top-color: var(--blue); }
.analysis-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 16px; background: #f7faf9; }
.analysis-chart-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.analysis-chart-wide { grid-column: 1 / -1; }
.analysis-chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.analysis-chart-heading h4 { margin: 0; font-size: 0.8rem; }
.analysis-chart-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.62rem; }
.chart-kind { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #b7d4db; border-radius: 4px; color: var(--blue); background: var(--blue-soft); font-size: 0.56rem; font-weight: 800; }
.analysis-chart { width: 100%; min-height: 280px; overflow-x: auto; }
.analysis-chart svg { display: block; width: 100%; min-width: 0; height: auto; font-family: inherit; }
.analysis-chart .chart-grid-line { stroke: #dce4e6; stroke-width: 1; }
.analysis-chart .chart-axis-line { stroke: #8ba0a8; stroke-width: 1.25; }
.analysis-chart .chart-axis-label { fill: var(--muted); font-size: 11px; }
.analysis-chart .chart-value-label { fill: var(--ink); font-size: 11px; font-weight: 800; }
.analysis-chart .chart-legend-label { fill: var(--ink); font-size: 11px; }
.analysis-chart-empty { display: grid; min-height: 260px; place-items: center; color: var(--muted); background: #fafcfc; font-size: 0.7rem; }

.student-exam-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.student-exam-card { display: flex; min-height: 245px; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-top: 4px solid var(--teal); border-radius: var(--radius); background: var(--paper); }
.student-exam-card.is-resumable { border-top-color: var(--gold); }
.student-exam-card h3 { margin: 10px 0 5px; font-size: 1rem; }
.student-exam-card > p { margin: 0; color: var(--muted); font-size: 0.72rem; }
.student-exam-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; padding: 13px 0; border-block: 1px solid var(--line); }
.student-exam-meta div { display: grid; }
.student-exam-meta strong { font-size: 0.82rem; }
.student-exam-meta span { color: var(--muted); font-size: 0.62rem; }
.student-exam-card .button { margin-top: auto; }

.dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(12, 24, 31, 0.3);
  overflow: auto;
}

.dialog::backdrop { background: rgba(19, 29, 35, 0.72); backdrop-filter: blur(2px); }
.dialog form { margin: 0; }
.dialog-heading { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 1.25rem; }
.dialog-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 24px; }
.dialog-details div { padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.dialog-details strong { display: block; font-size: 0.83rem; }
.dialog-details span { color: var(--muted); font-size: 0.62rem; }
.dialog > form > .field { margin: 0 24px 20px; }
.dialog-actions { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #f8faf9; }
.attempt-shell { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: 76px 4px minmax(0, 1fr); background: var(--page); }
.attempt-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px clamp(18px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--paper); }
.attempt-header h1 { margin: 0; font-size: 1.05rem; }
.attempt-status { display: flex; align-items: center; gap: 18px; }
.save-state { color: var(--green); font-size: 0.68rem; }
.save-state.is-saving { color: var(--gold); }
.save-state.is-error { color: var(--red); }
.countdown { min-width: 92px; color: var(--ink); font: 800 1.3rem/1 "Segoe UI", Tahoma, sans-serif; text-align: center; direction: ltr; }
.countdown.is-warning { color: var(--red); }
.proctor-status { min-width: 96px; padding: 7px 10px; border: 1px solid #b7d8d4; border-radius: 5px; color: var(--teal-dark); background: var(--teal-soft); font-size: 0.66rem; font-weight: 800; text-align: center; }
.proctor-status.is-warning { border-color: #e6c37b; color: #7a5100; background: var(--gold-soft); }
.proctor-status.is-danger { border-color: #e3aaa4; color: var(--red); background: var(--red-soft); }
.attempt-progress { background: #d8e1e3; }
.attempt-progress span { display: block; width: 0; height: 100%; background: var(--teal); transition: width 0.2s; }
.attempt-main { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; }
.attempt-watermark {
  --watermark-x: 0px;
  --watermark-y: 0px;
  position: fixed;
  inset: -90px;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  align-content: space-around;
  gap: 54px 32px;
  padding: 46px;
  color: rgba(11, 75, 111, 0.16);
  pointer-events: none;
  user-select: none;
  transform: translate(var(--watermark-x), var(--watermark-y)) rotate(-19deg);
  animation: watermark-drift 13s ease-in-out infinite alternate;
}
.attempt-watermark span { overflow: hidden; font: 800 0.68rem/1.5 "Segoe UI", Tahoma, sans-serif; text-align: center; white-space: nowrap; }
@keyframes watermark-drift {
  from { margin-inline-start: -14px; margin-top: -8px; }
  to { margin-inline-start: 14px; margin-top: 8px; }
}
.security-shield {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  background: #050708;
}
.security-shield-content { width: min(540px, 100%); text-align: center; }
.security-shield-content .section-kicker { color: #81c5bd; }
.security-shield-content h2 { margin: 8px 0 12px; color: #fff; font-size: clamp(1.35rem, 4vw, 2rem); }
.security-shield-content p:not(.section-kicker) { margin: 0 auto 24px; color: #cbd4d7; font-size: 0.82rem; line-height: 1.9; }
.security-shield-content .button { min-width: 190px; }
.proctor-warning {
  position: fixed;
  inset: 0;
  z-index: 97;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(48, 8, 7, 0.76);
  backdrop-filter: blur(4px);
}
.proctor-warning-card {
  position: relative;
  width: min(520px, 100%);
  padding: 30px;
  border: 2px solid #b42318;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 28px 80px rgba(54, 8, 5, 0.42);
  text-align: center;
}
.proctor-warning-card::before {
  content: "";
  position: absolute;
  inset: -2px -2px auto;
  height: 8px;
  border-radius: 7px 7px 0 0;
  background: #b42318;
}
.proctor-warning-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 0 auto 12px;
  border: 3px solid #b42318;
  border-radius: 50%;
  color: #b42318;
  background: #fff1ef;
  font: 900 2rem/1 "Segoe UI", Tahoma, sans-serif;
}
.proctor-warning-card .section-kicker { margin: 0; color: #b42318; }
.proctor-warning-card h2 { margin: 7px 0 10px; color: #8f1d15; font-size: 1.4rem; }
.proctor-warning-card > p:not(.section-kicker) { margin: 0; color: #4c555a; font-size: 0.78rem; line-height: 1.9; }
.proctor-warning-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 14px; padding: 12px 14px; border: 1px solid #edb7b1; border-inline-start: 5px solid #b42318; border-radius: 5px; color: #8f1d15; background: #fff1ef; text-align: start; }
.proctor-warning-meta span { font-size: 0.76rem; font-weight: 800; }
.proctor-warning-meta strong { white-space: nowrap; font-size: 0.72rem; }
.proctor-warning-note { padding: 0 8px; }
.proctor-warning-button { min-width: 210px; margin-top: 22px; color: #fff; border-color: #b42318; background: #b42318; }
.proctor-warning-button:hover { border-color: #8f1d15; background: #8f1d15; }
.attempt-map { padding: 22px 18px; border-left: 1px solid var(--line); background: var(--paper); overflow: auto; }
.attempt-map-summary { display: grid; margin-bottom: 18px; }
.attempt-map-summary strong { font-size: 1.45rem; }
.attempt-map-summary span { color: var(--muted); font-size: 0.68rem; }
.question-map-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.map-button { aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); background: #f7f9fa; font-size: 0.7rem; font-weight: 800; }
.map-button.is-current { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(11,107,103,.15); }
.map-button.is-answered { border-color: var(--teal); color: #fff; background: var(--teal); }
.map-button.is-review { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.map-button.is-answered.is-review { color: #fff; background: var(--gold); }
.map-legend { display: grid; gap: 6px; margin-top: 20px; color: var(--muted); font-size: 0.62rem; }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--teal); }
.map-legend i.review { background: var(--gold); }
.question-stage { display: flex; min-width: 0; flex-direction: column; overflow: auto; }
#questionStage { width: min(860px, calc(100% - 36px)); margin: auto; padding: 34px 0 16px; }
.question-card { padding: 0 0 28px; }
.proctor-selection-blocked .question-card,
.proctor-selection-blocked .question-card *:not(input):not(textarea) {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.proctor-selection-blocked .question-card input,
.proctor-selection-blocked .question-card textarea,
.proctor-selection-blocked .question-card [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.question-sequence { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.7rem; }
.question-card h2 { margin: 14px 0 22px; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.75; direction: ltr; text-align: left; }
.question-note { margin: -14px 0 18px; color: var(--blue); font-size: 0.7rem; direction: ltr; text-align: left; }
.option-list { display: grid; gap: 10px; }
.option-row { display: grid; grid-template-columns: 24px 32px minmax(0,1fr); align-items: center; gap: 10px; min-height: 54px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; direction: ltr; }
.option-row:hover { border-color: #8ebeb9; background: #f8fbfa; }
.option-row:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 1px var(--teal); }
.option-row input { width: 18px; height: 18px; accent-color: var(--teal); }
.option-letter { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line-strong); border-radius: 4px; font-weight: 800; font-size: 0.7rem; }
.option-text { min-width: 0; overflow-wrap: anywhere; font-size: 0.84rem; }
.all-question-block { padding: 24px 0; border-bottom: 1px solid var(--line); }
.all-question-block:first-child { padding-top: 0; }
.attempt-actions { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding: 15px max(18px, calc((100% - 860px) / 2)) max(15px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -6px 18px rgba(21, 42, 53, 0.06); }

.review-dialog { width: min(720px, calc(100% - 28px)); }
.review-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 24px; }
.review-summary div { padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.review-summary strong { display: block; font-size: 1.1rem; }
.review-summary span { color: var(--muted); font-size: 0.65rem; }
.review-question-list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; padding: 0 24px 20px; }
.review-question-list button { min-height: 40px; border: 1px solid var(--line); border-radius: 5px; background: #f5f7f7; font-weight: 800; font-size: 0.68rem; }
.review-question-list button.is-missing { color: var(--red); border-color: #e8bbb6; background: var(--red-soft); }
.review-question-list button.is-review { color: var(--gold); border-color: #ead0a3; background: var(--gold-soft); }
.submission-warning { margin: 0 24px 20px; color: var(--red); font-size: 0.72rem; }
.security-start-notice { margin: 0 24px 18px; padding: 13px 15px; border-inline-start: 4px solid var(--gold); background: var(--gold-soft); color: var(--ink); font-size: 0.72rem; line-height: 1.8; }
.security-start-notice strong { display: block; margin-bottom: 3px; }
.exam-security-panel { margin: 0 18px 18px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfc; }
.exam-security-panel .panel-heading { margin: 0; }
.exam-security-panel .form-grid { padding-top: 4px; }
.security-settings { padding: 0 18px 18px; }
.security-risk { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 0.64rem; font-weight: 800; }
.security-risk.low { color: var(--green); }
.security-risk.moderate { color: #8a5a00; }
.security-risk.high { color: var(--red); }
.proctor-event-list { display: grid; gap: 7px; margin-top: 14px; }
.proctor-event-item { display: grid; grid-template-columns: 130px 110px minmax(0,1fr); gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; font-size: 0.66rem; }
.proctor-event-item > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.proctor-event-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.58rem; direction: ltr; text-align: left; }
.student-report-proctor { margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfc; }
.student-report-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.student-report-section-heading span { color: var(--muted); font-size: 0.64rem; }

.result-dialog { width: min(650px, calc(100% - 28px)); }
.result-content { padding: 30px 26px 22px; text-align: center; }
.result-content .score-ring { display: grid; width: 132px; height: 132px; place-items: center; margin: 0 auto 20px; border: 10px solid var(--teal-soft); border-top-color: var(--teal); border-radius: 50%; }
.score-ring strong { display: block; font-size: 1.65rem; }
.score-ring span { color: var(--muted); font-size: 0.62rem; }
.result-content h2 { margin: 0; font-size: 1.35rem; }
.result-content p { margin: 7px 0 0; color: var(--muted); font-size: 0.76rem; }
.answer-review { margin-top: 24px; text-align: right; }
.answer-review-item { padding: 11px 0; border-top: 1px solid var(--line); font-size: 0.72rem; }
.answer-review-item strong { display: block; direction: ltr; text-align: left; }
.answer-review-item span { color: var(--muted); }
.student-report-dialog { width: min(1120px, calc(100% - 28px)); }
.student-report-content { padding: 18px 22px 24px; }
.student-report-identity { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.student-report-identity > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.student-report-identity span,
.student-report-identity small { display: block; color: var(--muted); font-size: 0.62rem; }
.user-activity-dialog { width: min(1040px, calc(100% - 28px)); }
.user-activity-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 18px 22px; }
.user-activity-summary article { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.user-activity-summary span { display: block; color: var(--muted); font-size: 0.62rem; }
.user-activity-summary strong { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 0.78rem; }
.user-activity-summary .badge { display: inline-flex; margin: 0; }
.user-activity-list { padding: 0 22px 24px; }
.user-activity-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 10px; }
.user-activity-heading span { min-width: 28px; padding: 4px 8px; border-radius: 999px; background: var(--page); color: var(--muted); text-align: center; font-size: 0.65rem; }
.user-activity-table { min-width: 760px; }
.user-activity-table small { display: block; color: var(--muted); font-size: 0.6rem; }
.student-report-identity strong { display: block; margin: 3px 0; overflow-wrap: anywhere; font-size: 0.82rem; }
.student-answer-summary { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 14px 0; padding: 12px 14px; border-right: 4px solid var(--teal); color: var(--muted); background: var(--teal-soft); font-size: 0.68rem; }
.student-answer-summary strong { margin-inline-start: 4px; color: var(--ink); font-size: 0.82rem; }
.student-answer-table { max-height: min(52vh, 560px); }
.student-answer-table td:first-child { min-width: 260px; }
.student-answer-table td:nth-child(2),
.student-answer-table td:nth-child(3) { min-width: 180px; direction: ltr; text-align: left; }

.toast-region { position: fixed; left: 18px; bottom: 18px; z-index: 100; display: grid; width: min(360px, calc(100% - 36px)); gap: 8px; }
.toast { padding: 12px 14px; border: 1px solid #9fc8c4; border-right: 4px solid var(--teal); border-radius: 6px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); font-size: 0.74rem; animation: toast-in 0.18s ease-out; }
.toast.error { border-color: #e3aaa4; border-right-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
  .student-exam-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .attempt-main { grid-template-columns: 210px minmax(0, 1fr); }
  .branding-form { grid-template-columns: 220px minmax(0, 1fr); }
  .analysis-select-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-summary-grid { grid-template-columns: 1fr; }
  .analysis-readiness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-chart-grid { grid-template-columns: 1fr; }
  .analysis-chart-wide { grid-column: auto; }
  .bank-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { min-height: 260px; padding: 28px; }
  .brand-copy { margin-top: 44px; }
  .brand-copy > p { display: none; }
  .auth-panel { padding: 34px 22px 48px; }
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 64px auto minmax(0, 1fr); grid-template-areas: "top" "side" "work"; }
  .topbar { padding: 0 16px; }
  .topbar-user { gap: 10px; }
  .topbar-user > div { display: grid; max-width: min(34vw, 180px); }
  .sidebar { position: sticky; top: 64px; z-index: 10; width: 100%; height: auto; padding: 7px 12px; border: 0; border-bottom: 1px solid #33434c; overflow-x: auto; }
  .nav-list { display: flex; }
  .nav-item { width: auto; min-height: 39px; white-space: nowrap; }
  .sidebar-note { display: none; }
  .workspace { padding: 24px 16px 50px; }
  .overview-grid { grid-template-columns: 1fr; }
  .branding-form { grid-template-columns: 1fr; }
  .branding-logo-column { border-left: 0; border-bottom: 1px solid var(--line); }
  .logo-preview { max-width: 240px; margin-inline: auto; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search-field { grid-column: 1 / -1; }
  .student-exam-grid { grid-template-columns: 1fr; }
  .analysis-summary-item { grid-template-columns: repeat(4, minmax(70px, 1fr)); }
  .random-group-panel { grid-template-columns: 1fr; align-items: stretch; }
  .attempt-shell { grid-template-rows: 70px 4px minmax(0, 1fr); }
  .attempt-main { grid-template-columns: 1fr; }
  .attempt-map { display: none; }
  .attempt-header { padding: 9px 16px; }
  .save-state { display: none; }
}

@media (max-width: 600px) {
  .analysis-readiness-grid { grid-template-columns: 1fr; }
  .dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .dialog-actions { padding-inline: 14px; }
  .dialog-actions .button { flex: 1; min-width: 0; }
  .brand-logo { width: 56px; height: 56px; }
  .brand-lockup h1 { font-size: 1.4rem; }
  .brand-stats dd { font-size: 0.62rem; }
  .topbar-brand span { display: none; }
  .topbar-brand img { width: 36px; height: 36px; }
  .topbar-user { flex: 1; justify-content: flex-end; }
  .topbar-user > div { max-width: min(36vw, 140px); }
  .topbar-user span { display: none; }
  .topbar-user .button { min-height: 38px; padding: 8px 10px; font-size: 0.68rem; }
  .page-header { align-items: flex-end; }
  .page-header h2 { font-size: 1.3rem; }
  .metric-grid,
  .form-grid-2,
  .form-grid-3,
  .settings-grid,
  .random-picker { grid-template-columns: 1fr; }
  .bank-strip { grid-template-columns: 1fr; }
  .brand-color-grid { grid-template-columns: 1fr; }
  .learning-outcomes-heading { align-items: stretch; flex-direction: column; }
  .learning-outcome-labels { display: none; }
  .learning-outcome-row { grid-template-columns: 1fr 44px; }
  .learning-outcome-row [data-learning-outcome-code] { grid-column: 1; }
  .learning-outcome-row [data-learning-outcome-description] { grid-column: 1; }
  .learning-outcome-row [data-remove-learning-outcome] { grid-column: 2; grid-row: 1 / span 2; }
  .user-policy-panel { align-items: stretch; flex-direction: column; gap: 12px; }
  .random-group-controls { grid-template-columns: 1fr; }
  .form-grid { padding: 16px; }
  .field-span { grid-column: auto; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .search-field { grid-column: auto; }
  .exam-card { grid-template-columns: 1fr; }
  .exam-card-side { justify-items: start; }
  .exam-card-actions { justify-content: flex-start; }
  .picker-toolbar { align-items: stretch; flex-direction: column; }
  .picker-toolbar select { width: 100%; }
  .participant-controls { align-items: stretch; flex-direction: column; }
  .participant-controls > input { width: 100%; }
  .credential-content { align-items: stretch; flex-direction: column; }
  .picker-item { grid-template-columns: 22px minmax(0, 1fr); }
  .picker-points { grid-column: 2; text-align: right; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .grade-center-filters { grid-template-columns: 1fr; width: 100%; }
  .inline-stats { padding: 6px 2px; }
  .result-report-grid { grid-template-columns: 1fr 1fr; }
  .analysis-select-grid { grid-template-columns: 1fr; padding: 16px; }
  .analysis-actions { align-items: stretch; flex-direction: column; }
  .agent-status { margin-inline-start: 0; }
  .analysis-summary-item { grid-template-columns: 1fr 1fr; }
  .analysis-item-heading { align-items: stretch; flex-direction: column; }
  .analysis-item-heading select { width: 100%; }
  .analysis-chart-grid { padding: 10px; }
  .analysis-chart-card { padding: 12px; }
  .analysis-chart-heading { align-items: stretch; flex-direction: column; }
  .chart-kind { align-self: flex-start; }
  .analysis-chart svg { min-width: 520px; }
  .student-exam-meta { grid-template-columns: 1fr 1fr 1fr; }
  .attempt-header h1 { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #questionStage { width: calc(100% - 28px); padding-top: 24px; }
  .attempt-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); overflow: visible; }
  .attempt-actions .button { width: 100%; min-width: 0; min-height: 44px; padding-inline: 8px; font-size: 0.68rem; }
  #openReview { grid-column: 1 / -1; }
  .review-question-list { grid-template-columns: repeat(5, 1fr); }
  .dialog-details,
  .review-summary { grid-template-columns: 1fr 1fr; }
  .student-report-identity { grid-template-columns: 1fr 1fr; }
  .student-report-section-heading { align-items: stretch; flex-direction: column; gap: 4px; }
  .proctor-event-item { grid-template-columns: 1fr; }
  .proctor-warning { padding: 10px; }
  .proctor-warning-card { max-height: calc(100dvh - 20px); padding: 24px 18px 20px; overflow-y: auto; }
  .proctor-warning-icon { width: 50px; height: 50px; font-size: 1.7rem; }
  .proctor-warning-card h2 { font-size: 1.2rem; }
  .proctor-warning-meta { align-items: stretch; flex-direction: column; gap: 5px; }
  .proctor-warning-button { width: 100%; min-width: 0; }
  .user-activity-summary { grid-template-columns: 1fr 1fr; padding-inline: 14px; }
  .user-activity-list { padding-inline: 14px; }
}

@media (max-width: 620px) {
  .result-report-grid,
  .student-report-identity { grid-template-columns: 1fr; }
  .attempt-watermark { grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 44px 20px; padding: 26px; }
  .attempt-watermark span { font-size: 0.58rem; }
}

@media print {
  body.attempt-active > * { display: none !important; }
  body.attempt-active::before {
    content: "تم تعطيل طباعة محتوى الاختبار";
    display: grid;
    min-height: 100vh;
    place-items: center;
    color: #111;
    background: #fff;
    font: 800 18px/1.8 "AlmaraiLocal", "Segoe UI", sans-serif;
  }
  body { background: #fff; }
  .topbar, .sidebar, .analysis-controls, .header-actions, .toast-region, #analysisEmpty, .agent-report-section .button { display: none !important; }
  .app-shell { display: block !important; }
  .workspace { padding: 0; }
  .view { display: none !important; max-width: none; }
  body[data-print-view="analysis"] .view[data-page="analysis"],
  body[data-print-view="results"] .view[data-page="results"] { display: block !important; }
  .analysis-output { display: block !important; }
  .page-header { display: flex !important; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 3px solid var(--teal); }
  .analysis-summary-grid, .analysis-section { margin-bottom: 16px; break-inside: avoid; }
  .analysis-chart-grid { display: block; padding: 0; background: #fff; }
  .analysis-chart-card { margin-bottom: 12px; break-inside: avoid; }
  .analysis-chart { overflow: visible; }
  .analysis-chart svg { min-width: 0; }
  .table-wrap, .bounded-table, .bounded-scroll { max-height: none; overflow: visible; }
  body[data-print-view="results"] .results-toolbar { border: 1px solid var(--line); }
  body[data-print-view="results"] #resultTable button { display: none !important; }
  th { color: var(--teal-dark) !important; background: var(--teal-soft) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table { font-size: 9px; }
}

/* User access, bulk management, and manual grading */
.user-toolbar { grid-template-columns: minmax(240px, 1fr) 160px 160px 160px; }
.bulk-user-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border: 1px solid var(--line); border-bottom: 0; background: var(--paper); }
.bulk-user-actions strong { margin-inline-end: auto; color: var(--muted); font-size: 0.9rem; }
.check-control { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check-control input { width: 20px; height: 20px; accent-color: var(--primary); }
.import-update-control { align-items: flex-start; padding: 14px; border: 1px solid var(--line); background: var(--surface); }
.import-update-control span { display: grid; gap: 4px; }
.import-update-control small { color: var(--muted); }
select[multiple] { min-height: 108px; padding: 8px; }
select[multiple] option { padding: 8px; }
.essay-answer-field { display: grid; gap: 8px; }
.essay-answer-field span { font-weight: 700; }
.essay-answer-field textarea { width: 100%; min-height: 210px; resize: vertical; }
.essay-response { min-width: 220px; white-space: pre-wrap; line-height: 1.8; }
.rubric-note, .teacher-feedback { display: block; margin-top: 8px; padding: 8px; border-inline-start: 3px solid var(--gold); background: var(--surface); white-space: pre-wrap; }
.manual-grade-controls { display: grid; gap: 10px; min-width: 230px; }
.manual-grade-controls label { display: grid; gap: 5px; font-size: 0.86rem; font-weight: 700; }
.manual-grade-controls input, .manual-grade-controls textarea { width: 100%; }
.manual-grade-actions, .student-exam-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.manual-grade-actions { padding: 16px; border-top: 1px solid var(--line); }
.review-mode-note { padding: 10px 14px; border-inline-start: 4px solid var(--teal); background: var(--teal-soft); color: var(--ink); font-size: 0.72rem; font-weight: 700; }
.attempt-closed-reason { color: var(--red); }
.result-published { color: var(--green); font-weight: 700; }
.grade-center-table thead th, .section-performance-table thead th { border-bottom: 2px solid var(--teal); background: var(--teal-soft); color: var(--teal-dark); }

@media (max-width: 820px) {
  .user-toolbar { grid-template-columns: 1fr; }
  .bulk-user-actions { align-items: stretch; flex-direction: column; border-bottom: 1px solid var(--line); }
  .bulk-user-actions strong { margin: 0; }
  .student-exam-actions > .button, .manual-grade-actions > .button { width: 100%; }
  .permissions-grid { grid-template-columns: 1fr; }
}

/* 21st-inspired academic dashboard refinement — 2026-11 */
@media screen {
  :root {
    --page: #f4f6f7;
    --surface: #f7f9fa;
    --paper: #ffffff;
    --ink: #14232d;
    --muted: #61717c;
    --line: #dce4e8;
    --line-strong: #c7d2d8;
    --radius: 10px;
    --radius-small: 7px;
    --radius-large: 14px;
    --shadow: 0 14px 34px rgba(20, 35, 45, 0.09);
    --shadow-soft: 0 4px 16px rgba(20, 35, 45, 0.055);
  }

  html { scroll-behavior: smooth; }

  body {
    background: var(--page);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  ::selection { color: #fff; background: var(--teal); }

  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible {
    outline: 3px solid rgba(11, 75, 111, 0.24);
    outline: 3px solid color-mix(in srgb, var(--teal) 28%, transparent);
    outline-offset: 2px;
  }

  .skip-link {
    position: fixed;
    inset-block-start: 10px;
    inset-inline-start: 12px;
    z-index: 200;
    padding: 9px 14px;
    border-radius: var(--radius-small);
    color: #fff;
    background: var(--teal-dark);
    font-size: 0.78rem;
    font-weight: 800;
    transform: translateY(-160%);
  }

  .skip-link:focus { transform: translateY(0); }

  .auth-layout {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(430px, 0.88fr) minmax(520px, 1.12fr);
    background: var(--page);
  }

  .auth-brand {
    isolation: isolate;
    padding: clamp(36px, 5.5vw, 76px);
    background: var(--teal-dark);
  }

  .auth-brand,
  .auth-panel,
  .brand-lockup,
  .brand-lockup > div,
  .brand-copy,
  .brand-stats,
  .brand-stats div { min-width: 0; }

  .auth-brand::before {
    content: "";
    position: absolute;
    inset-inline-end: -150px;
    inset-block-end: 8%;
    z-index: -1;
    width: 420px;
    height: 420px;
    border: 64px solid rgba(255, 255, 255, 0.055);
    border-radius: 50%;
  }

  .auth-brand::after {
    height: 6px;
    background: var(--gold);
  }

  .brand-logo {
    width: 76px;
    height: 76px;
    padding: 9px;
    border-color: rgba(255, 255, 255, 0.34);
    border-radius: var(--radius-large);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  }

  .brand-lockup h1 {
    max-width: 570px;
    font-size: clamp(1.85rem, 3.1vw, 3.1rem);
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
  }

  .brand-lockup .eyebrow { color: #c7e6f1; }
  .brand-copy > p { max-width: 600px; color: #dce9ee; line-height: 1.9; }
  .brand-stats { border-color: rgba(255, 255, 255, 0.2); }
  .brand-stats div { padding: 18px 14px; border-inline-start: 1px solid rgba(255, 255, 255, 0.13); }
  .brand-stats div:first-child { border-inline-start: 0; }
  .brand-stats dt { color: #fff; }
  .brand-stats dd { color: #bfd1d8; }

  .auth-panel { padding: 40px; background: var(--page); }

  .auth-form {
    width: min(450px, 100%);
    padding: clamp(28px, 4vw, 42px);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--paper);
    box-shadow: var(--shadow);
  }

  .form-heading { margin-bottom: 28px; }
  .form-heading h2 { font-size: 1.7rem; letter-spacing: -0.02em; }
  .form-heading p { line-height: 1.8; }

  .field input,
  .field select,
  .field textarea,
  .toolbar input,
  .toolbar select {
    min-height: 46px;
    padding-inline: 13px;
    border-radius: var(--radius-small);
    box-shadow: 0 1px 0 rgba(20, 35, 45, 0.02);
  }

  .field input:hover,
  .field select:hover,
  .field textarea:hover,
  .toolbar input:hover,
  .toolbar select:hover { border-color: #aebdc5; }

  .field input:focus,
  .field select:focus,
  .field textarea:focus,
  .toolbar input:focus,
  .toolbar select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 14%, transparent);
  }

  .button {
    min-height: 42px;
    padding: 8px 16px;
    border-radius: var(--radius-small);
    box-shadow: none;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
  }

  .button-primary { box-shadow: 0 5px 12px rgba(11, 75, 111, 0.2); box-shadow: 0 5px 12px color-mix(in srgb, var(--teal) 20%, transparent); }
  .button-primary:hover { box-shadow: 0 7px 16px rgba(11, 75, 111, 0.25); box-shadow: 0 7px 16px color-mix(in srgb, var(--teal) 25%, transparent); }
  .button-quiet:hover { border-color: var(--line-strong); background: var(--surface); }
  .button-danger:hover { border-color: #d89b95; background: #ffe7e4; }

  .language-toggle {
    min-height: 40px;
    padding-inline: 14px;
    border-radius: var(--radius-small);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
  }

  .app-shell {
    grid-template-columns: 264px minmax(0, 1fr);
    grid-template-rows: 68px minmax(0, 1fr);
    background: var(--page);
  }

  .topbar {
    min-height: 68px;
    padding-inline: 24px;
    border-bottom-color: var(--line);
    background: var(--paper);
    box-shadow: 0 1px 0 rgba(20, 35, 45, 0.02);
  }

  .topbar-brand { gap: 11px; font-size: 0.88rem; }
  .topbar-brand img { width: 42px; height: 42px; padding: 3px; }
  .topbar-user { gap: 12px; }
  .topbar-user > div { padding-inline: 12px; border-inline-end: 1px solid var(--line); }
  .topbar-user strong { font-size: 0.78rem; }
  .topbar-user span { font-size: 0.65rem; }

  .sidebar {
    top: 68px;
    height: calc(100vh - 68px);
    padding: 20px 12px;
    border-color: #243f4d;
    background: #142c39;
  }

  .nav-list { gap: 6px; }

  .nav-item {
    position: relative;
    min-height: 46px;
    gap: 12px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #cbd7dd;
    font-size: 0.78rem;
    transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
  }

  .nav-item:hover { color: #fff; border-color: rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.06); }
  .nav-item.is-active { color: #fff; border-color: rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.12); }
  .nav-item.is-active::after {
    content: "";
    position: absolute;
    inset-block: 10px;
    inset-inline-start: -12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--gold);
  }

  [dir="ltr"] .nav-item.is-active::after { border-radius: 3px 0 0 3px; }

  .nav-mark {
    width: 9px;
    height: 9px;
    border-width: 1px;
    border-radius: 3px;
    opacity: 0.8;
  }

  .nav-item.is-active .nav-mark { border-color: var(--gold); background: var(--gold); }

  .sidebar-note {
    margin-inline: 4px;
    padding: 16px 10px 4px;
    border-color: rgba(255, 255, 255, 0.13);
  }

  .sidebar-note strong { color: #e7eef1; }
  .sidebar-note span { color: #a7bac3; line-height: 1.75; }

  .workspace { padding: 32px clamp(22px, 3.2vw, 48px) 72px; }
  .view { max-width: 1500px; }

  .page-header {
    min-height: 76px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
  }

  .page-header h2 { color: #102531; font-size: clamp(1.35rem, 2vw, 1.7rem); letter-spacing: -0.025em; }
  .page-header p:not(.section-kicker) { max-width: 760px; font-size: 0.78rem; line-height: 1.8; }
  .section-kicker, .eyebrow { font-size: 0.7rem; letter-spacing: 0.01em; }

  .metric-grid { gap: 16px; }

  .metric-card {
    position: relative;
    min-height: 118px;
    padding: 20px;
    overflow: hidden;
    border-color: var(--line);
    border-top-width: 1px;
    border-inline-start: 4px solid var(--teal);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
  }

  .metric-card:nth-child(2) { border-inline-start-color: var(--gold); border-top-color: var(--line); }
  .metric-card:nth-child(3) { border-inline-start-color: var(--blue); border-top-color: var(--line); }
  .metric-card:nth-child(4) { border-inline-start-color: var(--green); border-top-color: var(--line); }
  .metric-card::after {
    content: "";
    position: absolute;
    inset-block-start: 18px;
    inset-inline-end: 18px;
    width: 8px;
    height: 8px;
    border: 3px solid var(--teal-soft);
    border-radius: 50%;
  }

  .metric-card span { font-size: 0.72rem; font-weight: 700; }
  .metric-card strong { margin-top: 14px; color: #102531; font-size: 1.85rem; font-variant-numeric: tabular-nums; }

  .overview-grid { gap: 20px; margin-top: 20px; }

  .panel {
    border-color: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
  }

  .panel-heading { min-height: 76px; padding: 16px 20px; }
  .panel-heading h3 { color: #17313f; font-size: 0.96rem; }
  .panel-heading p { line-height: 1.65; }

  .stack-item { min-height: 65px; padding: 14px 20px; transition: background 0.12s ease; }
  .stack-item:hover { background: #f8fafb; }
  .stack-item strong { color: #1c303b; }
  .stack-value { font-variant-numeric: tabular-nums; }

  .tabs { gap: 18px; scrollbar-width: thin; }
  .tab { min-height: 45px; padding-inline: 2px; }

  .toolbar,
  .results-toolbar,
  .bulk-user-actions {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 2px 8px rgba(20, 35, 45, 0.025);
  }

  .toolbar { margin-bottom: 16px; }

  .table-wrap {
    border-color: var(--line);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(20, 35, 45, 0.03);
    scrollbar-color: #b5c1c7 transparent;
    scrollbar-width: thin;
  }

  th, td { padding: 14px 16px; }
  th {
    height: 48px;
    color: #40535e;
    background: #f1f5f7;
    font-size: 0.67rem;
    letter-spacing: 0.005em;
  }

  tbody tr { transition: background 0.12s ease; }
  tbody tr:hover { background: #f8fafb; }
  td { color: #263943; }

  .bank-chip,
  .exam-card,
  .student-exam-card,
  .analysis-summary-item,
  .analysis-chart-card,
  .analysis-readiness-card,
  .result-report-metric {
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(20, 35, 45, 0.035);
  }

  .bank-chip { min-height: 182px; padding: 17px; border-top-width: 1px; border-inline-start: 4px solid var(--teal); }
  .bank-chip.is-archived { border-inline-start-color: var(--gold); }

  .exam-card { padding: 20px 22px; border-right-width: 1px; border-inline-start: 4px solid var(--teal); }
  .exam-card:hover, .student-exam-card:hover { border-color: #9dbbc9; border-color: color-mix(in srgb, var(--teal) 34%, var(--line)); box-shadow: 0 8px 22px rgba(20, 35, 45, 0.07); }

  .form-panel,
  .compact-form,
  .compact-form-wide { overflow: hidden; }

  .form-grid { gap: 18px; padding: 22px; }
  .form-actions { background: #fafcfc; }

  .check-setting { border-radius: var(--radius-small); background: #f8fafb; }
  .check-setting:has(input:checked) { border-color: #91b6c7; border-color: color-mix(in srgb, var(--teal) 38%, var(--line)); background: var(--teal-soft); }

  .multi-select-menu,
  .site-permissions,
  .question-picker { border-radius: var(--radius); }

  .badge { min-height: 27px; padding-inline: 9px; border-radius: 6px; }
  .empty-state { min-height: 130px; display: grid; place-items: center; }

  .student-exam-card { padding: 22px; border-top-width: 1px; border-inline-start: 4px solid var(--teal); }
  .student-exam-card.is-resumable { border-inline-start-color: var(--gold); }

  .dialog { border: 1px solid var(--line); border-radius: var(--radius-large); box-shadow: 0 24px 72px rgba(13, 28, 37, 0.24); }
  .dialog::backdrop { background: rgba(12, 27, 36, 0.58); }

  .toast { border-radius: var(--radius); box-shadow: var(--shadow); }

  .sticky-actions {
    border-top: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 -8px 20px rgba(20, 35, 45, 0.05);
  }

  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 8px; background: #aebbc1; background-clip: padding-box; }
  *::-webkit-scrollbar-thumb:hover { background-color: #8fa0a8; }
}

@media screen and (max-width: 1100px) {
  .app-shell { grid-template-columns: 238px minmax(0, 1fr); }
  .metric-card { min-height: 108px; }
}

@media screen and (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { min-height: 250px; padding: 28px; }
  .auth-brand::before { width: 280px; height: 280px; border-width: 42px; }
  .brand-copy { margin-top: 38px; }
  .auth-panel { padding: 28px 18px 48px; }
  .auth-form { padding: 28px; }

  .app-shell { grid-template-columns: 1fr; grid-template-rows: 64px auto minmax(0, 1fr); }
  .topbar { min-height: 64px; padding-inline: 14px; }
  .topbar-user > div { padding-inline: 8px; }

  .sidebar {
    top: 64px;
    height: auto;
    padding: 8px 10px;
    background: #142c39;
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar { display: none; }
  .nav-list { gap: 7px; }
  .nav-item { min-height: 41px; padding: 8px 12px; border-color: rgba(255, 255, 255, 0.08); }
  .nav-item.is-active::after { display: none; }
  .workspace { padding: 24px 16px 56px; }
  .page-header { min-height: 66px; }
}

@media screen and (max-width: 600px) {
  .language-toggle { inset-block-end: 12px; inset-inline-start: 12px; min-width: 70px; }
  .auth-brand { min-height: 225px; }
  .brand-lockup { align-items: flex-start; gap: 13px; }
  .brand-lockup > div { flex: 1 1 auto; }
  .brand-logo { width: 58px; height: 58px; }
  .brand-lockup h1 { font-size: 1.3rem; }
  .brand-stats div { padding: 13px 8px; }
  .auth-panel { padding-inline: 12px; }
  .auth-form { max-width: 100%; padding: 24px 20px; }

  .topbar-brand img { width: 38px; height: 38px; }
  .topbar-user > div { max-width: 34vw; border: 0; }
  .topbar-user strong { font-size: 0.7rem; }
  .topbar-user .button { min-height: 36px; padding-inline: 9px; }

  .page-header { align-items: stretch; flex-direction: column; gap: 12px; }
  .page-header > .button,
  .page-header > .header-actions { align-self: stretch; }
  .page-header > .button { width: 100%; }
  .header-actions .button { flex: 1; }

  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 102px; padding: 16px 14px; }
  .metric-card strong { margin-top: 12px; font-size: 1.45rem; }
  .metric-card::after { inset-block-start: 14px; inset-inline-end: 14px; }

  .toolbar,
  .results-toolbar,
  .bulk-user-actions { padding: 12px; }

  .panel-heading { align-items: flex-start; min-height: 68px; padding: 14px 16px; }
  .stack-item { padding: 13px 16px; }
  .bank-chip, .exam-card, .student-exam-card { padding: 17px; }
}

@media screen and (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }
  .topbar-user { gap: 5px; }
  .topbar-user > div { max-width: 31vw; padding: 0; }
}

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