:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #687184;
  --line: #dfe3ea;
  --accent: var(--tenant-accent, #2764d8);
  --accent-soft: #e9f0ff;
  --danger: #b42318;
  --warn: #a15c00;
  --ok: #0f7b4f;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a { color: var(--accent); text-decoration: none; }
.link-form { display: inline; margin: 0; padding: 0; }
.link-button {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: var(--accent); text-decoration: none;
  cursor: pointer;
}
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 0;
}

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

.brand span:last-child { display: grid; gap: 1px; }
.brand small, .muted { color: var(--muted); }
.brand strong, .brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Language switcher -- deliberately styled apart from the rest of
   top-actions (a plain-text link here was easy to miss entirely; a real
   user stayed in Chinese without noticing an English option existed). A
   pill toggle with the active language filled in makes both the current
   language and the alternative unmistakable at a glance. */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  flex: none;
}
.lang-switch-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.2;
}
.lang-switch-option span[aria-hidden] { font-size: 1rem; line-height: 1; }
.lang-switch-option:hover { text-decoration: none; }
.lang-switch-option:not(.active):hover {
  background: rgba(39, 100, 216, 0.08);
  color: var(--ink);
}
.lang-switch-option.active {
  background: var(--accent);
  color: #fff;
}

.inline-form { display: inline; margin: 0; }

.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  min-height: 0;
  font: inherit;
  font-weight: 400;
  cursor: pointer;
}
.nav-dropdown-trigger:hover { text-decoration: underline; }
.nav-dropdown-caret { font-size: 0.7em; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 28, 46, 0.14);
  padding: 6px;
  z-index: 30;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; flex-direction: column; }
.nav-dropdown-menu a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--accent-soft); text-decoration: none; }

button, .button-link {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  min-height: 42px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled { opacity: .65; cursor: wait; }
.ghost-button { background: #eef2f7; color: var(--ink); }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.button-link.secondary { background: #eef2f7; color: var(--ink); }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  min-height: 42px;
  font: inherit;
}

label { display: grid; gap: 6px; font-weight: 700; }

.page-shell {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 28px) 48px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.8rem); line-height: 1.08; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
.lead { max-width: 760px; color: var(--muted); font-size: 1.08rem; line-height: 1.55; }

.public-hero, .login-layout, .admin-head, .dashboard-hero {
  display: grid;
  gap: 20px;
  align-items: end;
  grid-template-columns: 1fr;
  padding: 24px 0;
}

.discovery-panel, .form-panel, .form-grid, .narrow, .task-section, .table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.discovery-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.public-grid, .stats-grid, .dashboard-grid {
  display: grid;
  gap: 14px;
}

.public-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.public-grid article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.link-band {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0;
  color: var(--muted);
}

.login-layout { max-width: 820px; margin: 0 auto; }
.form-panel { display: grid; gap: 14px; }
.form-error { color: var(--danger); font-weight: 700; }

.dashboard-hero {
  grid-template-columns: 1fr;
  border-bottom: 1px solid var(--line);
}

.school-year-band {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  margin: 14px 0;
}

.school-year-band h2 {
  margin-bottom: 4px;
}

.school-year-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.school-year-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 176px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.school-year-tab .school-year-tab-label {
  font-size: 1rem;
  line-height: 1.15;
}

