:root {
  --ink: #15233f;
  --ink-soft: #2c3b57;
  --muted: #66758f;
  --blue: #1f5cf0;
  --blue-dark: #1546c4;
  --blue-soft: #eaf0ff;
  --line: #d9e2f0;
  --line-strong: #c5d2e6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --bg: #eef3fa;
  --danger: #b42318;
  --success: #067647;
  --shadow-sm: 0 1px 2px #15233f0a, 0 8px 24px #15233f0c;
  --shadow-md: 0 12px 40px #15233f12;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --space: clamp(16px, 3vw, 28px);
  --page-max: 1120px;
  --header-h: 64px;
  --touch: 44px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Plus Jakarta Sans", system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}

html:has(.workspace-body) {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, #d9e7ff 0, transparent 28rem),
    radial-gradient(circle at 100% 100%, #d7f0f4 0, transparent 26rem),
    var(--bg);
  font: 400 15px/1.5 var(--font);
}

body.workspace-body {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.auth-body {
  background: var(--surface);
}

img, svg, video { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -0.03em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.eyebrow {
  display: inline-block;
  color: #4d6aa0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subtle { color: var(--muted); font-size: 0.95rem; }
.required { color: var(--danger); }
.hint { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.78rem; }
.error-text { display: block; margin-top: 0.35rem; color: var(--danger); font-size: 0.78rem; }
.field-hint { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.78rem; }

.checkbox-grid {
  display: grid;
  gap: 0.45rem;
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  background: #fff;
}

.checkbox-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.checkbox-grid li {
  margin: 0;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.checkbox-grid input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  font: 700 1.05rem/1 var(--display);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.55rem;
  color: var(--blue);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px #ffffff80;
}
.brand-text { min-width: 0; }

.text-link,
.helper a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}
.text-link:hover,
.helper a:hover { text-decoration: underline; }

.primary-button,
.ghost-button {
  display: inline-flex;
  min-height: var(--touch);
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.primary-button[hidden],
.ghost-button[hidden] {
  display: none !important;
}
.primary-button {
  width: 100%;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #2f6af7, #1c4fd4);
  box-shadow: 0 10px 22px #1c4fd433;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px #1c4fd44d; }
.primary-button:active { transform: translateY(0); }
.primary-button span { font-size: 1.1rem; line-height: 1; }
.ghost-button {
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: #fff;
  white-space: nowrap;
}
.ghost-button:hover { border-color: #9db4e0; background: var(--blue-soft); color: var(--blue-dark); }

.notice {
  margin: 1rem 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  font-size: 0.88rem;
}
.notice.error { color: var(--danger); background: #fef3f2; border-color: #fecdca; }
.notice.success { color: var(--success); background: #ecfdf3; border-color: #abefc6; }
.notice.warning { color: #93370d; background: #fffaeb; border-color: #fedf89; }

/* ---------- Auth shells ---------- */
.auth-shell {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(280px, 42%) minmax(0, 1fr);
}
.auth-shell-wide { grid-template-columns: minmax(260px, 36%) minmax(0, 1fr); }

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 5vw, 4.5rem);
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, #6eb0ff 0, transparent 26%),
    radial-gradient(circle at 10% 85%, #1fd0c8 0, transparent 32%),
    linear-gradient(155deg, #072f84 0%, #1558e8 48%, #0b3ea8 100%);
}
.brand-panel::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 42%, #ffffff12 52%, transparent 62%);
  content: "";
  animation: sheen-drift 12s ease-in-out infinite;
  pointer-events: none;
}
.brand-panel::after {
  position: absolute;
  right: -8rem;
  bottom: -9rem;
  width: 22rem;
  height: 22rem;
  border: 1px solid #ffffff38;
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 4rem #ffffff0c, 0 0 0 8rem #ffffff08;
  pointer-events: none;
  animation: orbit-soft 18s linear infinite;
}
.brand-panel .brand-mark { color: var(--blue); }
.brand-panel .eyebrow { color: #b7d3ff; }
.brand-hero {
  position: relative;
  z-index: 1;
  gap: 0.7rem;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
}
.brand-hero .brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  font-size: 1rem;
}
.brand-name { letter-spacing: -0.04em; }
.brand-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
  max-width: 28rem;
  animation: rise-in 0.45s ease both;
}
.brand-copy h1 {
  margin: 0.8rem 0;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
}
.brand-copy p {
  max-width: 24rem;
  color: #d5e6ff;
  font-size: 1rem;
}
.trust-note {
  position: relative;
  z-index: 1;
  color: #c6dcff;
  font-size: 0.85rem;
}
.trust-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: #7dffd2;
  box-shadow: 0 0 0 4px #7dffd224;
  vertical-align: middle;
}

.auth-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 34%),
    radial-gradient(circle at 0% 100%, #d9f3f1 0, transparent 28%),
    linear-gradient(180deg, #f4f7fc 0%, #eef3fa 100%);
}
.auth-panel::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(#15233f08 1px, transparent 1px),
    linear-gradient(90deg, #15233f08 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  content: "";
  pointer-events: none;
  opacity: 0.4;
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  animation: rise-in 0.4s ease both;
}
.auth-card-wide { width: min(100%, 36rem); }
.auth-card-elevated {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid #dfe7f4;
  border-radius: calc(var(--radius-lg) + 2px);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px #15233f12;
  backdrop-filter: blur(10px);
}
.mobile-brand {
  display: none;
  margin-bottom: 1.5rem;
  font: 700 1.05rem var(--display);
}
.mobile-brand .brand-mark {
  display: inline-grid;
  margin-right: 0.5rem;
  color: #fff;
  background: var(--blue);
}

.form-page-heading { margin-bottom: 0.25rem; }
.form-page-heading h1,
.form-page-heading h2 {
  margin: 0.4rem 0 0.45rem;
  font-size: clamp(1.55rem, 2.5vw, 1.9rem);
}
.auth-form,
.registration-form { margin-top: 1.35rem; }
.portal-form { margin-top: 1rem; }
.portal-form[hidden] { display: none !important; }

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: center;
  justify-content: center;
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid #e8eef7;
}
.auth-footer-link {
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}
.auth-footer-link:hover { text-decoration: underline; }
.auth-footer-sep {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: #b7c6df;
}

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
textarea { min-height: 6rem; resize: vertical; }
input:hover,
select:hover,
textarea:hover { border-color: var(--line-strong); }
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fcfdff;
  box-shadow: 0 0 0 4px #1f5cf018;
  outline: 0;
}
input[type="file"] {
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  background: var(--surface-soft);
}
.uppercase-input { text-transform: uppercase; }
.is-uppercase { text-transform: uppercase; }
input[type="password"] { text-transform: none; }

.password-input { position: relative; }
.password-input input { padding-right: 3.25rem; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 0.55rem;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
}
.password-toggle:hover { color: var(--blue); background: var(--blue-soft); }
.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

.phone-input {
  display: grid;
  grid-template-columns: minmax(8.5rem, 0.95fr) auto minmax(0, 1.35fr);
  gap: 0.45rem;
  align-items: stretch;
}
.phone-country {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--touch);
  padding: 0 0.55rem 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.phone-flag {
  width: 1.75rem;
  height: 1.25rem;
  object-fit: cover;
  border-radius: 0.2rem;
  box-shadow: inset 0 0 0 1px #15233f22;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}
.phone-country {
  position: relative;
  display: grid;
  align-items: stretch;
  min-height: var(--touch);
  background: var(--surface);
}
.phone-country-trigger {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--touch);
  border: 0;
  padding: 0 0.55rem;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.phone-country-name {
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phone-country-caret {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}
.phone-country.is-open .phone-country-caret {
  transform: rotate(225deg) translateY(-1px);
}
.phone-country-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 0.15rem;
  width: min(18.5rem, 78vw);
  max-height: 16rem;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  list-style: none;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.phone-country-menu[hidden] {
  display: none !important;
}
.phone-country-menu li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  border-radius: 0.55rem;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
}
.phone-country-menu li:hover,
.phone-country-menu li[aria-selected="true"] {
  background: var(--blue-soft);
}
.phone-country-menu img {
  width: 1.75rem;
  height: 1.25rem;
  object-fit: cover;
  border-radius: 0.2rem;
  box-shadow: inset 0 0 0 1px #15233f22;
}
.phone-option-name {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}
.phone-option-dial {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.phone-dial {
  display: grid;
  place-items: center;
  min-width: 3.4rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.phone-national {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--ink);
  background: var(--surface);
}
.phone-national:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px #1f5cf018;
  outline: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 0.15rem 0 1.1rem;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.checkbox input {
  width: 1rem;
  min-height: 1rem;
  accent-color: var(--blue);
}
.helper {
  margin-top: 1.1rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}
.helper + .helper { margin-top: 0.55rem; }

.portal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 1.2rem 0 0.15rem;
  padding: 0.3rem;
  border: 1px solid #dfe7f4;
  border-radius: var(--radius-md);
  background: #f2f6fc;
}
.portal-tab {
  min-height: 2.55rem;
  border: 0;
  border-radius: calc(var(--radius-sm) - 1px);
  color: var(--muted);
  background: transparent;
  font: 700 0.86rem var(--font);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.portal-tab.active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.1rem;
}
.span-two { grid-column: span 2; }

/* ---------- Workspace shell ---------- */
.app-shell,
.register-shell {
  min-height: 100dvh;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.workspace-body {
  background: #eef2f8;
}

.workspace {
  display: grid;
  grid-template-columns: 16.5rem minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.workspace-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  padding: 1.1rem 0.9rem 1rem;
  border-right: 1px solid #d9e3f2;
  background:
    linear-gradient(180deg, #0d3fad 0%, #154fd6 42%, #0f3f9f 100%);
  color: #fff;
  z-index: 30;
  overflow: hidden;
}

.workspace-sidebar-top,
.workspace-sidebar-foot {
  flex: 0 0 auto;
}

.workspace-sidebar-top {
  display: grid;
  gap: 0.2rem;
}

.workspace-sidebar-brand {
  margin-bottom: 0.55rem;
}
.workspace-sidebar-brand .brand {
  width: 100%;
  padding: 0.35rem 0.45rem;
  color: #fff;
}
.workspace-sidebar-brand .brand-mark {
  color: var(--blue);
  background: #fff;
  box-shadow: none;
}
.workspace-sidebar-brand .brand-text {
  font-size: 1.05rem;
}

.workspace-nav-dashboard {
  width: 100%;
}

.workspace-nav-student-search {
  width: 100%;
  margin-top: 0.2rem;
}

.workspace-nav {
  display: grid;
  gap: 0.3rem;
  flex: 1 1 auto;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 0.1rem;
}
.workspace-nav-label {
  margin: 0.35rem 0.55rem 0.45rem;
  color: #b7d0ff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.workspace-nav-empty {
  margin: 0 0.55rem;
  color: #b7d0ff;
}
.workspace-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.55rem;
  border-radius: 0.7rem;
  padding: 0.45rem 0.65rem;
  color: #dce8ff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.workspace-nav-link:hover {
  color: #fff;
  background: #ffffff18;
}
.workspace-nav-link.is-active {
  color: #fff;
  background: #ffffff24;
  box-shadow: inset 0 0 0 1px #ffffff2e;
}
.workspace-nav-link.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
  pointer-events: none;
}
.workspace-nav-icon {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  flex: 0 0 auto;
}
.workspace-nav-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}
.workspace-nav-badge {
  margin-left: auto;
  border: 1px solid #ffffff30;
  border-radius: 0.4rem;
  padding: 0.12rem 0.4rem;
  color: #d7e6ff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workspace-sidebar-foot {
  display: grid;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #ffffff22;
}
.workspace-role-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  border-radius: 0.65rem;
  padding: 0.65rem 0.7rem;
  background: #ffffff14;
  color: #e7efff;
  font-size: 0.8rem;
  font-weight: 700;
}
.workspace-role-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #7dffd2;
  box-shadow: 0 0 0 4px #7dffd220;
}
.workspace-sidebar-foot .workspace-nav-link {
  color: #dce8ff;
}
.workspace-nav-signout:hover {
  color: #fff;
  background: #ff5a5a33;
}

button.workspace-nav-action {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

button.workspace-nav-action.workspace-nav-action-danger {
  color: #ffb4ab;
}

button.workspace-nav-action.workspace-nav-action-danger:hover {
  color: #fff;
  background: #ff5a5a33;
}

.primary-button.is-danger {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

.primary-button.is-danger:hover {
  background: #912018;
  border-color: #912018;
}

.teacher-dash-action.is-danger {
  color: #b42318;
  background: #fef3f2;
}

.teacher-dash-action.is-danger:hover {
  background: #fee4e2;
}

.checkbox-field {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0.35rem 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.settings-panel {
  display: grid;
  gap: 1rem;
  max-width: 34rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.settings-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.settings-table-panel {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.settings-table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.settings-table th,
.settings-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e8eef8;
  vertical-align: middle;
  white-space: nowrap;
}

.settings-table td:has(.settings-stack) {
  white-space: normal;
}

.settings-table td:nth-child(4),
.settings-table th:nth-child(4) {
  white-space: normal;
  min-width: 10rem;
  max-width: 18rem;
}

.settings-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #f7f9fc;
}

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

.settings-table tbody tr:hover td {
  background: #f8fafc;
}

.allocation-level {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.allocation-table {
  min-width: 36rem;
}
.allocation-table th,
.allocation-table td {
  white-space: nowrap;
}
.allocation-table td:has(.settings-stack) {
  white-space: normal;
  min-width: 10rem;
}
.allocation-table select {
  min-width: 12.5rem;
  width: auto;
  min-height: 2.55rem;
  padding: 0.45rem 0.7rem;
}
.allocation-table-supervisors {
  min-width: 48rem;
}
.allocation-table-supervisors thead th[colspan] {
  text-align: center;
}
.allocation-teacher-name {
  display: inline-block;
  font-weight: 700;
}
.allocation-actions {
  display: flex;
  justify-content: flex-end;
}

.analytics-page {
  display: grid;
  gap: 1.25rem;
}
.analytics-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}
.analytics-stat {
  display: grid;
  gap: 0.4rem;
  align-content: start;
  min-width: 0;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.analytics-stat:hover {
  border-color: #9db4e0;
  transform: translateY(-1px);
}
.analytics-stat strong {
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.analytics-meter {
  display: block;
  height: 0.4rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef8;
}
.analytics-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6af7, #1c4fd4);
}
.analytics-meter.is-ok > span { background: #12b76a; }
.analytics-meter.is-warn > span { background: #dc6803; }
.analytics-meter.is-bad > span { background: #f04438; }
.analytics-section {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}
.analytics-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  align-items: start;
}
.analytics-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr));
  gap: 0.85rem;
}
.analytics-card {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 1.1rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.analytics-card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: flex-start;
  justify-content: space-between;
}
.analytics-card-header h3 {
  margin: 0.2rem 0 0.2rem;
  font-size: 1.05rem;
}
.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.analytics-metrics > div {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  background: #f7f9fc;
}
.analytics-metrics strong {
  font-size: 0.95rem;
}
.analytics-list {
  display: grid;
  gap: 0.6rem;
}
.analytics-row {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  background: #fff;
}
.analytics-row-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}
.analytics-row .settings-stack {
  min-width: 0;
  max-width: none;
}
.analytics-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.analytics-pills li {
  max-width: 100%;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  color: var(--ink-soft);
  background: #f0f4fb;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.status-pill.is-warn {
  color: #b54708;
  background: #fffaeb;
}
.analytics-period-list {
  margin: 0;
}

.generation-level-list {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 0.25rem;
}
.generation-level-group {
  display: grid;
  gap: 0.55rem;
}
.generation-level {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  border: 1px solid #dde6f4;
  border-radius: 0.8rem;
  padding: 0.8rem 0.9rem;
  background: #fff;
  cursor: pointer;
}
.generation-level span {
  display: grid;
  gap: 0.15rem;
}
.generation-level input {
  width: 1.1rem;
  min-height: 1.1rem;
  margin-top: 0.2rem;
}
.generation-level.is-viable {
  background: #ecfdf3;
  border-color: #abefc6;
}
.generation-level.is-blocked {
  background: #f8fafc;
  cursor: not-allowed;
}
.generation-level.is-blocked input {
  accent-color: #98a2b3;
}
.generation-level-reason {
  color: var(--muted);
  font-size: 0.8rem;
}
.generation-level.is-viable .generation-level-reason {
  color: #067647;
}

.generation-calendar {
  display: grid;
  gap: 0.9rem;
  margin: 1rem 0 0.25rem;
}
.generation-calendar .field small {
  display: block;
  margin-top: 0.35rem;
}
.generation-calendar output {
  display: block;
  min-height: 2.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line, #dde6f4);
  border-radius: 0.7rem;
  background: #f8fafc;
}
.generation-step[hidden] {
  display: none;
}

.app-modal-dialog-generation {
  display: flex;
  flex-direction: column;
  width: min(42rem, calc(100vw - 1.5rem));
  max-height: min(92dvh, 54rem);
  overflow: hidden;
}

.app-modal-dialog-generation .app-modal-header {
  flex: 0 0 auto;
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid #e8eef8;
}

.app-modal-dialog-generation .app-modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.app-modal-dialog-generation .generation-step:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.app-modal-dialog-generation .generation-step > .subtle,
.app-modal-dialog-generation .generation-step > .notice,
.app-modal-dialog-generation .generation-step > .settings-empty {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.85rem 1.25rem 0.5rem;
}

.app-modal-dialog-generation .generation-level-list,
.app-modal-dialog-generation .generation-calendar {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0.35rem 1.25rem;
  max-height: none;
}

.app-modal-dialog-generation .generation-step .app-modal-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.9rem 1.25rem calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid #e8eef8;
  background: #fff;
}

.exam-timetable-generation-page .exam-tool-block-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.exam-timetable-generation-page .exam-tool-block-head p {
  overflow-wrap: anywhere;
}

.exam-timetable-generation-page .exam-tool-panel-head > div {
  min-width: 0;
}

.exam-timetable-generation-page .schedule-timetable-wrap.is-scrollable-x {
  max-width: 100%;
}

/* Exam record management modals */
.exam-manage-modal .exam-manage-backdrop {
  background: linear-gradient(160deg, #0b1b36b8 0%, #1f5cf066 48%, #0b1b36cc 100%);
  backdrop-filter: blur(8px);
}

.exam-manage-modal.is-open .exam-manage-dialog {
  animation: exam-manage-dialog-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes exam-manage-dialog-in {
  from {
    opacity: 0;
    transform: translateY(1.25rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.exam-manage-dialog {
  display: flex;
  flex-direction: column;
  width: min(100%, 34rem);
  max-height: min(92dvh, 44rem);
  overflow: hidden;
  border: 1px solid #ffffffcc;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow:
    0 1px 2px #15233f0a,
    0 22px 50px #15233f24,
    0 0 0 1px #1f5cf00f inset;
}

.exam-manage-dialog-edit {
  width: min(100%, 40rem);
  max-height: min(92dvh, 52rem);
}

.exam-manage-dialog-accent {
  height: 0.28rem;
  flex: 0 0 auto;
}

.exam-manage-dialog-accent.is-edit {
  background: linear-gradient(90deg, #1f5cf0, #5b8dff, #7dffd2);
}

.exam-manage-dialog-accent.is-status {
  background: linear-gradient(90deg, #7c3aed, #1f5cf0, #22c55e);
}

.exam-manage-dialog-accent.is-deadline {
  background: linear-gradient(90deg, #0ea5e9, #1f5cf0, #6366f1);
}

.exam-manage-dialog-accent.is-delete {
  background: linear-gradient(90deg, #f97316, #ef4444, #b42318);
}

.exam-manage-dialog-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.85rem 1rem;
  align-items: start;
  padding: 1.15rem 1.25rem 0.9rem;
  border-bottom: 1px solid #e7eef8;
}

.exam-manage-dialog-icon {
  display: grid;
  place-items: center;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 1rem;
  box-shadow: inset 0 1px 0 #ffffffaa;
}

.exam-manage-dialog-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.exam-manage-dialog-icon.is-edit {
  color: #1f5cf0;
  background: linear-gradient(145deg, #eef4ff, #dce8ff);
}

.exam-manage-dialog-icon.is-status {
  color: #6d28d9;
  background: linear-gradient(145deg, #f5f3ff, #ede9fe);
}

.exam-manage-dialog-icon.is-deadline {
  color: #0369a1;
  background: linear-gradient(145deg, #ecfeff, #dbeafe);
}

.exam-manage-dialog-icon.is-delete {
  color: #b42318;
  background: linear-gradient(145deg, #fff1f0, #fee4e2);
}

.exam-manage-dialog-heading {
  min-width: 0;
}

.exam-manage-dialog-kicker {
  margin: 0 0 0.2rem;
  color: #5d7399;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.exam-manage-dialog-heading h2 {
  margin: 0 0 0.3rem;
  font: 800 1.18rem/1.2 var(--display);
  color: var(--ink);
  letter-spacing: -0.02em;
}

.exam-manage-dialog-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.exam-manage-dialog-close {
  margin-top: 0.1rem;
  border: 1px solid #e4ebf7;
  background: #ffffffb8;
}

.exam-manage-dialog-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.exam-manage-dialog-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 1rem 1.25rem 0.35rem;
}

.exam-manage-dialog-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.95rem 1.25rem calc(0.95rem + env(safe-area-inset-bottom));
  border-top: 1px solid #e7eef8;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.exam-manage-section + .exam-manage-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #dbe5f4;
}

.exam-manage-section-title {
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exam-manage-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.exam-level-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.55rem;
}

.exam-level-chip {
  display: grid;
  gap: 0.12rem;
  min-height: 3.4rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #d7e3f5;
  border-radius: 0.9rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.exam-level-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.exam-level-chip span {
  font: 750 0.82rem/1.2 var(--display);
  color: var(--ink);
}

.exam-level-chip small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.exam-level-chip:has(input:checked) {
  border-color: #9db4e0;
  background: linear-gradient(145deg, #f7faff, #eef4ff);
  box-shadow: 0 8px 18px #1f5cf014;
  transform: translateY(-1px);
}

.exam-manage-current-pill {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.9rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid #dce6f5;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exam-manage-current-pill strong {
  color: var(--blue-dark);
  font-size: 0.76rem;
}

.exam-status-grid {
  display: grid;
  gap: 0.65rem;
}

.exam-status-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border: 2px solid #dde6f4;
  border-radius: 1rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

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

.exam-status-card-indicator {
  position: relative;
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  border: 2px solid #c5d2e6;
  border-radius: 50%;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.exam-status-card-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.42rem;
  height: 0.72rem;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -58%) rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}

.exam-status-card-icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.8rem;
  font: 800 0.62rem/1 var(--display);
  letter-spacing: 0.04em;
}

.exam-status-card-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.exam-status-card-copy strong {
  font: 750 0.9rem/1.2 var(--display);
  color: var(--ink);
}

.exam-status-card-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.exam-status-card.is-in-session .exam-status-card-icon {
  color: #1d4ed8;
  background: #eff6ff;
}

.exam-status-card.is-marking .exam-status-card-icon {
  color: #b45309;
  background: #fffbeb;
}

.exam-status-card.is-analysing .exam-status-card-icon {
  color: #6d28d9;
  background: #f5f3ff;
}

.exam-status-card.is-published .exam-status-card-icon {
  color: #067647;
  background: #ecfdf3;
}

.exam-status-card.is-selected,
.exam-status-card:has(input:checked) {
  border-color: #1f5cf0;
  box-shadow: 0 12px 28px #1f5cf020;
  transform: translateY(-1px);
}

.exam-status-card.is-selected .exam-status-card-indicator,
.exam-status-card:has(input:checked) .exam-status-card-indicator {
  border-color: #1f5cf0;
  background: #1f5cf0;
  box-shadow: 0 0 0 3px #1f5cf022;
}

.exam-status-card.is-selected .exam-status-card-indicator::after,
.exam-status-card:has(input:checked) .exam-status-card-indicator::after {
  transform: translate(-50%, -58%) rotate(45deg) scale(1);
}

.exam-status-card.is-in-session.is-selected,
.exam-status-card.is-in-session:has(input:checked) {
  border-color: #1d4ed8;
  background: linear-gradient(145deg, #f7faff, #eef4ff);
  box-shadow: 0 12px 28px #1f5cf018;
}

.exam-status-card.is-in-session.is-selected .exam-status-card-indicator,
.exam-status-card.is-in-session:has(input:checked) .exam-status-card-indicator {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.exam-status-card.is-marking.is-selected,
.exam-status-card.is-marking:has(input:checked) {
  border-color: #d97706;
  background: linear-gradient(145deg, #fffdf5, #fff7e6);
  box-shadow: 0 12px 28px #f59e0b18;
}

.exam-status-card.is-marking.is-selected .exam-status-card-indicator,
.exam-status-card.is-marking:has(input:checked) .exam-status-card-indicator {
  border-color: #d97706;
  background: #d97706;
}

.exam-status-card.is-analysing.is-selected,
.exam-status-card.is-analysing:has(input:checked) {
  border-color: #7c3aed;
  background: linear-gradient(145deg, #faf5ff, #f3e8ff);
  box-shadow: 0 12px 28px #7c3aed18;
}

.exam-status-card.is-analysing.is-selected .exam-status-card-indicator,
.exam-status-card.is-analysing:has(input:checked) .exam-status-card-indicator {
  border-color: #7c3aed;
  background: #7c3aed;
}

.exam-status-card.is-published.is-selected,
.exam-status-card.is-published:has(input:checked) {
  border-color: #16a34a;
  background: linear-gradient(145deg, #f3fcf7, #ecfdf3);
  box-shadow: 0 12px 28px #16a34a18;
}

.exam-status-card.is-published.is-selected .exam-status-card-indicator,
.exam-status-card.is-published:has(input:checked) .exam-status-card-indicator {
  border-color: #16a34a;
  background: #16a34a;
}

.exam-deadline-panel {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid #d7e3f5;
  border-radius: 1rem;
  background:
    radial-gradient(circle at 0% 0%, #dbeafe 0, transparent 42%),
    linear-gradient(145deg, #ffffff, #f5f9ff);
}

.exam-deadline-panel-copy {
  display: grid;
  gap: 0.15rem;
}

.exam-deadline-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exam-deadline-panel-copy strong {
  font: 800 1rem/1.25 var(--display);
  color: var(--ink);
}

.exam-deadline-panel-copy span {
  color: var(--muted);
  font-size: 0.8rem;
}

.exam-deadline-input-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.2rem 0.85rem 0.2rem 0.2rem;
  border: 1px solid #d5deec;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: inset 0 1px 0 #ffffffcc;
}

.exam-deadline-input-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.7rem;
  color: #0369a1;
  background: #ecfeff;
}

.exam-deadline-input-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.exam-deadline-input-wrap input {
  width: 100%;
  min-height: 2.6rem;
  border: 0;
  background: transparent;
  padding: 0;
}

.exam-manage-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.85rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #e4ebf7;
  border-radius: 0.95rem;
  background: #fff;
  cursor: pointer;
}

.exam-manage-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.exam-manage-toggle-track {
  position: relative;
  width: 2.5rem;
  height: 1.45rem;
  border-radius: 999px;
  background: #d7e2f3;
  transition: background 0.15s ease;
}

.exam-manage-toggle-track::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #15233f22;
  transition: transform 0.15s ease;
}

.exam-manage-toggle:has(input:checked) .exam-manage-toggle-track {
  background: #1f5cf0;
}

.exam-manage-toggle:has(input:checked) .exam-manage-toggle-track::after {
  transform: translateX(1.05rem);
}

.exam-manage-toggle-copy {
  display: grid;
  gap: 0.1rem;
}

.exam-manage-toggle-copy strong {
  font-size: 0.86rem;
  color: var(--ink);
}

.exam-manage-toggle-copy span {
  color: var(--muted);
  font-size: 0.76rem;
}

.exam-delete-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding: 1rem 1.05rem;
  border: 1px solid #fecdca;
  border-radius: 1rem;
  background: linear-gradient(145deg, #fff7f6, #fff1f0);
}

.exam-delete-warning-badge {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.75rem;
  color: #b42318;
  background: #fee4e2;
  font: 800 1rem/1 var(--display);
}

.exam-delete-warning p {
  margin: 0;
  color: #7a271a;
  font-size: 0.88rem;
  line-height: 1.5;
}

.exam-delete-warning strong {
  color: #912018;
}

.exam-manage-dialog-edit .generation-step:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.exam-manage-dialog-edit .generation-calendar {
  padding-top: 0.15rem;
}

.exam-manage-dialog-edit .generation-step .app-modal-actions {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.settings-table code {
  font-size: 0.85rem;
  color: var(--blue-dark);
}

.settings-stack {
  display: grid;
  gap: 0.2rem;
  min-width: 12rem;
  max-width: 22rem;
  white-space: normal;
}

.settings-stack strong {
  color: var(--ink);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.settings-stack .subtle {
  font-size: 0.82rem;
  line-height: 1.35;
}

.exam-record-link {
  display: grid;
  gap: 0.2rem;
  min-width: 12rem;
  max-width: 22rem;
  color: inherit;
  text-decoration: none;
}

.exam-record-link strong {
  color: var(--ink);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.exam-record-link:hover strong,
.exam-record-link:focus-visible strong {
  color: var(--blue-dark);
  text-decoration: underline;
}

.level-classes-row > td {
  padding: 0 !important;
  background: #f8fafc;
  white-space: normal !important;
}

.level-classes-row:hover > td {
  background: #f8fafc;
}

.level-classes-panel {
  margin: 0.35rem 0.75rem 0.9rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.level-classes-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.level-classes-title {
  margin: 0;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
}

.level-classes-empty {
  margin: 0;
  padding: 0.4rem 0;
}

.settings-table-nested {
  border: 1px solid #e8eef8;
  border-radius: 10px;
  overflow: hidden;
}

.settings-table-nested th {
  position: static;
}

.level-class-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.app-modal-dialog-wide {
  width: min(720px, calc(100vw - 2rem));
}

.app-modal-dialog-calendar {
  display: flex;
  flex-direction: column;
  width: min(58rem, calc(100vw - 1.5rem));
  max-height: min(92dvh, 54rem);
  overflow: hidden;
}

.app-modal-dialog-calendar .app-modal-header {
  flex: 0 0 auto;
  padding: 1.15rem 1.35rem 0.9rem;
  border-bottom: 1px solid #e8eef8;
}

.app-modal-dialog-calendar .app-modal-header h2 {
  font-size: 1.2rem;
}

.calendar-modal-kicker {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-modal-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  gap: 0;
  padding: 0;
}

.calendar-modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 1rem 1.35rem 1.2rem;
}

.calendar-modal-form .app-modal-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.9rem 1.35rem calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid #e8eef8;
  background: #fff;
}

.calendar-section {
  display: grid;
  gap: 0.85rem;
}

.calendar-section + .calendar-section {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid #e8eef8;
}

.calendar-section-title {
  margin: 0;
  font-size: 0.95rem;
}

.calendar-year-name {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: baseline;
  justify-content: space-between;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  background: #f3f7ff;
}

.calendar-year-name-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calendar-year-name strong {
  color: var(--blue-dark);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.term-year-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.term-year-dates .field {
  margin-bottom: 0;
}

.calendar-year-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(10rem, 0.7fr);
  gap: 0.85rem;
  align-items: stretch;
}

.calendar-year-meta .field {
  margin-bottom: 0;
}

.calendar-toggle {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0;
  min-height: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid #e8eef8;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.calendar-toggle strong {
  display: block;
  font-size: 0.9rem;
}

.calendar-toggle small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.calendar-toggle input[type="checkbox"],
.calendar-check {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  margin: 0.15rem 0 0;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 0.28rem;
  accent-color: var(--blue);
  box-shadow: none;
}

.term-editor-row {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #e8eef8;
  border-radius: 12px;
  background: #f8fafc;
}

.term-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
}

.term-editor-dates {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
}

.checkbox-label {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  font-weight: 600;
}

@media (max-width: 860px) {
  .term-editor-dates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-modal-dialog-calendar {
    width: 100%;
    max-height: min(92dvh, 100%);
  }
  .term-year-dates,
  .calendar-year-meta,
  .term-editor-top,
  .term-editor-dates {
    grid-template-columns: 1fr;
  }
}

.calendar-year-list {
  display: grid;
  gap: 1rem;
}

.calendar-year-card {
  display: grid;
  gap: 1rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 1.05rem 1.15rem 1.15rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.calendar-year-card.is-current {
  border-color: #1f5cf0;
  background: #eef4ff;
  box-shadow: 0 0 0 3px #1f5cf033, var(--shadow-sm);
}

.calendar-year-card.is-current .calendar-year-kicker,
.calendar-year-card.is-current .calendar-year-title {
  color: #123a9e;
}

.calendar-current-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-current-select label {
  margin: 0;
  font-weight: 700;
}

.calendar-current-select select {
  min-width: min(100%, 12rem);
}

.calendar-year-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.calendar-year-kicker {
  margin: 0 0 0.2rem;
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-year-title {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.calendar-year-header p {
  margin: 0;
}

.calendar-year-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.calendar-year-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.calendar-year-summary > div {
  display: grid;
  gap: 0.18rem;
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  background: #f7f9fc;
}

.calendar-year-summary strong {
  font-size: 0.9rem;
}

.calendar-term-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.calendar-term-card {
  display: grid;
  gap: 0.75rem;
  border: 1px solid #e8eef8;
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  background: #fbfcfe;
}

.calendar-term-card.is-current {
  border-color: #1f5cf0;
  background: #e8f0ff;
  box-shadow: 0 0 0 2px #1f5cf033;
}

.calendar-term-card.is-current .calendar-term-card-header h4 {
  color: #123a9e;
}

.calendar-term-card-header h4 {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
}

.calendar-term-card-header p {
  margin: 0;
}

.calendar-term-milestones {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.calendar-term-milestones > div {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 0.45rem;
  border-top: 1px solid #eef3fa;
}

.calendar-term-milestones dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-term-milestones dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
}

.calendar-term-empty,
.calendar-empty {
  margin: 0;
  border: 1px dashed #d5e0f2;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  color: var(--muted);
  background: #f8fbff;
}

.calendar-empty {
  display: grid;
  justify-items: start;
  gap: 0.55rem;
  padding: 1.35rem 1.2rem;
}

.calendar-empty h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.calendar-empty p {
  margin: 0;
  max-width: 38rem;
}

@media (max-width: 960px) {
  .calendar-year-summary,
  .calendar-term-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .calendar-year-summary,
  .calendar-term-grid {
    grid-template-columns: 1fr;
  }
}

.class-editor {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e8eef8;
}

.class-editor-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.class-editor-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.class-editor-list {
  display: grid;
  gap: 0.65rem;
}

.class-editor-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.9fr auto;
  gap: 0.55rem;
  align-items: end;
  padding: 0.65rem;
  border: 1px solid #e8eef8;
  border-radius: 10px;
  background: #f8fafc;
}

.class-editor-field {
  margin: 0;
}

.class-editor-field label {
  font-size: 0.72rem;
}

.class-editor-remove {
  margin-bottom: 0.15rem;
}

@media (max-width: 720px) {
  .analytics-overview {
    grid-template-columns: 1fr;
  }
  .analytics-metrics {
    grid-template-columns: 1fr;
  }
  .analytics-stat:hover {
    transform: none;
  }
  .class-editor-row {
    grid-template-columns: 1fr;
  }

  .class-editor-remove {
    justify-self: start;
  }
}

@media (max-width: 960px) and (min-width: 721px) {
  .analytics-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.settings-category-list {
  display: grid;
  gap: 1.25rem;
}

.workspace-content:has(.student-directory),
.workspace-content:has(.employee-directory),
.workspace-content:has(.student-hero) {
  width: min(100% - 2rem, 92rem);
}

.workspace-content:has(> .exam-record-sheet) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.workspace-content:has(> .teacher-marks-sheet),
.workspace-content:has(> .it-marks-sheet) {
  height: 100%;
  max-height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.workspace-content:has(> .teacher-marks-sheet) > .teacher-dash-actions,
.workspace-content:has(> .teacher-marks-sheet) > .workspace-nav-drawer,
.workspace-content:has(> .teacher-marks-sheet) > .notice,
.workspace-content:has(> .it-marks-sheet) > .teacher-dash-actions,
.workspace-content:has(> .it-marks-sheet) > .workspace-nav-drawer,
.workspace-content:has(> .it-marks-sheet) > .notice {
  flex: 0 0 auto;
}

.teacher-marks-sheet,
.it-marks-sheet {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.workspace-content:has(> .exam-record-sheet) .notice {
  flex: 0 0 auto;
}

.settings-category-list .exam-record-sheet {
  flex: none;
  max-height: none;
  overflow: visible;
}

.exam-analytics-page .exam-record-sheet {
  display: block;
  flex: none;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.exam-analytics-scroll {
  max-width: 100%;
}

.exam-analytics-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.exam-analytics-table thead th,
.exam-analytics-table tbody td,
.exam-analytics-table tfoot td {
  background: #fff;
}

.exam-analytics-table thead th {
  position: static;
  top: auto;
  z-index: 1;
  background: #f7f9fc;
  font-size: 0.78rem;
}

.exam-analytics-table tfoot td {
  position: static;
  bottom: auto;
  z-index: 1;
  background: #f7f9fc;
}

.exam-analytics-table th,
.exam-analytics-table td {
  padding: 0.55rem 0.65rem;
  white-space: nowrap;
}

.exam-analytics-table th:first-child,
.exam-analytics-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: auto;
  min-width: max-content;
  max-width: none;
  padding-left: 0.85rem;
  background: #fff;
  box-shadow: 1px 0 0 #e8eef8;
  transition: min-width 0.2s ease, max-width 0.2s ease, padding 0.2s ease;
}

.exam-analytics-table thead th:first-child {
  z-index: 4;
  background: #f7f9fc;
}

.exam-analytics-table tfoot td:first-child {
  z-index: 3;
  background: #f7f9fc;
}

.exam-analytics-table tbody tr:hover td:first-child {
  background: #f7faff;
}

.exam-analytics-table th:nth-child(2),
.exam-analytics-table td:nth-child(2) {
  min-width: 4.75rem;
  text-align: center;
}

.exam-analytics-table th:nth-child(n + 3),
.exam-analytics-table td:nth-child(n + 3) {
  min-width: 3.1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.exam-analytics-table td:first-child strong {
  display: block;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.exam-analytics-scroll.is-compact .exam-analytics-table th:first-child,
.exam-analytics-scroll.is-compact .exam-analytics-table td:first-child {
  min-width: 6.25rem;
  max-width: 6.75rem;
  padding-right: 0.35rem;
}

.exam-analytics-scroll.is-compact .exam-analytics-table td:first-child strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.exam-analytics-scroll.is-compact .exam-analytics-table thead th:first-child {
  font-size: 0.72rem;
}

.exam-analytics-table .exam-record-mean-row td {
  font-weight: 700;
}

@media (max-width: 820px) {
  .exam-analytics-page .exam-record-bar {
    align-items: flex-start;
  }

  .exam-analytics-page .exam-record-bar-tools {
    width: 100%;
    margin-left: 0;
  }

  .exam-analytics-page .exam-record-bar-tools .exam-back-link {
    display: block;
    width: 100%;
    text-align: center;
  }

  .exam-analytics-scroll {
    margin-inline: -0.15rem;
    padding-bottom: 0.15rem;
  }

  .exam-analytics-scroll.is-compact .exam-analytics-table th:first-child,
  .exam-analytics-scroll.is-compact .exam-analytics-table td:first-child {
    min-width: 5.5rem;
    max-width: 6rem;
  }

  .exam-analytics-table th,
  .exam-analytics-table td {
    padding: 0.45rem 0.5rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  .exam-analytics-scroll.is-compact .exam-analytics-table th:first-child,
  .exam-analytics-scroll.is-compact .exam-analytics-table td:first-child {
    min-width: 5rem;
    max-width: 5.5rem;
  }

  .exam-analytics-table th:nth-child(n + 3),
  .exam-analytics-table td:nth-child(n + 3) {
    min-width: 2.75rem;
  }
}

.student-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  border: 1px solid #d9e4f6;
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 46%),
    linear-gradient(145deg, #fff, #f3f7ff);
  box-shadow: var(--shadow-sm);
}

.student-hero-kicker {
  margin: 0 0 0.2rem;
  color: var(--blue-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.student-hero-copy h2 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: -0.03em;
}

.student-hero-copy p {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
}

.student-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.student-stat {
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.student-stat strong {
  display: block;
  color: var(--blue-dark);
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.student-stat span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.student-directory {
  display: grid;
  gap: 1.6rem;
}

.student-level-block {
  display: grid;
  gap: 0.75rem;
}

.student-level-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.15rem;
}

.student-level-header h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.03em;
}

.student-level-header p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.student-count-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  color: var(--blue-dark);
  background: #eaf0ff;
  font-size: 0.74rem;
  font-weight: 800;
}

.student-count-chip.is-quiet {
  color: var(--ink-soft);
  background: #eef2f8;
}

.exam-marks-lock-chip {
  color: #8a4b12;
  background: #fff4e8;
  border: 1px solid #f0d4b0;
}

.exam-marks-lock-notice {
  margin: 0 0 0.75rem;
}

.student-stream-grid {
  display: grid;
  gap: 0.9rem;
}

.student-class-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7e2f3;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 24px #15233f0c;
}

.student-class-card-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(180deg, #f7f9fe, #eef3fb);
  border-bottom: 1px solid #e4ecf6;
}

.student-class-title {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

.student-class-badge {
  display: inline-flex;
  min-width: 2.6rem;
  justify-content: center;
  border-radius: 0.55rem;
  padding: 0.28rem 0.55rem;
  color: #fff;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.student-class-card-header h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

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

.student-class-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.student-class-table .col-name { width: 22%; }
.student-class-table .col-admission { width: 11%; }
.student-class-table .col-assessment { width: 13%; }
.student-class-table .col-gender { width: 8%; }
.student-class-table .col-parent { width: 18%; }
.student-class-table .col-access { width: 9%; }
.student-class-table .col-actions { width: 19%; }

.student-class-table th,
.student-class-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #eef2f8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-class-table th {
  color: #6b7c99;
  background: #fbfcfe;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.student-class-table tbody tr:nth-child(odd) {
  background: #f9fbfe;
}

.student-class-table tbody tr:hover {
  background: #f1f6ff;
}

.student-class-table tbody tr:last-child td {
  border-bottom: 0;
}

.student-name-cell,
.student-parent-cell {
  display: flex;
  min-width: 0;
}

.student-name-cell {
  gap: 0.65rem;
  align-items: center;
}

.student-avatar {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.55rem;
  color: #1d4fcc;
  background: #e8efff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.student-avatar-photo {
  object-fit: cover;
  background: #dce6f5;
}

.student-name-cell strong,
.student-parent-cell strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-parent-cell {
  flex-direction: column;
  gap: 0.05rem;
}

.student-parent-cell small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-code {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.student-class-table td:last-child {
  overflow: visible;
  white-space: nowrap;
}

.student-class-table .status-pill {
  padding: 0.14rem 0.48rem;
  font-size: 0.66rem;
}

.student-class-table .record-action {
  min-height: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.7rem;
}

.record-action-icon {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  min-width: 2rem;
  padding: 0;
  text-decoration: none;
}

.record-action-icon svg {
  width: 1rem;
  height: 1rem;
}

.student-class-table .record-action-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.workspace-content:has(.student-profile-grid) {
  width: min(100% - 2rem, 72rem);
}

.student-profile-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  border: 1px solid #d9e4f6;
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 46%),
    linear-gradient(145deg, #fff, #f3f7ff);
  box-shadow: var(--shadow-sm);
}

.student-profile-identity {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  min-width: 0;
}

.student-profile-avatar {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 1rem;
  color: #fff;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.student-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-photo-edit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.student-photo-preview,
.student-photo-placeholder {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 0.65rem;
  object-fit: cover;
}

.student-photo-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed #c5d3ea;
  background: #f4f7fc;
  color: #73849e;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.student-photo-controls {
  display: grid;
  gap: 0.35rem;
}

.student-photo-clear {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  color: #4d5f7a;
  font-size: 0.78rem;
}

.student-profile-hero h2 {
  margin: 0 0 0.2rem;
  font-size: 1.4rem;
}

.student-profile-hero p {
  margin: 0;
  color: var(--muted);
}

.student-profile-hero-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.student-profile-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr 1fr;
}

.student-profile-card {
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem 0.85rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.student-profile-card.is-full {
  grid-column: 1 / -1;
}

.student-profile-card h3 {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
}

.student-detail-list {
  display: grid;
  gap: 0.75rem 1rem;
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.student-detail-list > div.is-wide {
  grid-column: 1 / -1;
}

.student-detail-list dt {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.student-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

@media (max-width: 820px) {
  .student-profile-grid,
  .student-detail-list {
    grid-template-columns: 1fr;
  }
}

.student-class-table .record-actions {
  flex-wrap: wrap;
}

@media (max-width: 820px) {
  .student-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-hero {
    padding: 1rem;
  }

  .student-hero .primary-button,
  .student-hero .exam-tool-cta {
    width: 100%;
  }

  .student-class-table,
  .student-class-table thead,
  .student-class-table tbody,
  .student-class-table th,
  .student-class-table td,
  .student-class-table tr {
    display: block;
    width: 100%;
  }

  .student-class-table thead {
    display: none;
  }

  .student-class-table tr {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #e8eef8;
  }

  .student-class-table td {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.28rem 0;
    border: 0;
    white-space: normal;
    overflow: visible;
  }

  .student-class-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .student-class-table td:first-child::before,
  .student-class-table td[data-label="Actions"]::before {
    display: none;
  }

  .student-class-table .record-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .student-stats {
    grid-template-columns: 1fr;
  }
}

.settings-category-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.settings-category-title {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.settings-category-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill.is-active {
  color: #067647;
  background: #ecfdf3;
}

.status-pill.is-inactive {
  color: #b42318;
  background: #fef3f2;
}

.grade-chip {
  display: inline-grid;
  min-width: 2.2rem;
  place-items: center;
  border-radius: 0.45rem;
  padding: 0.25rem 0.55rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.settings-category-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.settings-inline-action {
  width: auto;
  min-height: 2.2rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.app-modal-dialog-wide {
  width: min(100%, 42rem);
}

.grade-rows-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin: 0.35rem 0 0.75rem;
}

.grade-rows-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.grade-rows {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.grade-rows-footer {
  display: flex;
  justify-content: stretch;
  margin: 0 0 0.25rem;
}

.grade-rows-footer .ghost-button {
  width: 100%;
  justify-content: center;
}

.grade-row {
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  background: #f8fafc;
}

.grade-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.grade-row-top strong {
  font-size: 0.86rem;
}

.grade-setup-panel {
  position: relative;
}

.grade-setup-panel.is-locked .grade-rows,
.grade-setup-panel.is-locked .grade-rows-header,
.grade-setup-panel.is-locked .grade-rows-footer {
  opacity: 0.45;
  pointer-events: none;
}

.grade-setup-lock-note {
  margin: 0 0 0.85rem;
  border: 1px dashed #c5d2e6;
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  color: var(--muted);
  background: #f7f9fc;
  font-size: 0.88rem;
}

.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;
}

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.record-actions form {
  margin: 0;
}

.record-action {
  border: 1px solid #d5e0f0;
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  color: var(--blue-dark);
  background: #f5f8fd;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.record-action:hover {
  border-color: #9db4e0;
  background: #eaf1ff;
}

.record-action.is-danger {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}

.record-action.is-danger:hover {
  background: #fee4e2;
}

body.modal-open {
  overflow: hidden;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.app-modal[hidden] {
  display: none;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: #0b1b3699;
  backdrop-filter: blur(2px);
}

.app-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 32rem);
  max-height: min(90dvh, 40rem);
  overflow: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 24px 60px #0b1b3640;
}

.app-modal-dialog.app-modal-dialog-calendar {
  display: flex;
  flex-direction: column;
  width: min(58rem, calc(100vw - 1.5rem));
  max-height: min(92dvh, 54rem);
  overflow: hidden;
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.35rem;
}

.app-modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.app-modal-close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.55rem;
  color: var(--muted);
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.app-modal-close:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.app-modal-form {
  display: grid;
  gap: 0.15rem;
  padding: 0.5rem 1.25rem 1.25rem;
}

.app-modal-form .field {
  margin-bottom: 0.85rem;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

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

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .app-modal-actions {
    flex-direction: column-reverse;
  }
  .app-modal-actions .primary-button,
  .app-modal-actions .ghost-button {
    width: 100%;
  }
}
.settings-profile-card {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.settings-profile-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
}
.settings-profile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.school-logo-preview {
  width: 3.4rem;
  height: 3.4rem;
  flex: 0 0 auto;
  border-radius: 0.85rem;
  object-fit: cover;
  border: 1px solid #d5deec;
  background: #fff;
}
.school-logo-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  margin: 0 0 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d7e3f5;
  border-radius: 0.75rem;
  background: #f8fbff;
}
.school-logo-current img {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 0.55rem;
  object-fit: cover;
  border: 1px solid #d5deec;
  background: #fff;
}
.school-profile-form {
  display: grid;
  gap: 1rem;
  max-width: 48rem;
}
.school-profile-panel {
  max-width: none;
}
.school-profile-section-title {
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}
.school-profile-enrollment {
  margin-top: 0.65rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.school-profile-panel .field {
  margin-bottom: 0;
}
.school-profile-curricula {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.school-profile-curricula legend {
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}
.school-profile-checkboxes ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}
.school-profile-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--touch);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.school-profile-checkboxes input[type="checkbox"] {
  width: 1rem;
  min-height: 0;
  margin: 0;
}
.school-profile-actions {
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .school-profile-checkboxes ul {
    grid-template-columns: 1fr;
  }
  .school-profile-actions .primary-button {
    width: 100%;
  }
}
.settings-upload-form { margin: 0; }
.settings-upload-btn { width: 100%; }

.workspace-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.workspace-header {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 0;
  border-bottom: 1px solid #e4ebf5;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 #ffffff inset;
}
.workspace-header-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem 1.25rem;
  min-height: var(--header-h);
  padding: 0.55rem 1.35rem;
}
.workspace-header-left,
.workspace-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.workspace-header-right {
  justify-content: flex-end;
}
.workspace-header-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}
.workspace-header-eyebrow {
  margin: 0;
  overflow: hidden;
  color: #6a7f9f;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-header-title {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-profile {
  position: relative;
  flex: 0 0 auto;
}
.workspace-profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  max-width: 16.5rem;
  min-height: 2.6rem;
  border: 1px solid #e1eaf6;
  border-radius: 999px;
  padding: 0.2rem 0.7rem 0.2rem 0.2rem;
  background: #fff;
  color: inherit;
  box-shadow: 0 1px 2px #15233f08;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.workspace-profile-trigger:hover,
.workspace-profile.is-open .workspace-profile-trigger {
  border-color: #c7d7f2;
  background: #f8faff;
  box-shadow: 0 4px 14px #15233f0f;
}
.workspace-avatar-wrap {
  position: relative;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(145deg, #4f85ff, #2bc4b8);
}
.workspace-avatar-wrap-lg {
  width: 3.6rem;
  height: 3.6rem;
}
.workspace-avatar {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  color: #fff;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  font: 800 0.88rem var(--display);
}
.workspace-avatar-fallback {
  background: linear-gradient(145deg, #3b78f7, #1a4bc4);
}
.workspace-user-meta {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
  text-align: left;
}
.workspace-user-meta strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-user-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-profile-caret {
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 0.05rem;
  flex: 0 0 auto;
  border-right: 1.6px solid #8a9bb5;
  border-bottom: 1.6px solid #8a9bb5;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}
.workspace-profile.is-open .workspace-profile-caret {
  transform: rotate(225deg) translateY(-1px);
}
.workspace-profile-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 40;
  min-width: 15rem;
  max-width: min(18rem, calc(100vw - 1.5rem));
  border: 1px solid #d9e4f5;
  border-radius: 0.9rem;
  padding: 0.45rem;
  background: #fff;
  box-shadow: 0 16px 36px #15233f18;
}
.workspace-profile-menu[hidden] {
  display: none !important;
}
.workspace-profile-summary {
  display: grid;
  gap: 0.12rem;
  padding: 0.45rem 0.65rem 0.35rem;
}
.workspace-profile-summary-name {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-profile-summary-meta,
.workspace-profile-summary-email {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-profile-summary-email {
  color: #7a8aa6;
}
.workspace-profile-heading {
  margin: 0.15rem 0.45rem 0.35rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.workspace-role-switch {
  display: grid;
  gap: 0.15rem;
  max-height: 16rem;
  overflow: auto;
}
.workspace-role-switch form {
  margin: 0;
}
.workspace-profile-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.62rem 0.85rem;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.workspace-role-option:hover {
  background: #f3f7fd;
}
.workspace-role-option.is-active {
  background: #eaf1ff;
  color: #1d4fcc;
}
.workspace-profile-divider {
  height: 1px;
  margin: 0.4rem 0.35rem;
  background: #e7eef8;
}
.workspace-profile-signout {
  color: #b42318;
  background: #fff5f4;
  text-align: center;
}
.workspace-profile-signout:hover {
  color: #912018;
  background: #fee4e2;
}
.workspace-switch-link {
  color: #1d4fcc;
  font-weight: 800;
}
.workspace-switch-link:hover {
  background: #eaf1ff;
}
.workspace-preview-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  margin: 0 1.35rem 0.7rem;
  border: 1px solid #d7e4ff;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, #f4f8ff, #eef5ff);
  color: var(--ink-soft);
  font-size: 0.84rem;
}
.workspace-preview-banner p {
  margin: 0;
  min-width: 0;
  flex: 1 1 12rem;
}
.workspace-preview-change {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: #fff;
  color: #1d4fcc;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 2px #15233f0a;
}
.role-switch-dialog {
  width: min(100%, 28rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.role-switch-kicker {
  margin: 0 0 0.2rem;
  color: #4d6aa0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.role-switch-copy {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.role-switch-form {
  gap: 0.65rem;
}
.role-switch-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: #f7f9fc;
}
.role-switch-list {
  display: grid;
  gap: 0.4rem;
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.15rem;
}
.role-switch-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid #e4ecf8;
  border-radius: 0.9rem;
  padding: 0.8rem 0.9rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.role-switch-option:hover,
.role-switch-option.is-selected {
  border-color: #bfd0f5;
  background: #f3f7ff;
}
.role-switch-option.is-selected {
  box-shadow: inset 0 0 0 1px #1f5cf0;
}
.role-switch-option-name {
  display: block;
  font-weight: 800;
  font-size: 0.92rem;
}
.role-switch-option-meta {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}
.role-switch-employee {
  justify-content: flex-start;
}
.role-switch-avatar {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  color: #fff;
  font: 800 0.85rem var(--display);
}
.role-switch-employee-copy {
  min-width: 0;
}
.role-switch-empty {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.role-switch-actions {

  margin-top: 0.35rem;
}
.role-switch-actions [data-role-switch-back] {
  margin-right: auto;
}

.student-search-dialog {
  width: min(100%, 30rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.student-search-kicker {
  margin: 0 0 0.2rem;
  color: #4d6aa0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.student-search-form {
  gap: 0.75rem;
}
.student-search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.75rem 0.95rem;
  background: #f7f9fc;
  font: inherit;
}
.student-search-field input:focus {
  outline: 2px solid #bfd0f5;
  outline-offset: 1px;
  border-color: #8eadea;
  background: #fff;
}
.student-search-results {
  display: grid;
  gap: 0.4rem;
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.1rem;
}
.student-search-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid #e4ecf8;
  border-radius: 0.9rem;
  padding: 0.8rem 0.9rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.student-search-option:hover,
.student-search-option:focus-visible {
  border-color: #bfd0f5;
  background: #f3f7ff;
}
.student-search-avatar {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  color: #fff;
  font: 800 0.85rem var(--display);
}
.student-search-option-copy {
  min-width: 0;
}
.student-search-option-name {
  display: block;
  font-weight: 800;
  font-size: 0.92rem;
  text-transform: uppercase;
}
.student-search-option-meta {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}
.student-search-hint,
.student-search-empty {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.workspace-menu-btn {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid #dce5f2;
  border-radius: 0.7rem;
  padding: 0;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.workspace-menu-btn:hover {
  border-color: #b8c9ea;
  background: #f7faff;
  box-shadow: 0 4px 12px #15233f0d;
}
.workspace-menu-btn span {
  display: block;
  width: 1rem;
  height: 1.5px;
  border-radius: 2px;
  background: var(--ink-soft);
}
.workspace-back-btn {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #dce5f2;
  border-radius: 0.7rem;
  padding: 0;
  color: #5d7399;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.workspace-back-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}
.workspace-back-btn:hover:not(:disabled) {
  border-color: #b8c9ea;
  color: var(--blue-dark);
  background: #f7faff;
  box-shadow: 0 4px 12px #15233f0d;
}
.workspace-back-btn:disabled,
.workspace-back-btn[hidden] {
  display: none;
}

.workspace-content {
  width: min(100% - 2rem, var(--page-max));
  max-width: 100%;
  margin: 0 auto;
  padding: 1.25rem 0 1.25rem;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.workspace-footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #e4ebf5;
  padding: 0.65rem 1.25rem max(0.65rem, env(safe-area-inset-bottom));
  color: #6f819d;
  background:
    linear-gradient(180deg, #fbfcfe 0%, #f4f7fc 100%);
  font-size: 0.74rem;
}
.workspace-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  justify-content: center;
}
.workspace-footer-brand {
  color: #4d6285;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.workspace-footer-role {
  color: #7a8aa6;
}
.workspace-footer-sep {
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 50%;
  background: #b7c6df;
}

.workspace-welcome {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 42%),
    linear-gradient(145deg, #fff, #f5f8fd);
  box-shadow: var(--shadow-sm);
  animation: rise-in 0.35s ease both;
}
.workspace-welcome-copy {
  max-width: 40rem;
  min-width: 0;
}
.workspace-welcome-copy h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
}
.workspace-welcome-copy p {
  color: var(--muted);
  font-size: 0.95rem;
}
.workspace-welcome-cta {
  width: auto;
  min-width: 10.5rem;
  padding-inline: 1.1rem;
}
.workspace-welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.workspace-panel {
  width: 100%;
  margin: 0;
  animation: rise-in 0.35s ease both;
}

.workspace-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: #15233f66;
}

@media (max-width: 1100px) {
  .workspace {
    display: block;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }
  .workspace-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(17.5rem, 86vw);
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .workspace.is-nav-open .workspace-sidebar {
    transform: translateX(0);
  }
  .workspace-menu-btn { display: inline-flex; }
  .workspace-header-bar {
    padding-inline: 0.85rem;
    gap: 0.65rem;
  }
  .workspace-preview-banner {
    margin-inline: 0.85rem;
  }
  .workspace-header-left {
    min-width: 0;
  }
  .workspace-header-right {
    flex: 0 0 auto;
  }
  .workspace-user-meta {
    display: none;
  }
  .workspace-profile-trigger {
    max-width: none;
    padding: 0.15rem;
    border-radius: 999px;
  }
  .workspace-profile-caret {
    display: none;
  }
  .workspace-back-btn,
  .workspace-menu-btn {
    flex: 0 0 auto;
  }
  .workspace-welcome-cta { width: 100%; }
  .workspace-main {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }
  .workspace-content {
    width: min(100% - 1.5rem, var(--page-max));
  }
  .form-grid,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .span-two { grid-column: auto; }
}

@media (max-width: 640px) {
  .workspace-content {
    width: min(100% - 1.25rem, var(--page-max));
    padding-top: 1rem;
  }
  .admission-card.workspace-panel,
  .admit-panel.workspace-panel {
    width: 100%;
    padding: 1rem;
  }
  .admit-actions .primary-button { width: 100%; }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #e4ebf5;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}
.app-header-inner,
.page-wrap {
  width: min(100% - 2rem, var(--page-max));
  margin-inline: auto;
}
.app-header-inner {
  display: flex;
  min-height: var(--header-h);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.65rem;
}
.app-header .brand-mark {
  color: #fff;
  background: var(--blue);
  box-shadow: none;
}
.app-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem 0.85rem;
  min-width: 0;
}
.user-chip {
  max-width: 12rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-header {
  display: flex;
  width: min(100% - 2rem, var(--page-max));
  margin: 1rem auto 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.simple-header .brand-mark {
  color: #fff;
  background: var(--blue);
  box-shadow: none;
}

.register-shell { padding: 0.5rem 0 2.5rem; }

.registration-card {
  position: relative;
  width: min(100% - 2rem, 40rem);
  margin: 1.5rem auto 0;
  padding: clamp(1.25rem, 3vw, 2.1rem);
  border: 1px solid #e1e8f3;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
}
.registration-card::before {
  position: absolute;
  top: 0;
  left: 1.5rem;
  width: 3.5rem;
  height: 0.28rem;
  border-radius: 0 0 0.5rem 0.5rem;
  background: linear-gradient(90deg, #4f85ff, #3fc2df);
  content: "";
}
.admission-card { width: min(100% - 2rem, 54rem); }

.admit-panel {
  width: min(100%, 46rem);
  max-width: 100%;
  border: 1px solid #e1e8f3;
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.admit-form { display: grid; gap: 1.15rem; }
.admit-group {
  display: grid;
  gap: 0.85rem;
  padding-bottom: 1.05rem;
  border-bottom: 1px solid #e8eef7;
}
.admit-group:last-of-type { border-bottom: 0; padding-bottom: 0; }
.admit-group-title {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 700;
}
.admit-optional {
  border: 1px solid #e4ebf5;
  border-radius: var(--radius-md);
  padding: 0.15rem 0.9rem 0.35rem;
  background: #f8fafc;
}
.admit-optional summary {
  cursor: pointer;
  list-style: none;
  padding: 0.75rem 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}
.admit-optional summary::-webkit-details-marker { display: none; }
.admit-optional summary::after {
  content: "Show";
  float: right;
  color: var(--blue);
  font-size: 0.78rem;
}
.admit-optional[open] summary::after { content: "Hide"; }
.admit-optional .form-grid { padding-bottom: 0.5rem; }
.admit-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.25rem;
}
.admit-actions .primary-button {
  width: auto;
  min-width: 11rem;
  padding-inline: 1.35rem;
}

.form-section {
  margin: 1rem 0;
  border: 1px solid #e4ebf5;
  border-radius: var(--radius-md);
  padding: 1rem 1rem 0.35rem;
  background: linear-gradient(#fff, #fbfcff);
}
.form-section-header { margin-bottom: 0.75rem; }
.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.3rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.form-section-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}
.registration-form {
  counter-reset: register-step;
}
.registration-form .form-section-title::before {
  counter-increment: register-step;
  content: counter(register-step);
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  border-radius: 0.45rem;
  color: var(--blue);
  background: #edf3ff;
  font: 700 0.72rem var(--font);
}
.section-help {
  margin: 0 0 0 2.15rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.form-submit-bar {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
  border-top: 1px solid #e6edf7;
  padding: 1rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, #fff 28%);
}
.form-submit-bar .hint { margin: 0; }
.form-submit-bar .primary-button { width: min(100%, 20rem); margin-left: auto; }

/* ---------- Phone + file controls ---------- */
.phone-input-unified {
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.phone-input-unified:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px #1f5cf018;
}
.phone-input-unified .phone-country,
.phone-input-unified .phone-dial,
.phone-input-unified .phone-national {
  border: 0;
  border-radius: 0;
  min-height: var(--touch);
  background: transparent;
}
.phone-input-unified .phone-country {
  border-right: 1px solid var(--line);
  background: #f7f9fd;
}
.phone-input-unified .phone-dial {
  border-right: 1px solid var(--line);
  background: #f3f6fb;
  color: var(--blue-dark);
}
.phone-input-unified .phone-national:focus {
  box-shadow: none;
}

.file-drop {
  position: relative;
  display: flex;
  gap: 0.85rem;
  align-items: center;
  min-height: 4.5rem;
  border: 1.5px dashed #c5d3ea;
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  color: var(--muted);
  background:
    linear-gradient(180deg, #fbfcff, #f4f7fc);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.file-drop:hover {
  border-color: #8fb0ef;
  background: #eef4ff;
  transform: translateY(-1px);
}
.file-drop-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.75rem;
  color: var(--blue);
  background: #e8efff;
}
.file-drop-icon svg { width: 1.2rem; height: 1.2rem; }
.file-drop-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.file-drop-copy strong {
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.file-drop-copy span {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

@keyframes sheen-drift {
  0%, 100% { transform: translateX(-8%); opacity: 0.35; }
  50% { transform: translateX(12%); opacity: 0.7; }
}
@keyframes orbit-soft {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Dashboard / portals ---------- */
.page-wrap { padding: clamp(1.25rem, 3vw, 2rem) 0 2.5rem; }

.hero-panel {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 1.85rem);
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 40%),
    linear-gradient(145deg, #fff, #f5f8fd);
  box-shadow: var(--shadow-sm);
}
.hero-panel-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}
.hero-identity {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  min-width: 0;
}
.avatar {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 1rem;
  color: #fff;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  font: 800 1.05rem var(--display);
}
.hero-copy { min-width: 0; }
.hero-copy h1 {
  margin: 0.25rem 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  overflow-wrap: anywhere;
}
.hero-copy p { max-width: 40rem; color: var(--muted); }

.module-grid {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.module-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "icon title meta"
    "icon copy meta";
  column-gap: 0.85rem;
  row-gap: 0.2rem;
  align-items: center;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid #e8eef8;
  border-radius: 0;
  padding: 0.95rem 1.1rem;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
  transition: background 0.15s ease;
}
.module-card:last-child {
  border-bottom: 0;
}
.module-card:hover {
  transform: none;
  border-color: #e8eef8;
  background: #f7f9fc;
  box-shadow: none;
}
.module-card.is-static:hover {
  transform: none;
  cursor: default;
  background: transparent;
}
.module-icon {
  grid-area: icon;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  align-self: center;
  border-radius: 0.7rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.85rem;
  font-weight: 800;
}
.module-card h3 {
  grid-area: title;
  margin: 0;
  font-size: 1rem;
}
.module-card p {
  grid-area: copy;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.module-meta {
  grid-area: meta;
  margin-top: 0;
  align-self: center;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.student-list {
  display: grid;
  gap: 0.75rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.student-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  background: #fff;
}
.student-list span {
  color: var(--muted);
  font-size: 0.85rem;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Breakpoints ---------- */
@media (max-width: 960px) {
  .analytics-split {
    grid-template-columns: 1fr;
  }
  .auth-shell,
  .auth-shell-wide {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .brand-panel {
    min-height: auto;
    gap: 0.55rem;
    padding: 0.95rem 1.15rem 1.05rem;
  }
  .brand-panel::before,
  .brand-panel::after {
    animation: none;
  }
  .brand-copy {
    margin: 0;
  }
  .brand-copy h1 {
    font-size: clamp(1.2rem, 4vw, 1.45rem);
    margin: 0.2rem 0 0;
  }
  .brand-copy p,
  .trust-note {
    display: none;
  }
  .auth-panel {
    align-items: start;
    padding: 1.1rem 0.85rem 1.75rem;
  }
  .auth-card,
  .auth-card-wide,
  .auth-card-elevated {
    width: 100%;
    max-width: 36rem;
    margin: 0 auto;
    border: 1px solid #e1e8f3;
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .form-progress { grid-template-columns: 1fr; }
  .form-progress li { border-radius: var(--radius-sm); }
  .admit-actions .primary-button { width: 100%; }
  .form-grid,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .span-two { grid-column: auto; }
  .admit-panel,
  .admission-card,
  .registration-card,
  .settings-panel,
  .workspace-panel {
    width: 100%;
    max-width: 100%;
  }
  .app-header-inner,
  .page-wrap,
  .simple-header {
    width: min(100% - 1.5rem, var(--page-max));
  }
  .app-header-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }
  .app-header-actions .ghost-button {
    flex: 0 1 auto;
    min-width: 0;
    white-space: normal;
  }
  .hero-panel-top .ghost-button {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .auth-shell,
  .auth-shell-wide {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .brand-panel {
    min-height: auto;
    gap: 0.55rem;
    padding: 0.95rem 1.15rem 1.05rem;
  }
  .brand-panel::before,
  .brand-panel::after {
    animation: none;
  }
  .brand-hero {
    margin-bottom: 0;
  }
  .brand-copy {
    margin: 0;
  }
  .brand-copy h1 {
    font-size: clamp(1.25rem, 4.5vw, 1.55rem);
    margin: 0.2rem 0 0;
  }
  .brand-copy p,
  .trust-note {
    display: none;
  }
  .auth-panel {
    align-items: start;
    padding: 1.25rem 1rem 2rem;
  }
  .auth-card,
  .auth-card-wide,
  .auth-card-elevated {
    width: min(100%, 36rem);
    margin: 0 auto;
    border: 1px solid #e1e8f3;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .mobile-brand { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .section-help { margin-left: 0; }
  .form-submit-bar .primary-button { width: 100%; margin-left: 0; }
  .phone-input-unified {
    grid-template-columns: auto auto minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
    line-height: 1.5;
  }

  .eyebrow,
  .workspace-header-eyebrow {
    font-size: 0.7rem;
  }

  .subtle,
  .settings-empty,
  .workspace-welcome-copy p,
  .hero-copy p,
  .form-section-copy,
  .section-help {
    font-size: 0.92rem;
  }

  .brand {
    font-size: 1.05rem;
  }

  .brand-panel .brand-hero {
    font-size: 1.1rem;
  }

  .brand-copy h1 {
    font-size: 1.45rem;
  }

  .form-page-heading h1,
  .form-page-heading h2 {
    font-size: 1.5rem;
  }

  .workspace-header-title {
    font-size: 1.2rem;
  }

  .workspace-welcome-copy h2,
  .settings-toolbar-copy h2,
  .app-modal-header h2,
  .settings-profile-card h3 {
    font-size: 1.2rem;
  }

  .hero-copy h1 {
    font-size: 1.55rem;
  }

  .module-card h3,
  .admit-group-title,
  .form-section-title {
    font-size: 1rem;
  }

  .module-card p,
  .workspace-nav-link,
  .notice,
  .helper,
  .auth-footer-link,
  .student-list span {
    font-size: 0.9rem;
  }

  .module-meta,
  .hint,
  .error-text,
  .field-hint,
  .status-pill,
  .workspace-footer {
    font-size: 0.8rem;
  }

  .field label,
  .field-label {
    font-size: 0.84rem;
  }

  .primary-button,
  .ghost-button {
    font-size: 0.95rem;
  }

  .record-action {
    font-size: 0.8rem;
  }

  .settings-table {
    font-size: 0.9rem;
  }

  .portal-tab {
    font-size: 0.85rem;
  }

  .module-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "icon title"
      "icon copy"
      "icon meta";
    padding: 0.9rem 1rem;
  }

  .module-meta {
    justify-self: start;
    margin-top: 0.15rem;
  }

  .app-header-inner,
  .page-wrap,
  .simple-header,
  .registration-card,
  .admission-card {
    width: min(100% - 1.25rem, var(--page-max));
  }
  .app-header-inner { gap: 0.65rem; }
  .user-chip {
    max-width: 8.5rem;
    font-size: 0.8rem;
  }
  .app-header-actions .user-chip {
    display: none;
  }
  .header-nav { display: none; }
  .hero-panel-top { gap: 0.85rem; }
  .registration-card { margin-top: 1rem; padding: 1.15rem; border-radius: 1rem; }
  .form-section { padding: 0.9rem 0.85rem 0.2rem; }
  .portal-tabs { border-radius: var(--radius-sm); }
  .portal-tab { border-radius: 0.55rem; }
  .form-actions { flex-direction: column; align-items: flex-start; }
  .phone-input {
    grid-template-columns: auto auto minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .phone-input,
  .phone-input-unified {
    grid-template-columns: 1fr;
  }
  .phone-input-unified .phone-country,
  .phone-input-unified .phone-dial {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .phone-country,
  .phone-dial,
  .phone-national { width: 100%; }
}

/* ---------- Responsive usability refinements ---------- */
.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.settings-toolbar-copy {
  min-width: 0;
  flex: 1 1 14rem;
}

.settings-toolbar-copy h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.settings-toolbar-action {
  width: auto;
  min-width: 11rem;
}

.settings-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.exam-class-filter {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.55rem;
  align-items: center;
}

.exam-class-filter label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.exam-class-filter select {
  min-width: 11.5rem;
  width: auto;
  min-height: 2.35rem;
  margin: 0;
  padding: 0.4rem 0.75rem;
}

.exam-record-sheet {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.exam-detail-sheet {
  border-radius: 1.1rem;
  border-color: #d9e4f4;
  box-shadow: 0 1px 2px #15233f06, 0 12px 28px #15233f0a;
}

.exam-detail-bar {
  gap: 0.85rem 1.1rem;
  padding: 1rem 1.15rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 92, 240, 0.08) 0, transparent 40%),
    linear-gradient(180deg, #f8fbff 0%, #f4f8fd 100%);
}

.exam-detail-bar-main {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 16rem;
}

.exam-detail-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  color: #8a97ad;
  font-size: 0.74rem;
  font-weight: 650;
}

.exam-detail-crumb a {
  color: var(--blue);
  text-decoration: none;
}

.exam-detail-crumb a:hover {
  text-decoration: underline;
}

.exam-detail-crumb span.is-uppercase {
  color: var(--ink-soft);
  font-weight: 750;
}

.exam-detail-bar .exam-record-bar-title {
  align-items: flex-start;
  gap: 0.55rem 0.75rem;
}

.exam-detail-bar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.exam-detail-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.exam-detail-actions .ghost-button,
.exam-detail-actions .primary-button {
  width: auto;
  min-height: 2.35rem;
  border-radius: 0.75rem;
  padding-inline: 0.95rem;
}

.exam-detail-sheet .exam-class-filter select {
  min-height: 2.35rem;
  border-radius: 0.75rem;
  border-color: #d5e1f4;
  background: #fff;
}

.exam-detail-sheet .exam-record-students-table thead th {
  padding: 0.8rem 0.7rem;
  background: #f7f9fd;
  color: #6b7c97;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  border-bottom-color: #e4ecf7;
}

.exam-detail-sheet .exam-subject-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.55rem;
  background: #eef3ff;
  color: var(--blue-dark);
  font: 800 0.72rem/1 var(--display);
}

.exam-detail-sheet .exam-subject-combined-note {
  display: block;
  margin-top: 0.2rem;
  color: #8a97ad;
  font: 650 0.62rem/1.2 var(--font);
  letter-spacing: 0.01em;
  text-transform: none;
}

.exam-detail-sheet .exam-mark-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 2rem;
  color: var(--ink);
  font: 750 0.84rem/1 var(--display);
}

.exam-detail-sheet .exam-record-students-table tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

.exam-detail-sheet .exam-record-students-table tbody tr:hover td {
  background: #f4f8ff;
}

.exam-detail-sheet .exam-record-students-table td {
  padding: 0.65rem 0.7rem;
  vertical-align: middle;
}

.exam-detail-sheet .exam-record-students-table td:first-child strong {
  font: 750 0.9rem/1.3 var(--display);
}

.exam-detail-sheet .exam-admission {
  color: var(--muted);
  font: 650 0.82rem/1.3 var(--font);
  letter-spacing: 0.02em;
}

.exam-detail-sheet .exam-mark-input {
  width: 3rem;
  min-height: 2.15rem;
  border: 1px solid #d7e2f3;
  border-radius: 0.65rem;
  background: #fff;
  box-shadow: inset 0 1px 0 #ffffffaa;
  font: 750 0.88rem/1 var(--display);
}

.exam-detail-sheet .exam-record-marks-form:not(.is-editing) .exam-mark-input {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.exam-detail-sheet .exam-record-marks-form.is-editing .exam-mark-input {
  border-color: #c5d4ee;
  background: #fff;
}

.exam-detail-sheet .exam-record-marks-form.is-editing .exam-mark-input:focus {
  outline: 2px solid #c5d6f7;
  border-color: var(--blue);
  background: #f8fbff;
}

.exam-detail-empty-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.2rem;
  border-radius: 0.85rem;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font: 800 0.72rem/1 var(--display);
}

.exam-detail-kicker {
  margin: 0 0 0.2rem;
  color: #5d7399;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.exam-detail-bar .exam-record-bar-title h2 {
  font: 800 1.08rem/1.2 var(--display);
  letter-spacing: 0.03em;
}

.exam-detail-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: visible;
  animation: rise-in 0.35s ease both;
}

.exam-detail-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.35rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border: 1px solid #d7e3f5;
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 92, 240, 0.14) 0, transparent 42%),
    linear-gradient(145deg, #ffffff 0%, #f3f7ff 100%);
  box-shadow: 0 1px 2px #15233f08, 0 14px 32px #15233f0c;
}

.exam-detail-hero-copy {
  min-width: 0;
  max-width: 38rem;
}

.exam-detail-hero-copy h2 {
  margin: 0 0 0.35rem;
  font: 800 clamp(1.3rem, 2.3vw, 1.7rem)/1.15 var(--display);
  color: var(--ink);
  letter-spacing: -0.02em;
}

.exam-detail-hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.exam-detail-hero-aside {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.exam-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.exam-detail-stat {
  display: grid;
  gap: 0.15rem;
  min-width: 5.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(31, 92, 240, 0.12);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.92);
}

.exam-detail-stat strong {
  font: 800 1.25rem/1 var(--display);
  color: var(--blue-dark);
  letter-spacing: -0.03em;
}

.exam-detail-stat span {
  color: var(--muted);
  font: 650 0.7rem/1.2 var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exam-detail-back {
  width: auto;
  min-height: 2.65rem;
  border-radius: 0.85rem;
}

.exam-detail-levels {
  border: 1px solid #d9e4f4;
  border-radius: 1.1rem;
  background: #fff;
  box-shadow: 0 1px 2px #15233f06, 0 12px 28px #15233f0a;
  overflow: hidden;
}

.exam-detail-levels-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid #e7eef8;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8fd 100%);
}

.exam-detail-levels-head h3 {
  margin: 0 0 0.15rem;
  font: 800 0.98rem/1.2 var(--display);
  color: var(--ink);
}

.exam-detail-levels-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.exam-detail-levels-count {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid #d7e2f3;
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font: 700 0.72rem/1 var(--font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.exam-detail-level-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.exam-detail-level-list > li + li .exam-detail-level-row {
  border-top: 1px solid #eef3fa;
}

.exam-detail-level-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  text-decoration: none;
  transition: background 0.18s ease;
}

.exam-detail-level-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  bottom: 0.55rem;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: transparent;
  transition: background 0.18s ease;
}

.exam-detail-level-row:hover {
  background: linear-gradient(90deg, #f5f8ff 0%, #fafcff 100%);
}

.exam-detail-level-row:hover::before {
  background: var(--blue);
}

.exam-detail-level-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.exam-detail-level-main strong {
  color: var(--ink);
  font: 750 0.98rem/1.25 var(--display);
}

.exam-detail-level-main span {
  color: var(--muted);
  font-size: 0.8rem;
}

.exam-detail-level-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0 0.85rem;
  border: 1px solid #d5e1f4;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--blue);
  font: 750 0.78rem/1 var(--font);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.exam-detail-level-row:hover .exam-detail-level-go {
  border-color: #b8c9ea;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.exam-detail-empty {
  display: grid;
  gap: 0.35rem;
  place-content: center;
  min-height: 10rem;
  padding: 1.6rem 1.2rem;
  text-align: center;
}

.exam-detail-empty strong {
  font: 750 1rem/1.3 var(--display);
  color: var(--ink);
}

.exam-detail-empty p,
.exam-detail-empty .settings-empty {
  margin: 0;
  color: var(--muted);
}

.exam-record-sheet-empty.exam-detail-empty {
  flex: 1 1 auto;
  border-top: 1px solid #eef3fa;
  background:
    radial-gradient(circle at 50% 0%, #eef4ff 0, transparent 55%),
    #fff;
}

@media (max-width: 720px) {
  .exam-detail-hero-aside {
    width: 100%;
  }

  .exam-detail-stats {
    width: 100%;
  }

  .exam-detail-stat {
    flex: 1 1 0;
  }

  .exam-detail-back,
  .exam-detail-level-go {
    width: 100%;
  }

  .exam-detail-page,
  .exam-detail-sheet {
    font-size: 0.82rem;
  }

  .exam-detail-kicker,
  .exam-detail-crumb {
    font-size: 0.62rem;
  }

  .exam-detail-hero-copy h2,
  .exam-detail-bar .exam-record-bar-title h2 {
    font-size: 0.95rem;
  }

  .exam-detail-hero-copy p,
  .exam-detail-levels-head p {
    font-size: 0.78rem;
  }

  .exam-detail-stat strong {
    font-size: 1.05rem;
  }

  .exam-detail-stat span,
  .exam-detail-levels-count,
  .student-count-chip {
    font-size: 0.62rem;
  }

  .exam-detail-level-main strong {
    font-size: 0.86rem;
  }

  .exam-detail-level-main span,
  .exam-detail-level-go {
    font-size: 0.72rem;
  }

  .exam-detail-actions .ghost-button,
  .exam-detail-actions .primary-button,
  .exam-detail-sheet .exam-class-filter label,
  .exam-detail-sheet .exam-class-filter select {
    font-size: 0.78rem;
  }

  .exam-detail-sheet .exam-class-filter select {
    min-height: 2.1rem;
  }

  .exam-detail-sheet .exam-record-students-table {
    font-size: 0.74rem;
  }

  .exam-detail-sheet .exam-record-students-table thead th {
    padding: 0.5rem 0.4rem;
    font-size: 0.58rem;
  }

  .exam-detail-sheet .exam-subject-code {
    min-width: 2.1rem;
    padding: 0.14rem 0.32rem;
    font-size: 0.62rem;
  }

  .exam-detail-sheet .exam-record-students-table td {
    padding: 0.4rem 0.4rem;
  }

  .exam-detail-sheet .exam-record-students-table td:first-child strong {
    font-size: 0.76rem;
  }

  .exam-detail-sheet .exam-admission {
    font-size: 0.68rem;
  }

  .exam-detail-sheet .exam-mark-input {
    width: 2.55rem;
    min-height: 1.9rem;
    border-radius: 0.45rem;
    font-size: 16px;
  }

  .exam-record-students-table th:first-child,
  .exam-record-students-table td:first-child {
    min-width: 8.5rem;
    max-width: 10.5rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .exam-record-students-table.is-name-collapsed th:first-child,
  .exam-record-students-table.is-name-collapsed td:first-child {
    min-width: 4.75rem;
    max-width: 4.75rem;
  }
}

.exam-record-bar {
  position: relative;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  gap: 0.55rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 0;
  border-bottom: 1px solid #e8eef8;
  background: #f8fafc;
}

.exam-record-bar-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  min-width: 0;
}

.exam-record-bar-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.exam-record-bar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.7rem;
  align-items: center;
  margin-left: auto;
}

.exam-record-bar .exam-back-link {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.exam-record-bar .exam-back-link:hover {
  color: var(--blue);
}

.exam-record-sheet-table,
.exam-record-sheet .exam-record-sheet-table.settings-table-panel {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scroll-padding-inline-start: 0.5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.exam-record-sheet-table::-webkit-scrollbar {
  width: 0.55rem;
  height: 0.55rem;
}

.exam-record-sheet-table::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c5d2e8;
}

.exam-record-sheet-table::-webkit-scrollbar-thumb:hover {
  background: #9fb4d6;
}

.exam-record-sheet-table::-webkit-scrollbar-track {
  background: #eef3fa;
}

.exam-analytics-page .exam-analytics-scroll,
.exam-analytics-page .exam-record-sheet .exam-record-sheet-table.settings-table-panel,
.exam-analytics-page .exam-record-sheet .exam-analytics-scroll.settings-table-panel {
  flex: none;
  min-height: auto;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
}

.exam-record-sheet-empty {
  padding: 1.1rem 0.9rem 1.2rem;
}

.exam-record-sheet .settings-table.exam-record-students-table,
.exam-record-sheet .settings-table-responsive.exam-record-students-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.exam-record-students-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7f9fc;
  box-shadow: 0 1px 0 #e8eef8;
}

.exam-record-students-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid #d9e4f5;
  background: #f7f9fc;
  box-shadow: 0 -1px 0 #d9e4f5;
}

.exam-record-students-table th,
.exam-record-students-table td {
  padding: 0.32rem 0.45rem;
  width: auto;
}

.exam-student-name {
  display: inline-flex;
  gap: 0.35rem;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
}

.exam-student-last {
  display: inline;
}

.exam-record-students-table th:first-child,
.exam-record-students-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 1%;
  min-width: 11rem;
  max-width: 14rem;
  padding-left: 0.85rem;
  padding-right: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  background-clip: padding-box;
  background: #fff;
  box-shadow: 1px 0 0 #e8eef8;
  transition:
    min-width 0.2s ease,
    max-width 0.2s ease,
    padding 0.2s ease,
    box-shadow 0.2s ease;
}

.exam-record-sheet-table.is-scrolled-x .exam-record-students-table th:first-child,
.exam-record-sheet-table.is-scrolled-x .exam-record-students-table td:first-child {
  box-shadow: 10px 0 14px -10px rgba(21, 35, 63, 0.35);
}

.teacher-marks-sheet .teacher-marks-table-panel.is-scrolled-x .teacher-marks-table-scroll .exam-record-students-table th:first-child,
.teacher-marks-sheet .teacher-marks-table-panel.is-scrolled-x .teacher-marks-table-scroll .exam-record-students-table td:first-child {
  box-shadow: 10px 0 14px -10px rgba(21, 35, 63, 0.35);
}

.exam-record-students-table .exam-student-name {
  display: flex;
  width: 100%;
  overflow: hidden;
}

.exam-record-students-table .exam-student-first,
.exam-record-students-table .exam-student-last {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exam-record-students-table.is-name-collapsed th:first-child,
.exam-record-students-table.is-name-collapsed td:first-child {
  min-width: 5.5rem;
  max-width: 5.5rem;
  padding-left: 0.55rem;
  padding-right: 0.45rem;
}

.exam-record-students-table.is-name-collapsed .exam-student-last {
  display: none;
}

.exam-record-students-table.is-name-collapsed .exam-student-first {
  flex: 1 1 auto;
  max-width: 100%;
}

.exam-record-students-table.is-name-collapsed th:nth-child(2),
.exam-record-students-table.is-name-collapsed td:nth-child(2) {
  max-width: 0;
  min-width: 0;
  width: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.exam-record-students-table.is-name-collapsed thead th:first-child {
  font-size: 0;
}

.exam-record-students-table.is-name-collapsed thead th:first-child::after {
  content: "Name";
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exam-record-students-table thead th:first-child {
  z-index: 6;
  background: #f7f9fc;
}

.exam-record-students-table tfoot td:first-child {
  z-index: 6;
  background: #f7f9fc;
}

.exam-record-students-table tbody tr:nth-child(even) td:first-child {
  background: #fbfcfe;
}

.exam-record-students-table tbody tr:hover td:first-child {
  background: #f4f8ff;
}

.exam-detail-sheet .exam-record-students-table thead th:first-child {
  background: #f7f9fd;
}

.exam-detail-sheet .exam-record-students-table tbody tr:nth-child(even) td:first-child {
  background: #fbfcfe;
}

.exam-detail-sheet .exam-record-students-table tbody tr:hover td:first-child {
  background: #f4f8ff;
}

.exam-record-students-table th:nth-child(2),
.exam-record-students-table td:nth-child(2) {
  width: 1%;
  padding-right: 0.7rem;
  white-space: nowrap;
  transition: max-width 0.2s ease, padding 0.2s ease, opacity 0.15s ease;
}

.exam-record-students-table th:nth-child(n + 2),
.exam-record-students-table td:nth-child(n + 2) {
  position: relative;
  z-index: 1;
}

.exam-record-students-table th:nth-child(n + 3),
.exam-record-students-table td:nth-child(n + 3) {
  width: 1%;
  min-width: 2.8rem;
  text-align: center;
  white-space: nowrap;
}

.exam-record-marks-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.exam-record-bar .ghost-button,
.exam-record-bar .primary-button {
  width: auto;
  min-width: 5.5rem;
  min-height: 2.15rem;
  padding: 0.32rem 0.8rem;
}

.exam-record-marks-form:not(.is-editing) .exam-mark-input {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.exam-record-marks-form:not(.is-editing) .exam-mark-input:focus {
  outline: none;
  border-color: transparent;
}

.exam-mark-input {
  display: block;
  width: 2.7rem;
  min-height: 1.7rem;
  margin: 0 auto;
  border: 1px solid #d5deee;
  border-radius: 0.32rem;
  padding: 0.1rem 0.15rem;
  color: var(--ink);
  background: #fff;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  appearance: textfield;
  -moz-appearance: textfield;
}

.exam-mark-input::-webkit-outer-spin-button,
.exam-mark-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.exam-mark-input:focus {
  outline: 2px solid #c5d6f7;
  border-color: var(--blue);
}

.exam-mark-percent {
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.exam-record-mean-row td {
  font-weight: 800;
}

.exam-record-mean-row td:first-child {
  padding-left: 0.85rem;
  color: var(--ink-soft);
}

.exam-mark-mean {
  display: inline-block;
  min-width: 2.4rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.exam-record-bar .primary-button {
  min-width: 8.5rem;
}

/* Teacher marks sheet — modern class marks entry */
.teacher-marks-sheet {
  border-radius: 1.1rem;
  border-color: #d5e1f2;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(21, 35, 63, 0.04),
    0 14px 34px rgba(21, 35, 63, 0.07);
  animation: rise-in 0.35s ease both;
}

.teacher-marks-bar {
  gap: 0.85rem 1.1rem;
  padding: 1rem 1.15rem;
  border-bottom-color: #e3ebf7;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 92, 240, 0.1) 0, transparent 42%),
    linear-gradient(180deg, #f9fbff 0%, #f3f7fd 100%);
}

.teacher-marks-bar-main {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 16rem;
}

.teacher-marks-bar .exam-record-bar-title {
  align-items: flex-start;
  gap: 0.55rem 0.75rem;
}

.teacher-marks-title-block h2 {
  margin: 0;
  font: 800 1.05rem/1.2 var(--display);
  letter-spacing: 0.03em;
  color: var(--ink);
}

.teacher-marks-meta {
  margin: 0.2rem 0 0;
  color: #6b7c97;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.teacher-marks-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  align-items: center;
}

.teacher-marks-subject-chip {
  display: inline-flex;
  gap: 0.2rem;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(31, 92, 240, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--blue-dark);
  font: 800 0.68rem/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.teacher-marks-out-of {
  color: #7a8ca8;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.teacher-marks-subject-head {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
}

.teacher-marks-out-of-head {
  color: #8a97ad;
  font: 700 0.62rem/1 var(--font);
  letter-spacing: 0.01em;
  text-transform: none;
}

.exam-mark-out-of-field {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  white-space: nowrap;
}

.exam-mark-out-of-suffix {
  color: #8a97ad;
  font: 700 0.72rem/1 var(--font);
}

.teacher-marks-tools {
  gap: 0.5rem;
}

.teacher-marks-tools .ghost-button,
.teacher-marks-tools .primary-button {
  min-height: 2.35rem;
  border-radius: 0.75rem;
  padding-inline: 0.95rem;
}

.teacher-marks-back {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid #d5e1f2;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.teacher-marks-back:hover {
  border-color: #b8ccee;
  background: #fff;
  color: var(--blue);
}

.teacher-marks-notice {
  margin: 0;
  border-inline: 0;
  border-radius: 0;
  border-bottom: 1px solid #f0e2cf;
  font-size: 0.82rem;
}

.teacher-marks-sheet .exam-record-students-table thead th {
  padding: 0.72rem 0.55rem;
  background: #f6f9fd;
  color: #6b7c97;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid #e4ecf7;
}

.teacher-marks-sheet .exam-subject-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.18rem 0.42rem;
  border-radius: 0.5rem;
  background: linear-gradient(180deg, #eef3ff 0%, #e4ecff 100%);
  color: var(--blue-dark);
  font: 800 0.68rem/1 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.teacher-marks-pct-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  color: #8a97ad;
  font-size: 0.72rem;
  font-weight: 800;
}

.teacher-marks-sheet .exam-record-students-table tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

.teacher-marks-sheet .exam-record-students-table tbody tr:hover td {
  background: #f2f7ff;
}

.teacher-marks-sheet .exam-record-students-table td {
  padding: 0.55rem 0.5rem;
  vertical-align: middle;
  border-bottom: 1px solid #eef3fa;
}

.teacher-marks-sheet .exam-record-students-table tbody tr:last-child td {
  border-bottom-color: transparent;
}

.teacher-marks-sheet .exam-record-students-table td:first-child strong,
.teacher-marks-sheet .exam-student-name {
  font: 750 0.86rem/1.3 var(--display);
  color: var(--ink);
}

.teacher-marks-sheet .exam-admission {
  display: inline-block;
  padding: 0.12rem 0.42rem;
  border-radius: 0.45rem;
  background: #f1f5fb;
  color: #6b7c97;
  font: 650 0.74rem/1.2 var(--font);
  letter-spacing: 0.02em;
}

.teacher-marks-sheet .exam-mark-input {
  width: 2.85rem;
  min-height: 2rem;
  border: 1px solid #d7e2f3;
  border-radius: 0.6rem;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font: 750 0.84rem/1 var(--display);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.teacher-marks-sheet .exam-record-marks-form:not(.is-editing) .exam-mark-input {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.teacher-marks-sheet .exam-record-marks-form.is-editing .exam-mark-input {
  border-color: #c5d4ee;
  background: #fff;
}

.teacher-marks-sheet .exam-record-marks-form.is-editing .exam-mark-input:focus {
  outline: 2px solid #c5d6f7;
  border-color: var(--blue);
  background: #f8fbff;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.teacher-marks-sheet .exam-mark-percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.14rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(31, 92, 240, 0.08);
  color: var(--blue-dark);
  font-size: 0.74rem;
  font-weight: 800;
}

.teacher-marks-sheet .exam-mark-percent:empty {
  display: none;
  padding: 0;
  background: transparent;
}

.teacher-marks-sheet .exam-record-mean-row td {
  background: linear-gradient(180deg, #f4f8ff 0%, #eef4ff 100%);
  border-top: 1px solid #d5e3f8;
}

.teacher-marks-sheet .exam-record-mean-row td:first-child {
  color: var(--blue-dark);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.teacher-marks-sheet .exam-mark-mean {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.12rem 0.3rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.teacher-marks-sheet .exam-mark-mean-percent {
  background: rgba(31, 92, 240, 0.12);
  color: var(--blue-dark);
}

.teacher-marks-sheet .exam-record-students-table th:first-child,
.teacher-marks-sheet .exam-record-students-table td:first-child {
  min-width: 11rem;
  max-width: none;
}

.teacher-marks-sheet .exam-record-students-table.is-name-collapsed th:first-child,
.teacher-marks-sheet .exam-record-students-table.is-name-collapsed td:first-child {
  min-width: 5.5rem;
  max-width: 5.5rem;
}

.teacher-marks-sheet .exam-record-students-table thead th:first-child {
  background: #f6f9fd;
}

.teacher-marks-sheet .exam-record-students-table tbody tr:nth-child(even) td:first-child {
  background: #fbfcfe;
}

.teacher-marks-sheet .exam-record-students-table tbody tr:hover td:first-child {
  background: #f2f7ff;
}

.teacher-marks-sheet .exam-record-students-table tfoot td:first-child {
  background: linear-gradient(180deg, #f4f8ff 0%, #eef4ff 100%);
}

.teacher-marks-empty {
  display: grid;
  gap: 0.45rem;
  place-content: center;
  min-height: 12rem;
  padding: 2rem 1.25rem;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(31, 92, 240, 0.06) 0, transparent 55%),
    #fff;
}

.teacher-marks-empty strong {
  font: 750 1rem/1.3 var(--display);
  color: var(--ink);
}

.teacher-marks-empty .settings-empty {
  margin: 0;
  max-width: 22rem;
  margin-inline: auto;
}

/* IT support level marks sheet */
.it-marks-sheet .exam-record-marks-form,
.teacher-marks-sheet .exam-record-marks-form {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.it-marks-sheet {
  animation: rise-in 0.35s ease both;
}

.it-marks-title-block h2 {
  margin: 0;
}

.it-marks-meta {
  margin: 0.2rem 0 0;
  color: #6b7c97;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.it-marks-notice {
  margin: 0;
  border-inline: 0;
  border-radius: 0;
  border-bottom: 1px solid #f0e2cf;
  font-size: 0.82rem;
}

.it-marks-sheet .exam-subject-code.is-combined {
  background: linear-gradient(180deg, #f3efff 0%, #e8e4ff 100%);
  color: #4a3f8f;
}

.it-marks-sheet .exam-mark-percent-readonly {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.14rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(74, 63, 143, 0.1);
  color: #4a3f8f;
  font-size: 0.74rem;
  font-weight: 800;
}

.it-marks-sheet .exam-mark-percent-readonly:empty {
  display: none;
}

.it-marks-sheet .exam-record-students-table th:first-child,
.it-marks-sheet .exam-record-students-table td:first-child {
  min-width: 11rem;
  max-width: none;
}

.it-marks-sheet .exam-record-students-table.is-name-collapsed th:first-child,
.it-marks-sheet .exam-record-students-table.is-name-collapsed td:first-child {
  min-width: 5.5rem;
  max-width: 5.5rem;
}

.it-marks-sheet .exam-mark-input {
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.it-marks-sheet .exam-record-marks-form.is-editing .exam-mark-input:focus {
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.it-marks-sheet .exam-mark-mean-percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.12rem 0.3rem;
  border-radius: 0.45rem;
  background: rgba(31, 92, 240, 0.12);
  color: var(--blue-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.it-marks-sheet .exam-record-mean-row td {
  background: linear-gradient(180deg, #f4f8ff 0%, #eef4ff 100%);
  border-top: 1px solid #d5e3f8;
}

.it-marks-sheet .exam-record-mean-row td:first-child {
  color: var(--blue-dark);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.it-marks-sheet .it-marks-table-panel,
.teacher-marks-sheet .teacher-marks-table-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.it-marks-sheet .exam-record-sheet-table.it-marks-table-panel,
.teacher-marks-sheet .exam-record-sheet-table.teacher-marks-table-panel {
  flex: 1 1 auto;
  min-height: 0;
}

.it-marks-sheet .it-marks-table-scroll,
.teacher-marks-sheet .teacher-marks-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scroll-padding-inline-start: 0.5rem;
  touch-action: pan-x pan-y;
}

.it-marks-sheet .it-marks-table-scroll::-webkit-scrollbar,
.teacher-marks-sheet .teacher-marks-table-scroll::-webkit-scrollbar {
  width: 0.55rem;
  height: 0.55rem;
}

.it-marks-sheet .it-marks-table-scroll::-webkit-scrollbar-thumb,
.teacher-marks-sheet .teacher-marks-table-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c5d2e8;
}

.it-marks-sheet .it-marks-table-scroll::-webkit-scrollbar-thumb:hover,
.teacher-marks-sheet .teacher-marks-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #9fb4d6;
}

.it-marks-sheet .it-marks-table-scroll::-webkit-scrollbar-track,
.teacher-marks-sheet .teacher-marks-table-scroll::-webkit-scrollbar-track {
  background: #eef3fa;
}

.it-marks-sheet .it-marks-mean-bar,
.teacher-marks-sheet .teacher-marks-mean-bar {
  position: relative;
  z-index: 6;
  flex-shrink: 0;
  border-top: 1px solid #c5d8f2;
  background:
    linear-gradient(180deg, rgba(244, 248, 255, 0.98) 0%, rgba(234, 242, 255, 0.98) 100%);
  box-shadow:
    0 -1px 0 #d5e3f8,
    0 -10px 24px rgba(21, 35, 63, 0.1);
  backdrop-filter: blur(8px);
}

.it-marks-sheet .it-marks-mean-scroll,
.teacher-marks-sheet .teacher-marks-mean-scroll {
  overflow: hidden;
  overscroll-behavior-x: contain;
}

.it-marks-sheet .it-marks-mean-table,
.teacher-marks-sheet .teacher-marks-mean-table {
  margin: 0;
}

.it-marks-sheet .it-marks-mean-table .exam-record-mean-row td,
.teacher-marks-sheet .teacher-marks-mean-table .exam-record-mean-row td {
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
  border-bottom: 0;
}

.it-marks-sheet .it-marks-table-panel.is-scrolled-x .it-marks-table-scroll .exam-record-students-table th:first-child,
.it-marks-sheet .it-marks-table-panel.is-scrolled-x .it-marks-table-scroll .exam-record-students-table td:first-child {
  box-shadow: 10px 0 14px -10px rgba(21, 35, 63, 0.35);
}

.it-marks-sheet .it-marks-table-panel.is-scrolled-x .it-marks-mean-table th:first-child,
.it-marks-sheet .it-marks-table-panel.is-scrolled-x .it-marks-mean-table td:first-child,
.teacher-marks-sheet .teacher-marks-table-panel.is-scrolled-x .teacher-marks-mean-table th:first-child,
.teacher-marks-sheet .teacher-marks-table-panel.is-scrolled-x .teacher-marks-mean-table td:first-child {
  box-shadow: 10px 0 14px -10px rgba(21, 35, 63, 0.35);
}

@media (max-width: 720px) {
  .exam-record-bar-tools {
    width: 100%;
    margin-left: 0;
  }

  .exam-class-filter {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    width: 100%;
  }

  .exam-class-filter select {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }
}

.reorder-handle-col {
  width: 2.5rem;
  text-align: center;
}

.reorder-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: -0.12em;
  cursor: grab;
  user-select: none;
}

.settings-table tr.is-draggable {
  cursor: grab;
}

.settings-table tr.is-dragging {
  opacity: 0.55;
  background: #eef4ff;
}

.settings-table tr.is-drop-target td {
  box-shadow: inset 0 2px 0 #2f6fed;
}

.exam-combine-panel[hidden],
.exam-card-actions[hidden],
.settings-table [hidden] {
  display: none !important;
}

body.is-reordering-exam-subjects .exam-combine-panel,
body.is-reordering-exam-subjects .exam-card-actions {
  display: none;
}

body.is-reordering-exam-subjects [data-marks-input] {
  pointer-events: none;
  opacity: 0.7;
}

.exam-hub-list {
  display: grid;
  gap: 1.35rem;
}

.exam-tools-grid {
  margin-bottom: 1.35rem;
  animation: rise-in 0.35s ease both;
}

.exam-hub-list .module-grid {
  animation: rise-in 0.35s ease both;
}

.exam-back-row {
  margin: 0 0 0.85rem;
}

.exam-back-link {
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.exam-back-link:hover {
  text-decoration: underline;
}

.exam-level-workspace {
  display: grid;
  gap: 1.25rem;
}

.exam-subjects-panel {
  display: grid;
  gap: 0.85rem;
}

.exam-subjects-table,
.exam-combined-table {
  min-width: 44rem;
}

.exam-subjects-table input[type="number"] {
  width: 8rem;
  min-height: 2.5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  background: #fff;
}

.exam-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.exam-card-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.exam-card-action-buttons .primary-button,
.exam-card-action-buttons .ghost-button {
  width: auto;
  min-width: 10rem;
}

.exam-combine-hint {
  margin: 0;
  max-width: 28rem;
}

.exam-combine-panel {
  display: grid;
  gap: 0.9rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
  background:
    radial-gradient(circle at 100% 0%, #eef4ff 0, transparent 46%),
    #fff;
  box-shadow: var(--shadow-sm);
}

.exam-combine-intro h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.exam-combine-intro p {
  margin: 0;
}

.exam-select-col {
  width: 4.5rem;
  text-align: center;
}

.exam-combine-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.exam-timetable-layout {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}

.exam-timetable-form-panel,
.exam-timetable-list-panel {
  max-width: none;
  width: 100%;
  animation: rise-in 0.35s ease both;
}

.exam-timetable-form {
  display: grid;
  gap: 0.9rem;
}

.exam-timetable-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.exam-timetable-form-actions .primary-button,
.exam-timetable-form-actions .ghost-button {
  width: auto;
  min-width: 9.5rem;
}

.exam-session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-end;
}

.exam-session-item.is-editing {
  border-color: #9db4e0;
  background: #eef4ff;
}

.grading-scale-section {
  display: grid;
  gap: 0.55rem;
}

.grading-scale-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.grading-scale-header h3 {
  display: inline-flex;
  gap: 0.45rem;
  align-items: baseline;
  margin: 0;
  font-size: 0.95rem;
}

.grading-table-panel {
  box-shadow: none;
}

.grading-list-panel {
  max-width: none;
  width: 100%;
}

.grading-table {
  min-width: 42rem;
  font-size: 0.84rem;
}

.grading-table th,
.grading-table td {
  padding: 0.5rem 0.7rem;
  white-space: nowrap;
}

.grading-table td:nth-child(2),
.grading-table td:nth-child(3),
.grading-table th:nth-child(2),
.grading-table th:nth-child(3) {
  white-space: normal;
  min-width: 8rem;
  max-width: 14rem;
}

.grading-table tr.is-editing-row td {
  background: #eef4ff;
}

.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  border-radius: 0.4rem;
  padding: 0.15rem 0.4rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.grading-table .record-actions {
  gap: 0.25rem;
}

.grading-table .record-action {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.exam-timetable-list-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: flex-start;
  justify-content: space-between;
}

.exam-timetable-list-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.exam-timetable-list-header p {
  margin: 0;
}

.exam-session-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-session-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #e4ecf8;
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  background: #f8fafc;
}

.exam-session-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.exam-session-copy strong {
  font-size: 0.95rem;
}

.exam-session-times {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.exam-session-sep {
  opacity: 0.7;
}

.schedule-profile-list {
  display: grid;
  gap: 1rem;
}

.schedule-profile-card {
  display: grid;
  gap: 0.9rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.schedule-profile-header,
.schedule-activities-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.schedule-profile-header h3,
.schedule-form-section h3,
.schedule-activities-heading h3 {
  margin: 0.2rem 0;
  font-size: 1rem;
}

.schedule-profile-header p,
.schedule-activities-heading p {
  margin: 0;
}

.schedule-profile-category {
  color: var(--blue-dark);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.schedule-profile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.schedule-profile-summary > div {
  display: grid;
  gap: 0.18rem;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: #f7f9fc;
}

.schedule-profile-summary strong {
  font-size: 0.88rem;
}

.schedule-activity-table {
  min-width: 34rem;
}

.schedule-day-times {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.schedule-day-times .field {
  margin-bottom: 0;
}

.schedule-form-section {
  display: grid;
  gap: 0.85rem;
  border-top: 1px solid #e8eef8;
  padding-top: 1.15rem;
}

.schedule-profile-dialog {
  display: flex;
  flex-direction: column;
  width: min(64rem, calc(100vw - 1.5rem));
  max-height: min(92dvh, 56rem);
  overflow: hidden;
}

.schedule-profile-dialog .app-modal-header {
  flex: 0 0 auto;
  align-items: flex-start;
  padding: 1.15rem 1.35rem 0.9rem;
  border-bottom: 1px solid #e8eef8;
}

.schedule-profile-kicker {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schedule-profile-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  gap: 0;
  padding: 0;
}

.schedule-profile-form-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.35rem 1.35rem 1.2rem;
}

.schedule-profile-form-body .schedule-form-section:first-of-type {
  border-top: 0;
  padding-top: 0.85rem;
}

.schedule-profile-form .app-modal-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.9rem 1.35rem calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid #e8eef8;
  background: #fff;
}

.schedule-profile-form .app-modal-actions .primary-button,
.schedule-profile-form .app-modal-actions .ghost-button {
  width: auto;
  min-width: 8.5rem;
}

.schedule-profile-form .uppercase-input[readonly] {
  color: var(--ink-soft);
  background: #f4f7fb;
  border-style: dashed;
}

.schedule-empty-hint {
  margin: 0;
  border: 1px dashed #d5e0f2;
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  color: var(--muted);
  background: #f8fbff;
  font-size: 0.86rem;
}

.choice-chips {
  max-height: none;
  overflow: visible;
  border: 0;
  padding: 0;
  background: transparent;
}

.choice-chips > div,
.choice-chips ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.choice-chips li,
.choice-chips > div > div {
  margin: 0;
}

.choice-chips label {
  display: inline-flex;
  min-height: 2.4rem;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid #d5e0f2;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  color: var(--ink-soft);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.choice-chips.is-pills input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.choice-chips.is-pills label {
  position: relative;
}

.choice-chips.is-pills label:has(input:checked) {
  border-color: #1c4fd4;
  color: #fff;
  background: linear-gradient(135deg, #2f6af7, #1c4fd4);
}

.choice-chips.is-pills label:has(input:focus-visible) {
  outline: 2px solid #8fb0ff;
  outline-offset: 2px;
}

.schedule-activity-rows {
  display: grid;
  gap: 0.75rem;
}

.schedule-activity-row {
  display: grid;
  gap: 0.75rem;
  border: 1px solid #e3eaf6;
  border-radius: 14px;
  padding: 0.9rem;
  background: #f9fbfe;
}

.schedule-activity-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
}

.schedule-activity-name,
.schedule-activity-timing .field,
.schedule-activity-row-top .field {
  margin-bottom: 0;
}

.schedule-activity-timing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.schedule-end-time {
  display: flex;
  min-height: var(--touch);
  align-items: center;
  border: 1px solid #cbd9f1;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 700;
}

.schedule-add-activity {
  display: inline-flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px dashed #b7c7e6;
  border-radius: var(--radius-sm);
  color: var(--blue-dark);
  background: #f7faff;
  font-weight: 700;
  cursor: pointer;
}

.schedule-add-activity svg {
  width: 1.1rem;
  height: 1.1rem;
}

.schedule-add-activity:hover {
  border-color: #1c4fd4;
  background: #eef3ff;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid #ead7d7;
  border-radius: 10px;
  color: #b42318;
  background: #fff;
  cursor: pointer;
}

.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.icon-button.is-danger:hover {
  background: #fee4e2;
}

.schedule-preview-alerts {
  display: grid;
  gap: 0.45rem;
}

.schedule-preview-alert {
  margin: 0;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.schedule-preview-alert.is-collision {
  border: 1px solid #f5c2c0;
  color: #912018;
  background: #fef3f2;
}

.schedule-preview-alert.is-gap {
  border: 1px solid #f9db8d;
  color: #854d0e;
  background: #fff8eb;
}

.schedule-timetable-wrap {
  overflow: auto;
  border: 1px solid #cfdcf0;
  border-radius: 12px;
  background: #fff;
}

.schedule-timetable {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.schedule-timetable th,
.schedule-timetable td {
  border: 1px solid #d5e2f4;
  padding: 0.5rem 0.45rem;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
}

.schedule-timetable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 5.6rem;
  color: #fff;
  background: #173e8f;
  vertical-align: bottom;
}

.schedule-timetable thead th span {
  display: block;
  line-height: 1.2;
}

.schedule-timetable thead th:first-child,
.schedule-timetable tbody th {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 7rem;
  text-align: left;
  white-space: nowrap;
  background: #0f2f73;
  color: #fff;
}

.schedule-timetable tbody th {
  z-index: 1;
  color: var(--ink-soft);
  background: #f4f7fc;
}

.schedule-timetable td.is-activity,
.schedule-timetable thead th.is-activity {
  color: var(--blue-dark);
  background: #eaf1ff;
}

.schedule-timetable thead th.is-activity {
  color: #dbe7ff;
  background: #2453b5;
}

.schedule-timetable td.is-collision,
.schedule-timetable thead th.is-collision {
  color: #912018;
  background: #fdecee;
}

.schedule-timetable thead th.is-collision {
  color: #fff;
  background: #b42318;
}

.generated-timetable-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 1.25rem;
}
.generated-timetable-card {
  gap: 0.85rem;
}
.generated-timetable td {
  min-width: 8.5rem;
  vertical-align: top;
  font-weight: 600;
}
.generated-timetable .tt-subject,
.generated-timetable .tt-teacher {
  display: block;
  line-height: 1.3;
}
.generated-timetable .tt-teacher {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}
.generated-timetable td.is-collision .tt-subject,
.generated-timetable td.is-collision .tt-teacher {
  color: #912018;
}
.generated-timetable td.is-collision {
  outline: 1px solid #f04438;
}
.generated-timetable td.is-blank {
  color: #6b7f96;
  background: #e9eef5;
  border-color: #d5dde8;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.generated-timetable td.teacher-tt-busy,
.schedule-timetable td.teacher-tt-busy {
  color: var(--blue-dark);
  background: #f4f8ff;
  border-color: #d7e4fb;
}
.generated-timetable .record-action {
  margin-top: 0.45rem;
}
.supervisor-choice-list {
  display: grid;
  gap: 0.55rem;
  max-height: 22rem;
  overflow: auto;
  margin: 0.75rem 0 0.25rem;
}
.supervisor-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  border: 1px solid #dde6f4;
  border-radius: 0.75rem;
  padding: 0.7rem 0.8rem;
}
.supervisor-choice span {
  display: grid;
  gap: 0.1rem;
}
.supervisor-choice.is-free {
  background: #ecfdf3;
  border-color: #abefc6;
}
.supervisor-choice.is-busy {
  background: #fef3f2;
  border-color: #fecdca;
  cursor: not-allowed;
}
.supervisor-choice.is-busy strong {
  color: #b42318;
}
.supervisor-choice.is-free strong {
  color: #067647;
  font-weight: 600;
}

@media (max-width: 900px) {
  .exam-timetable-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .schedule-activity-timing {
    grid-template-columns: 1fr 1fr;
  }

  .schedule-activity-timing .field:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .exam-card-actions {
    align-items: stretch;
  }

  .exam-card-action-buttons {
    width: 100%;
  }

  .exam-card-action-buttons .primary-button,
  .exam-card-action-buttons .ghost-button,
  .exam-timetable-form-actions .primary-button,
  .exam-timetable-form-actions .ghost-button {
    width: 100%;
  }

  .exam-session-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .exam-session-meta {
    width: 100%;
    justify-content: space-between;
  }

  .schedule-activity-timing {
    grid-template-columns: 1fr;
  }

  .schedule-day-times {
    grid-template-columns: 1fr;
  }

  .schedule-profile-form .app-modal-actions .primary-button,
  .schedule-profile-form .app-modal-actions .ghost-button {
    width: 100%;
  }

  .schedule-profile-dialog {
    width: 100%;
    max-height: min(94dvh, 100%);
  }
}

.settings-table-panel {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  max-width: 100%;
}

.settings-table-responsive {
  min-width: 48rem;
}

.record-action {
  min-height: var(--touch);
  padding: 0.45rem 0.75rem;
}

@media (max-width: 820px) {
  .workspace-header-bar {
    min-height: var(--header-h);
    padding-block: 0.45rem;
  }

  .workspace-header-left {
    min-width: 0;
  }

  .workspace-user-meta span {
    display: none;
  }

  .workspace-profile-trigger {
    max-width: 12rem;
  }

  .settings-panel {
    max-width: none;
  }

  .settings-toolbar-actions {
    width: 100%;
  }

  .settings-toolbar-action,
  .settings-toolbar-actions .primary-button,
  .settings-toolbar-actions .ghost-button {
    width: 100%;
    min-width: 0;
  }

  .settings-table-panel {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .exam-record-sheet .exam-record-sheet-table.settings-table-panel {
    overflow: auto;
    overscroll-behavior: contain;
  }

  .exam-analytics-page .exam-analytics-scroll,
  .exam-analytics-page .exam-record-sheet .exam-record-sheet-table.settings-table-panel,
  .exam-analytics-page .exam-record-sheet .exam-analytics-scroll.settings-table-panel {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .exam-record-bar-tools {
    width: 100%;
    margin-left: 0;
  }

  .exam-record-bar-tools .ghost-button,
  .exam-record-bar-tools .primary-button,
  .exam-record-bar .exam-back-link {
    flex: 1 1 auto;
    min-width: 0;
  }

  .exam-record-bar .primary-button {
    min-width: 0;
  }

  /* Matrix / marks sheets keep horizontal scroll */
  .allocation-table,
  .allocation-table-supervisors,
  .exam-record-students-table,
  .exam-analytics-table {
    min-width: 36rem;
  }

  .teacher-marks-sheet .exam-record-students-table {
    min-width: 0;
  }

  .it-marks-sheet .exam-record-students-table {
    min-width: 0;
  }

  .exam-record-sheet .settings-table.exam-record-students-table,
  .exam-record-sheet .settings-table-responsive.exam-record-students-table {
    width: max-content;
    min-width: 100%;
  }

  .settings-table th,
  .settings-table td {
    padding: 0.8rem 0.9rem;
  }

  .exam-record-students-table th,
  .exam-record-students-table td {
    padding: 0.28rem 0.4rem;
  }

  /* Teacher marks sheet: compact mobile layout; full names until horizontal scroll */
  .workspace-content:has(> .teacher-marks-sheet) {
    width: min(100% - 1rem, var(--page-max));
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .teacher-marks-sheet {
    font-size: 0.76rem;
    border-radius: 0.85rem;
  }

  .teacher-marks-bar {
    padding: 0.55rem 0.6rem;
    gap: 0.4rem 0.55rem;
  }

  .teacher-marks-bar .exam-detail-kicker {
    font-size: 0.58rem;
  }

  .teacher-marks-title-block h2 {
    font-size: 0.78rem;
  }

  .teacher-marks-meta {
    font-size: 0.66rem;
  }

  .teacher-marks-sheet .student-count-chip,
  .teacher-marks-sheet .exam-marks-lock-chip,
  .teacher-marks-subject-chip {
    font-size: 0.56rem;
    padding: 0.1rem 0.34rem;
  }

  .teacher-marks-tools .exam-back-link,
  .teacher-marks-tools .ghost-button,
  .teacher-marks-tools .primary-button,
  .teacher-marks-back {
    min-height: 1.85rem;
    padding: 0.22rem 0.5rem;
    font-size: 0.68rem;
  }

  .teacher-marks-notice {
    font-size: 0.72rem;
    padding: 0.45rem 0.55rem;
  }

  .teacher-marks-sheet .exam-record-sheet-table,
  .teacher-marks-sheet .teacher-marks-table-panel {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
  }

  .teacher-marks-sheet .teacher-marks-table-scroll,
  .it-marks-sheet .it-marks-table-scroll {
    overflow: auto;
    min-height: 0;
    max-height: none;
  }

  .it-marks-sheet .exam-record-sheet-table,
  .it-marks-sheet .it-marks-table-panel {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
  }

  .teacher-marks-sheet .exam-record-students-table {
    width: max-content;
    min-width: 100%;
    font-size: 0.68rem;
  }

  .teacher-marks-sheet .settings-table.exam-record-students-table,
  .teacher-marks-sheet .settings-table-responsive.exam-record-students-table {
    width: max-content;
    min-width: 100%;
  }

  .teacher-marks-sheet .exam-record-students-table thead th {
    padding: 0.32rem 0.22rem;
    font-size: 0.52rem;
    letter-spacing: 0.03em;
  }

  .teacher-marks-sheet .exam-subject-code {
    min-width: 1.75rem;
    padding: 0.1rem 0.28rem;
    font-size: 0.56rem;
    border-radius: 0.35rem;
  }

  .teacher-marks-pct-head {
    min-width: 1rem;
    font-size: 0.58rem;
  }

  .teacher-marks-sheet .exam-record-students-table th,
  .teacher-marks-sheet .exam-record-students-table td {
    padding: 0.2rem 0.22rem;
  }

  .teacher-marks-sheet .exam-record-students-table th:first-child,
  .teacher-marks-sheet .exam-record-students-table td:first-child {
    min-width: 8.5rem;
    max-width: none;
    padding-left: 0.5rem;
    padding-right: 0.55rem;
  }

  .teacher-marks-sheet .exam-record-students-table.is-name-collapsed th:first-child,
  .teacher-marks-sheet .exam-record-students-table.is-name-collapsed td:first-child {
    min-width: 4.5rem;
    max-width: 5.25rem;
    padding-left: 0.4rem;
    padding-right: 0.28rem;
  }

  .teacher-marks-sheet .exam-record-students-table th:nth-child(n + 3),
  .teacher-marks-sheet .exam-record-students-table td:nth-child(n + 3) {
    min-width: 1.85rem;
  }

  .teacher-marks-sheet .exam-student-name {
    font-size: 0.68rem;
    font-weight: 700;
  }

  .teacher-marks-sheet .exam-admission {
    padding: 0;
    background: transparent;
    font-size: 0.66rem;
  }

  .teacher-marks-sheet .exam-mark-input {
    width: 1.95rem;
    min-height: 1.35rem;
    padding: 0.04rem 0.08rem;
    font-size: 0.66rem;
    border-radius: 0.4rem;
  }

  .teacher-marks-sheet .exam-record-marks-form.is-editing .exam-mark-input {
    font-size: 16px;
  }

  .teacher-marks-sheet .exam-mark-percent,
  .teacher-marks-sheet .exam-mark-mean {
    min-width: 1.65rem;
    padding: 0.08rem 0.2rem;
    font-size: 0.62rem;
    border-radius: 0.32rem;
  }

  .teacher-marks-sheet .exam-record-mean-row td:first-child {
    padding-left: 0.4rem;
    font-size: 0.62rem;
  }

  .teacher-marks-chips {
    gap: 0.25rem;
  }

  @media (max-width: 480px) {
    .teacher-marks-subject-chip {
      display: none;
    }

    .teacher-marks-meta {
      display: none;
    }

    .it-marks-meta {
      display: none;
    }
  }

  /* IT support marks sheet: compact mobile layout; full names until horizontal scroll */
  .workspace-content:has(> .it-marks-sheet) {
    width: min(100% - 1rem, var(--page-max));
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .it-marks-sheet {
    font-size: 0.76rem;
    border-radius: 0.85rem;
  }

  .it-marks-bar {
    padding: 0.55rem 0.65rem;
    gap: 0.45rem 0.6rem;
  }

  .it-marks-bar .exam-detail-crumb {
    font-size: 0.58rem;
  }

  .it-marks-title-block h2,
  .it-marks-bar .exam-record-bar-title h2 {
    font-size: 0.82rem;
  }

  .it-marks-meta {
    font-size: 0.66rem;
  }

  .it-marks-sheet .student-count-chip {
    font-size: 0.58rem;
    padding: 0.12rem 0.38rem;
  }

  .it-marks-tools .exam-class-filter {
    flex: 1 1 100%;
    width: 100%;
  }

  .it-marks-tools .exam-class-filter select,
  .it-marks-tools .exam-detail-actions .ghost-button,
  .it-marks-tools .exam-detail-actions .primary-button {
    min-height: 1.9rem;
    font-size: 0.72rem;
  }

  .it-marks-notice {
    font-size: 0.72rem;
    padding: 0.45rem 0.55rem;
  }

  .it-marks-sheet .exam-record-sheet-table,
  .it-marks-sheet .it-marks-table-panel {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
  }

  .it-marks-sheet .it-marks-table-scroll {
    overflow: auto;
    min-height: 0;
    max-height: none;
  }

  .it-marks-sheet .exam-record-students-table {
    width: max-content;
    min-width: 100%;
    font-size: 0.68rem;
  }

  .it-marks-sheet .exam-record-students-table thead th {
    padding: 0.35rem 0.25rem;
    font-size: 0.54rem;
  }

  .it-marks-sheet .exam-subject-code {
    min-width: 1.7rem;
    padding: 0.1rem 0.26rem;
    font-size: 0.56rem;
  }

  .it-marks-sheet .exam-subject-combined-note {
    display: none;
  }

  .it-marks-sheet .exam-record-students-table th,
  .it-marks-sheet .exam-record-students-table td {
    padding: 0.22rem 0.24rem;
  }

  .it-marks-sheet .exam-record-students-table th:first-child,
  .it-marks-sheet .exam-record-students-table td:first-child {
    min-width: 8.5rem;
    max-width: none;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .it-marks-sheet .exam-record-students-table.is-name-collapsed th:first-child,
  .it-marks-sheet .exam-record-students-table.is-name-collapsed td:first-child {
    min-width: 4.5rem;
    max-width: 5.25rem;
    padding-left: 0.4rem;
    padding-right: 0.28rem;
  }

  .it-marks-sheet .exam-record-students-table th:nth-child(n + 3),
  .it-marks-sheet .exam-record-students-table td:nth-child(n + 3) {
    min-width: 2rem;
  }

  .it-marks-sheet .exam-student-name {
    font-size: 0.68rem;
  }

  .it-marks-sheet .exam-admission {
    padding: 0.1rem 0.32rem;
    font-size: 0.64rem;
  }

  .it-marks-sheet .exam-mark-input {
    width: 2rem;
    min-height: 1.4rem;
    font-size: 0.66rem;
    border-radius: 0.4rem;
  }

  .it-marks-sheet .exam-record-marks-form.is-editing .exam-mark-input {
    font-size: 16px;
  }

  .it-marks-sheet .exam-mark-percent-readonly,
  .it-marks-sheet .exam-mark-mean-percent {
    min-width: 1.7rem;
    padding: 0.08rem 0.18rem;
    font-size: 0.62rem;
  }

  .it-marks-sheet .exam-record-mean-row td:first-child {
    padding-left: 0.4rem;
    font-size: 0.62rem;
  }

  .it-marks-chips {
    gap: 0.28rem;
  }

  .settings-table .record-actions {
    flex-wrap: wrap;
  }

  /* List tables with data-label → stacked cards */
  .settings-table-panel:has(.settings-table td[data-label]):not(:has(.allocation-table)):not(:has(.exam-record-students-table)):not(:has(.exam-analytics-table)):not(:has(.subject-attendance-matrix)):not(:has(.attendance-students-table)) {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table),
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table),
  .grading-table:has(td[data-label]),
  .exam-subjects-table:has(td[data-label]),
  .exam-combined-table:has(td[data-label]) {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) thead,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) thead,
  .grading-table:has(td[data-label]) thead,
  .exam-subjects-table:has(td[data-label]) thead,
  .exam-combined-table:has(td[data-label]) thead {
    display: none;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) tbody,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) tbody,
  .grading-table:has(td[data-label]) tbody,
  .exam-subjects-table:has(td[data-label]) tbody,
  .exam-combined-table:has(td[data-label]) tbody {
    display: grid;
    gap: 0.75rem;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) tr,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) tr,
  .grading-table:has(td[data-label]) tr,
  .exam-subjects-table:has(td[data-label]) tr,
  .exam-combined-table:has(td[data-label]) tr {
    display: grid;
    gap: 0.35rem;
    border: 1px solid #dde6f4;
    border-radius: var(--radius-lg);
    padding: 0.85rem 0.95rem;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td,
  .grading-table:has(td[data-label]) td,
  .exam-subjects-table:has(td[data-label]) td,
  .exam-combined-table:has(td[data-label]) td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.2rem 0;
    border: 0;
    white-space: normal;
    min-width: 0;
    max-width: none;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) tbody tr:hover td,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) tbody tr:hover td,
  .grading-table:has(td[data-label]) tbody tr:hover td,
  .exam-subjects-table:has(td[data-label]) tbody tr:hover td,
  .exam-combined-table:has(td[data-label]) tbody tr:hover td {
    background: transparent;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td::before,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td::before,
  .grading-table:has(td[data-label]) td::before,
  .exam-subjects-table:has(td[data-label]) td::before,
  .exam-combined-table:has(td[data-label]) td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 42%;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td:first-child::before,
  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td[data-label="Actions"]::before,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td:first-child::before,
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td[data-label="Actions"]::before,
  .grading-table:has(td[data-label]) td:first-child::before,
  .grading-table:has(td[data-label]) td[data-label="Actions"]::before,
  .exam-subjects-table:has(td[data-label]) td:first-child::before,
  .exam-combined-table:has(td[data-label]) td:first-child::before {
    display: none;
  }

  .settings-table:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td[data-label="Actions"],
  .settings-table-responsive:has(td[data-label]):not(.allocation-table):not(.exam-record-students-table):not(.exam-analytics-table):not(.subject-attendance-matrix):not(.attendance-students-table) td[data-label="Actions"],
  .grading-table:has(td[data-label]) td[data-label="Actions"] {
    justify-content: flex-start;
    padding-top: 0.45rem;
  }

  .settings-table:has(td[data-label]) .settings-stack,
  .settings-table-responsive:has(td[data-label]) .settings-stack,
  .grading-table:has(td[data-label]) .settings-stack {
    min-width: 0;
    max-width: none;
  }

  .settings-table:has(td[data-label]) .record-actions,
  .settings-table-responsive:has(td[data-label]) .record-actions,
  .grading-table:has(td[data-label]) .record-actions {
    width: 100%;
  }

  .settings-table td[hidden],
  .exam-subjects-table td[hidden] {
    display: none !important;
  }
}

@media (max-width: 640px) {
  /* Keep controls at 16px so iOS does not zoom; UI copy stays smaller above. */
  input,
  select,
  textarea,
  .phone-national,
  .phone-option-name,
  .phone-country-name {
    font-size: 16px;
  }

  .phone-option-dial,
  .phone-dial {
    font-size: 0.75rem;
  }

  .app-header-inner {
    min-height: 3.75rem;
  }

  .app-header-actions {
    gap: 0.4rem;
  }

  .app-header-actions .ghost-button {
    min-height: 2.5rem;
  }

  .workspace-header-bar {
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
  }

  .workspace-preview-banner {
    margin: 0 0.7rem 0.6rem;
    padding: 0.45rem 0.65rem;
  }

  .workspace-header-left,
  .workspace-header-right {
    gap: 0.45rem;
  }

  .workspace-menu-btn {
    width: var(--touch);
    height: var(--touch);
  }

  .workspace-back-btn {
    width: var(--touch);
    height: var(--touch);
  }

  .workspace-profile-trigger {
    min-height: var(--touch);
    min-width: var(--touch);
    justify-content: center;
    padding: 0.15rem;
  }

  .workspace-avatar-wrap {
    width: 2.2rem;
    height: 2.2rem;
  }

  .workspace-profile-menu {
    position: fixed;
    top: calc(var(--header-h) + 0.15rem);
    right: 0.65rem;
    min-width: min(15rem, calc(100vw - 1.3rem));
  }

  .workspace-welcome,
  .hero-panel {
    padding: 1rem;
  }

  .workspace-welcome-cta,
  .hero-panel .ghost-button {
    width: 100%;
  }

  .student-list li {
    align-items: flex-start;
    padding: 0.85rem;
  }

  .student-list li > * {
    overflow-wrap: anywhere;
  }

  .app-modal {
    place-items: end center;
    padding: 0;
  }

  .app-modal-dialog {
    width: 100%;
    max-height: min(88dvh, 46rem);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .app-modal-dialog.app-modal-dialog-generation {
    width: 100%;
    max-height: min(92dvh, 100%);
  }

  .app-modal-dialog.app-modal-dialog-calendar {
    width: 100%;
    max-height: min(92dvh, 100%);
  }

  .app-modal-header {
    padding: 1rem 1rem 0.25rem;
  }

  .app-modal-form {
    padding: 0.5rem 1rem calc(1rem + env(safe-area-inset-bottom));
  }

  .app-modal-dialog-generation .app-modal-form {
    padding: 0;
  }

  .app-modal-dialog-generation .app-modal-header {
    padding: 1rem 1rem 0.75rem;
  }

  .app-modal-dialog-generation .generation-step > .subtle,
  .app-modal-dialog-generation .generation-step > .notice,
  .app-modal-dialog-generation .generation-step > .settings-empty {
    padding: 0.75rem 1rem 0.45rem;
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .app-modal-dialog-generation .generation-level-list,
  .app-modal-dialog-generation .generation-calendar {
    padding: 0.25rem 1rem;
  }

  .app-modal-dialog-generation .generation-level {
    padding: 0.7rem 0.75rem;
    gap: 0.55rem;
  }

  .app-modal-dialog-generation .generation-level .subtle,
  .app-modal-dialog-generation .generation-level-reason {
    overflow-wrap: anywhere;
  }

  .app-modal-dialog-generation .generation-step .app-modal-actions {
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  }

  .exam-manage-modal {
    place-items: end center;
    padding: 0;
  }

  .exam-manage-modal.is-open .exam-manage-dialog {
    animation: exam-manage-dialog-in-mobile 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @keyframes exam-manage-dialog-in-mobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .exam-manage-dialog,
  .exam-manage-dialog-edit {
    width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: 1.35rem 1.35rem 0 0;
  }

  .exam-manage-dialog-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 1rem 1rem 0.8rem;
  }

  .exam-manage-dialog-heading h2 {
    font-size: 1.05rem;
  }

  .exam-manage-dialog-lead {
    font-size: 0.8rem;
  }

  .exam-manage-dialog-body {
    padding: 0.85rem 1rem 0.25rem;
  }

  .exam-manage-dialog-actions,
  .exam-manage-dialog-edit .generation-step .app-modal-actions {
    flex-direction: column-reverse;
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  }

  .exam-manage-dialog-actions .primary-button,
  .exam-manage-dialog-actions .ghost-button,
  .exam-manage-dialog-edit .generation-step .app-modal-actions .primary-button,
  .exam-manage-dialog-edit .generation-step .app-modal-actions .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .exam-manage-field-grid,
  .exam-level-chip-grid {
    grid-template-columns: 1fr;
  }

  .exam-status-card {
    padding: 0.8rem 0.85rem;
  }

  .exam-timetable-generation-page .teacher-page-bar-actions .ghost-button,
  .exam-timetable-generation-page .teacher-page-bar-actions .primary-button {
    flex: 1 1 100%;
  }

  .exam-timetable-generation-page .generated-timetable .record-action {
    display: block;
    width: 100%;
    text-align: center;
  }

  .file-drop {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .brand-text { font-size: 1rem; }
  .ghost-button { padding-inline: 0.75rem; }
  .avatar { width: 2.6rem; height: 2.6rem; border-radius: 0.85rem; }

  .workspace-header-title,
  .form-page-heading h1,
  .form-page-heading h2,
  .hero-copy h1 {
    font-size: 1.1rem;
  }

  .app-header .brand-text {
    display: none;
  }

  .app-header-actions .user-chip {
    display: none;
  }

  .portal-tabs {
    gap: 0.2rem;
    padding: 0.2rem;
  }

  .portal-tab {
    min-height: var(--touch);
    padding-inline: 0.35rem;
  }
}

.subject-profile-bar {
  margin-bottom: 0;
  flex: 0 0 auto;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.workspace-content:has(.subject-profile-page),
.workspace-content:has(.teacher-dashboard-page) {
  display: flex;
  flex-direction: column;
  width: min(100% - 2rem, 72rem);
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.subject-profile-page,
.teacher-dashboard-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.exam-tool-page,
.sa-hub-page,
.all-exams-page {
  min-width: 0;
  max-width: 100%;
}

.teacher-dash-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  margin-bottom: 0.85rem;
  padding: 1rem 1.15rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, #dce8ff 0, transparent 46%),
    linear-gradient(145deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: var(--shadow-sm);
}

.teacher-dash-kicker {
  margin: 0 0 0.25rem;
  color: #5d7399;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.teacher-dash-hero-copy {
  min-width: 0;
  max-width: 34rem;
}

.teacher-dash-hero-copy h2 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
}

.teacher-dash-hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.teacher-dash-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.teacher-dash-stat {
  display: grid;
  gap: 0.12rem;
  min-width: 7.5rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #dce6f5;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.88);
}

.teacher-dash-stat strong {
  font: 800 1.2rem/1.1 var(--display);
  color: var(--blue-dark);
}

.teacher-dash-stat span {
  color: var(--muted);
  font: 650 0.72rem/1.25 var(--font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.teacher-dash-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  gap: 0.65rem;
  flex: 0 0 auto;
  margin-bottom: 0.85rem;
}

.teacher-dash-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  min-height: 4.4rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.teacher-dash-action:hover {
  border-color: #b8c9ea;
  background: #f7f9fc;
  transform: translateY(-1px);
}

.teacher-dash-action.is-static {
  cursor: default;
  opacity: 0.92;
  background: #f8fafc;
}

.teacher-dash-action.is-static:hover {
  border-color: #dde6f4;
  background: #f8fafc;
  transform: none;
}

.teacher-dash-action-icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.75rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font: 800 0.78rem/1 var(--display);
}

.teacher-dash-action-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.teacher-dash-action-copy strong {
  font: 750 0.92rem/1.2 var(--display);
  color: var(--ink);
}

.teacher-dash-action-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

/* Large screens: module links live in the sidebar only. */
@media (min-width: 1101px) {
  .teacher-dash-actions.is-nav-links {
    display: none;
  }

  .workspace-nav-drawer-toggle {
    display: none;
  }

  .workspace-nav-drawer-panel {
    display: block !important;
  }

  .workspace-nav-drawer-panel[hidden] {
    display: block !important;
  }
}

.workspace-nav-drawer {
  flex: 0 0 auto;
  margin-bottom: 0.55rem;
}

.workspace-nav-drawer-toggle {
  display: none;
  width: 100%;
  min-height: 2.35rem;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.85rem;
  border-radius: 0.75rem;
  border-color: #d5e1f2;
  background: #f7faff;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.workspace-nav-drawer-toggle:hover {
  border-color: #b8ccee;
  background: #eef4ff;
  color: var(--blue);
}

.workspace-nav-drawer-toggle-icon {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.workspace-nav-drawer:not(.is-collapsed) .workspace-nav-drawer-toggle-icon {
  transform: rotate(-135deg);
}

.workspace-nav-drawer-panel {
  display: grid;
  gap: 0.45rem;
}

@media (max-width: 1100px) {
  .workspace-nav-drawer-toggle {
    display: inline-flex;
  }

  .workspace-nav-drawer.is-collapsed .workspace-nav-drawer-panel {
    display: none;
  }

  .workspace-nav-drawer:not(.is-collapsed) .workspace-nav-drawer-panel {
    display: grid;
  }
}

.teacher-dashboard-scroll {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  padding: 0;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.teacher-tt-section-head {
  padding: 1rem 1.1rem 0.35rem;
}

.teacher-tt-section-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.teacher-tt-section-head .subtle {
  margin: 0;
}

.teacher-dashboard-scroll > .teacher-tt-card + .teacher-tt-card,
.teacher-dashboard-scroll > .teacher-tt-empty + .teacher-tt-card,
.teacher-dashboard-scroll > .teacher-tt-card + .teacher-tt-empty,
.teacher-dashboard-scroll > .teacher-tt-empty + .teacher-tt-empty {
  border-top: 1px solid #dde6f4;
}

.teacher-tt-card {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  min-height: auto;
  padding: 1rem 1.1rem 1.15rem;
}

.teacher-tt-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.teacher-tt-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.teacher-tt-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font: 750 0.72rem/1 var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.teacher-tt-wrap {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.teacher-tt-table td.teacher-tt-busy {
  background: #f4f8ff;
  border-color: #d7e4fb;
}

.teacher-tt-table td.is-blank {
  color: #6b7f96;
  background: #e9eef5;
  border-color: #d5dde8;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.teacher-tt-table .tt-subject {
  color: var(--blue-dark);
  font-weight: 800;
}

.teacher-tt-table .tt-teacher {
  color: var(--ink-soft);
}

.teacher-tt-empty {
  display: grid;
  gap: 0.35rem;
  place-content: center;
  min-height: 12rem;
  padding: 2rem 1.25rem;
  text-align: center;
}

.teacher-tt-empty strong {
  font: 750 1rem/1.3 var(--display);
  color: var(--ink);
}

@media (max-width: 1100px) {
  .workspace-content:has(.teacher-dashboard-page),
  .workspace-content:has(.subject-profile-page),
  .workspace-content:has(.sa-hub-page),
  .workspace-content:has(.exam-tool-page),
  .workspace-content:has(.all-exams-page),
  .workspace-content:has(.exam-detail-page) {
    width: min(100% - 1.5rem, 72rem);
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .teacher-dash-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .teacher-dash-actions.is-nav-links {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
  }

  .teacher-dash-actions.is-nav-links .teacher-dash-action {
    min-height: 2.1rem;
    padding: 0.25rem 0.55rem 0.25rem 0.28rem;
    gap: 0.35rem;
  }

  .teacher-dash-actions.is-nav-links .teacher-dash-action-icon {
    width: 1.45rem;
    height: 1.45rem;
    font-size: 0.55rem;
    border-radius: 0.4rem;
  }

  .teacher-dash-actions.is-nav-links .teacher-dash-action-copy strong {
    font-size: 0.74rem;
  }

  .teacher-dash-action {
    display: inline-flex;
    flex: 0 1 auto;
    gap: 0.45rem;
    align-items: center;
    min-height: 2.45rem;
    max-width: 100%;
    padding: 0.35rem 0.7rem 0.35rem 0.35rem;
    border-radius: 0.7rem;
    box-shadow: none;
    background: #f7faff;
  }

  .teacher-dash-action:hover {
    transform: none;
    background: #eef4ff;
  }

  .teacher-dash-action.is-static:hover {
    background: #f7faff;
  }

  .teacher-dash-action-icon {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.5rem;
    font-size: 0.62rem;
  }

  .teacher-dash-action-copy {
    gap: 0;
    min-width: 0;
  }

  .teacher-dash-action-copy strong {
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .teacher-dash-action-copy span {
    display: none;
  }

  .teacher-page-bar {
    gap: 0.5rem;
  }

  .teacher-page-bar-actions {
    width: 100%;
  }

  .teacher-page-bar-actions .ghost-button,
  .teacher-page-bar-actions .primary-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .teacher-tt-card {
    gap: 0.7rem;
    padding: 0.85rem 0.9rem 1rem;
  }

  .teacher-tt-section-head {
    padding: 0.85rem 0.9rem 0.3rem;
  }

  .sa-hub-page,
  .exam-tool-page {
    gap: 0.75rem;
  }

  .sa-class-grid,
  .exam-hub-grid,
  .sa-subject-grid,
  .sa-subject-list {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.7rem 0.75rem 0.85rem;
  }

  .sa-class-card,
  .exam-hub-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem 0.65rem;
    align-items: center;
    min-height: 2.6rem;
    padding: 0.45rem 0.65rem;
    box-shadow: none;
    background: #f7faff;
  }

  .sa-class-card {
    grid-template-areas: "mark copy go";
  }

  .exam-hub-card {
    grid-template-areas: "icon copy go";
  }

  .sa-class-card:hover,
  .exam-hub-card:hover {
    transform: none;
    background: #eef4ff;
  }

  .sa-class-mark,
  .exam-hub-card-icon {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.5rem;
    font-size: 0.62rem;
  }

  .sa-class-copy strong,
  .exam-hub-card-copy strong {
    font-size: 0.82rem;
  }

  .sa-class-copy span,
  .exam-hub-card-copy span:not(.exam-hub-card-meta),
  .exam-hub-card-meta,
  .sa-class-go,
  .exam-hub-card-go {
    display: none;
  }

  .sa-class-card::after,
  .exam-hub-card::after {
    grid-area: go;
    content: "→";
    color: var(--blue);
    font-weight: 750;
  }

  .sa-subject-tile {
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    box-shadow: none;
    background: #f7faff;
  }

  .sa-subject-tile-icon {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.5rem;
    font-size: 0.62rem;
  }

  .sa-subject-tile-text strong {
    font-size: 0.82rem;
  }

  .sa-level-head,
  .exam-tool-panel-head,
  .all-exams-year-head {
    padding: 0.75rem 0.85rem;
  }

  .exam-record-bar-tools {
    width: 100%;
    margin-left: 0;
  }

  .schedule-timetable-wrap,
  .teacher-tt-wrap,
  .settings-table-panel {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  .workspace-content:has(.teacher-dashboard-page),
  .workspace-content:has(.subject-profile-page),
  .workspace-content:has(.sa-hub-page),
  .workspace-content:has(.exam-tool-page),
  .workspace-content:has(.all-exams-page),
  .workspace-content:has(.exam-detail-page) {
    width: min(100% - 1rem, 72rem);
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .teacher-page-bar {
    gap: 0.45rem;
  }

  .teacher-page-bar-stats,
  .teacher-page-bar-actions {
    width: 100%;
  }

  .teacher-page-bar-stat {
    min-height: 2rem;
    padding: 0.25rem 0.55rem;
  }

  .teacher-page-bar-stat strong {
    max-width: min(12rem, 55vw);
  }

  .teacher-page-bar-actions .ghost-button,
  .teacher-page-bar-actions .primary-button {
    flex: 1 1 100%;
    min-height: 2.35rem;
    padding-inline: 0.75rem;
    font-size: 0.8rem;
  }

  .teacher-dash-actions {
    gap: 0.4rem;
    margin-bottom: 0.65rem;
  }

  .teacher-dash-action {
    min-height: 2.25rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  }

  .teacher-dash-action-copy strong {
    font-size: 0.76rem;
    max-width: min(14rem, 70vw);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .teacher-dash-stat {
    min-width: 6.5rem;
  }

  .teacher-dashboard-scroll {
    border-radius: var(--radius-sm);
  }

  .teacher-tt-section-head {
    padding: 0.75rem 0.75rem 0.25rem;
  }

  .teacher-tt-section-head h2 {
    font-size: 0.95rem;
  }

  .teacher-tt-section-head .subtle {
    font-size: 0.78rem;
  }

  .teacher-tt-card {
    gap: 0.6rem;
    padding: 0.75rem;
  }

  .teacher-tt-header {
    gap: 0.45rem 0.65rem;
  }

  .teacher-tt-header h3 {
    font-size: 0.9rem;
  }

  .teacher-tt-header .subtle {
    font-size: 0.75rem;
  }

  .teacher-tt-wrap {
    margin-inline: -0.75rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .teacher-tt-empty,
  .sa-hub-empty,
  .exam-tool-empty {
    min-height: 9rem;
    padding: 1.35rem 1rem;
  }

  .exam-record-bar {
    padding: 0.65rem 0.75rem;
  }

  .exam-record-bar-title h2 {
    font-size: 0.9rem;
  }

  .exam-record-bar-tools .ghost-button,
  .exam-record-bar-tools .primary-button,
  .exam-record-bar .exam-back-link {
    flex: 1 1 auto;
    min-height: 2.35rem;
    justify-content: center;
    text-align: center;
  }

  .subject-profile-bar {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .workspace-footer {
    padding-inline: 0.75rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .workspace-header-bar {
    padding-inline: 0.6rem;
  }

  .workspace-header-title {
    font-size: 0.98rem;
  }

  .workspace-header-eyebrow {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  .workspace-preview-banner {
    margin-inline: 0.6rem;
    font-size: 0.78rem;
  }

  .teacher-dash-action {
    flex: 1 1 calc(50% - 0.4rem);
    min-width: 0;
  }

  .teacher-dash-action-copy strong {
    white-space: normal;
    line-height: 1.2;
  }

  .teacher-page-bar-stat {
    flex: 1 1 auto;
  }

  .sa-level-block,
  .exam-tool-panel,
  .all-exams-year {
    border-radius: var(--radius-md);
  }

  .schedule-timetable,
  .generated-timetable {
    min-width: 22rem;
  }

  .exam-timetable-generation-page .schedule-timetable thead th,
  .exam-timetable-generation-page .schedule-timetable td {
    padding: 0.4rem 0.35rem;
    font-size: 0.68rem;
  }

  .exam-timetable-generation-page .schedule-timetable thead th:first-child,
  .exam-timetable-generation-page .schedule-timetable tbody th {
    min-width: 4.25rem;
  }

  .exam-timetable-generation-page .generated-timetable td {
    min-width: 6.5rem;
  }

  .class-attendance-day-filter,
  .sa-scope-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .class-attendance-day-controls,
  .sa-scope-controls {
    width: 100%;
  }

  .class-attendance-day-controls .attendance-control,
  .sa-scope-controls .attendance-control,
  .class-attendance-day-controls .ghost-button,
  .class-attendance-day-controls .primary-button,
  .sa-scope-controls .ghost-button,
  .sa-scope-controls .primary-button {
    width: 100%;
  }
}

.sa-hub-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0.95rem;
  min-height: 0;
  /* Grow with content; workspace-content scrolls (nested overflow was trapping pages). */
  height: auto;
  overflow: visible;
}

.teacher-page-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}

.teacher-page-bar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.teacher-page-bar-stat {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
  min-height: 2.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid #dce6f5;
  border-radius: 0.7rem;
  background: #f7faff;
}

.teacher-page-bar-stat strong {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 750 0.84rem/1.15 var(--display);
  color: var(--blue-dark);
}

.teacher-page-bar-stat span {
  color: var(--muted);
  font: 650 0.65rem/1.2 var(--font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.teacher-page-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.workspace-content:has(.sa-hub-page),
.workspace-content:has(.exam-tool-page),
.workspace-content:has(.all-exams-page),
.workspace-content:has(.exam-detail-page) {
  display: block;
  width: min(100% - 2rem, 72rem);
  max-width: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.sa-hub-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.sa-level-block {
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sa-level-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.9rem 1.05rem;
  border-bottom: 1px solid #e8eef8;
  background: #f8fafc;
}

.sa-level-head h3 {
  margin: 0 0 0.15rem;
  font-size: 0.98rem;
}

.sa-level-head .subtle {
  margin: 0;
  font-size: 0.82rem;
}

.sa-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.7rem;
  padding: 0.9rem 1rem 1rem;
}

.sa-class-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "mark copy"
    "mark go";
  gap: 0.2rem 0.75rem;
  align-items: center;
  min-height: 4.6rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.sa-class-card:hover {
  border-color: #b8c9ea;
  background: #f7faff;
  transform: translateY(-1px);
}

.sa-class-mark {
  grid-area: mark;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.75rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font: 800 0.78rem/1 var(--display);
  text-transform: uppercase;
}

.sa-class-copy {
  grid-area: copy;
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.sa-class-copy strong {
  color: var(--ink);
  font: 750 0.95rem/1.2 var(--display);
}

.sa-class-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-class-go {
  grid-area: go;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 750;
}

.sa-hub-empty {
  display: grid;
  gap: 0.35rem;
  place-content: center;
  flex: 1 1 auto;
  min-height: 12rem;
  padding: 2rem 1.25rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.sa-hub-empty strong {
  font: 750 1rem/1.3 var(--display);
  color: var(--ink);
}

.sa-subject-list,
.sa-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.75rem;
  padding: 0.9rem 1rem 1rem;
}

.sa-subject-tile {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.95rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.sa-subject-tile-main {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  text-decoration: none;
}

.sa-subject-tile-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.8rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font: 800 0.72rem/1 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sa-subject-tile-text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.sa-subject-tile-text strong {
  color: var(--ink);
  font: 750 0.95rem/1.25 var(--display);
}

.sa-subject-tile-text span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.sa-subject-tile-main:hover .sa-subject-tile-text strong {
  color: var(--blue-dark);
}

.sa-subject-tile-meta,
.sa-subject-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sa-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid #d7e0ef;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font: 700 0.68rem/1 var(--font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sa-pill.is-done {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #027a48;
}

.sa-subject-tile-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink-soft);
  font: 650 0.78rem/1 var(--font);
  text-decoration: none;
}

.sa-subject-tile-actions a:hover {
  border-color: #b8c9ea;
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.exam-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.75rem;
  padding: 0.9rem 1rem 1rem;
}

.exam-hub-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon copy"
    "icon go";
  gap: 0.2rem 0.8rem;
  align-items: center;
  min-width: 0;
  min-height: 5.5rem;
  padding: 0.95rem;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.exam-hub-card:hover {
  border-color: #b8c9ea;
  background: #f7faff;
  transform: translateY(-1px);
}

.exam-hub-card-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.8rem;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font: 800 0.72rem/1 var(--display);
}

.exam-hub-card-copy {
  grid-area: copy;
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.exam-hub-card-copy strong {
  color: var(--ink);
  font: 750 0.95rem/1.25 var(--display);
}

.exam-hub-card-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.exam-hub-card-meta {
  font-weight: 650;
}

.exam-hub-card-go {
  grid-area: go;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 750;
}

.exam-tool-page,
.all-exams-page {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: visible;
}

.exam-tool-hero,
.all-exams-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.35rem;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 1.15rem 1.25rem;
  border: 1px solid #d7e3f5;
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 92, 240, 0.14) 0, transparent 42%),
    linear-gradient(145deg, #ffffff 0%, #f3f7ff 100%);
  box-shadow: 0 1px 2px #15233f08, 0 14px 32px #15233f0c;
  animation: rise-in 0.35s ease both;
}

.exam-tool-kicker,
.all-exams-kicker {
  margin: 0 0 0.3rem;
  color: #5d7399;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.exam-tool-hero-copy,
.all-exams-hero-copy {
  min-width: 0;
  max-width: 36rem;
}

.exam-tool-hero-copy h2,
.all-exams-hero-copy h2 {
  margin: 0 0 0.35rem;
  font: 800 clamp(1.35rem, 2.4vw, 1.75rem)/1.15 var(--display);
  color: var(--ink);
  letter-spacing: -0.02em;
}

.exam-tool-hero-copy p,
.all-exams-hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.exam-tool-hero-aside,
.all-exams-hero-aside {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.exam-tool-stats,
.all-exams-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.exam-tool-stat,
.all-exams-stat {
  display: grid;
  gap: 0.15rem;
  min-width: 5.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(31, 92, 240, 0.12);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 #ffffffcc;
}

.exam-tool-stat strong,
.all-exams-stat strong {
  font: 800 1.25rem/1 var(--display);
  color: var(--blue-dark);
  letter-spacing: -0.03em;
}

.exam-tool-stat span,
.all-exams-stat span {
  color: var(--muted);
  font: 650 0.7rem/1.2 var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exam-tool-cta,
.all-exams-generate {
  width: auto;
  min-height: 2.75rem;
  padding-inline: 1.15rem;
  border-radius: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 8px 18px #1f5cf024;
}

.exam-tool-scroll,
.all-exams-scroll {
  display: grid;
  gap: 1rem;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  align-content: start;
}

.exam-tool-panel,
.all-exams-year {
  border: 1px solid #d9e4f4;
  border-radius: 1.1rem;
  background: #fff;
  box-shadow: 0 1px 2px #15233f06, 0 12px 28px #15233f0a;
  overflow: hidden;
  animation: rise-in 0.4s ease both;
}

.exam-tool-panel-head,
.all-exams-year-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid #e7eef8;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8fd 100%);
}

.exam-tool-panel-head h3,
.all-exams-year-head h3 {
  margin: 0 0 0.15rem;
  font: 800 0.98rem/1.2 var(--display);
  color: var(--ink);
  letter-spacing: 0.04em;
}

.exam-tool-panel-head p,
.all-exams-year-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.exam-tool-panel-count,
.all-exams-year-count {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid #d7e2f3;
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font: 700 0.72rem/1 var(--font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.exam-tool-block {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem 1.05rem 1.05rem;
  border-top: 1px solid #eef3fa;
}

.exam-tool-block:first-of-type {
  border-top: 0;
}

.exam-tool-block-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.exam-tool-block-head h2,
.exam-tool-block-head h3 {
  margin: 0 0 0.15rem;
  font: 800 0.98rem/1.2 var(--display);
  color: var(--ink);
  letter-spacing: 0.03em;
}

.exam-tool-block-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.exam-tool-block .settings-table-panel {
  border-radius: 0.9rem;
  border-color: #e4ecf7;
  box-shadow: none;
}

.exam-tool-block .primary-button,
.exam-tool-block .ghost-button,
.exam-tool-cta.ghost-button {
  width: auto;
  min-height: 2.35rem;
  border-radius: 0.75rem;
  box-shadow: none;
}

.exam-tool-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.exam-tool-empty,
.all-exams-empty {
  display: grid;
  gap: 0.55rem;
  place-content: center;
  flex: 1 1 auto;
  min-height: 16rem;
  padding: 2.4rem 1.4rem;
  border: 1px dashed #cfdced;
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 50% 0%, #eef4ff 0, transparent 55%),
    #fff;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.exam-tool-empty-icon,
.all-exams-empty-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.35rem;
  border-radius: 0.9rem;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font: 800 0.78rem/1 var(--display);
}

.exam-tool-empty strong,
.all-exams-empty strong {
  font: 750 1.05rem/1.3 var(--display);
  color: var(--ink);
}

.exam-tool-empty p,
.all-exams-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.exam-tool-empty .primary-button,
.all-exams-empty .primary-button {
  width: auto;
  justify-self: center;
  margin-top: 0.45rem;
  border-radius: 0.85rem;
}

.generated-timetable-list.exam-tool-scroll {
  margin-top: 0;
}

.generated-timetable-card.exam-tool-block {
  margin: 0;
  background: transparent;
  box-shadow: none;
}

.exam-tool-panel .analytics-card-header h3 {
  margin: 0 0 0.2rem;
  font: 800 0.95rem/1.2 var(--display);
}

.all-exams-list-shell {
  display: grid;
}

.all-exams-list-head,
.all-exams-row {
  display: grid;
  grid-template-columns: minmax(14rem, 1.6fr) minmax(6rem, 0.7fr) minmax(10rem, 1fr) 5.5rem minmax(11rem, auto);
  gap: 0.85rem;
  align-items: center;
}

.all-exams-list-head {
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid #edf2f9;
  background: #fbfcfe;
  color: #7a8aa5;
  font: 700 0.68rem/1 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.all-exams-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.all-exams-list > li + li .all-exams-row {
  border-top: 1px solid #eef3fa;
}

.all-exams-row {
  position: relative;
  padding: 1rem 1.15rem;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.all-exams-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  bottom: 0.55rem;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: transparent;
  transition: background 0.18s ease;
}

.all-exams-row:hover {
  background: linear-gradient(90deg, #f5f8ff 0%, #fafcff 100%);
}

.all-exams-row:hover::before {
  background: var(--blue);
}

.all-exams-col-exam {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  text-decoration: none;
}

.all-exams-col-exam:hover strong {
  color: var(--blue-dark);
}

.all-exams-col-exam strong {
  color: var(--ink);
  font: 750 0.98rem/1.25 var(--display);
  letter-spacing: -0.01em;
}

.all-exams-registered {
  color: #8a97ad;
  font-size: 0.74rem;
}

.all-exams-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.all-exams-level-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.2rem 0.55rem;
  border: 1px solid #d7e2f3;
  border-radius: 999px;
  background: #f5f8fd;
  color: var(--ink-soft);
  font: 650 0.66rem/1.2 var(--font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.all-exams-col-term,
.all-exams-col-dates {
  color: var(--ink-soft);
  font: 650 0.86rem/1.35 var(--font);
}

.all-exams-col-sittings {
  display: flex;
  justify-content: flex-start;
}

.all-exams-sitting-pill {
  display: inline-grid;
  place-items: center;
  min-width: 2.35rem;
  min-height: 2.1rem;
  padding: 0 0.55rem;
  border-radius: 0.7rem;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font: 800 0.9rem/1 var(--display);
}

.all-exams-row-actions {
  justify-self: end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .all-exams-list-head {
    display: none;
  }

  .all-exams-row {
    grid-template-columns: 1fr auto;
    gap: 0.55rem 0.85rem;
  }

  .all-exams-col-exam {
    grid-column: 1 / -1;
  }

  .all-exams-col-term,
  .all-exams-col-dates,
  .all-exams-col-sittings {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.8rem;
  }

  .all-exams-col-term::before,
  .all-exams-col-dates::before,
  .all-exams-col-sittings::before {
    content: attr(data-label);
    color: #8a97ad;
    font: 700 0.66rem/1 var(--font);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .all-exams-row-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .exam-tool-page,
  .all-exams-page {
    font-size: 0.82rem;
  }

  .exam-tool-hero-aside,
  .all-exams-hero-aside {
    width: 100%;
    justify-content: stretch;
  }

  .exam-tool-stats,
  .all-exams-stats {
    width: 100%;
  }

  .exam-tool-stat,
  .all-exams-stat {
    flex: 1 1 0;
  }

  .exam-tool-cta,
  .all-exams-generate {
    width: 100%;
  }

  .exam-tool-kicker,
  .all-exams-kicker {
    font-size: 0.6rem;
  }

  .exam-tool-hero-copy h2,
  .all-exams-hero-copy h2,
  .exam-tool-panel-head h3,
  .all-exams-year-head h3,
  .exam-tool-block-head h2,
  .exam-tool-block-head h3 {
    font-size: 0.95rem;
  }

  .exam-tool-hero-copy p,
  .all-exams-hero-copy p,
  .exam-tool-panel-head p,
  .all-exams-year-head p,
  .exam-tool-block-head p,
  .exam-tool-note {
    font-size: 0.76rem;
  }

  .exam-tool-stat strong,
  .all-exams-stat strong {
    font-size: 1.05rem;
  }

  .exam-tool-stat span,
  .all-exams-stat span,
  .exam-tool-panel-count,
  .all-exams-year-count,
  .all-exams-level-chip {
    font-size: 0.62rem;
  }

  .all-exams-row {
    grid-template-columns: 1fr;
  }

  .all-exams-row-actions {
    grid-column: 1;
    width: 100%;
  }

  .all-exams-col-exam strong {
    font-size: 0.86rem;
  }

  .all-exams-sitting-pill {
    font-size: 0.72rem;
  }
}

.subject-profile-jump {

  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-right: 0.35rem;
}

.subject-profile-jump a,
.subject-profile-jump button {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font: 650 0.82rem var(--font);
  text-decoration: none;
  cursor: pointer;
}

.subject-profile-jump a:hover,
.subject-profile-jump button:hover {
  border-color: #b8c9ea;
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.subject-profile-jump button.is-active {
  border-color: #9db7f3;
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.subject-profile-panels {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dde6f4;
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.subject-profile-panel {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.1rem 1.15rem;
  scroll-margin: 0;
}

.subject-profile-panel.is-active {
  display: flex;
}

.subject-panel-header {
  flex: 0 0 auto;
  margin-bottom: 0.35rem;
}

.subject-profile-card {
  margin-top: 1rem;
  padding: 1.15rem 1.2rem 1.25rem;
  scroll-margin-top: 1rem;
}

.subject-profile-form {
  display: grid;
  gap: 0.95rem;
}

.subject-profile-form label,
.lesson-plan-field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  font-weight: 600;
  color: var(--ink);
}

.lesson-plan-label {
  font: 700 0.78rem/1.2 var(--font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.subject-profile-form input[type="text"],
.subject-profile-form input[type="date"],
.subject-profile-form textarea,
.attendance-status-select {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
  color: var(--ink);
  font: 500 0.95rem/1.45 var(--font);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.subject-profile-form textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.subject-profile-form input::placeholder,
.subject-profile-form textarea::placeholder {
  color: #98a2b3;
}

.subject-profile-form input:hover,
.subject-profile-form textarea:hover,
.attendance-status-select:hover {
  border-color: #b8c9ea;
}

.subject-profile-form input:focus,
.subject-profile-form textarea:focus,
.attendance-status-select:focus {
  outline: none;
  border-color: #7aa2ff;
  background: #fcfdff;
  box-shadow: 0 0 0 3px rgba(31, 92, 240, 0.14);
}

.lesson-plan-form {
  gap: 1rem;
}

.lesson-plan-section {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid #e4ebf6;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, #fbfcfe 0%, #f7f9fc 100%);
}

.lesson-plan-section-header {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin: 0;
}

.lesson-plan-section-header strong {
  display: block;
  margin: 0 0 0.12rem;
  font: 750 0.95rem/1.25 var(--display);
  color: var(--ink);
}

.lesson-plan-section-header .subtle {
  display: block;
  font: 500 0.82rem/1.35 var(--font);
}

.lesson-plan-step {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  margin-top: 0.05rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: 800 0.78rem/1 var(--display);
}

.lesson-plan-fields {
  display: grid;
  gap: 0.85rem;
}

.lesson-plan-fields-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.lesson-plan-field-wide textarea {
  min-height: 9rem;
}

.subject-profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.lesson-plan-actions {
  margin-top: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid #dce6f5;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.attendance-date-row {
  margin-bottom: 0.35rem;
}

.attendance-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.15rem;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid #e4ebf6;
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.attendance-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.attendance-summary-item strong {
  font: 800 1rem/1.1 var(--display);
  color: var(--ink);
}

.attendance-summary-item span {
  font: 650 0.72rem/1.2 var(--font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.attendance-summary-item.is-present strong { color: #027a48; }
.attendance-summary-item.is-absent strong { color: #b42318; }
.attendance-summary-item.is-late strong { color: #b54708; }
.attendance-summary-item.is-excused strong { color: #3538cd; }

.attendance-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.attendance-quick-actions .ghost-button {
  min-height: 2.2rem;
  padding-inline: 0.8rem;
  font-size: 0.82rem;
}

.attendance-quick-actions .primary-button {
  margin-left: auto;
}

.attendance-form .attendance-form-controls {
  margin-bottom: 0.85rem;
}

.attendance-form .attendance-control input[type="text"],
.attendance-form .attendance-control input[type="date"] {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
  color: var(--ink);
  font: 500 0.95rem/1.45 var(--font);
}

.attendance-roll-table {
  margin: 0;
  border-radius: 0.85rem;
  overflow: auto;
  overscroll-behavior-x: contain;
}

.attendance-students-table {
  width: auto;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.attendance-students-table th:first-child,
.attendance-students-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 1%;
  min-width: 11rem;
  padding-left: 0.85rem;
  padding-right: 0.95rem;
  white-space: nowrap;
  color: inherit;
  font-weight: inherit;
  background: #fff;
  background-clip: padding-box;
  box-shadow: 10px 0 14px -10px rgba(21, 35, 63, 0.35);
  transition: min-width 0.18s ease, max-width 0.18s ease, padding 0.18s ease;
}

.attendance-students-table thead th:first-child {
  z-index: 6;
  background: #f7f9fc;
}

.attendance-students-table tbody tr:nth-child(even) td:first-child {
  background: #fbfcfe;
}

.attendance-students-table tbody tr:hover td:first-child {
  background: #f4f8ff;
}

.attendance-students-table .sa-student-index {
  color: #667085;
  font-weight: 700;
  margin-right: 0.2rem;
}

.attendance-students-table.is-name-collapsed th:first-child,
.attendance-students-table.is-name-collapsed td:first-child {
  min-width: 0;
  max-width: 7.25rem;
  padding-right: 0.65rem;
}

.attendance-students-table.is-name-collapsed .exam-student-last {
  display: none;
}

.attendance-students-table.is-name-collapsed thead th:first-child {
  font-size: 0;
}

.attendance-students-table.is-name-collapsed thead th:first-child::after {
  content: "Name";
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.attendance-roll-table .settings-table td:last-child {
  min-width: 0;
}

.attendance-summary-binary {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  gap: 1.25rem;
}

.attendance-students-table.is-binary {
  width: 100%;
  min-width: 0;
}

.attendance-students-table.is-binary th:first-child,
.attendance-students-table.is-binary td:first-child {
  position: static;
  left: auto;
  z-index: auto;
  min-width: 0;
  width: auto;
  box-shadow: none;
  transition: none;
}

.attendance-students-table.is-binary thead th:first-child {
  z-index: auto;
}

.attendance-students-table .attendance-student-cell {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.attendance-student-meta {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.attendance-presence-col {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.attendance-presence {
  display: inline-flex;
  align-items: stretch;
  padding: 0.18rem;
  border: 1px solid #d7e0ef;
  border-radius: 999px;
  background: #f4f7fb;
  gap: 0.15rem;
}

.attendance-presence-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.4rem;
  min-height: 2rem;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font: 700 0.78rem/1 var(--font);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.attendance-presence-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.attendance-presence-option:hover {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}

.attendance-presence-option.is-present:has(input:checked) {
  color: #027a48;
  background: #ecfdf3;
  box-shadow: inset 0 0 0 1px #abefc6;
}

.attendance-presence-option.is-absent:has(input:checked) {
  color: #b42318;
  background: #fef3f2;
  box-shadow: inset 0 0 0 1px #fecdca;
}

.attendance-students-table.is-binary tbody tr:hover td {
  background: #f8faff;
}

.attendance-students-table.is-binary tbody td {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #edf2f8;
}

.attendance-students-table.is-binary tbody tr:last-child td {
  border-bottom: 0;
}

.attendance-students-table .attendance-check-col {
  width: 4.75rem;
  min-width: 4.5rem;
  text-align: center;
}

.attendance-students-table .attendance-check {
  width: 2.1rem;
  height: 2.1rem;
  margin: 0 auto;
  border: 1px solid #d7e0ef;
  border-radius: 0.55rem;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.attendance-students-table .attendance-check:hover {
  border-color: #b8c9ea;
  background: #fff;
}

.attendance-students-table .attendance-check:has(input:checked) {
  border-color: #7aa2ff;
  background: #eef4ff;
  box-shadow: 0 0 0 2px rgba(31, 92, 240, 0.12);
}

.attendance-students-table .attendance-check input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.attendance-students-table tbody td {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

@media (max-width: 640px) {
  .attendance-presence-col {
    text-align: left;
  }

  .attendance-presence {
    width: 100%;
  }

  .attendance-presence-option {
    flex: 1 1 0;
    min-width: 0;
  }
}

.outcome-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.outcome-guide span {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--ink-soft);
  font: 650 0.78rem/1 var(--font);
}

.outcome-form .lesson-plan-field-wide textarea {
  min-height: 11rem;
}

.attendance-status-select {
  min-width: 8.5rem;
  font-weight: 600;
}

.attendance-status-select.status-present {
  color: #027a48;
  background: #ecfdf3;
  border-color: #abefc6;
}

.attendance-status-select.status-absent {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}

.attendance-status-select.status-late {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}

.attendance-status-select.status-excused {
  color: #3538cd;
  background: #eef4ff;
  border-color: #c7d7fe;
}

@media (max-width: 760px) {
  .subject-profile-jump {
    width: 100%;
    order: 3;
  }

  .lesson-plan-fields-2 {
    grid-template-columns: 1fr;
  }

  .lesson-plan-section {
    padding: 0.9rem;
  }

  .attendance-summary {
    gap: 0.35rem 0.85rem;
  }

  .attendance-quick-actions .primary-button {
    margin-left: 0;
    width: 100%;
  }
}

/* Shared tool-page / table responsiveness across IT Support & settings */
@media (max-width: 900px) {
  .exam-tool-hero,
  .all-exams-hero,
  .student-hero {
    align-items: stretch;
  }

  .exam-tool-panel-head,
  .exam-tool-block-head,
  .settings-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .settings-toolbar-actions > *,
  .settings-toolbar-actions form {
    flex: 1 1 auto;
    min-width: 0;
  }

  .allocation-actions {
    justify-content: stretch;
  }

  .allocation-actions .primary-button {
    width: 100%;
  }

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

  .schedule-timetable-wrap,
  .settings-table-panel:has(.allocation-table),
  .settings-table-panel:has(.exam-record-students-table),
  .settings-table-panel:has(.exam-analytics-table),
  .settings-table-panel:has(.attendance-students-table),
  .generated-timetable-list .schedule-timetable-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .attendance-students-table:not(.is-binary) {
    min-width: 30rem;
  }

  .schedule-timetable,
  .generated-timetable {
    min-width: 28rem;
  }

  .schedule-timetable thead th:first-child,
  .schedule-timetable tbody th {
    min-width: 4.75rem;
    box-shadow: 2px 0 0 #d5e2f4;
  }

  .analytics-profiles {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .module-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "icon title"
      "icon copy"
      "meta meta";
    row-gap: 0.35rem;
    padding: 0.85rem 0.95rem;
  }

  .module-meta {
    justify-self: start;
  }

  .module-card h3 {
    font-size: 0.92rem;
  }

  .module-card p {
    font-size: 0.78rem;
  }

  .exam-tool-hero,
  .all-exams-hero {
    padding: 0.95rem 1rem;
  }

  .exam-tool-panel,
  .exam-tool-block {
    padding-inline: 0.85rem;
  }

  .exam-tool-block .settings-table-panel:has(.allocation-table) {
    margin-inline: -0.85rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .allocation-table,
  .allocation-table-supervisors {
    min-width: 30rem;
  }

  .allocation-table select {
    min-width: 9.5rem;
    max-width: 100%;
  }

  .settings-stack,
  .exam-record-link {
    min-width: 0;
  }

  .generation-level-list {
    max-height: min(55dvh, 22rem);
  }

  .app-modal-dialog-generation .generation-level-list {
    max-height: none;
  }

  .exam-timetable-generation-page .exam-tool-panel,
  .exam-timetable-generation-page .exam-tool-block {
    padding-inline: 0.85rem;
  }

  .exam-timetable-generation-page .schedule-timetable-wrap.is-scrollable-x {
    margin-inline: -0.15rem;
    border-radius: 0.75rem;
  }

  .analytics-page .analytics-section,
  .analytics-page .settings-category {
    padding-inline: 0.85rem;
  }

  .supervisor-choice-list {
    max-height: min(42dvh, 18rem);
  }

  .app-modal-dialog-wide {
    width: min(100%, 42rem);
  }

  .schedule-profile-summary {
    grid-template-columns: 1fr;
  }

  .exam-card-action-buttons {
    width: 100%;
  }

  .exam-card-action-buttons .primary-button,
  .exam-card-action-buttons .ghost-button {
    width: 100%;
    min-width: 0;
  }

  .workspace-preview-banner {
    align-items: stretch;
  }

  .workspace-preview-change {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .exam-tool-page,
  .all-exams-page {
    gap: 0.75rem;
  }

  .module-icon {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }

  .exam-tool-empty {
    padding: 1.25rem 1rem;
  }

  .schedule-timetable,
  .generated-timetable {
    min-width: 24rem;
  }

  .schedule-timetable th,
  .schedule-timetable td,
  .generated-timetable th,
  .generated-timetable td {
    padding: 0.4rem 0.35rem;
    font-size: 0.68rem;
  }

  .schedule-timetable thead th {
    min-width: 4.25rem;
  }

  .tt-subject {
    font-size: 0.74rem;
  }

  .tt-teacher {
    font-size: 0.62rem;
  }

  .record-action {
    min-height: 2.35rem;
  }
}


/* Exam report builder */
.exam-report-builder-page {
  gap: 1rem;
}

.exam-report-builder-page.has-report .exam-tool-stat strong {
  font-size: clamp(0.82rem, 1.6vw, 1.05rem);
  line-height: 1.15;
  word-break: break-word;
}

.exam-report-builder-details {
  border: 1px solid #d7e3f5;
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 1px 2px #15233f06, 0 12px 28px #15233f0a;
  overflow: clip;
}

.exam-report-builder-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.exam-report-builder-summary::-webkit-details-marker {
  display: none;
}

.exam-report-builder-summary strong {
  display: block;
  color: var(--ink);
  font: 750 0.98rem/1.2 var(--display);
}

.exam-report-builder-summary small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.exam-report-builder-summary-action {
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 750;
}

.exam-report-builder-details[open] .exam-report-builder-summary {
  border-bottom: 1px solid #e7eef8;
  background: linear-gradient(180deg, #fbfcff 0%, #f5f8fd 100%);
}

.exam-report-builder-details[open] .exam-report-builder-summary-action {
  opacity: 0.7;
}

.exam-report-builder-details .exam-report-builder {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.exam-report-builder .exam-report-form,
.exam-report-preview-table {
  padding: 1.05rem 1.15rem 1.2rem;
}

.exam-report-steps {
  display: grid;
  gap: 0.95rem;
}

.exam-report-step.field {
  margin-bottom: 0;
}

.exam-report-kind {
  display: grid;
  gap: 0.65rem;
}

.exam-report-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid #d9e4f4;
  border-radius: 0.9rem;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.exam-report-choice:hover {
  border-color: #b7c9ef;
}

.exam-report-choice:has(input:checked) {
  border-color: #9db7f5;
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px rgba(31, 92, 240, 0.18);
}

.exam-report-choice input {
  margin-top: 0.2rem;
}

.exam-report-choice strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}

.exam-report-choice small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.exam-report-level-note {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid #d9e4f4;
  border-radius: 0.9rem;
  background: #f8fbff;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.exam-report-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e7eef8;
}

.exam-report-actions .primary-button {
  width: auto;
  min-width: 12.5rem;
}

.exam-report-preview {
  animation: rise-in 0.35s ease both;
}

/* Learning / e-learning report builder */
.lr-builder {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 92, 240, 0.1) 0, transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.lr-builder::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #2f6af7, #5b8cff 45%, #8eb4ff);
  pointer-events: none;
}

.lr-builder-summary-lead {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  min-width: 0;
}

.lr-builder-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  border: 1px solid #c9d8f4;
  border-radius: 0.85rem;
  color: var(--blue-dark);
  background: linear-gradient(160deg, #ffffff 0%, #eaf1ff 100%);
  box-shadow: inset 0 1px 0 #ffffffcc;
}

.lr-builder-summary-open {
  display: none;
}

.lr-builder[open] .lr-builder-summary-closed {
  display: none;
}

.lr-builder[open] .lr-builder-summary-open {
  display: inline;
}

.lr-builder-form {
  display: grid;
  gap: 1.15rem;
  padding: 1.1rem 1.15rem 1.15rem;
}

.lr-builder-section {
  display: grid;
  gap: 0.75rem;
}

.lr-builder-section-head h3 {
  margin: 0 0 0.15rem;
  color: var(--ink);
  font: 800 0.84rem/1.2 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lr-builder-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.lr-builder-fields {
  gap: 0.8rem 0.9rem;
}

.lr-builder-fields .field label {
  margin-bottom: 0.35rem;
  color: #425574;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.lr-builder-fields input,
.lr-builder-fields select {
  min-height: 2.7rem;
  border-color: #cfdced;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: inset 0 1px 0 #ffffffa8;
}

.lr-builder-fields input:focus,
.lr-builder-fields select:focus {
  background: #fff;
}

.exam-report-kind-3 {
  gap: 0.7rem;
}

.lr-builder-choice {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  min-height: 5.4rem;
  padding: 0.9rem 0.95rem 0.95rem;
  border-color: #d3e0f3;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fd 100%);
  box-shadow: 0 1px 0 #ffffffb8 inset, 0 8px 18px #15233f08;
}

.lr-builder-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lr-builder-choice::after {
  content: "";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.5px solid #b7c7e2;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 3px #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lr-builder-choice:hover {
  transform: translateY(-1px);
  border-color: #a9bff0;
  box-shadow: 0 1px 0 #ffffffb8 inset, 0 12px 24px #15233f0f;
}

.lr-builder-choice:has(input:checked) {
  border-color: #7ea3f4;
  background: linear-gradient(180deg, #eef4ff 0%, #e5edff 100%);
  box-shadow:
    inset 0 0 0 1px rgba(31, 92, 240, 0.16),
    0 10px 22px #1f5cf01a;
}

.lr-builder-choice:has(input:checked)::after {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: inset 0 0 0 3px #fff;
}

.lr-builder-choice:has(input:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.lr-builder-choice-icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid #d3e0f3;
  border-radius: 0.8rem;
  color: #3d5f9e;
  background: #fff;
}

.lr-builder-choice:has(input:checked) .lr-builder-choice-icon {
  border-color: #9db7f5;
  color: var(--blue-dark);
  background: linear-gradient(160deg, #ffffff 0%, #dfeaff 100%);
}

.lr-builder-choice-copy {
  min-width: 0;
  padding-right: 1.1rem;
}

.lr-builder-choice-copy strong {
  font: 750 0.92rem/1.2 var(--display);
}

.lr-builder-choice-copy small {
  margin-top: 0.28rem;
  line-height: 1.35;
}

.lr-builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.15rem;
  padding: 0.95rem 0 0;
  border-top: 1px solid #e4ecf7;
}

.lr-builder-actions-hint {
  margin: 0;
  color: #6a7b96;
  font-size: 0.78rem;
}

.lr-builder-actions .primary-button {
  min-width: 13.5rem;
  padding-inline: 1.25rem;
}

@media (min-width: 720px) {
  .exam-report-kind {
    grid-template-columns: 1fr 1fr;
  }

  .exam-report-kind-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .exam-report-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem 1rem;
  }

  .lr-builder-fields-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .exam-report-step-span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .lr-builder-actions {
    align-items: stretch;
  }

  .lr-builder-actions .primary-button {
    width: 100%;
  }
}

/* Printable student report cards */
.exam-report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.1rem;
  border: 1px solid #d9e4f4;
  border-radius: 1.1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 1px 2px #15233f06, 0 12px 28px #15233f0a;
}

.exam-report-toolbar-copy {
  min-width: 0;
  flex: 1 1 14rem;
}

.exam-report-toolbar strong {
  color: var(--ink);
  font: 750 0.98rem/1.2 var(--display);
}

.exam-report-toolbar p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  word-break: break-word;
}

.exam-report-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.exam-report-print-hint {
  margin: 0.55rem 0 0;
  color: #6a7b96;
  font-size: 0.78rem;
  line-height: 1.35;
}

.elr-report-page .elr-report-sheet {
  margin-top: 1rem;
}

.elr-report-section {
  margin: 0 0 1.1rem;
}

.elr-report-section-title {
  margin: 0 0 0.45rem;
  color: #10233f;
  font: 750 0.92rem/1.2 var(--display);
  letter-spacing: 0.01em;
}

.elr-report-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.25rem;
}

.elr-report-summary div {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d7e3f5;
  border-radius: 0.45rem;
  background: #f8fbff;
}

.elr-report-summary span {
  color: #6a7b96;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.elr-report-summary strong {
  color: #10233f;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
}

.elr-report-empty {
  margin: 0;
  color: #5d7399;
  font-size: 0.86rem;
  line-height: 1.4;
}

.elr-report-subsection {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0 0;
  border-top: 1px solid #e2eaf5;
}

.elr-report-subsection:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.elr-report-subsection-title {
  margin: 0 0 0.4rem;
  color: #1a3358;
  font: 700 0.84rem/1.25 var(--display);
}

.elr-learner-table {
  table-layout: fixed;
  width: 100%;
}

.elr-learner-table .elr-col-learner {
  width: 38%;
  font-size: 0.78rem;
}

.elr-learner-table .elr-col-admission {
  width: 22%;
  font-size: 0.78rem;
}

.elr-learner-table .elr-col-status {
  width: 18%;
  font-size: 0.78rem;
}

.elr-report-details {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}

.elr-report-details > div {
  display: grid;
  gap: 0.1rem;
}

.elr-report-details dt {
  margin: 0;
  color: #6a7b96;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.elr-report-details dd {
  margin: 0;
  color: #10233f;
  font-size: 0.86rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.elr-doc-band {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  margin: 0 0 0.85rem;
  padding: 0 0 0.7rem;
  border-bottom: 1px solid #e2eaf5;
}

.elr-doc-band .elr-report-section-title {
  margin: 0.1rem 0 0;
}

.elr-doc-band-kicker {
  margin: 0;
  color: #6a7b96;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.elr-doc-band-meta {
  margin: 0;
  color: #5d7399;
  font-size: 0.8rem;
  font-weight: 600;
}

.elr-plan-grid,
.elr-outcome-grid {
  display: grid;
  gap: 0.85rem;
}

.elr-plan-card,
.elr-outcome-card {
  padding: 0.9rem 0.95rem 1rem;
  border: 1px solid #d7e3f5;
  border-radius: 0.75rem;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 6px 18px #15233f08;
}

.elr-plan-card.is-missing,
.elr-outcome-card.is-missing {
  background: #fcfdff;
  box-shadow: none;
}

.elr-plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.elr-plan-card-titles {
  min-width: 0;
}

.elr-plan-card-level {
  margin: 0;
  color: #6a7b96;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
}

.elr-plan-card-subject {
  margin: 0.18rem 0 0;
  color: #10233f;
  font: 750 1.02rem/1.2 var(--display);
  letter-spacing: -0.02em;
}

.elr-status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.elr-status-pill.is-saved {
  color: #0f6a45;
  background: #e8f8f0;
  border: 1px solid #b7e4cb;
}

.elr-status-pill.is-missing {
  color: #8a5a16;
  background: #fff6e8;
  border: 1px solid #f0d4a8;
}

.elr-plan-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}

.elr-plan-metric {
  min-width: 0;
  padding: 0.5rem 0.55rem;
  border: 1px solid #dce6f5;
  border-radius: 0.55rem;
  background: #fff;
}

.elr-plan-metric span {
  display: block;
  color: #6a7b96;
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.elr-plan-metric strong {
  display: block;
  margin-top: 0.2rem;
  color: #10233f;
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.25;
  word-break: break-word;
}

.elr-plan-blocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.elr-plan-block,
.elr-outcome-body {
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border: 1px solid #e1e9f5;
  border-radius: 0.55rem;
  background: #fff;
}

.elr-plan-block-wide {
  grid-column: 1 / -1;
}

.elr-plan-label {
  display: block;
  margin: 0 0 0.28rem;
  color: #6a7b96;
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.elr-plan-body {
  color: #10233f;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.elr-outcome-body {
  margin: 0 0 0.55rem;
  padding: 0.75rem 0.8rem;
  background:
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-color: #cfdcf0;
}

.elr-outcome-body .elr-plan-body {
  font-size: 0.95rem;
  line-height: 1.55;
}

.elr-outcome-meta {
  margin: 0;
  color: #6a7b96;
  font-size: 0.76rem;
  font-weight: 600;
}

@media (max-width: 720px) {
  .elr-plan-metrics,
  .elr-plan-blocks {
    grid-template-columns: 1fr;
  }

  .elr-plan-block-wide {
    grid-column: auto;
  }
}

.elr-report-footer {
  margin-top: 0.85rem;
  padding-top: 0.55rem;
  border-top: 1px solid #d7e3f5;
}

.elr-report-footer p {
  margin: 0;
  color: #6a7b96;
  font-size: 0.76rem;
}

@media (max-width: 720px) {
  .elr-report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.exam-report-cards {
  display: grid;
  gap: 1.25rem;
}

.exam-report-matrices {
  display: grid;
  gap: 1.25rem;
}

.exam-matrix-list {
  min-width: 0;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid #d7e3f5;
  border-radius: 0.85rem;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 24px #15233f0a;
}

.exam-matrix-list-head {
  margin: 0 0 0.85rem;
  padding: 0 0 0.75rem;
  border: 0;
  border-bottom: 2px solid #1b4fd6;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.exam-matrix-list-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.exam-matrix-list-logo,
.exam-matrix-list-logo-mark {
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 0.5rem;
  object-fit: cover;
}

.exam-matrix-list-logo-mark {
  display: grid;
  place-items: center;
  border: 1px solid #d5deec;
  background: #1b4fd6;
  color: #fff;
  font: 800 1.05rem/1 var(--display);
}

.exam-matrix-list-titles {
  min-width: 0;
}

.exam-matrix-list-kicker {
  margin: 0 0 0.18rem;
  color: #5d7399;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.exam-matrix-list-head h2 {
  margin: 0;
  color: #10233f;
  font: 800 1.12rem/1.2 var(--display);
  letter-spacing: 0.01em;
}

.exam-matrix-list-motto {
  margin: 0.28rem 0 0;
  color: #4d5f7a;
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.35;
}

.exam-matrix-list-contact {
  margin: 0.22rem 0 0;
  color: #6a7b96;
  font-size: 0.72rem;
  line-height: 1.35;
}

.exam-matrix-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.7rem 0 0;
  padding-top: 0;
  border-top: 0;
}

.exam-matrix-list-meta span {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(31, 92, 240, 0.14);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.96);
  color: #334155;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
}

.exam-matrix-list-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d0dceb;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 1px 2px #15233f08;
}

.exam-matrix-list-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.78rem;
}

.exam-matrix-list-table th,
.exam-matrix-list-table td {
  padding: 0.35rem 0.3rem;
  border-bottom: 1px solid #e8eef7;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

.exam-matrix-list-table th.is-left,
.exam-matrix-list-table td.is-left {
  text-align: left;
}

.exam-matrix-list-table thead th {
  color: #334155;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f4f7fc 0%, #e9f0fb 100%);
  border-bottom: 1px solid #cfdced;
}

.exam-matrix-list-table th.is-left:nth-child(1),
.exam-matrix-list-table td.is-left:nth-child(1) {
  width: 24%;
  max-width: 24%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}

.exam-matrix-list-table th.is-left:nth-child(2),
.exam-matrix-list-table td.is-left:nth-child(2) {
  width: 6%;
  white-space: nowrap;
}

.exam-matrix-list-table th:not(.is-left),
.exam-matrix-list-table td:not(.is-left) {
  width: 4.5%;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
  font-size: 0.72rem;
}

.exam-matrix-list-table th:last-child,
.exam-matrix-list-table td:last-child {
  width: 5%;
}

.exam-matrix-learner {
  color: #10233f;
  font-weight: 700;
}

.exam-matrix-class {
  color: #4d5f7a;
  font-weight: 650;
}

.exam-matrix-list-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.exam-matrix-list-table tbody tr:hover td {
  background: #eef4ff;
}

.exam-matrix-list-table tbody tr:last-child td {
  border-bottom: 0;
}

.exam-matrix-avg-col {
  background: #f3f7ff;
  box-shadow: inset 1px 0 0 #d7e2f4;
}

.exam-matrix-list-table tbody tr:nth-child(even) td.exam-matrix-avg-col {
  background: #eef3fb;
}

.exam-matrix-list-table tbody tr:hover td.exam-matrix-avg-col {
  background: #e4ecff;
}

.exam-matrix-mark strong,
.exam-matrix-mark em {
  display: block;
  line-height: 1.2;
}

.exam-matrix-mark strong {
  color: #10233f;
  font-size: 0.74rem;
}

.exam-matrix-mark em {
  margin-top: 0.06rem;
  color: #1b4fd6;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 750;
}

.exam-matrix-empty {
  color: #a8b4c7;
}

.student-report-card {
  break-inside: avoid;
  page-break-inside: avoid;
  color: #12233f;
  animation: rise-in 0.35s ease both;
}

.src-sheet {
  min-width: 0;
  padding: 1.05rem 1.1rem 1.15rem;
  border: 1px solid #d7e3f5;
  border-radius: 0.85rem;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 24px #15233f0a;
}

.src-dual-head {
  display: grid;
  gap: 0.65rem 1rem;
  align-items: start;
  margin: 0 0 0.85rem;
  padding: 0 0 0.75rem;
  border: 0;
  border-bottom: 2px solid #1b4fd6;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.src-dual-school,
.src-dual-student {
  min-width: 0;
}

.src-dual-school {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
}

.src-dual-logo,
.src-dual-logo-mark {
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 0.45rem;
  object-fit: cover;
}

.src-dual-logo-mark {
  display: grid;
  place-items: center;
  border: 1px solid #d5deec;
  background: #1b4fd6;
  color: #fff;
  font: 800 0.95rem/1 var(--display);
}

.src-dual-copy {
  min-width: 0;
}

.src-dual-kicker {
  margin: 0 0 0.12rem;
  color: #5d7399;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.src-dual-copy h1,
.src-dual-student-name {
  margin: 0;
  color: #10233f;
  font: 800 1rem/1.18 var(--display);
  letter-spacing: 0.01em;
  word-break: break-word;
}

.src-dual-student-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.src-dual-motto {
  margin: 0.28rem 0 0;
  color: #4d5f7a;
  font-size: 0.76rem;
  font-style: italic;
  line-height: 1.35;
}

.src-dual-contact {
  margin: 0.22rem 0 0;
  color: #6a7b96;
  font-size: 0.7rem;
  line-height: 1.35;
}

.src-dual-school-meta {
  margin: 0.28rem 0 0;
  color: #4d5f7a;
  font-size: 0.72rem;
  line-height: 1.3;
  font-weight: 650;
}

.src-dual-student {
  display: grid;
  gap: 0.12rem;
  align-content: start;
}

.src-dual-student-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.src-student-photo,
.src-student-photo-mark {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 0.45rem;
  object-fit: cover;
}

.src-student-photo-mark {
  display: grid;
  place-items: center;
  border: 1px solid #d5deec;
  background: #e8efff;
  color: #1b4fd6;
  font: 800 0.85rem/1 var(--display);
  letter-spacing: 0.02em;
}

.src-dual-student-copy {
  min-width: 0;
}

.src-dual-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin: 0.4rem 0 0;
}

.src-dual-facts div {
  display: inline-flex;
  flex-direction: column;
  gap: 0.04rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.src-dual-facts dt {
  margin: 0;
  color: #73849e;
  font-size: 0.52rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.src-dual-facts dd {
  margin: 0;
  color: #10233f;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.src-head {
  display: none;
}

.src-header-compact,
.src-dual-header {
  display: none;
}

.src-results {
  margin-top: 0.85rem;
}

.src-trend {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.85rem 0.7rem;
  border: 1px solid #d0dceb;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 1px 2px #15233f08;
}

.src-trend-copy {
  margin: 0 0 0.35rem;
}

.src-trend-subtitle {
  margin: 0.15rem 0 0;
  color: #5d7399;
  font-size: 0.72rem;
  line-height: 1.35;
}

.src-trend-frame {
  width: 100%;
  overflow: hidden;
}

.src-trend-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 12rem;
}

.src-trend-grid {
  stroke: #e4ebf6;
  stroke-width: 1;
}

.src-trend-axis {
  fill: #8091aa;
  font-size: 9px;
  font-weight: 650;
}

.src-trend-area {
  fill: rgba(27, 79, 214, 0.12);
}

.src-trend-line {
  stroke: #1b4fd6;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.src-trend-dot {
  fill: #fff;
  stroke: #1b4fd6;
  stroke-width: 2.2;
}

.src-trend-bar {
  fill: #1b4fd6;
  opacity: 0.88;
}

.src-trend-value {
  fill: #10233f;
  font-size: 10px;
  font-weight: 750;
}

.src-trend-label {
  fill: #4d5f7a;
  font-size: 9px;
  font-weight: 650;
}

.src-trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.55rem 0 0;
  padding: 0.55rem 0 0;
  border-top: 1px solid #e2eaf6;
  list-style: none;
}

.src-trend-legend li {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  align-items: baseline;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(31, 92, 240, 0.14);
  border-radius: 0.45rem;
  background: #f8fbff;
}

.src-trend-legend strong {
  color: #10233f;
  font-size: 0.72rem;
}

.src-trend-legend span {
  color: #4d5f7a;
  font-size: 0.7rem;
  line-height: 1.3;
}

.src-results .src-section-label {
  margin: 0 0 0.55rem;
}

.src-assessment-key {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border: 0;
  border-top: 1px solid #d5deec;
  border-radius: 0;
  background: transparent;
}

.src-assessment-key-label {
  margin: 0 0 0.5rem;
  color: #6a7b96;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.src-assessment-key-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.src-assessment-key-list li {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  align-items: baseline;
  max-width: 100%;
  padding: 0.32rem 0.55rem;
  border: 1px solid rgba(31, 92, 240, 0.14);
  border-radius: 0.5rem;
  background: #f8fbff;
}

.src-assessment-key-list strong {
  color: #10233f;
  font-size: 0.74rem;
  white-space: nowrap;
}

.src-assessment-key-list span {
  color: #4d5f7a;
  font-size: 0.72rem;
  line-height: 1.35;
  word-break: break-word;
}

.src-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.95rem;
  align-items: start;
}

.src-logo,
.src-logo-mark {
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 0.95rem;
  object-fit: cover;
}

.src-logo-mark {
  display: grid;
  place-items: center;
  border: 1px solid #d7e2f5;
  background: linear-gradient(160deg, #f7faff 0%, #eaf1ff 100%);
  color: #1b4fd6;
  font: 800 1.55rem/1 var(--display);
}

.src-doc-type {
  margin: 0 0 0.28rem;
  color: #6a7b96;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.src-brand-copy h1 {
  margin: 0;
  color: #10233f;
  font: 800 clamp(1.15rem, 2.1vw, 1.55rem)/1.15 var(--display);
  letter-spacing: 0.02em;
}

.src-motto {
  margin: 0.35rem 0 0;
  color: #4d5f7a;
  font-size: 0.88rem;
  font-style: italic;
}

.src-contact {
  margin: 0.35rem 0 0;
  color: #6a7b96;
  font-size: 0.78rem;
  line-height: 1.4;
}

.src-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
}

.src-header-meta div {
  min-width: 7rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #e2eaf6;
  border-radius: 0.65rem;
  background: #f8fbff;
}

.src-header-meta span,
.src-section-label,
.src-field span,
.src-summary-item span {
  display: block;
  color: #73849e;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.src-header-meta strong {
  display: block;
  margin-top: 0.18rem;
  color: #12233f;
  font-size: 0.9rem;
}

.src-section-label {
  margin: 0 0 0.55rem;
}

.src-student {
  margin-top: 1rem;
}

.src-student-grid {
  display: grid;
  gap: 0.7rem 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.9rem 1rem;
  border: 1px solid #dce6f5;
  border-radius: 0.85rem;
  background: linear-gradient(180deg, #fbfcff 0%, #f4f8ff 100%);
}

.src-field-wide {
  grid-column: 1 / -1;
}

.src-field strong {
  display: block;
  margin-top: 0.18rem;
  color: #10233f;
  font-size: 0.95rem;
  line-height: 1.3;
  word-break: break-word;
}

.src-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d0dceb;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 1px 2px #15233f08;
}

.src-table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.src-table-multi {
  min-width: 36rem;
}

.src-table th,
.src-table td {
  padding: 0.42rem 0.4rem;
  border-bottom: 1px solid #e8eef7;
  text-align: center;
  vertical-align: middle;
}

.src-table th.is-left,
.src-table td.is-left {
  text-align: left;
}

.src-table thead th {
  color: #334155;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f4f7fc 0%, #e9f0fb 100%);
  border-bottom: 1px solid #cfdced;
}

.src-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.src-table tbody tr:hover td {
  background: #eef4ff;
}

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

.src-table th.is-left:first-child,
.src-table td.is-left:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 8.5rem;
  max-width: 14rem;
  background: #fff;
  box-shadow: 1px 0 0 #e8eef7;
}

.src-table thead th.is-left:first-child {
  z-index: 3;
  background: linear-gradient(180deg, #f4f7fc 0%, #e9f0fb 100%);
}

.src-table tbody tr:nth-child(even) td.is-left:first-child {
  background: #f8fafc;
}

.src-table tbody tr:hover td.is-left:first-child {
  background: #eef4ff;
}

.src-table tfoot th.is-left:first-child {
  background: #e8effc;
}

.src-subject {
  color: #10233f;
  font-weight: 700;
}

.src-mark strong,
.src-mark em,
.src-exam-cell strong,
.src-exam-cell em {
  display: block;
  line-height: 1.2;
}

.src-mark strong,
.src-exam-cell strong {
  color: #10233f;
  font-size: 0.8rem;
}

.src-mark em,
.src-exam-cell em {
  margin-top: 0.06rem;
  color: #1b4fd6;
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 750;
}

.src-avg-col {
  background: #f3f7ff;
  box-shadow: inset 1px 0 0 #d7e2f4;
}

.src-table tbody tr:nth-child(even) td.src-avg-col {
  background: #eef3fb;
}

.src-table tbody tr:hover td.src-avg-col {
  background: #e4ecff;
}

.src-remark {
  color: #4d5f7a;
  font-size: 0.74rem;
}

.src-empty {
  color: #a8b4c7;
}

.src-table tfoot th {
  padding: 0.55rem 0.4rem;
  border-top: 1px solid #cddaf0;
  border-bottom: 0;
  color: #12233f;
  background: #e8effc;
  font-size: 0.76rem;
  font-weight: 800;
}

.src-table tfoot th.src-avg-col {
  background: #dde8fb;
}

.src-table tfoot .src-mark strong {
  font-size: 0.8rem;
}

.src-table tfoot .src-mark em {
  color: #1b4fd6;
  font-weight: 750;
}

.src-summary {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 0.15rem;
}

.src-summary-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid #d7e2f4;
  border-radius: 0.65rem;
  background: #fff;
}

.src-summary-grade {
  border-color: #b8cbf3;
  background: linear-gradient(180deg, #f4f8ff 0%, #e9f0ff 100%);
}

.src-summary-wide {
  grid-column: 1 / -1;
}

.src-summary-item strong {
  display: block;
  margin-top: 0.18rem;
  color: #10233f;
  font-size: 1rem;
  line-height: 1.25;
}

.src-summary-wide strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.exam-report-grade-scale {
  margin: 0.85rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid #d5deec;
}

.exam-report-grade-scale .src-section-label {
  margin-bottom: 0.45rem;
}

.exam-report-grade-scale-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-report-grade-scale-list li {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  align-items: baseline;
  color: #4d5f7a;
  font-size: 0.7rem;
  line-height: 1.35;
}

.exam-report-grade-scale-list strong {
  color: #10233f;
  font-size: 0.72rem;
  font-weight: 800;
}

.src-signoff {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #d5deec;
}

.src-sign-line {
  display: block;
  height: 2.2rem;
  margin-bottom: 0.35rem;
  border-bottom: 1.5px solid #8fa3c2;
}

.src-sign strong {
  display: block;
  color: #12233f;
  font-size: 0.76rem;
}

.src-sign small {
  margin-top: 0.12rem;
  color: #73849e;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: none;
}

.src-footnote {
  margin: 1rem 0 0;
  color: #8091aa;
  font-size: 0.72rem;
  line-height: 1.4;
}

@media (min-width: 820px) {
  .src-dual-head {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: start;
  }

  .src-dual-student {
    padding-left: 1rem;
    border-left: 1px solid #e2eaf6;
  }
}

@media (max-width: 820px) {
  .exam-report-builder-page.has-report .exam-tool-hero-aside {
    width: 100%;
  }

  .exam-report-toolbar-actions {
    width: 100%;
  }

  .exam-report-toolbar-actions .primary-button {
    flex: 1 1 auto;
  }
}

@media (max-width: 640px) {
  .exam-report-builder-summary {
    padding: 0.85rem 0.95rem;
  }

  .exam-report-builder .exam-report-form {
    padding: 0.9rem 0.95rem 1rem;
  }

  .exam-report-toolbar {
    padding: 0.85rem 0.95rem;
  }

  .exam-report-toolbar-actions .primary-button,
  .exam-report-actions .primary-button {
    width: 100%;
  }

  .src-dual-head {
    padding: 0 0 0.65rem;
  }

  .src-sheet,
  .exam-matrix-list {
    padding: 0.85rem 0.9rem 0.95rem;
  }

  .src-dual-student-name {
    white-space: normal;
  }

  .src-dual-facts {
    gap: 0.35rem 0.7rem;
  }

  .src-table {
    font-size: 0.74rem;
  }

  .src-table th,
  .src-table td {
    padding: 0.4rem 0.32rem;
  }

  .src-signoff {
    grid-template-columns: 1fr;
  }

  .src-summary {
    grid-template-columns: 1fr 1fr;
  }

  .src-summary-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .src-dual-school {
    grid-template-columns: 1fr;
  }

  .src-dual-logo,
  .src-dual-logo-mark {
    width: 2.35rem;
    height: 2.35rem;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  html, body.workspace-body {
    background: #fff !important;
    color: #000 !important;
  }

  .workspace-sidebar,
  .workspace-header,
  .workspace-footer,
  .workspace-backdrop,
  .no-print,
  .notice {
    display: none !important;
  }

  .workspace,
  .workspace-main,
  .workspace-content,
  .exam-tool-page,
  .exam-report-cards,
  .exam-report-matrices,
  .elr-report-sheet {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .student-report-card {
    break-after: page;
    page-break-after: always;
    margin: 0;
    box-shadow: none;
    animation: none;
  }

  .student-report-card:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .src-sheet {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  .exam-matrix-list {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  .src-summary {
    gap: 0.35rem;
    margin: 0 0 0.45rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .src-summary-item {
    padding: 0.28rem 0.4rem;
    border-radius: 0;
    border-color: #c8d2e4;
    background: #f8fbff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .src-summary-grade {
    background: #e9f0ff !important;
  }

  .src-summary-item span {
    font-size: 6.5pt;
  }

  .src-summary-item strong {
    font-size: 10pt;
  }

  .src-summary-wide strong {
    font-size: 8.5pt;
  }

  .src-trend {
    margin: 0.45rem 0 0;
    padding: 0.3rem 0 0.15rem;
    border: 0;
    border-top: 0.5pt solid #d5deec;
    border-radius: 0;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .src-trend-svg {
    max-height: 8.5rem;
  }

  .src-trend-area,
  .src-trend-bar,
  .src-trend-dot {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .src-dual-head {
    margin-bottom: 0.4rem;
    padding: 0 0 0.35rem;
    border: 0;
    border-bottom: 1.5pt solid #1b4fd6 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 0.35rem 0.7rem;
    align-items: start;
  }

  .src-dual-student {
    padding-left: 0.65rem;
    border-left: 0.5pt solid #d5deec;
  }

  .src-dual-logo,
  .src-dual-logo-mark,
  .src-table thead th,
  .src-table tfoot th,
  .src-table tbody tr:nth-child(even) td,
  .src-avg-col,
  .src-summary-item {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .src-dual-logo,
  .src-dual-logo-mark {
    width: 2.15rem;
    height: 2.15rem;
  }

  .src-student-photo,
  .src-student-photo-mark {
    width: 2.35rem;
    height: 2.35rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .src-dual-student-top {
    gap: 0.4rem;
  }

  .src-dual-copy h1,
  .src-dual-student-name {
    font-size: 10.5pt;
  }

  .src-dual-student-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .src-dual-kicker {
    font-size: 6.5pt;
  }

  .src-dual-motto {
    margin-top: 0.12rem;
    font-size: 7.5pt;
  }

  .src-dual-contact {
    margin-top: 0.1rem;
    font-size: 7pt;
  }

  .src-dual-school-meta {
    font-size: 8pt;
  }

  .src-dual-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.65rem;
    margin-top: 0.22rem;
  }

  .src-dual-facts div {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .src-dual-facts dt {
    font-size: 6pt;
  }

  .src-dual-facts dd {
    font-size: 8pt;
  }

  .src-results {
    margin-top: 0.45rem;
  }

  .src-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .src-table,
  .src-table-multi {
    min-width: 0;
    font-size: 9pt;
  }

  .src-table th,
  .src-table td {
    padding: 0.2rem 0.18rem !important;
    border-bottom: 0.5pt solid #c8d2e4 !important;
    font-size: 9pt;
    line-height: 1.25;
  }

  .src-table thead th {
    font-size: 8pt;
    background: #eef3fb !important;
  }

  .src-avg-col {
    background: #f3f7ff !important;
  }

  .src-table tbody tr:nth-child(even) td.src-avg-col {
    background: #eef3fb !important;
  }

  .src-table tfoot th {
    background: #e8effc !important;
  }

  .src-table tfoot th.src-avg-col {
    background: #dde8fb !important;
  }

  .src-mark strong,
  .src-exam-cell strong {
    font-size: 9pt;
  }

  .src-mark em,
  .src-exam-cell em {
    color: #1b4fd6 !important;
    font-size: 7.5pt;
  }

  .src-table th.is-left:first-child,
  .src-table td.is-left:first-child {
    position: static;
    box-shadow: none;
    max-width: none;
    left: auto;
  }

  .exam-report-grade-scale {
    margin-top: 0.45rem;
    padding-top: 0.35rem;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .exam-report-grade-scale .src-section-label {
    margin-bottom: 0.25rem;
    font-size: 7pt;
  }

  .exam-report-grade-scale-list {
    gap: 0.15rem 0.55rem;
  }

  .exam-report-grade-scale-list li {
    font-size: 7.5pt;
  }

  .exam-report-grade-scale-list strong {
    font-size: 7.5pt;
  }

  .src-signoff {
    gap: 0.7rem;
    margin-top: 0.7rem;
    padding-top: 0.45rem;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .src-sign-line {
    height: 1.55rem;
    margin-bottom: 0.2rem;
  }

  .src-sign strong {
    font-size: 8pt;
  }

  .src-sign small {
    font-size: 7pt;
  }

  .exam-matrix-list {
    break-inside: auto;
    page-break-inside: auto;
  }

  .elr-report-section {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 0.65rem;
  }

  .elr-report-section-title {
    font-size: 10pt;
    margin-bottom: 0.25rem;
  }

  .elr-report-summary {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.25rem;
    margin-bottom: 0.35rem;
  }

  .elr-report-summary div {
    padding: 0.25rem 0.3rem;
    border-radius: 0;
    background: #f8fbff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .elr-report-summary span {
    font-size: 6.5pt;
  }

  .elr-report-summary strong {
    font-size: 9pt;
  }

  .elr-report-subsection {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 0.45rem;
    padding-top: 0.35rem;
  }

  .elr-report-subsection-title {
    font-size: 9pt;
  }

  .elr-doc-band {
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
  }

  .elr-doc-band-kicker {
    font-size: 6.5pt;
  }

  .elr-doc-band-meta {
    font-size: 7.5pt;
  }

  .elr-plan-card,
  .elr-outcome-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0;
    padding: 0.45rem 0;
    border: 0;
    border-bottom: 0.5pt solid #d5deec;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
  }

  .elr-plan-card-subject {
    font-size: 11pt;
  }

  .elr-status-pill {
    padding: 0.1rem 0.35rem;
    border-radius: 0;
    font-size: 7pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .elr-plan-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    margin-bottom: 0.4rem;
  }

  .elr-plan-metric,
  .elr-plan-block,
  .elr-outcome-body {
    padding: 0.28rem 0.35rem;
    border-radius: 0;
    background: #f8fbff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .elr-plan-blocks {
    gap: 0.25rem;
  }

  .elr-plan-metric span,
  .elr-plan-label {
    font-size: 6.5pt;
  }

  .elr-plan-metric strong,
  .elr-plan-body {
    font-size: 8pt;
  }

  .elr-outcome-body .elr-plan-body {
    font-size: 9pt;
  }

  .elr-outcome-meta {
    font-size: 7pt;
  }

  .elr-report-details dt {
    font-size: 6.5pt;
  }

  .elr-report-details dd {
    font-size: 8pt;
  }

  .elr-report-table {
    font-size: 8pt;
  }

  .elr-learner-table .elr-col-learner,
  .elr-learner-table .elr-col-admission {
    font-size: 7pt;
  }

  .elr-learner-table .elr-col-learner {
    width: 34%;
  }

  .elr-learner-table .elr-col-admission {
    width: 18%;
  }

  .elr-report-footer {
    margin-top: 0.45rem;
    padding-top: 0.3rem;
  }

  .elr-report-footer p {
    font-size: 7.5pt;
  }

  .exam-matrix-list-head {
    margin-bottom: 0.45rem;
    padding: 0 0 0.35rem;
    border: 0;
    border-bottom: 1.5pt solid #1b4fd6 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .exam-matrix-list-brand {
    gap: 0.5rem;
  }

  .exam-matrix-list-logo,
  .exam-matrix-list-logo-mark {
    width: 1.9rem;
    height: 1.9rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .exam-matrix-list-kicker {
    font-size: 7.5pt;
  }

  .exam-matrix-list-motto {
    margin-top: 0.12rem;
    font-size: 7.5pt;
  }

  .exam-matrix-list-contact {
    margin-top: 0.1rem;
    font-size: 7pt;
  }

  .exam-matrix-list-head h2 {
    font-size: 12pt;
  }

  .exam-matrix-list-meta {
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 0.5pt solid #d5deec;
  }

  .exam-matrix-list-meta span {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 8.5pt;
  }

  .exam-matrix-list-meta span + span::before {
    content: " · ";
    color: #8091aa;
  }

  .exam-matrix-list-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .exam-matrix-list-table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 9pt;
  }

  .exam-matrix-list-table thead {
    display: table-header-group;
  }

  .exam-matrix-list-table tbody {
    display: table-row-group;
  }

  .exam-matrix-list-table th,
  .exam-matrix-list-table td {
    padding: 0.18rem 0.16rem !important;
    border-bottom: 0.5pt solid #c8d2e4 !important;
    font-size: 9pt;
    line-height: 1.25;
  }

  .exam-matrix-list-table thead th {
    font-size: 8pt;
    background: #eef3fb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .exam-matrix-avg-col {
    background: #f3f7ff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .exam-matrix-list-table tbody tr:nth-child(even) td.exam-matrix-avg-col {
    background: #eef3fb !important;
  }

  .exam-matrix-list-table th.is-left:nth-child(1),
  .exam-matrix-list-table td.is-left:nth-child(1) {
    width: 22%;
    max-width: 22%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
  }

  .exam-matrix-list-table th.is-left:nth-child(2),
  .exam-matrix-list-table td.is-left:nth-child(2) {
    width: 5.5%;
    white-space: nowrap;
  }

  .exam-matrix-list-table th:not(.is-left),
  .exam-matrix-list-table td:not(.is-left) {
    width: auto;
    padding: 0.14rem 0.1rem !important;
    font-size: 8pt;
  }

  .exam-matrix-list-table th:last-child,
  .exam-matrix-list-table td:last-child {
    width: 5%;
  }

  .exam-matrix-list-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .exam-matrix-list-table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .exam-matrix-mark strong,
  .exam-matrix-mark em {
    display: block;
    line-height: 1.15;
  }

  .exam-matrix-mark strong {
    font-size: 8pt;
  }

  .exam-matrix-mark em {
    margin-top: 0.04rem;
    color: #1b4fd6;
    font-size: 7pt;
  }
}

.attendance-form-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  margin: 0 0 1rem;
}
.attendance-control {
  display: grid;
  gap: 0.35rem;
  min-width: 10rem;
}
.attendance-control.is-wide {
  flex: 1 1 16rem;
}
.attendance-control span {
  color: #5b6472;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.attendance-check-col {
  text-align: center;
  width: 6.5rem;
}
.attendance-check {
  display: inline-grid;
  place-items: center;
  width: 100%;
  min-height: 2rem;
  cursor: pointer;
}
.attendance-check input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #1f6feb;
  cursor: pointer;
}
.class-attendance-page .allocation-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
}

.class-attendance-day-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin: 0 0 1.1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.class-attendance-day-copy {
  display: grid;
  gap: 0.25rem;
  min-width: min(100%, 18rem);
  flex: 1 1 16rem;
}
.class-attendance-day-label {
  margin: 0;
  color: #5b6472;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.class-attendance-day-title {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 750;
  line-height: 1.25;
}
.class-attendance-day-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 0.9rem;
}
.class-attendance-calendar-control input[type="date"] {
  min-width: 12.5rem;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
  background: #fff;
  color: var(--ink);
  font: 600 0.95rem/1.3 var(--font);
  color-scheme: light;
}
.class-attendance-day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.class-attendance-page .attendance-notes-control {
  margin-bottom: 0.85rem;
}
@media (max-width: 720px) {
  .class-attendance-day-filter {
    padding: 0.9rem;
  }
  .class-attendance-calendar-control input[type="date"] {
    min-width: 100%;
  }
}

.class-attendance-page .attendance-quick-actions {
  align-items: center;
}
.class-attendance-page .attendance-quick-actions .primary-button {
  margin-left: auto;
}

.subject-attendance-matrix-panel {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

.subject-attendance-matrix {
  width: auto;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.subject-attendance-matrix .subject-attendance-col {
  text-align: center;
  min-width: 4.5rem;
  white-space: nowrap;
}

.subject-attendance-matrix th:first-child,
.subject-attendance-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 1%;
  min-width: 11rem;
  padding-left: 0.85rem;
  padding-right: 0.95rem;
  white-space: nowrap;
  background: #fff;
  background-clip: padding-box;
  box-shadow: 10px 0 14px -10px rgba(21, 35, 63, 0.35);
  transition: min-width 0.18s ease, max-width 0.18s ease, padding 0.18s ease;
}

.subject-attendance-matrix thead th:first-child {
  z-index: 6;
  background: #f7f9fc;
}

.subject-attendance-matrix tbody tr:nth-child(even) td:first-child {
  background: #fbfcfe;
}

.subject-attendance-matrix tbody tr:hover td:first-child {
  background: #f4f8ff;
}

.subject-attendance-matrix .sa-student-index {
  color: #667085;
  font-weight: 700;
  margin-right: 0.2rem;
}

.subject-attendance-matrix.is-name-collapsed th:first-child,
.subject-attendance-matrix.is-name-collapsed td:first-child {
  min-width: 0;
  max-width: 7.25rem;
  padding-right: 0.65rem;
}

.subject-attendance-matrix.is-name-collapsed .exam-student-last {
  display: none;
}

.subject-attendance-matrix.is-name-collapsed thead th:first-child {
  font-size: 0;
}

.subject-attendance-matrix.is-name-collapsed thead th:first-child::after {
  content: "Name";
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sa-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.1rem;
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sa-status-pill.status-present {
  background: #ecfdf3;
  color: #027a48;
}
.sa-status-pill.status-absent {
  background: #fef3f2;
  color: #b42318;
}
.sa-status-pill.status-late {
  background: #fffaeb;
  color: #b54708;
}
.sa-status-pill.status-excused {
  background: #eef4ff;
  color: #3538cd;
}
.sa-status-pill.is-empty {
  background: #f2f4f7;
  color: #98a2b3;
}
.sa-status-pill.rate-high {
  background: #ecfdf3;
  color: #027a48;
}
.sa-status-pill.rate-mid {
  background: #fffaeb;
  color: #b54708;
}
.sa-status-pill.rate-low {
  background: #fef3f2;
  color: #b42318;
}
.sa-scope-filter {
  align-items: stretch;
}
.sa-scope-form {
  display: grid;
  gap: 0.85rem;
  flex: 1 1 22rem;
}
.sa-scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.sa-scope-tabs .ghost-button.is-active {
  color: #fff;
  background: #173e8f;
  border-color: #173e8f;
}
.sa-scope-controls {
  width: 100%;
}
.sa-scope-controls select {
  min-width: 11rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.sa-scope-controls [data-filter-field][hidden] {
  display: none !important;
}

/* ---------- E-learning learning materials ---------- */
.learning-materials-hero {
  align-items: end;
}

.learning-materials-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

.learning-material-dialog {
  width: min(100%, 36rem);
  max-height: min(92dvh, 44rem);
}

.learning-material-dialog-sub {
  margin: 0.25rem 0 0;
}

.learning-material-form {
  display: grid;
  gap: 1rem;
}

.learning-material-simple-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.learning-material-simple-grid .field {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.learning-material-simple-grid .field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.learning-material-simple-grid .field select,
.learning-material-simple-grid .field input,
.learning-material-simple-grid .field textarea {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.learning-material-simple-grid .field textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.learning-material-simple-grid .field input[type="file"] {
  min-height: 0;
  padding: 0.55rem;
  border-style: dashed;
  background: #f8fafc;
}

.learning-material-span {
  grid-column: 1 / -1;
}

.learning-format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.learning-format-chips span {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #eef4ff;
  color: #173e8f;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
}

.learning-material-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.learning-material-list,
.portal-materials-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
  gap: 0.85rem;
}

.learning-material-card,
.portal-material-card {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
}

.learning-material-cover,
.portal-material-cover {
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 0.85rem;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eef4ff;
  color: #173e8f;
  font: 800 0.9rem/1 var(--display);
}

.learning-material-cover img,
.portal-material-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.learning-material-body h4,
.portal-material-body h3 {
  margin: 0.3rem 0 0.2rem;
  font: 800 1rem/1.25 var(--display);
}

.learning-material-desc {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.learning-material-meta,
.portal-material-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.learning-material-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.portal-material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.learning-material-delete-form {
  margin: 0;
}

.ghost-button.is-danger {
  color: #b42318;
  border-color: #fecdca;
}

.ghost-button.is-danger:hover {
  background: #fef3f2;
  border-color: #f04438;
  color: #912018;
}

.portal-materials-panel {
  margin-top: 1rem;
}

@media (max-width: 760px) {
  .learning-materials-hero {
    align-items: stretch;
  }

  .learning-materials-hero-actions {
    justify-content: stretch;
  }

  .learning-materials-hero-actions .primary-button,
  .learning-materials-hero-actions .exam-tool-cta {
    width: 100%;
  }

  .learning-material-dialog {
    width: min(100%, calc(100vw - 1rem));
    max-height: min(94dvh, 100%);
    border-radius: 1rem;
  }

  .learning-material-simple-grid {
    grid-template-columns: 1fr;
  }

  .learning-material-actions {
    flex-direction: column-reverse;
  }

  .learning-material-actions .primary-button,
  .learning-material-actions .ghost-button {
    width: 100%;
  }

  .learning-material-card,
  .portal-material-card {
    grid-template-columns: 1fr;
  }

  .learning-material-cover,
  .portal-material-cover {
    width: 100%;
    height: 8.5rem;
  }
}

/* Multi-role login selection */
.role-select-form {
  display: grid;
  gap: 1.1rem;
}
.role-select-list {
  display: grid;
  gap: 0.65rem;
}
.role-select-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.9rem 1rem;
  border: 1px solid #d7e0f2;
  border-radius: 0.85rem;
  background: #fff;
  cursor: pointer;
}
.role-select-option:has(input:checked) {
  border-color: #1f5cf0;
  background: #f3f7ff;
  box-shadow: inset 0 0 0 1px #1f5cf0;
}
.role-select-option input {
  margin-top: 0.2rem;
}
.role-select-option-body {
  display: grid;
  gap: 0.15rem;
}
.role-select-option-body strong {
  font-size: 0.95rem;
}

/* Employee management */
.employee-mgmt-page {
  display: grid;
  gap: 1rem;
}
.employee-mgmt-controls {
  display: grid;
  gap: 0.75rem;
}
.employee-mgmt-search {
  position: relative;
  display: block;
}
.employee-mgmt-search svg {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  width: 1rem;
  height: 1rem;
  fill: #7b879c;
  transform: translateY(-50%);
  pointer-events: none;
}
.employee-mgmt-search input {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.65rem 0.9rem 0.65rem 2.45rem;
  border: 1px solid #d7e2f3;
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 6px 18px #15233f08;
  font: 600 0.9rem/1.3 var(--font);
}
.employee-mgmt-search input:focus {
  outline: none;
  border-color: #1f5cf0;
  box-shadow: 0 0 0 3px #1f5cf033;
}
.employee-role-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.employee-role-nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid #d7e2f3;
  border-radius: 999px;
  background: #fff;
  color: #40506b;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.employee-role-nav-chip em {
  font-style: normal;
  color: #1f5cf0;
  background: #eaf0ff;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
}
.employee-role-nav-chip:hover {
  border-color: #9db6ef;
  background: #f5f8ff;
  color: #1d4fcc;
}
.employee-directory {
  display: grid;
  gap: 1.35rem;
}
.employee-role-block {
  display: grid;
  gap: 0.7rem;
  scroll-margin-top: 1rem;
}
.employee-role-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.1rem;
}
.employee-role-header h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}
.employee-role-header p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.employee-role-card {
  overflow: hidden;
  border: 1px solid #d7e2f3;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 24px #15233f0c;
}
.employee-table-wrap {
  overflow-x: auto;
}
.employee-table {
  width: 100%;
  min-width: 52rem;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.employee-table .col-employee { width: 24%; }
.employee-table .col-code { width: 9%; }
.employee-table .col-employment { width: 9%; }
.employee-table .col-contact { width: 20%; }
.employee-table .col-approval { width: 12%; }
.employee-table .col-access { width: 10%; }
.employee-table .col-actions { width: 16%; }
.employee-table th,
.employee-table td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #eef2f8;
}
.employee-table th {
  color: #6b7c99;
  background: linear-gradient(180deg, #f8fafd, #f3f6fb);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.employee-table tbody tr:last-child td {
  border-bottom: 0;
}
.employee-table tbody tr:hover td {
  background: #f8faff;
}
.employee-name-cell {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-width: 0;
}
.employee-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #3b78f7, #1d4fcc);
  color: #fff;
  font: 800 0.72rem/1 var(--display);
  letter-spacing: 0.02em;
}
.employee-avatar-photo {
  object-fit: cover;
  background: #dfe7f5;
}
.employee-name-copy {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}
.employee-name-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}
.employee-role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}
.employee-role-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #eef2f8;
  color: #40506b;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.employee-role-chip.is-primary {
  background: #e7efff;
  color: #1f5cf0;
}
.employee-code {
  display: inline-block;
  padding: 0.18rem 0.4rem;
  border-radius: 0.4rem;
  background: #f3f6fb;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 700;
}
.employee-contact-cell {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}
.employee-contact-cell span,
.employee-contact-cell small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-contact-cell span {
  color: var(--ink);
  font-weight: 600;
}
.employee-contact-cell small {
  color: var(--muted);
  font-size: 0.74rem;
}
.employee-mgmt-empty,
.employee-mgmt-blank {
  display: grid;
  gap: 0.35rem;
  place-items: start;
  padding: 1.4rem 1.2rem;
  border: 1px dashed #cfd9ea;
  border-radius: 1rem;
  background: #f8fafc;
  color: var(--muted);
}
.employee-mgmt-blank strong,
.employee-mgmt-empty {
  color: var(--ink-soft);
  font-weight: 750;
}
.employee-mgmt-blank p {
  margin: 0;
  font-size: 0.88rem;
}
.employee-modal-kicker {
  margin: 0 0 0.2rem;
  color: #4d6aa0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.edit-employee-dialog {
  display: flex;
  flex-direction: column;
  width: min(38rem, calc(100vw - 1.5rem));
  max-height: min(90dvh, 40rem);
  height: auto;
  overflow: hidden;
  border: 1px solid #d7e3f4;
  background: #fff;
  box-shadow: 0 24px 60px #0b1b3640, 0 2px 8px #0b1b3612;
}
.edit-employee-header {
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.05rem 1.2rem 0.9rem;
  border-bottom: 1px solid #e4ecf6;
  background: #f8faff;
}
.edit-employee-header-copy {
  min-width: 0;
}
.edit-employee-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.edit-employee-header-note {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.edit-employee-dialog .app-modal-close {
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #fff;
}
.edit-employee-dialog .app-modal-close:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-soft);
}
.edit-employee-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
  padding: 0;
}
.edit-employee-form-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.25rem 1.2rem 1rem;
}
.edit-employee-section {
  padding: 0.9rem 0 0.2rem;
  border-top: 1px solid #e8eef8;
}
.edit-employee-section:first-child {
  border-top: 0;
  padding-top: 0.75rem;
}
.edit-employee-section-head {
  margin-bottom: 0.7rem;
}
.edit-employee-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.edit-employee-section-head p {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}
.edit-employee-form .field {
  margin-bottom: 0.75rem;
}
.edit-employee-form .field label,
.edit-employee-form .field-label {
  margin-bottom: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.edit-employee-form input:not([type="checkbox"]):not([type="radio"]),
.edit-employee-form select {
  min-height: 2.5rem;
  border-color: #d5e0ef;
  background: #fbfdff;
}
.edit-employee-form input:not([type="checkbox"]):not([type="radio"]):hover,
.edit-employee-form select:hover {
  border-color: #c2d0e6;
}
.edit-employee-form input:not([type="checkbox"]):not([type="radio"]):focus,
.edit-employee-form select:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px #1f5cf01a;
  outline: none;
}
.edit-employee-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 0.6rem;
  margin: 0;
  padding: 0.85rem 1.2rem calc(0.85rem + env(safe-area-inset-bottom));
  border-top: 1px solid #e4ecf6;
  background: #fafcff;
}
.edit-employee-actions .ghost-button,
.edit-employee-actions .primary-button {
  min-width: 7rem;
}
.employee-roles-field {
  padding: 0;
  border: 0;
  background: transparent;
}
.employee-roles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.55rem;
}
.edit-employee-form label.employee-role-option,
.employee-role-option {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
  margin: 0 !important;
  min-height: 2.7rem;
  height: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d7e2f3;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem !important;
  font-weight: 650 !important;
  letter-spacing: 0 !important;
  line-height: 1.3 !important;
  cursor: pointer;
  user-select: none;
  overflow: visible;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.edit-employee-form label.employee-role-option:hover,
.employee-role-option:hover {
  border-color: #b8c9ea;
  background: #f7faff;
}
.edit-employee-form .employee-role-option input[type="checkbox"],
.employee-role-option input[type="checkbox"] {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  cursor: pointer;
}
.employee-role-option-mark {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border: 1.5px solid #9aafd0;
  border-radius: 0.32rem;
  background: #fff;
  pointer-events: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.employee-role-option-mark::after {
  content: "";
  display: block;
  width: 0.7rem;
  height: 0.7rem;
  opacity: 0;
  transition: opacity 0.12s ease;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11l6-6.5' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.employee-role-option-label {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  overflow: visible;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
  pointer-events: none;
}
.edit-employee-form label.employee-role-option:has(input:checked),
.employee-role-option:has(input:checked) {
  border-color: #8eadeb;
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px #c9daf8;
}
.employee-role-option:has(input:checked) .employee-role-option-mark {
  border-color: var(--blue);
  background: var(--blue);
}
.employee-role-option:has(input:checked) .employee-role-option-mark::after {
  opacity: 1;
}
.employee-role-option:has(input:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
@media (max-width: 640px) {
  .edit-employee-dialog {
    width: min(100%, calc(100vw - 1rem));
    max-height: min(94dvh, 100%);
  }
  .edit-employee-header,
  .edit-employee-form-body,
  .edit-employee-actions {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }
  .employee-roles-grid {
    grid-template-columns: 1fr;
  }
  .edit-employee-actions {
    flex-direction: column-reverse;
  }
  .edit-employee-actions .ghost-button,
  .edit-employee-actions .primary-button {
    width: 100%;
    min-width: 0;
  }
}
.field-hint {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}
.field-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

@media (max-width: 860px) {
  .employee-table {
    min-width: 0;
  }
  .employee-table thead {
    display: none;
  }
  .employee-table,
  .employee-table tbody,
  .employee-table tr,
  .employee-table td {
    display: block;
    width: 100%;
  }
  .employee-table tr {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid #eef2f8;
  }
  .employee-table tr:last-child {
    border-bottom: 0;
  }
  .employee-table td {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0.55rem;
    padding: 0.35rem 0;
    border-bottom: 0;
  }
  .employee-table td::before {
    content: attr(data-label);
    color: #6b7c99;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .employee-table td[data-label="Employee"],
  .employee-table td[data-label="Actions"] {
    grid-template-columns: 1fr;
  }
  .employee-table td[data-label="Employee"]::before,
  .employee-table td[data-label="Actions"]::before {
    display: none;
  }
  .employee-table .record-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .employee-contact-cell span,
  .employee-contact-cell small,
  .employee-name-copy strong {
    white-space: normal;
  }
}
