:root {
  --ink: #122d37;
  --muted: #60737a;
  --paper: #f4f1e9;
  --white: #fffef9;
  --navy: #123b4a;
  --navy-deep: #0c2934;
  --teal: #0e8d83;
  --teal-soft: #d9ece7;
  --line: #ced8d7;
  --danger: #a53d35;
  --danger-soft: #f7e5e2;
  --success: #17685d;
  --shadow: 0 22px 60px rgba(12, 41, 52, 0.13);
  --radius: 8px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.wordmark {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--navy);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid currentColor;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.wordmark--light { color: #fff; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid var(--navy);
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  font-weight: 750;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.button:hover { transform: translateY(-1px); background: var(--teal); border-color: var(--teal); }
.button--light { background: #fff; border-color: #fff; color: var(--navy); }
.button--ghost { background: transparent; border-color: var(--line); color: var(--navy); }
.button--ghost:hover { color: #fff; }
.button--small { min-height: 38px; padding: 0 15px; font-size: 0.84rem; }

.notice {
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 13px 16px;
  border-left: 3px solid var(--success);
  background: var(--teal-soft);
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 650;
}
.notice--error { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

/* Landing */
.landing-shell {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1.05fr) minmax(430px, 0.95fr);
}
.landing-intro {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 100svh;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(52px, 8vw, 120px);
  background: var(--navy);
  color: #fff;
  isolation: isolate;
}
.landing-intro::before,
.landing-intro::after {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  content: "";
}
.landing-intro::before { width: 58vw; height: 58vw; right: -31vw; top: -24vw; }
.landing-intro::after { width: 30vw; height: 30vw; left: -17vw; bottom: -13vw; }
.brand-mark {
  display: grid;
  width: 86px;
  height: 86px;
  margin-bottom: clamp(46px, 8vh, 90px);
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  transform: rotate(45deg);
}
.brand-mark span { transform: rotate(-45deg); font-family: var(--serif); font-size: 1.25rem; }
.landing-intro .eyebrow { color: #71d0c2; }
.landing-intro h1 {
  max-width: 690px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.5rem, 7vw, 7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.94;
}
.lead { max-width: 610px; margin: 28px 0 36px; color: #d7e5e5; font-size: clamp(1rem, 1.6vw, 1.25rem); }
.class-picker {
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: center;
  padding: clamp(45px, 7vw, 110px);
  background: var(--white);
}
.section-heading h2, .section-heading h3 { margin: 0; font-family: var(--serif); font-weight: 500; letter-spacing: -0.025em; }
.section-heading h2 { font-size: clamp(2rem, 3vw, 3.4rem); }
.section-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.class-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(58px, 1fr));
  margin-top: 30px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.class-cell {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--navy);
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease;
}
.class-cell:hover,
.class-cell:focus-visible { background: var(--navy); color: var(--white); }
.class-cell--empty { background: rgba(226, 232, 230, 0.22); pointer-events: none; }
.class-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}
.class-pagination a {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--navy);
  text-decoration: none;
}
.class-pagination a:hover { border-color: var(--teal); color: var(--teal); }
.teacher-link { margin-top: 34px; align-self: flex-start; color: var(--muted); font-size: 0.86rem; text-decoration: none; }
.teacher-link:hover { color: var(--teal); }

.empty-state { padding: 28px; border: 1px dashed var(--line); background: rgba(255, 255, 255, 0.55); }
.empty-state h2, .empty-state h3 { margin: 0 0 6px; font-family: var(--serif); font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-state--wide { padding: clamp(34px, 6vw, 70px); text-align: center; }
.empty-state .button { margin-top: 20px; }

/* Authentication */
.auth-page { background: var(--paper); }
.auth-shell {
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 42px;
  padding: 30px 20px;
  background:
    linear-gradient(rgba(18, 59, 74, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 59, 74, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}
.auth-panel { width: min(100%, 500px); padding: clamp(34px, 6vw, 62px); background: var(--white); box-shadow: var(--shadow); }
.auth-panel h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.auth-panel > p:not(.eyebrow) { margin: 18px 0 27px; color: var(--muted); }
.auth-panel .notice { margin: 0 0 20px; }
.stack-form { display: grid; gap: 18px; }
.stack-form label, .grid-form label, .inline-editor label, .resource-form > label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 750;
}
.stack-form label small, .grid-form label small, .inline-editor label small, .resource-form label small { color: var(--muted); font-weight: 500; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 132px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 141, 131, 0.11); }
.back-link { display: inline-block; margin-top: 24px; color: var(--muted); font-size: 0.82rem; text-decoration: none; }

/* Student materials */
.student-page { background: var(--paper); }
.student-header {
  display: grid;
  min-height: 82px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px clamp(22px, 5vw, 72px);
  background: var(--navy-deep);
  color: #fff;
}
.student-header__class { display: flex; flex-direction: column; align-items: center; font-size: 0.88rem; }
.student-header__class span { color: #92b1b5; font-size: 0.72rem; }
.quiet-link { justify-self: end; color: var(--muted); font-size: 0.8rem; text-decoration: none; }
.quiet-link--light { color: #b6cacc; }
.student-main { width: 100%; max-width: 1088px; margin: 0 auto; padding: clamp(62px, 9vw, 120px) 19px; }
.student-title { max-width: 700px; margin-bottom: 62px; }
.student-title h1 { margin: 0; font-family: var(--serif); font-size: clamp(3rem, 7vw, 6.4rem); font-weight: 500; letter-spacing: -0.055em; line-height: 0.95; }
.student-title > p:last-child { margin: 20px 0 0; color: var(--muted); }
.lesson-list { border-top: 1px solid var(--ink); }
.lesson-block { padding: 34px 0 42px; border-bottom: 1px solid var(--line); }
.lesson-heading {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.lesson-index { padding-top: 6px; color: var(--teal); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.lesson-heading h2 { max-width: 820px; margin: 0; font-family: var(--serif); font-size: clamp(1.45rem, 2.6vw, 2.25rem); font-weight: 500; letter-spacing: -0.025em; line-height: 1.14; }
.lesson-heading p { margin: 8px 0 0; color: var(--muted); font-size: 0.74rem; }
.lesson-resources { margin: 24px 0 0 112px; padding-left: 26px; border-left: 1px solid #abc5c2; }
.lesson-resource {
  display: grid;
  min-height: 68px;
  grid-template-columns: 44px minmax(0, 1fr) 38px;
  gap: 15px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 170ms ease, transform 170ms ease;
}
.lesson-resource:hover { transform: translateX(4px); background: rgba(255, 255, 255, 0.7); }
.lesson-resource--link { background: rgba(217, 236, 231, 0.36); }
.lesson-resource--link .material-copy strong { color: var(--success); }
.lesson-resource--note { grid-template-columns: 44px minmax(0, 1fr); align-items: start; padding-top: 17px; padding-bottom: 18px; background: rgba(255, 254, 249, 0.76); }
.lesson-resource--note:hover { transform: none; }
.resource-mark { display: grid; width: 34px; min-height: 30px; place-items: center; border: 1px solid #abc5c2; color: var(--teal); font-size: 0.66rem; font-weight: 850; letter-spacing: 0.03em; }
.material-copy { display: flex; min-width: 0; flex-direction: column; }
.material-copy strong { overflow-wrap: anywhere; font-size: 0.95rem; line-height: 1.35; }
.material-copy small { margin-top: 4px; color: var(--muted); font-size: 0.72rem; }
.lesson-resource--note .material-copy p { max-width: 780px; margin: 8px 0 0; color: #3d555c; font-size: 0.88rem; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.download-icon { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 50%; transition: background 170ms ease, color 170ms ease; }
.lesson-resource:hover .download-icon { background: var(--teal); color: #fff; }
.js-ready .reveal { opacity: 0; transform: translateY(14px); transition: opacity 500ms ease, transform 500ms ease; }
.js-ready .reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Admin shell */
.admin-page { background: #eef1ed; }
.admin-layout { display: grid; min-height: 100svh; grid-template-columns: 258px minmax(0, 1fr); }
.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 258px;
  flex-direction: column;
  padding: 30px 22px;
  background: var(--navy-deep);
  color: #fff;
}
.admin-sidebar nav { display: grid; gap: 5px; margin-top: 64px; }
.admin-sidebar nav a { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 11px 10px; border-radius: 3px; color: #a9c0c3; font-size: 0.86rem; font-weight: 650; text-decoration: none; }
.admin-sidebar nav a span { color: #547983; font-size: 0.68rem; letter-spacing: 0.05em; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.is-active { background: rgba(255, 255, 255, 0.08); color: #fff; }
.admin-sidebar nav a.is-active span { color: #59c5b5; }
.sidebar-footer { display: flex; margin-top: auto; justify-content: space-between; }
.sidebar-footer a { color: #8ba9ad; font-size: 0.73rem; text-decoration: none; }
.admin-main { grid-column: 2; min-width: 0; }
.admin-topbar {
  display: grid;
  min-height: 86px;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 17px clamp(24px, 4vw, 62px);
  border-bottom: 1px solid #d9dedb;
  background: rgba(255, 255, 255, 0.7);
}
.admin-topbar .eyebrow { margin-bottom: 1px; font-size: 0.61rem; }
.admin-topbar strong { font-size: 0.88rem; }
.status-dot { color: var(--muted); font-size: 0.74rem; }
.status-dot i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #24a36e; box-shadow: 0 0 0 4px rgba(36, 163, 110, 0.13); }
.menu-toggle { display: none; border: 0; background: transparent; color: var(--navy); font-size: 1.4rem; }
.admin-main > .notice, .admin-heading, .admin-section, .class-tabs, .visibility-form, .admin-main > .empty-state {
  width: min(calc(100% - 48px), 1180px);
  margin-right: auto;
  margin-left: auto;
}
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: clamp(48px, 7vw, 88px) 0 36px; }
.admin-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.5rem, 5vw, 5rem); font-weight: 500; letter-spacing: -0.05em; line-height: 0.98; }
.admin-heading > div > p:last-child { max-width: 620px; margin: 17px 0 0; color: var(--muted); }
.metric { flex: none; padding-left: 24px; border-left: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
.metric strong { display: block; color: var(--navy); font-family: var(--serif); font-size: 2.4rem; font-weight: 500; }
.admin-section { margin-bottom: 38px; padding: clamp(25px, 4vw, 44px); background: var(--white); }
.admin-section--tinted { background: #e3ebe7; }
.admin-section .section-heading { margin-bottom: 25px; }
.admin-section .section-heading h2 { font-size: 2rem; }
.admin-list { border-top: 1px solid var(--ink); }
.admin-row { border-bottom: 1px solid var(--line); }
.admin-row summary {
  display: grid;
  min-height: 80px;
  grid-template-columns: 58px 1fr auto auto;
  gap: 18px;
  align-items: center;
  list-style: none;
  cursor: pointer;
}
.admin-row summary::-webkit-details-marker { display: none; }
.admin-row__copy { display: flex; min-width: 0; flex-direction: column; }
.admin-row__copy small { overflow: hidden; color: var(--muted); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.visibility-count { color: var(--muted); font-size: 0.75rem; }
.state { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; border: 0; border-radius: 99px; font-size: 0.68rem; font-weight: 800; }
.state--on { background: var(--teal-soft); color: var(--success); }
.state--off { background: #e8e8e3; color: #6d7472; }
.inline-editor { display: grid; grid-template-columns: 1.5fr 0.7fr 1.3fr; gap: 15px; padding: 7px 0 25px 76px; }
.check-label { display: flex !important; flex-direction: row; align-items: center; gap: 9px !important; }
.check-label input { width: 18px; min-height: 18px; accent-color: var(--teal); }
.form-actions { display: flex; grid-column: 1 / -1; gap: 10px; }
.grid-form { display: grid; grid-template-columns: 1.2fr 0.8fr 1fr 1fr auto; gap: 14px; align-items: end; }
.grid-form .button { white-space: nowrap; }

/* Visibility */
.class-tabs { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 24px; padding-bottom: 4px; }
.class-tabs a { flex: none; padding: 9px 15px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.55); font-size: 0.78rem; font-weight: 700; text-decoration: none; }
.class-tabs a.is-active { border-color: var(--navy); background: var(--navy); color: #fff; }
.visibility-form { min-width: 0; }
.bulk-bar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
  background: var(--navy-deep);
  color: #fff;
  box-shadow: 0 8px 24px rgba(12, 41, 52, 0.14);
}
.bulk-bar > div { display: flex; flex-direction: column; }
.bulk-bar > div span { color: #a9c0c3; font-size: 0.7rem; }
.bulk-bar label { display: flex; align-items: center; gap: 8px; color: #bcd0d2; font-size: 0.74rem; white-space: nowrap; }
.bulk-bar input { width: 68px; min-height: 38px; }
.bulk-bar .button--ghost { border-color: #597781; color: #fff; }
.visibility-group { margin: 28px 0 42px; padding: clamp(22px, 4vw, 38px); background: var(--white); }
.visibility-list { border-top: 1px solid var(--ink); }
.visibility-row {
  display: grid;
  min-height: 72px;
  grid-template-columns: 22px 50px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.visibility-row > input { width: 18px; min-height: 18px; accent-color: var(--teal); }
.visibility-row .lesson-number { font-size: 1.2rem; }
.state-label { padding: 4px 8px; border-radius: 99px; color: transparent; font-size: 0.65rem; font-weight: 800; }
.visibility-row:has(input:checked) { background: rgba(217, 236, 231, 0.24); }
.visibility-row:has(input:checked) .state-label { background: var(--teal-soft); color: var(--success); }
.sticky-save { position: sticky; z-index: 4; bottom: 16px; display: flex; align-items: center; justify-content: space-between; margin: 25px 0; padding: 14px 18px; border: 1px solid var(--line); background: rgba(255, 254, 249, 0.96); box-shadow: var(--shadow); }
.sticky-save span { color: var(--muted); font-size: 0.78rem; }

/* Teacher docs, links, settings */
.teacher-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.teacher-grade { padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.teacher-grade:nth-child(4n) { border-right: 0; }
.teacher-grade > strong { display: block; margin-bottom: 16px; font-family: var(--serif); font-size: 1.3rem; font-weight: 500; }
.teacher-grade a { display: grid; grid-template-columns: 42px 1fr 16px; gap: 8px; align-items: center; padding: 8px 0; color: var(--muted); font-size: 0.68rem; text-decoration: none; }
.teacher-grade a span { color: var(--teal); font-weight: 800; }
.teacher-grade a b { font-weight: 500; }
.teacher-grade a i { font-style: normal; }
.teacher-grade a:hover { color: var(--navy); }
.resource-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.55fr) auto; gap: 16px; align-items: end; }
.resource-form__wide { grid-column: span 2; }
.resource-form__full { grid-column: 1 / -1; }
.resource-form__submit { grid-column: 1 / -1; justify-self: start; }
.resource-class-picker { min-width: 0; margin: 2px 0 0; padding: 16px 0 0; border: 0; border-top: 1px solid rgba(18, 45, 55, 0.22); }
.resource-class-picker legend { padding: 0 10px 0 0; color: var(--ink); font-size: 0.76rem; font-weight: 800; }
.resource-class-picker > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.resource-class-picker label { display: flex; min-width: 0; align-items: center; gap: 9px; padding: 10px; border: 1px solid rgba(18, 45, 55, 0.13); background: rgba(255, 255, 255, 0.58); cursor: pointer; }
.resource-class-picker label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.resource-class-picker input { width: 18px; min-height: 18px; flex: none; accent-color: var(--teal); }
.resource-class-picker span { display: flex; min-width: 0; flex-direction: column; }
.resource-class-picker strong { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.resource-class-picker small { color: var(--muted); font-size: 0.65rem; font-weight: 500; }
.resource-class-picker.is-invalid { padding: 14px; border: 1px solid var(--danger); background: var(--danger-soft); }
.link-admin-list { border-top: 1px solid var(--ink); }
.link-admin-row { display: grid; min-height: 82px; grid-template-columns: 74px minmax(180px, 1fr) minmax(110px, 180px) 88px auto auto auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.link-admin-row > div { display: flex; min-width: 0; flex-direction: column; }
.link-admin-row > div a { overflow: hidden; color: var(--muted); font-size: 0.69rem; text-overflow: ellipsis; white-space: nowrap; }
.link-admin-row > div p { display: -webkit-box; overflow: hidden; margin: 4px 0 0; color: var(--muted); font-size: 0.72rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: pre-wrap; }
.link-admin-row > span { color: var(--muted); font-size: 0.75rem; }
.link-lesson { color: var(--teal); font-size: 0.76rem; }
.link-lesson--missing { color: var(--danger); }
.resource-type { display: inline-flex; width: fit-content; min-height: 26px; align-items: center; padding: 0 9px; border-radius: 99px; font-size: 0.64rem !important; font-weight: 800; }
.resource-type--link { background: var(--teal-soft); color: var(--success) !important; }
.resource-type--note { background: #eee7d9; color: #765d2b !important; }
.link-edit-form { padding: 24px; border-bottom: 1px solid var(--line); background: #edf3f0; }
.link-edit-form label { display: grid; gap: 7px; font-size: 0.75rem; font-weight: 750; }
.link-edit-form .form-actions { display: flex; grid-column: 1 / -1; align-items: end; }
.icon-button { width: 30px; height: 30px; border: 1px solid var(--line); background: transparent; color: var(--danger); font-size: 1.2rem; }
.settings-section { display: grid; grid-template-columns: minmax(280px, 440px) minmax(240px, 1fr); gap: clamp(30px, 7vw, 100px); }
.stack-form--narrow { max-width: 440px; }
.settings-note { padding-left: 25px; border-left: 1px solid var(--line); }
.settings-note p { color: var(--muted); }
.settings-note code { font-size: 0.8em; }

@media (max-width: 1020px) {
  .landing-shell { grid-template-columns: 1fr; }
  .landing-intro { min-height: 76svh; }
  .class-picker { min-height: auto; }
  .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-form__wide { grid-column: span 1; }
  .resource-class-picker > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-form .button { align-self: end; }
  .teacher-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .teacher-grade:nth-child(4n) { border-right: 1px solid var(--line); }
  .teacher-grade:nth-child(3n) { border-right: 0; }
  .bulk-bar { grid-template-columns: 1fr auto auto; }
  .bulk-bar > .button:last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .landing-intro { min-height: 68svh; padding: 50px 28px; }
  .brand-mark { width: 64px; height: 64px; margin-bottom: 55px; }
  .landing-intro h1 { font-size: clamp(3.2rem, 17vw, 5rem); }
  .class-picker { padding: 62px 28px; }
  .class-table {
    grid-template-rows: repeat(5, minmax(54px, 1fr));
    margin-top: 24px;
  }
  .class-cell { min-height: 54px; padding: 6px; font-size: 0.76rem; }
  .student-header { grid-template-columns: 1fr auto; }
  .student-header__class { display: none; }
  .student-main { width: 100%; margin: 0; padding: 60px 14px; }
  .student-title { margin-bottom: 50px; }
  .student-title h1 { font-size: clamp(2.8rem, 12vw, 4rem); overflow-wrap: anywhere; }
  .lesson-block { padding: 27px 0 34px; }
  .lesson-heading { grid-template-columns: 1fr; gap: 8px; }
  .lesson-index { padding-top: 0; }
  .lesson-heading h2 { font-size: 1.45rem; overflow-wrap: anywhere; }
  .lesson-resources { margin: 20px 0 0 12px; padding-left: 14px; }
  .lesson-resource { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding-right: 4px; }
  .lesson-resource .download-icon { display: none; }
  .material-copy { max-width: 100%; overflow: hidden; }
  .material-copy strong { word-break: break-word; }
  .admin-layout { display: block; }
  .admin-sidebar { width: min(82vw, 290px); transform: translateX(-105%); transition: transform 220ms ease; }
  .menu-open .admin-sidebar { transform: translateX(0); }
  .admin-main { min-height: 100svh; max-width: 100vw; overflow: hidden; }
  .admin-topbar { grid-template-columns: 38px 1fr auto; padding: 14px 18px; }
  .menu-toggle { display: block; }
  .admin-main > .notice, .admin-heading, .admin-section, .class-tabs, .visibility-form, .admin-main > .empty-state { width: auto; max-width: 1180px; margin-right: 14px; margin-left: 14px; }
  .admin-heading > div { min-width: 0; max-width: 100%; }
  .admin-heading > div > p { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
  .status-dot { display: none; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .metric { padding: 0; border: 0; }
  .admin-row summary { grid-template-columns: 43px 1fr auto; gap: 10px; }
  .admin-row summary .visibility-count { display: none; }
  .admin-row summary .state { grid-column: 3; }
  .inline-editor { grid-template-columns: 1fr; padding-left: 0; }
  .form-actions { flex-direction: column; }
  .grid-form, .resource-form { grid-template-columns: 1fr; }
  .resource-form__wide, .resource-form__full, .resource-form__submit { grid-column: 1; }
  .resource-class-picker > div { grid-template-columns: 1fr; }
  .bulk-bar { position: relative; grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .bulk-bar > div { grid-column: 1 / -1; }
  .bulk-bar label { justify-content: flex-start; }
  .bulk-bar .button { width: 100%; grid-column: 1 !important; }
  .visibility-group { padding: 18px 14px; }
  .visibility-row { grid-template-columns: 20px 30px minmax(0, 1fr); gap: 8px; }
  .visibility-row .state-label { display: none; }
  .visibility-row .material-copy strong { font-size: 0.82rem; }
  .sticky-save { bottom: 8px; gap: 10px; }
  .sticky-save span { display: none; }
  .sticky-save .button { width: 100%; }
  .teacher-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-grade:nth-child(3n) { border-right: 1px solid var(--line); }
  .teacher-grade:nth-child(2n) { border-right: 0; }
  .link-admin-row { grid-template-columns: 64px minmax(0, 1fr) auto; padding: 12px 0; }
  .link-admin-row > span { display: none; }
  .link-admin-row > .button { grid-column: 2; justify-self: start; }
  .link-admin-row > form:last-child { grid-column: 3; }
  .link-edit-form { grid-template-columns: 1fr; padding: 18px 12px; }
  .settings-section { grid-template-columns: 1fr; }
  .settings-note { padding: 22px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 460px) {
  .auth-panel { padding: 34px 24px; }
  .class-cell { padding: 4px; font-size: 0.7rem; }
  .teacher-grid { grid-template-columns: 1fr; }
  .teacher-grade { border-right: 0 !important; }
}

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