.school-year-tab .school-year-tab-meta {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.school-year-tab strong {
  align-self: flex-end;
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .82rem;
}

.school-year-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.school-year-tab.active .school-year-tab-meta {
  color: var(--accent);
}

.weekly-accordion {
  display: grid;
  gap: 12px;
}

.weekly-accordion--teacher {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.weekly-accordion--admin {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.weekly-accordion--teacher > .day-schedule {
  min-width: 0;
  flex: 1 1 calc((100% - 48px) / 5);
}

.weekly-accordion--admin > .day-schedule {
  min-width: 0;
  flex: 1 1 calc((100% - 48px) / 5);
}

.weekly-accordion--teacher > .day-schedule[open] {
  flex: 0 0 100%;
  order: -1;
}

.weekly-accordion--admin > .day-schedule[open] {
  flex: 0 0 100%;
  order: -1;
}

.schedule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.schedule-head > div:first-child {
  min-width: 0;
}

.schedule-subtotal {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 104px;
  padding: 10px 12px;
  border: 1px solid rgba(39, 100, 216, .28);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(39, 100, 216, .06);
}

.schedule-subtotal span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.schedule-subtotal strong {
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.schedule-subtotal small {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
}

.now-next-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.now-next-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.now-next-card--current {
  border-color: rgba(39, 100, 216, .36);
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
}

.now-next-card--next {
  background: #fcfdff;
}

.now-next-card-label {
  color: var(--accent);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.now-next-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.now-next-card-head strong {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
}

.now-next-card-head small {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
  text-align: right;
}

.now-next-entry-list {
  display: grid;
  gap: 8px;
}

.now-next-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfe;
}

.now-next-entry strong {
  font-size: .94rem;
}

.now-next-entry span,
.teacher-class-summary {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

/* The drawer rail.
   Every toggle used to be position:fixed with its own hardcoded `top`,
   56px apart, which meant adding a drawer required remembering to add a
   magic number in two places (desktop and the 720px breakpoint). Three
   selectors never got one -- feedback-completion, team-announcements and
   leave-bank -- so all three inherited the base 230px and stacked on top
   of 我的周课表, leaving whichever came last in the DOM as the only one
   anybody could click. Laying them out in a column removes the class of
   bug rather than the instance: a new drawer now just appears in order.
   The per-button rules are left in place for their colours; the
   rail-scoped selector below outranks their positions. */
.teacher-drawer-rail {
  position: fixed;
  left: 0;
  top: 174px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.teacher-drawer-rail .teacher-classes-toggle {
  position: static;
  top: auto;
  bottom: auto;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .teacher-drawer-rail {
    top: auto;
    bottom: 16px;
    max-height: 60vh;
    gap: 8px;
  }
}

.teacher-classes-toggle {
  position: fixed;
  left: 0;
  top: 230px;
  z-index: 28;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .12);
}

.teacher-units-and-lessons-toggle {
  top: 286px;
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.teacher-units-and-assessments-toggle {
  top: 342px;
  background: #be185d;
  border-color: #be185d;
}

.teacher-unit-planning-toggle {
  top: 398px;
  background: #0f766e;
  border-color: #0f766e;
}

.teacher-mb-unit-planning-checkup-toggle {
  top: 454px;
  background: #0e7490;
  border-color: #0e7490;
}

.teacher-device-usage-toggle {
  top: 510px;
  background: #7c3aed;
  border-color: #7c3aed;
}

.teacher-feedback-schedule-toggle {
  top: 566px;
  background: #b45309;
  border-color: #b45309;
}

.teacher-master-schedule-toggle {
  top: 622px;
  background: #2c4a6e;
  border-color: #2c4a6e;
}

.teacher-dse-schedule-toggle {
  top: 678px;
  background: #6b7a2e;
  border-color: #6b7a2e;
}

.teacher-college-counseling-toggle {
  top: 734px;
  background: #9d4edd;
  border-color: #9d4edd;
}

.teacher-hk-college-counseling-toggle {
  top: 790px;
  background: #c1121f;
  border-color: #c1121f;
}

.teacher-homeroom-schedule-toggle {
  top: 846px;
  background: #4338ca;
  border-color: #4338ca;
}

.teacher-drawer-master-toggle {
  top: 174px;
  background: var(--ink);
  border-color: var(--ink);
  justify-content: center;
  min-width: 40px;
  padding: 10px 12px;
}

.teacher-drawer-master-toggle .master-toggle-icon {
  font-weight: 900;
  font-size: 1rem;
  line-height: 1;
}

body.drawer-toggles-collapsed .teacher-classes-toggle {
  min-width: 0;
  padding: 10px;
  justify-content: center;
}

body.drawer-toggles-collapsed .teacher-classes-toggle > span:not(.master-toggle-icon) {
  display: none;
}

.teacher-classes-toggle span {
  font-weight: 800;
}

.teacher-classes-toggle strong {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  min-height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: .82rem;
  font-weight: 900;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(24, 32, 51, .26);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.teacher-classes-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(390px, 88vw);
  z-index: 30;
  transform: translateX(-100%);
  transition: transform .22s ease;
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 40px rgba(24, 32, 51, .16);
  display: grid;
  grid-template-rows: auto 1fr;
}

.teacher-classes-drawer.open {
  transform: translateX(0);
}

.teacher-classes-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.teacher-classes-drawer-head h2 {
  margin-bottom: 4px;
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-link {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.icon-link:hover {
  text-decoration: none;
  background: var(--accent-soft);
}

.teacher-classes-list {
  display: grid;
  gap: 12px;
  padding: 16px 18px 20px;
  overflow: auto;
}

.teacher-class-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfe;
}

.teacher-class-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.teacher-class-card-head h3 {
  margin: 0;
  font-size: .98rem;
}

.teacher-class-card-head strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .85rem;
}

.unit-planning-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.leave-bank-summary {
  align-self: start;
  /* Three tiles normally, four once credit has been granted by hand. */
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

.leave-bank-summary,
.device-usage-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.unit-planning-summary div,
.leave-bank-summary div,
.device-usage-summary div,
.unit-planning-counts span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.unit-planning-summary strong,
.device-usage-summary strong,
.unit-planning-counts strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.unit-planning-summary span,
.device-usage-summary span,
.unit-planning-counts span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.unit-planning-card {
  border-left: 4px solid var(--muted);
}

.unit-planning-card--red {
  border-left-color: var(--danger);
}

.unit-planning-card--yellow {
  border-left-color: #d97706;
}

.unit-planning-card--green {
  border-left-color: #059669;
}

.audit-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
}

.audit-status-pill--red {
  background: #fee2e2;
  color: #991b1b;
}

.audit-status-pill--yellow {
  background: #fef3c7;
  color: #92400e;
}

.audit-status-pill--green {
  background: #d1fae5;
  color: #065f46;
}

.unit-planning-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.device-usage-card {
  border-left: 4px solid #7c3aed;
}

.device-usage-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.teacher-class-slot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.teacher-class-slot {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

.compact-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.expanded-panel {
  display: grid;
  gap: 16px;
}

.expanded-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.expanded-summary {
  max-width: 720px;
}

.day-schedule {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.day-schedule > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  list-style: none;
  cursor: pointer;
  font-weight: 800;
}

.day-schedule > summary::-webkit-details-marker { display: none; }

.day-schedule > summary strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .85rem;
}

.day-schedule[open] > summary {
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}

/* Today's highlight, per dashboard.html's day-strip: pink outranks green
   when both would apply (my own class is a stronger signal than "the
   school has class today, just not necessarily mine right now"). Reuses
   the same pink already used for .active-period below, and the existing
   --ok-family green from .audit-status-pill--green for visual consistency. */
.day-schedule--personal-active {
  border-color: #f0a3c5;
  background: #fde7f0;
}

.day-schedule--personal-active > summary strong {
  background: #f0a3c5;
  color: #7a1f47;
}

.day-schedule--school-active {
  border-color: #059669;
  background: #d1fae5;
}

.day-schedule--school-active > summary strong {
  background: #059669;
  color: #fff;
}

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

.day-timetable {
  min-width: 920px;
}

.day-timetable th,
.day-timetable td {
  vertical-align: top;
}

.day-timetable thead th {
  white-space: nowrap;
}

.day-timetable th[scope="row"] {
  width: 150px;
}

.day-timetable th[scope="row"] small,
.timetable-item small {
  display: block;
  color: var(--muted);
  font-weight: 600;
  margin-top: 3px;
}

.timetable-item {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
}

.timetable-item strong {
  font-size: .92rem;
}

.day-timetable tr.active-period td,
.day-timetable tr.active-period th {
  background: #fde7f0;
}

.day-timetable tr.active-period .timetable-item {
  border-color: #f0a3c5;
  background: #fff3f7;
}

.division-hierarchy {
  display: grid;
  gap: 12px;
}

.division-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.division-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  list-style: none;
  cursor: pointer;
  font-weight: 800;
}

.division-panel > summary::-webkit-details-marker { display: none; }

.division-panel > summary strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .85rem;
}

.division-panel[open] > summary {
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}

.division-panel-body {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.division-group {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfe;
}

.division-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.division-group-head h3 {
  margin: 0;
  font-size: .98rem;
}

.division-group-head strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--ink);
  font-size: .85rem;
}

.teacher-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.teacher-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
}

.dashboard-hero time { color: var(--muted); }

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

.stats-grid div {
  display: grid;
  gap: 3px;
  min-height: 82px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stats-grid strong { font-size: 1.9rem; }
.stats-grid span { color: var(--muted); font-size: .9rem; }

.dashboard-grid { grid-template-columns: 1fr; }
.task-section { display: grid; gap: 12px; align-content: start; }
.admin-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin: 14px 0;
}
.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-start;
}
.admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-list { display: grid; gap: 8px; }
.metric-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 900px) {
  .now-next-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .teacher-classes-toggle {
    top: auto;
    bottom: 16px;
    box-shadow: 0 10px 28px rgba(24, 32, 51, .18);
  }

  .teacher-units-and-lessons-toggle {
    bottom: 70px;
  }

  .teacher-units-and-assessments-toggle {
    bottom: 124px;
  }

  .teacher-unit-planning-toggle {
    bottom: 178px;
  }

  .teacher-mb-unit-planning-checkup-toggle {
    bottom: 232px;
  }

  .teacher-device-usage-toggle {
    bottom: 286px;
  }

  .teacher-drawer-master-toggle {
    top: auto;
    bottom: 340px;
  }

  .teacher-feedback-schedule-toggle {
    bottom: 394px;
  }

  .teacher-master-schedule-toggle {
    bottom: 448px;
  }

  .teacher-dse-schedule-toggle {
    bottom: 502px;
  }

  .teacher-college-counseling-toggle {
    bottom: 556px;
  }

  .teacher-hk-college-counseling-toggle {
    bottom: 610px;
  }

  .teacher-homeroom-schedule-toggle {
    bottom: 664px;
  }

  .teacher-classes-drawer {
    width: min(92vw, 390px);
  }

  .teacher-classes-drawer-head,
  .teacher-classes-list {
    padding-left: 16px;
    padding-right: 16px;
  }
}
.metric-list div:last-child { border-bottom: 0; }
.metric-list span { color: var(--muted); overflow-wrap: anywhere; }
.compact-table table { min-width: 760px; }
.member-cell { min-width: 280px; }
.today-section { border-top: 4px solid var(--accent); }
.overdue-section { border-top: 4px solid var(--danger); }

.task-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}

.priority-urgent, .priority-high { border-left-color: var(--danger); }
.priority-low { border-left-color: var(--muted); }

.task-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 9px;
  font-size: .76rem;
  font-weight: 800;
}

.task-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.task-meta div { min-width: 0; }
.task-meta dt { color: var(--muted); font-size: .75rem; }
.task-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.task-meta.stacked { grid-template-columns: 1fr; }

.task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.task-actions form, .note-form { margin: 0; }
.task-actions button { width: 100%; background: #eef2f7; color: var(--ink); }
.task-actions form:nth-child(2) button { background: var(--ok); color: #fff; }

.note-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.empty { color: var(--muted); margin: 0; }

.feedback-schedule-term-label {
  margin: 18px 0 6px;
  font-size: .82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.feedback-schedule-term-label:first-child { margin-top: 0; }

.feedback-schedule-table { width: 100%; border-collapse: collapse; min-width: 0; font-size: .82rem; }
.feedback-schedule-table th,
.feedback-schedule-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.feedback-schedule-table th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.feedback-schedule-table tr.skip td { color: var(--muted); font-style: italic; font-size: .78rem; }
.feedback-schedule-table tr.is-next td { background: var(--accent-soft); font-weight: 700; }

/* This drawer holds only a couple of blocks, so the grid's default
   align-content: stretch spreads them to the drawer's full height. */
.teacher-feedback-completion-drawer .teacher-classes-list { align-content: start; }
.drawer-table-scroll { overflow-x: auto; }
.drawer-table-scroll .feedback-schedule-table { min-width: 460px; }

.master-schedule-category-label {
  margin: 18px 0 6px;
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.master-schedule-category-label:first-child { margin-top: 0; }
.master-schedule-category-label--saie { color: var(--muted); }
.master-schedule-category-label--us { color: #2c4a6e; }
.master-schedule-category-label--uk { color: #7a2331; }

.master-schedule-table { width: 100%; border-collapse: collapse; min-width: 0; font-size: .82rem; margin-bottom: 4px; }
.master-schedule-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.master-schedule-table td.date { white-space: nowrap; color: var(--muted); font-size: .78rem; width: 1%; }
.master-schedule-table .master-schedule-note { color: var(--muted); font-size: .78rem; }
.master-schedule-table tr.approximate td { font-style: italic; }
.master-schedule-table tr.reminder td.event { font-weight: 700; }

.dse-schedule-table { width: 100%; border-collapse: collapse; min-width: 0; font-size: .82rem; }
.dse-schedule-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dse-schedule-table td.date { white-space: nowrap; color: var(--ink); font-weight: 600; width: 1%; }
.dse-schedule-table td.cat { width: 1%; white-space: nowrap; }

.dse-category-pill {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 20px;
  color: #fff;
  white-space: nowrap;
}
.dse-category-pill--teaching { background: #65a30d; }
.dse-category-pill--campus { background: #2563eb; }
.dse-category-pill--activity { background: #7c3aed; }
.dse-category-pill--weekend_teaching { background: #ca8a04; }
.dse-category-pill--holiday { background: #dc2626; }
.dse-category-pill--festival { background: #ea580c; }
.dse-category-pill--launch { background: #0891b2; }
.dse-category-pill--weekly_governance { background: #2563eb; }
.dse-category-pill--one_to_one_talk { background: #7c3aed; }
.dse-category-pill--exam_event { background: #ca8a04; }
.dse-category-pill--term_close { background: #dc2626; }

.drawer-subheading {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 4px 0 6px;
}
.homeroom-teachers-table { width: 100%; table-layout: fixed; border-collapse: collapse; min-width: 0; font-size: .82rem; margin-bottom: 14px; }
.homeroom-teachers-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: break-word; }
.homeroom-teachers-table td.grade { color: var(--ink); font-weight: 600; width: 42%; }
.homeroom-inferred-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: .66rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 6px;
}

.mb-checkup-table { width: 100%; border-collapse: collapse; min-width: 0; font-size: .82rem; }
.mb-checkup-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.mb-checkup-table td.date { color: var(--ink); font-weight: 600; }

.mb-checkup-status-pill {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 3px 9px;
  border-radius: 20px;
  color: #fff;
  white-space: nowrap;
}
.mb-checkup-status-pill--upcoming { background: #64748b; }
.mb-checkup-status-pill--fix_window_open { background: #ca8a04; }
.mb-checkup-status-pill--pending_verification { background: #ea580c; }
.mb-checkup-status-pill--pass { background: #16a34a; }
.mb-checkup-status-pill--fail_suspended { background: #dc2626; }
.mb-checkup-status-pill--pre_checkup_open { background: #0891b2; }

.mb-checkup-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mb-checkup-tab {
  font-size: .78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.mb-checkup-tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.mb-checkup-tab-panel.is-hidden { display: none; }
.mb-checkup-block-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.mb-checkup-block-card p { margin: 0 0 8px 0; }
.mb-checkup-block-card p:last-child { margin-bottom: 0; }

.schedule-now-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: .9rem;
}
.schedule-now-date { font-weight: 700; color: var(--ink); }
.schedule-now-clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.today-arrow {
  color: #e11d48;
  font-weight: 900;
  margin-right: 4px;
  display: inline-block;
}

tr.is-today td {
  background: #ffe0ec;
  font-weight: 700;
}

.schedule-countdown-row td {
  background: #ffe0ec;
  padding: 10px 14px;
  font-size: .88rem;
  color: var(--ink);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: .82rem; }

.table-wrap th, .table-wrap td { padding: 8px 10px; font-size: .85rem; white-space: nowrap; }
.table-wrap td.wrap { white-space: normal; }
.table-wrap td.email-cell { white-space: normal; max-width: 190px; overflow-wrap: anywhere; }
.table-wrap .ghost-button { padding: 5px 10px; min-height: auto; font-size: .8rem; font-weight: 600; }
.table-wrap input[type="checkbox"] { width: auto; margin: 0; vertical-align: middle; }

/* Green = default/expected state (active, full access, no elevated grant).
   Red = restricted/limited (inactive, login restricted).
   Yellow = elevated/special, worth an admin noticing (an editor grant in effect). */
.table-wrap .ghost-button--ok { background: #d1fae5; color: #065f46; }
.table-wrap .ghost-button--warn { background: #fee2e2; color: #991b1b; }
.table-wrap .ghost-button--flag { background: #fef3c7; color: #92400e; }

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.span-2 { grid-column: 1 / -1; }
.narrow { max-width: 760px; margin: 20px auto; }
.state-page { text-align: center; }
.plain-list { padding-left: 18px; }

.site-footer {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 28px) 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: .82rem;
}

.site-footer-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer-copyright {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}

.site-footer-copyright img {
  height: 60px;
  width: auto;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.site-footer-icp {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.site-footer-icp:hover { color: var(--ink); text-decoration: underline; }

.site-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.site-footer-brand-link { display: inline-flex; align-items: center; }
.site-footer-brand-link img { height: 30px; width: auto; display: block; }

@media (max-width: 759px) {
  .site-footer {
    align-items: flex-start;
  }
}

@media (min-width: 760px) {
  .public-hero, .login-layout, .dashboard-hero, .admin-head { grid-template-columns: 1.3fr .7fr; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-section.wide { grid-column: 1 / -1; }
  .task-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .note-form { grid-template-columns: 1fr auto; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-section.wide { grid-column: span 3; }
}

@media (max-width: 560px) {
  .topbar { align-items: start; flex-direction: column; }
  .top-actions { justify-content: start; }
  .discovery-row { grid-template-columns: 1fr; }
}

.policy-search-form {
  margin: 18px 0 24px;
  gap: 8px;
}
.policy-search-form input[type="search"] {
  flex: 1;
  min-width: 240px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
}

.policy-tier-section { margin-bottom: 36px; }
.policy-tier-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  margin: 0 0 14px;
}
.policy-group-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 18px 0 8px;
  font-weight: 700;
}
.policy-group-label:first-child { margin-top: 0; }

.policy-tier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 20px;
  color: #fff;
  white-space: nowrap;
}
.policy-tier-badge--1 { background: #a93226; }
.policy-tier-badge--2 { background: #8a6a2e; }
.policy-tier-badge--3 { background: #45566a; }

.policy-results { margin-top: 8px; }

.policy-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.policy-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.policy-card-head h3 { margin: 0; font-size: 0.98rem; }
.policy-card-note {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 10px;
  max-width: 74ch;
}
.policy-card-actions {
  display: flex;
  gap: 8px;
}

.policy-view-dialog {
  width: min(880px, 92vw);
  height: min(88vh, 1000px);
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.policy-view-dialog::backdrop {
  background: rgba(15, 20, 30, 0.55);
}
.policy-view-dialog-head {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.policy-view-frame {
  display: block;
  width: 100%;
  height: calc(100% - 45px);
  border: none;
  background: #fff;
}

/* Units and Assessments (course -> unit -> assessment browser) */
.ua-root { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ua-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ua-tab {
  font-size: .78rem;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card, #fff);
  color: var(--muted);
  cursor: pointer;
}
.ua-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.ua-content { display: flex; flex-direction: column; gap: 12px; }

.ua-year-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 14px;
}
.ua-year-label { font-weight: 700; font-size: 1rem; }
.ua-year-sub { font-size: .68rem; opacity: .7; text-transform: uppercase; letter-spacing: .06em; }

.ua-course-head { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.ua-eyebrow {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #5c3f10; background: #f3e6cf; display: inline-block; padding: 2px 8px; border-radius: 20px; margin-bottom: 8px;
}
.ua-course-name { margin: 0 0 6px; font-size: 1.1rem; }
.ua-course-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .82rem; }
.ua-course-meta strong { color: var(--ink); }

.ua-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.ua-stat-tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ua-stat-tile .ua-num { font-size: 1.2rem; font-weight: 700; display: block; }
.ua-stat-tile .ua-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.ua-semester-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.ua-semester-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ua-semester-title { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 6px; }
.ua-semester-check-row { display: flex; gap: 14px; }
.ua-semester-check { display: flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--muted); }
.ua-semester-check.ua-is-yes { color: var(--ink); font-weight: 600; }
.ua-check-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ua-check-yes { background: #2f7a4f; }
.ua-check-no { background: var(--line); }

.ua-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; box-sizing: border-box; }
.ua-search-input {
  flex: 1 1 140px; min-width: 0; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line);
  font-size: .82rem; box-sizing: border-box;
}
.ua-toolbar button {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); font-size: .76rem; cursor: pointer; white-space: nowrap;
}
.ua-score-toggle-btn { border-color: #9c6b1f; color: #5c3f10; background: #f3e6cf; font-weight: 600; }
.ua-content.ua-scores-visible .ua-score-toggle-btn { background: var(--ink); color: #fff; border-color: var(--ink); }

.ua-unit-list { display: flex; flex-direction: column; gap: 8px; }
.ua-unit { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ua-unit[hidden] { display: none; }
.ua-unit-summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.ua-unit-summary::-webkit-details-marker { display: none; }
.ua-disclosure { width: 16px; flex: 0 0 16px; color: var(--muted); transition: transform .15s ease; }
.ua-unit[open] .ua-disclosure { transform: rotate(90deg); }
.ua-unit-index { font-family: ui-monospace, monospace; font-size: .68rem; color: var(--muted); flex: 0 0 20px; }
.ua-unit-title-block { flex: 1; min-width: 0; }
.ua-unit-title { font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ua-unit-dates { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.ua-semester-tag { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-left: 6px; }
.ua-unit-badges { display: flex; gap: 5px; align-items: center; flex: 0 0 auto; }
.ua-score-pill { font-family: ui-monospace, monospace; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.ua-score-good { color: #2f7a4f; background: #e4f2e8; }
.ua-score-warn { color: #a9660f; background: #faedd8; }
.ua-score-bad { color: #b23b3b; background: #fbe6e6; }
.ua-flag-count { font-size: .68rem; color: #b23b3b; background: #fbe6e6; border-radius: 20px; padding: 2px 7px; font-weight: 600; }
.ua-assessment-count-pill { font-size: .7rem; color: var(--muted); white-space: nowrap; }

.ua-unit-body { padding: 0 12px 12px 46px; border-top: 1px solid var(--line); }
.ua-unit-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 4px; }
.ua-tag { font-size: .66rem; padding: 2px 7px; border-radius: 20px; font-weight: 600; }
.ua-tag-flag { color: #b23b3b; background: #fbe6e6; }
.ua-tag-warn { color: #a9660f; background: #faedd8; }

.ua-assessment { border-top: 1px solid var(--line); padding: 8px 0; }
.ua-assessment:first-child { border-top: none; }
.ua-assessment-row { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.ua-assessment-title { font-size: .8rem; font-weight: 500; flex: 1; min-width: 0; }
.ua-assessment-row[aria-expanded="true"] .ua-assessment-title { color: #5c3f10; }
.ua-category-pill { font-size: .62rem; color: var(--muted); background: var(--line); padding: 2px 7px; border-radius: 20px; white-space: nowrap; flex: 0 0 auto; }
.ua-resource-pill { font-size: .62rem; color: var(--muted); background: var(--line); padding: 2px 7px; border-radius: 20px; white-space: nowrap; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; }
.ua-resource-pill-icon { font-size: .72rem; line-height: 1; }
.ua-well-described-pill { font-size: .62rem; font-weight: 600; color: #2f7a4f; background: #e4f2e8; padding: 2px 7px; border-radius: 20px; white-space: nowrap; flex: 0 0 auto; }
.ua-ai-grading-slot:empty { display: none; }
.ua-ai-grading-pill { font-size: .62rem; font-weight: 600; padding: 2px 7px; border-radius: 20px; white-space: nowrap; flex: 0 0 auto; }
.ua-ai-grading-ready { color: #2f7a4f; background: #e4f2e8; }
.ua-ai-grading-not-ready { color: #a8341f; background: #fbe6e2; }
.ua-ai-grading-irrelevant { color: var(--muted); background: var(--line); }
.ua-due-date { font-family: ui-monospace, monospace; font-size: .7rem; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }
.ua-assessment-desc { display: none; font-size: .78rem; color: var(--muted); margin-top: 5px; white-space: pre-line; max-width: 70ch; }
.ua-assessment.open .ua-assessment-desc { display: block; }
.ua-no-desc { font-style: italic; }

.ua-empty-state { text-align: center; color: var(--muted); padding: 24px 12px; font-size: .84rem; }

/* Units and Lessons (school year -> course -> unit -> lesson -> {resource, assessment} browser) */
.ul-root { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ul-year-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ul-year-tab {
  font-size: .78rem;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card, #fff);
  color: var(--muted);
  cursor: pointer;
}
.ul-year-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.ul-courses { display: flex; flex-direction: column; gap: 8px; }
.ul-course { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ul-course-toggle {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer; color: var(--ink);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px; font: inherit; font-weight: 400; min-height: 0;
}
.ul-course-caret { width: 16px; flex: 0 0 16px; color: var(--muted); transition: transform .15s ease; }
.ul-course.open .ul-course-caret { transform: rotate(90deg); }
.ul-course-name { font-weight: 600; font-size: .88rem; }
.ul-course-body { padding: 0 12px 12px; }
.ul-course.open .ul-course-body { border-top: 1px solid var(--line); padding-top: 12px; }

.ul-lessons-unavailable { color: var(--muted); font-style: italic; }

.ul-lesson-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ul-lesson { border: 1px dashed var(--line); border-radius: 6px; overflow: hidden; }
.ul-lesson-summary {
  list-style: none; cursor: pointer; padding: 8px 10px; display: flex; align-items: center; gap: 8px;
}
.ul-lesson-summary::-webkit-details-marker { display: none; }
.ul-lesson[open] .ua-disclosure { transform: rotate(90deg); }
.ul-lesson-index { font-family: ui-monospace, monospace; font-size: .66rem; color: var(--muted); flex: 0 0 16px; }
.ul-lesson-title { flex: 1; min-width: 0; font-size: .82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ul-lesson-badges { display: flex; gap: 5px; align-items: center; flex: 0 0 auto; }
.ul-lesson-body { padding: 0 10px 10px 34px; }

.ul-resource-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.ul-resource-chip {
  font-size: .72rem; color: var(--muted); background: var(--line); padding: 3px 9px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ul-lesson-assessment { border-top-color: var(--line); }
.ul-lesson-assessment:first-child { border-top: none; }

/* Score-hiding: blurred until the master eye toggle reveals them */
.ua-content:not(.ua-scores-visible) .ua-score-value,
.ua-content:not(.ua-scores-visible) .ua-stat-tile.ua-is-score .ua-num,
.ua-content:not(.ua-scores-visible) .ua-score-pill .ua-score-value {
  filter: blur(4px);
  user-select: none;
}

@media (max-width: 600px) {
  .ua-unit-body { padding-left: 16px; }
}

/* Login page: password / SMS code / email code tabs */
.form-success { color: #2f7a4f; font-weight: 700; }
.form-panel-heading { margin: 0 0 4px; font-size: 1.05rem; }
.login-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.login-tab {
  padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: .84rem; cursor: pointer;
}
.login-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.login-panel[hidden] { display: none; }
.otp-status { font-size: .82rem; color: var(--muted); }
.otp-status.form-error { color: var(--danger); }
.otp-code-row { display: flex; gap: 8px; align-items: flex-end; }
.otp-code-label { flex: 1; }
.otp-code-row button { flex: 0 0 auto; margin-bottom: 1px; white-space: nowrap; }

.ua-ai-grading-button {
  font-family: inherit;
  font-size: .62rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  flex: 0 0 auto;
  color: #1f5c37;
  background: linear-gradient(180deg, #eafff0 0%, #d3f2dd 100%);
  border: 1px solid #b7e6c4;
  box-shadow: 0 1px 0 #fff inset, 0 2px 0 #9fd6ae, 0 3px 4px rgba(31, 92, 55, 0.25);
  cursor: pointer;
  transform: translateY(0);
  transition: transform .08s ease, box-shadow .08s ease;
}
.ua-ai-grading-button:hover { box-shadow: 0 1px 0 #fff inset, 0 2px 0 #9fd6ae, 0 4px 6px rgba(31, 92, 55, 0.3); }
.ua-ai-grading-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #fff inset, 0 0 0 #9fd6ae, 0 1px 2px rgba(31, 92, 55, 0.25);
}

.ai-grading-dashboard-dialog {
  width: min(720px, 94vw);
  max-height: min(88vh, 900px);
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.ai-grading-dashboard-dialog::backdrop { background: rgba(15, 20, 30, 0.55); }
.ai-grading-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.ai-grading-dialog-head h3 { margin: 0; font-size: 1rem; }
.ai-grading-dialog-body {
  padding: 16px;
  overflow-y: auto;
  max-height: calc(min(88vh, 900px) - 54px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-grading-why-ready {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .85rem;
  line-height: 1.5;
}
.ai-grading-why-ready h4 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ai-grading-missing-list { margin: 8px 0 0; padding-left: 18px; font-size: .8rem; color: var(--muted); }

.ai-grading-section h4 { margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

.ai-grading-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}
.ai-grading-file-name { flex: 1; min-width: 0; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-grading-file-student { font-size: .72rem; color: var(--muted); flex: 0 0 auto; }
.ai-grading-file-grade-button {
  flex: 0 0 auto;
  font-size: .74rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}
.ai-grading-file-grade-button:disabled { opacity: .6; cursor: default; }

.ai-grading-review-card {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: .84rem;
}
.ai-grading-review-score { font-size: 1.1rem; font-weight: 700; }
.ai-grading-review-comments { margin: 6px 0 0; color: var(--ink); white-space: pre-line; }
.ai-grading-review-actions { display: flex; gap: 8px; margin-top: 10px; }
.ai-grading-confirm-button {
  font-size: .78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.ai-grading-discard-button {
  font-size: .78rem;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.ai-grading-pending-invitation { margin: 0; color: var(--muted); font-size: .92rem; }
.ai-grading-review-status { margin-top: 8px; font-size: .78rem; }
.ai-grading-review-status.ok { color: #1f5c37; }
.ai-grading-review-status.error { color: #a8341f; }

.ai-grading-roadmap { display: flex; flex-direction: column; gap: 6px; }
.ai-grading-roadmap-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: var(--muted);
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.ai-grading-roadmap-step-index {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-grading-roadmap-note { font-size: .74rem; color: var(--muted); font-style: italic; margin: 4px 0 0; }

.ai-grading-review-score-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.ai-grading-score-input {
  width: 70px;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
}
.ai-grading-max-score { font-size: .84rem; color: var(--muted); }
.ai-grading-comments-input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: .84rem;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  color: var(--ink);
  background: var(--bg);
}
.ai-grading-submission-text-details { margin-top: 10px; }
.ai-grading-submission-text-details summary {
  cursor: pointer;
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
}
/* Long policy paragraphs inside a <pre>.
   The markup asked for .pre-wrap before the class existed, so the notice
   previews were unstyled: a <pre> does not wrap, and these lines are
   paragraphs, so they ran off the side rather than reading as text. */
.pre-wrap {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-family: inherit;
  font-size: .82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}

.ai-grading-submission-text {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-family: inherit;
  font-size: .8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
}

.ua-ai-grading-loading {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  background: var(--line);
}
.ua-ai-grading-spinner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  border-top-color: transparent;
  animation: ua-ai-grading-spin .7s linear infinite;
}
@keyframes ua-ai-grading-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .ua-ai-grading-spinner { animation: none; }
}

.ai-grading-roadmap-step-active { border-style: solid; border-color: var(--accent); padding: 6px 10px; }
.ai-grading-roadmap-step-active .ai-grading-confirm-button { margin-left: 2px; }

.hw-grade-form { display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.hw-grade-score input { width: 72px; font-weight: 700; }
.hw-grade-form textarea { width: 100%; box-sizing: border-box; font-family: inherit; font-size: .84rem; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }

/* Persistent "still onboarding" trace on the main dashboard -- shown
   whenever is_actively_onboarding() is true, so a teacher (or an admin
   impersonating one) always has a visible way back to /onboarding/modules,
   not just the one-time post-login redirect. */
.onboarding-dashboard-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--accent-soft, #eef3ff);
  border: 1px solid var(--accent, #2764d8);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 20px;
}
.onboarding-dashboard-banner strong { display: block; font-size: 1rem; }
.onboarding-dashboard-banner p { margin: 4px 0 0; }

/* First-time-login onboarding wizard (app/routers/onboarding.py) */
.onboarding-wizard {
  max-width: 720px;
  margin: 32px auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(20px, 4vw, 40px);
}

.onboarding-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.onboarding-progress-dots { display: flex; gap: 8px; }

.onboarding-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.onboarding-dot.is-active { background: var(--accent); }
.onboarding-dot.is-done { background: var(--accent-soft); }

.onboarding-progress-label { color: var(--muted); font-size: .85rem; font-weight: 700; }

.onboarding-step { display: none; min-height: 220px; }
.onboarding-step.is-active { display: block; }

.onboarding-lede { max-width: 560px; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

.onboarding-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.onboarding-feature-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fbfdff;
}

.onboarding-feature-card strong { display: block; margin-bottom: 6px; }
.onboarding-feature-card p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.onboarding-actions-nav { display: flex; gap: 10px; }

/* Self-paced curriculum + Q&A (app/routers/onboarding.py: /onboarding/modules) */
.onboarding-curriculum, .onboarding-module-detail {
  max-width: 720px;
  margin: 32px auto;
}

.onboarding-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 18px 0 28px;
}

.onboarding-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

.onboarding-module-list { display: grid; gap: 10px; margin-bottom: 36px; }
.onboarding-section-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 22px 0 4px;
  font-weight: 700;
}
.onboarding-section-label:first-child { margin-top: 0; }

.onboarding-module-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}

.onboarding-module-card:hover { border-color: var(--accent); }

.onboarding-module-card.is-done {
  background: #f3fbf7;
  border-color: #a7e6c8;
}

.onboarding-module-check {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 800;
}

.onboarding-module-card.is-done .onboarding-module-check {
  background: #059669;
  color: #fff;
}

.onboarding-qa {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.onboarding-chat-history { display: grid; gap: 14px; margin: 18px 0; }

.onboarding-chat-entry {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fbfdff;
}

.onboarding-chat-question { font-weight: 800; margin: 0 0 6px; }
.onboarding-chat-answer { margin: 0; color: var(--muted); }

.onboarding-ask-form { display: flex; gap: 10px; margin-top: 14px; }
.onboarding-ask-form input { flex: 1; }

.onboarding-module-body { display: grid; gap: 14px; margin: 20px 0 32px; color: var(--ink); line-height: 1.6; }

/* Documents a module links (app/models.py OnboardingModuleDocument) --
   each embedded inline via iframe onto the existing single-document view
   routes, as a numbered step-by-step reading checklist. */
.onboarding-module-reading-list { margin: 0 0 32px; }
.onboarding-module-reading-list h2 { font-size: 1.05rem; margin: 0 0 8px; }
.onboarding-reading-list-note { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.onboarding-reading-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: onboarding-reading-step; }
.onboarding-reading-step {
  counter-increment: onboarding-reading-step;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.onboarding-reading-step h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.98rem;
}
.onboarding-reading-step h3::before {
  content: counter(onboarding-reading-step);
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 800;
  flex: none;
}

/* Required-reading accordion (non-SAIE-Pedagogy modules only) -- each
   linked document expands/collapses in place and carries its own
   dwell-timer countdown; see the reading-gate script in
   onboarding_module_detail.html for the expand/collapse/timer logic. */
.onboarding-doc-accordion { display: grid; gap: 12px; }
.onboarding-doc-subsection-heading {
  margin: 10px 0 -2px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.onboarding-doc-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.onboarding-doc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
}
.onboarding-doc-card-header h3 { margin: 0; font-size: 0.98rem; }
.onboarding-doc-card-controls { display: flex; align-items: center; gap: 12px; flex: none; }
.onboarding-doc-countdown {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.onboarding-doc-card-body[hidden] { display: none; }
.onboarding-doc-card-body { border-top: 1px solid var(--line); }
.onboarding-doc-frame { display: block; width: 100%; height: 70vh; min-height: 420px; border: 0; }

.onboarding-module-actions { border-top: 1px solid var(--line); padding-top: 20px; }

/* Timed-review + scroll-to-bottom gate, before a quiz-gated module's quiz
   unlocks (app/services/onboarding_curriculum.py compute_module_required_seconds). */
.onboarding-reading-gate { display: grid; gap: 10px; max-width: 420px; }
.onboarding-reading-gate-status { margin: 0; color: var(--muted); font-size: 0.9rem; }
.onboarding-reading-gate-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.onboarding-reading-gate-bar-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s linear; }

/* Module completion quiz (onboarding_module_quiz.html). */
.onboarding-quiz-result { margin: 0 0 24px; padding: 14px 18px; border-radius: 10px; }
.onboarding-quiz-result--pass { background: #ecfdf5; border: 1px solid #059669; }
.onboarding-quiz-result--fail { background: #fff7ed; border: 1px solid #ea9a3e; }
.onboarding-quiz-form { display: grid; gap: 24px; }
.onboarding-quiz-question { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0; }
.onboarding-quiz-question legend { font-weight: 700; padding: 0 4px; }
.onboarding-quiz-option { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; }
.onboarding-quiz-option input { flex: none; margin-top: 4px; }
.onboarding-quiz-option span { flex: 1 1 0%; min-width: 0; line-height: 1.5; }
.onboarding-module-done-label { color: #059669; font-weight: 800; margin: 0; }


/* Reconstructed .pptx viewer. One card per slide so a deck reads as a
   sequence of slides rather than one long column of text -- the slide
   boundary is information, and losing it was what made the first
   version unreadable. */
.pptx-deck { max-width: 900px; margin: 0 auto; padding: 4px 20px 28px; }
.pptx-note { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.pptx-slide {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px 16px 20px;
  margin: 0 0 16px;
  background: #fff;
}
.pptx-slide-no {
  position: absolute; top: 10px; right: 14px;
  font-size: .78rem; font-weight: 700; color: var(--muted);
  letter-spacing: .04em;
}
.pptx-slide-title {
  margin: 0 0 10px; font-size: 1.05rem; color: var(--accent, #102a55);
  padding-right: 28px;
}
.pptx-slide p { margin: 0 0 8px; }
.pptx-slide ul.pptx-body { margin: 0 0 8px; padding-left: 20px; }
.pptx-slide ul.pptx-body li { margin: 0 0 5px; }
.pptx-slide img.technical-document-page {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 8px; margin: 10px 0 4px;
}

/* Sign-in page: two audiences, comparable weight.
   The shared .public-hero/.login-layout rule puts the wide column first,
   which is right when one side is a hero and the other an afterthought.
   Here both sides are a way in -- staff on the left, families on the right
   -- so this page opts out and splits evenly. */
.login-staff { display: grid; gap: 20px; align-content: start; }

.login-family {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  align-self: start;
  display: grid;
  gap: 10px;
}
.login-family h2 { font-size: 1.12rem; margin: 0; }
.login-family-intro { margin: 0; color: var(--muted); font-size: .92rem; }
/* Second-level pads. The sign-in methods above are pills -- one choice of
   several ways to do the same thing. These are three different destinations,
   so they are pads rather than pills: same rounded vocabulary, squarer, and
   sized to hold a name and the audience it serves. */
.login-family-pads { display: grid; gap: 8px; margin-top: 4px; }
.login-family-pad {
  display: grid; gap: 1px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; text-decoration: none; color: inherit;
}
.login-family-pad:hover { border-color: var(--accent); background: var(--accent-soft, #f2f6ff); }
.login-family-pad:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-family-pad strong { font-size: .95rem; color: var(--accent); font-weight: 600; }
.login-family-pad span { color: var(--muted); font-size: .82rem; }
.pad-ext { font-size: .78em; color: var(--muted); }
.login-family-more { margin: 6px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: .9rem; }

@media (min-width: 880px) {
  .login-layout { grid-template-columns: 1fr 1fr; align-items: start; gap: 32px; max-width: 900px; }
}

/* Recommendation detail spacing. The page stacks several unrelated
   sections -- decision, letter, brag sheet, transcript -- and without
   space above each heading they read as one run-on block, which is
   exactly the page a teacher has to skim under time pressure. */
.rec-detail h3 { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.rec-detail h3:first-of-type { margin-top: 18px; }
.rec-detail h4 { margin-top: 16px; margin-bottom: 2px; }
.rec-detail form { margin-top: 10px; }
.rec-detail .empty { margin-top: 6px; }

/* Recommendation on letterhead. Screen and print share one rule set so
   what a teacher approves on screen is what comes out of the printer. */
.letterhead-actions { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: baseline;
  margin-bottom: 18px; font-size: .9rem; }
.letterhead {
  background: #fff; color: #14181d; max-width: 720px; margin: 0 auto;
  padding: 34px 46px 54px; border: 1px solid var(--line); border-radius: 4px;
  font-family: Georgia, "Times New Roman", serif; line-height: 1.6;
}
.letterhead-banner { display: block; width: 100%; height: auto; margin-bottom: 26px; }
.letterhead-date { text-align: right; margin: 0 0 22px; color: #444c56; font-size: .95rem; }
.letterhead-title { font-size: 1.28rem; margin: 0 0 2px; }
.letterhead-sub { margin: 0 0 24px; color: #444c56; }
.letterhead-body { margin: 0 0 14px; text-align: justify; hyphens: auto; }
.letterhead-sign { margin-top: 30px; }
.letterhead-sign p { margin: 0 0 2px; }
/* Blank space a teacher can sign in after printing. */
.letterhead-space { height: 56px; }

@media print {
  /* Name what to hide rather than hiding everything that is not the
     letter: the letter lives inside main.page-shell, so a blanket
     :not() rule printed a blank page. */
  .topbar, .site-footer, .letterhead-actions { display: none !important; }
  body { background: #fff; }
  .page-shell { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .letterhead { border: 0; border-radius: 0; max-width: none; margin: 0; padding: 0; }
  .letterhead-body { orphans: 3; widows: 3; }
  .letterhead-sign { page-break-inside: avoid; }
  @page { size: A4; margin: 16mm 18mm; }
}


/* Leave-bank granting form. These four classes were used by the template
   from the start but never defined, so every field stacked full width and
   -- because of `label { display: grid }` above -- the notify checkbox
   rendered on its own row above its own text. */
.stacked-form { display: grid; gap: 14px; }
.stacked-form .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.stacked-form .form-row > label { flex: 1 1 170px; min-width: 0; }
.stacked-form .wide-field { display: grid; gap: 6px; }
/* The box belongs beside its words, not above them. Overrides the global
   grid label; font-weight too, since this reads as a sentence. */
.stacked-form label.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  flex: 0 1 auto;
  padding-bottom: 8px;
}
.stacked-form label.checkbox-field input { flex: 0 0 auto; margin: 0; }
.sample-notice { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 10px 12px; }
.sample-notice > summary { cursor: pointer; font-weight: 700; }
.sample-notice .pre-wrap { max-height: 320px; overflow: auto; }

/* Feedback round tabs. A round is a closed week, not a filter -- once its
   deadline passes the numbers never change again -- so the strip reads as
   a set of documents to open rather than a control that reshapes one. */
.round-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 18px;
              border-bottom: 1px solid var(--border, #e2e2e6); }
.round-tab { display: inline-flex; align-items: center; gap: 7px;
             padding: 8px 16px; text-decoration: none; color: var(--muted, #55555c);
             border: 1px solid transparent; border-bottom: none;
             border-radius: 8px 8px 0 0; font-weight: 600; font-size: .93rem;
             position: relative; top: 1px; }
.round-tab:hover { background: #f4f4f6; color: inherit; }
.round-tab.current { background: #fff; color: inherit;
                     border-color: var(--border, #e2e2e6);
                     border-bottom: 1px solid #fff; }
.round-tab .latest { font-size: .68rem; font-weight: 600; text-transform: uppercase;
                     letter-spacing: .05em; padding: 2px 6px; border-radius: 3px;
                     background: #e7f3ed; color: #146b4f; }
.round-tab:focus-visible { outline: 2px solid #2c4c7c; outline-offset: 2px; }

/* Feedback completion: a course carrying unmarked assessments across
   consecutive empty rounds. Tinted row rather than red text, so the whole
   line reads as flagged at a glance in a dense table; the badge carries the
   detail because a colour alone tells nobody what is wrong or for how long. */
tr.fc-red > td { background: #fdf0ed; }
tr.fc-red > td:first-child { box-shadow: inset 3px 0 0 #9e3b28; }
tr.fc-orange > td { background: #fdf6ec; }
tr.fc-orange > td:first-child { box-shadow: inset 3px 0 0 #b26a1a; }
.fc-badge {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 3px;
  color: #fff; font-size: .72rem; font-weight: 600;
  white-space: nowrap; vertical-align: middle;
}
.fc-badge-red { background: #9e3b28; }
.fc-badge-orange { background: #b26a1a; }
/* Checked against the ManageBac gradebook rather than the weekly
   export. Deliberately quieter than the red/orange flags: this is
   provenance, not an alarm. */
.fc-badge-verified { background: #1f6f43; }
.fc-badge-checked { background: #5a6472; }
.fc-violation-inline { color: #9e3b28; }
.fc-orange-inline { color: #b26a1a; }

/* Code Alert: show the sender what they are about to send.
   Each level gets its own SHAPE as well as its own colour -- octagon,
   triangle, pause -- because a page whose only signal is red vs orange is
   unreadable to anyone colour-blind, and this is the one screen where
   picking the wrong level has a real cost in someone's classroom. */
.ca-preview {
  display: grid; grid-template-columns: 132px 1fr; gap: 20px;
  align-items: center; margin: 14px 0 4px; padding: 16px 18px;
  border: 1px solid var(--border, #e2e2e6); border-radius: 10px;
  background: #fafafb;
}
.ca-art { margin: 0; text-align: center; }
.ca-svg { width: 96px; height: 96px; display: block; margin: 0 auto; }
/* Only the group matching the chosen level is drawn. */
.ca-shape { display: none; }
.ca-preview[data-level="red"] .ca-shape-red,
.ca-preview[data-level="orange"] .ca-shape-orange,
.ca-preview[data-level="yellow"] .ca-shape-yellow { display: block; }
.ca-caption { margin-top: 8px; line-height: 1.35; }
.ca-caption .ca-name { display: block; font-size: 1rem; font-weight: 700; }
.ca-meaning { font-size: .82rem; color: #55555c; }
.ca-preview[data-level="red"] .ca-caption .ca-name { color: #c0392b; }
.ca-preview[data-level="orange"] .ca-caption .ca-name { color: #b26a1a; }
.ca-preview[data-level="yellow"] .ca-caption .ca-name { color: #8a6b12; }

.ca-card-label {
  margin: 0 0 6px; font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: #6b6b70;
}
.ca-card-body {
  display: flex; background: #fff; border: 1px solid #e2e2e6;
  border-radius: 8px; overflow: hidden;
}
.ca-card-bar { width: 6px; flex: 0 0 6px; background: #c0392b; }
.ca-preview[data-level="orange"] .ca-card-bar { background: #b26a1a; }
.ca-preview[data-level="yellow"] .ca-card-bar { background: #b8901a; }
.ca-card-inner { padding: 10px 14px; flex: 1; min-width: 0; }
.ca-card-title { margin: 0 0 8px; font-weight: 700; font-size: .95rem; }
.ca-card-line { margin: 0 0 4px; font-size: .88rem; display: flex; gap: 10px; }
.ca-k { flex: 0 0 62px; color: #6b6b70; }
.ca-v { min-width: 0; overflow-wrap: anywhere; }
.ca-v.ca-empty { color: #9a9aa1; font-style: italic; }
.ca-card-from { margin: 8px 0 0; font-size: .78rem; color: #6b6b70; }
@media (max-width: 560px) {
  .ca-preview { grid-template-columns: 1fr; }
}


/* Expandable evidence behind a feedback flag. Collapsed by default: the
   table is for scanning, the panel is for the one row someone stops on. */
.fc-detail-row > td { padding: 0 !important; background: #fbfbfc; }
.fc-detail { border-left: 3px solid #c9ced6; margin: 0; }
.fc-detail > summary { cursor: pointer; padding: 8px 14px; font-size: .92em;
  color: #4a5260; user-select: none; }
.fc-detail > summary:hover { color: #1a1d23; background: #f2f4f7; }
.fc-detail[open] > summary { border-bottom: 1px solid #e6e9ee; }
.fc-detail > *:not(summary) { padding: 0 14px; }
.fc-detail h5 { margin: 12px 0 4px; font-size: .85em; text-transform: uppercase;
  letter-spacing: .04em; color: #6b7280; }
.fc-detail p { margin: 0 0 8px; }
.fc-detail-note { background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 4px;
  padding: 10px 12px !important; margin: 10px 14px !important; }
.fc-detail-grid { display: flex; gap: 28px; flex-wrap: wrap; }
.fc-detail-table { border-collapse: collapse; font-size: .9em; margin-bottom: 10px;
  width: auto; }
.fc-detail-table th, .fc-detail-table td { border: 1px solid #e3e6ea; padding: 4px 9px;
  text-align: left; }
.fc-detail-table th { background: #f4f6f8; font-weight: 600; }


/* SAIE's per-student standard, shown beside the record-counting flags.
   Green is deliberate even on a row that is otherwise flagged: the two
   measure different things, and a course can fail one while meeting the
   other. */
.fc-badge-met { background: #1f6f43; }
.fc-badge-short { background: #8a3d3d; }

/* Technical Documents uploader (Dr. Chen only). Collapsed by default --
   the page's job is reading, so the form should be reachable without
   being the first thing anyone sees. */
.tech-doc-upload {
  margin: 14px 0 18px; padding: 12px 16px;
  border: 1px solid var(--border, #e2e2e6); border-radius: 10px;
  background: #fafafb;
}
.tech-doc-upload > summary {
  cursor: pointer; font-weight: 700; color: #102a55; list-style: revert;
}
.tech-doc-upload-form {
  display: flex; flex-wrap: wrap; gap: 12px 16px;
  align-items: flex-end; margin-top: 14px;
}
.tech-doc-upload-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tech-doc-upload-form label > span {
  font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: #6b6b70;
}
.tech-doc-upload-form input[type="text"] { min-width: 240px; }
.tech-doc-upload-form input[type="file"] { max-width: 320px; }
.tech-doc-upload-hint { flex: 1 0 100%; margin: 2px 0 0; font-size: .82rem; }
.tech-doc-upload-note {
  margin: 12px 0 0; padding: 8px 12px; border-radius: 6px; font-size: .88rem;
}
.tech-doc-upload-note.is-ok  { background: #e8f5ec; color: #1e6b36; }
.tech-doc-upload-note.is-bad { background: #fdeceb; color: #9c2a21; }

@media (max-width: 640px) {
  .tech-doc-upload-form { flex-direction: column; align-items: stretch; }
  .tech-doc-upload-form input[type="text"],
  .tech-doc-upload-form input[type="file"] { min-width: 0; max-width: none; width: 100%; }
}

/* Midterm paper status pills */
.mp-pill { padding:2px 10px; border-radius:999px; font-size:.75rem; font-weight:700; }
.mp-ok   { background:#e8f5ec; color:#1e6b36; }
.mp-bad  { background:#fdeceb; color:#9c2a21; }
.mp-wait { background:#fff4e5; color:#8a5a12; }
.mp-none { background:#eceef1; color:#5a6070; }
.mp-ai   { margin:10px 0; padding:10px 14px; background:#fafafb; border:1px solid var(--border,#e2e2e6); border-radius:8px; }
.mp-ai-grid { display:flex; flex-wrap:wrap; gap:18px; font-size:.86rem; }
.mp-ai-grid ul { margin:4px 0 0 18px; }

/* Midterm Papers drawer: tabs per term */
.mp-tabs { display:flex; gap:6px; flex-wrap:wrap; margin:12px 0 14px; border-bottom:1px solid var(--border,#e2e2e6); }
.mp-tab { appearance:none; background:none; border:none; border-bottom:2px solid transparent; padding:7px 12px; cursor:pointer; font-weight:600; color:#5e6670; font-size:.9rem; }
.mp-tab.is-active { color:#102a55; border-bottom-color:#102a55; }
.mp-tab-count { display:inline-block; margin-left:6px; background:#fff4e5; color:#8a5a12; border-radius:999px; padding:0 7px; font-size:.74rem; font-weight:700; }
.mp-pane.is-hidden { display:none; }
.mp-table { width:100%; font-size:.88rem; }

.mp-proposed { margin:8px 0 10px; padding:10px 14px; border-left:3px solid #102a55; background:#fff; border-radius:4px; font-size:.9rem; }

.mp-link-status { margin:4px 0 0; font-size:.82rem; line-height:1.4; }
.mp-link-status.is-checking { color:#6b6b70; }
.mp-link-status.is-ok { color:#1e6b36; }
.mp-link-status.is-bad { color:#9c2a21; font-weight:600; }

/* Midterm timeline strip */
.mp-timeline { list-style:none; display:flex; flex-wrap:wrap; gap:10px; margin:18px 0 6px; padding:0; }
.mp-step { flex:1 1 170px; min-width:0; padding:10px 12px; border:1px solid var(--border,#e2e2e6); border-left:3px solid #c9ccd2; border-radius:6px; background:#fff; }
.mp-step.is-ours { border-left-color:#17365d; }
.mp-step.is-next { border-left-color:#8a5a12; background:#fffaf2; box-shadow:0 1px 4px rgba(138,90,18,.12); }
.mp-step.is-past { opacity:.55; }
.mp-step-date { display:block; font-weight:700; font-size:.9rem; color:#17365d; font-variant-numeric:tabular-nums; }
.mp-step-label { display:block; font-size:.84rem; color:#3c4350; margin-top:2px; }
.mp-step-time { font-size:.78rem; color:#6b6b70; }
.mp-step-approx { display:inline-block; margin-top:4px; font-size:.7rem; font-weight:700; color:#8a5a12; background:#fff4e5; border-radius:999px; padding:0 7px; }
.mp-step-next { display:inline-block; margin-top:4px; margin-left:4px; font-size:.7rem; font-weight:700; color:#fff; background:#8a5a12; border-radius:999px; padding:0 7px; text-transform:uppercase; letter-spacing:.04em; }
@media (max-width:640px){ .mp-timeline{flex-direction:column;} }
