:root {
  --ink: #1d2527;
  --muted: #607073;
  --faint: #839093;
  --line: #d7e0dd;
  --paper: #f7f9f8;
  --paper-deep: #e9efed;
  --panel: #ffffff;
  --panel-soft: #f8faf9;
  --brand: #223536;
  --brand-soft: #eaf0ee;
  --shadow: 0 18px 48px rgba(26, 38, 39, 0.12);
  --shadow-soft: 0 8px 24px rgba(26, 38, 39, 0.08);
  --done: #2d8f67;
  --partial: #d79a24;
  --empty: #c95e52;
  --field: #2c8fb8;
  --light: #9b7bd1;
  --rest: #9da39d;
  --done-bg: #e8f4ee;
  --partial-bg: #fff1d2;
  --empty-bg: #f8e5e1;
  --field-bg: #e3f2f7;
  --light-bg: #efe8f8;
  --rest-bg: #eeeeea;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef4f1;
  background-size: auto;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
.open-planner {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f9f8);
  color: var(--ink);
  padding: 9px 13px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease, transform 150ms ease;
}

button:hover,
.open-planner:hover {
  border-color: color-mix(in srgb, var(--child, var(--brand)) 42%, var(--line));
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--child, var(--brand)) 24%, transparent);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfcfb);
  color: var(--ink);
  padding: 9px 11px;
  box-shadow: inset 0 1px 2px rgba(26, 38, 39, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--child, var(--brand)) 22%, var(--line));
}

input:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--child, var(--brand)) 42%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child, var(--brand)) 12%, transparent);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  line-height: 1.05;
}

h3 {
  font-size: 1rem;
}

.today-row strong,
.progress-row strong,
.year-progress-meter strong,
.metric-grid strong,
.year-stats strong,
.calendar-day span,
.calendar-day small,
.day-dot {
  font-variant-numeric: tabular-nums;
}

.shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 32px clamp(14px, 3vw, 36px) 52px;
}

.teacher-notice {
  position: sticky;
  top: 10px;
  z-index: 800;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  margin: -8px 0 14px;
}

.teacher-notice span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  max-width: min(440px, calc(100vw - 32px));
  border: 1px solid color-mix(in srgb, var(--teacher, var(--brand)) 22%, var(--line));
  border-left: 5px solid var(--teacher, var(--brand));
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 900;
}

.top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid color-mix(in srgb, var(--teacher) 54%, #ffffff);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teacher) 88%, #172527), color-mix(in srgb, var(--teacher-accent) 58%, #ffffff));
  box-shadow: var(--shadow);
  color: white;
  padding: 20px;
  margin-bottom: 20px;
}

.top::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 46%);
}

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

.brand-lockup,
.student-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark,
.student-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-mark {
  background: rgba(255, 255, 255, 0.96);
  color: var(--teacher);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 26px rgba(26, 38, 39, 0.18);
}

.milestone-glyph {
  display: block;
  width: 31px;
  height: 31px;
  overflow: visible;
}

.milestone-glyph circle {
  fill: currentColor;
}

.milestone-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 4.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.milestone-peak,
.milestone-pole {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.milestone-peak {
  stroke-width: 3.4;
}

.milestone-pole {
  stroke-width: 3.2;
}

.milestone-flag {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.milestone-dot {
  fill: currentColor;
}

.student-avatar {
  background: color-mix(in srgb, var(--child) 13%, white);
  color: var(--child);
  border: 1px solid color-mix(in srgb, var(--child) 24%, var(--line));
}

.top p,
.child-head p,
.reports-head p,
.plan-head p,
.year-head p {
  color: var(--muted);
  font-weight: 850;
  margin-bottom: 4px;
}

.top h1 {
  color: white;
}

.top p,
.top-actions label {
  color: rgba(255, 255, 255, 0.84);
}

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

.top-actions label {
  min-width: 190px;
}

.top-actions select {
  min-height: 40px;
  padding-right: 34px;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(26, 38, 39, 0.12);
}

.dashboard-theme-menu {
  position: relative;
  z-index: 500;
}

.dashboard-theme-menu[open] {
  z-index: 1200;
}

.shared-sync-menu {
  position: relative;
  z-index: 120;
}

.shared-sync-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  color: white;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.shared-sync-menu summary::-webkit-details-marker {
  display: none;
}

.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--partial);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.34);
}

.shared-sync-menu.is-connected .sync-dot {
  background: var(--done);
}

.shared-sync-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 140;
  width: min(286px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 12px;
}

.shared-sync-panel p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  margin-bottom: 10px;
}

.sync-time {
  color: var(--done);
}

.sync-error {
  color: var(--empty);
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sync-actions button {
  width: 100%;
}

.dashboard-theme-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  color: white;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.dashboard-theme-menu summary::-webkit-details-marker {
  display: none;
}

.theme-current,
.dashboard-swatch span {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  background: var(--theme-current);
  box-shadow: 0 0 0 1px rgba(31, 39, 38, 0.12);
}

.dashboard-theme-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 1201;
  width: min(262px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 12px;
}

.dashboard-theme-panel p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  margin-bottom: 10px;
}

.dashboard-swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.dashboard-swatch {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 5px;
  text-align: center;
}

.dashboard-swatch span {
  width: 26px;
  height: 26px;
  background: var(--swatch);
  border-color: white;
}

.dashboard-swatch strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dashboard-swatch.is-active {
  border-color: color-mix(in srgb, var(--teacher) 48%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teacher) 12%, transparent);
}

.theme-reset {
  width: 100%;
  margin-top: 10px;
  color: var(--muted);
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(23, 34, 36, 0.46);
  backdrop-filter: blur(5px);
  padding: clamp(12px, 3vw, 34px);
}

.control-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 100%);
  height: min(760px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--child) 34%, white);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(23, 34, 36, 0.28);
}

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--child) 92%, #1d2527), color-mix(in srgb, var(--child) 70%, white));
  color: white;
  padding: 18px;
}

.control-head p {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 850;
  margin-bottom: 4px;
}

.control-head h2 {
  color: white;
}

.quiet-control {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  color: white;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: #ffffff;
  color: var(--child);
  padding: 7px 8px 7px 13px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(26, 38, 39, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.modal-close i {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--child);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.modal-close i::before,
.modal-close i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.modal-close i::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close i::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal-close:hover {
  border-color: #ffffff;
  background: color-mix(in srgb, var(--child) 7%, #ffffff);
}

.control-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.student-roster {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 14px;
  overflow: auto;
}

.roster-list {
  display: grid;
  gap: 8px;
}

.roster-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  width: 100%;
  text-align: left;
  background: white;
}

.roster-item span {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--child) 13%, white);
  color: var(--child);
  font-weight: 950;
}

.roster-item strong,
.roster-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-item small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.roster-item.is-active {
  border-color: color-mix(in srgb, var(--child) 42%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child) 12%, transparent);
}

.add-student {
  width: 100%;
  margin-top: auto;
}

.student-editor {
  display: grid;
  gap: 18px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.editor-card {
  display: grid;
  gap: 18px;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-title p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  margin-bottom: 4px;
}

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

.profile-grid label:first-child,
.profile-grid label:last-child {
  grid-column: 1 / -1;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--panel) 34%);
  padding-top: 14px;
}

.danger-button {
  color: #9e2f28;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.year-manager,
.year-grade-card,
.backup-panel {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.manager-head,
.backup-panel,
.backup-actions,
.year-pill-list {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.manager-head {
  justify-content: space-between;
}

.manager-head p,
.new-year-form p,
.backup-panel p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  margin-bottom: 4px;
}

.manager-head span {
  border: 1px solid color-mix(in srgb, var(--child) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--child) 10%, white);
  color: var(--child);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.year-pill-list {
  align-items: stretch;
}

.year-pill {
  min-height: 34px;
  padding: 7px 10px;
}

.year-pill.is-active {
  border-color: color-mix(in srgb, var(--child) 48%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child) 12%, transparent);
}

.year-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.year-form > div,
.year-form .profile-actions,
.new-year-form button {
  grid-column: 1 / -1;
}

.year-form .profile-actions {
  position: static;
  background: transparent;
  padding-top: 0;
}

.year-grade-card .profile-actions {
  position: static;
  justify-content: flex-start;
  background: transparent;
  padding-top: 0;
}

.grade-year-list {
  display: grid;
  gap: 8px;
}

.grade-year-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
  padding: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.grade-year-row span {
  display: grid;
  gap: 2px;
}

.grade-year-row strong {
  color: var(--ink);
}

.grade-year-row small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.grade-year-row.is-disabled {
  opacity: 0.64;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.9rem;
}

.check-row input {
  width: auto;
}

.backup-panel {
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
  border-radius: 8px;
  padding-inline: 12px;
  padding-bottom: 12px;
}

.import-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f9f8);
  color: var(--ink);
  cursor: pointer;
  padding: 9px 13px;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.import-button:hover {
  border-color: color-mix(in srgb, var(--child, var(--brand)) 32%, var(--line));
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.dashboard-primary,
.dashboard-rail,
.overview {
  min-width: 0;
}

.overview {
  display: grid;
}

.child-card,
.reports-panel,
.plan-editor,
.year-panel {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--child) 16%, var(--line));
  border-top: 4px solid var(--child);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), #fbfcfb);
  box-shadow: var(--shadow-soft);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.child-card:hover,
.reports-panel:hover,
.plan-editor:hover,
.year-panel:hover {
  border-color: color-mix(in srgb, var(--child) 28%, var(--line));
  box-shadow: 0 14px 34px rgba(26, 38, 39, 0.11);
}

.child-card {
  min-height: 100%;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.child-head,
.reports-head,
.plan-head,
.year-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--child) 4%, var(--panel-soft)));
  padding: 12px;
}

.open-planner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--child);
  border-color: color-mix(in srgb, var(--child) 24%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--child) 8%, white), #ffffff);
  white-space: nowrap;
}

.action-icon {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--child) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--child) 8%, #ffffff);
  color: color-mix(in srgb, var(--child) 76%, var(--muted));
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.open-planner:hover .action-icon,
.report-actions button:hover .action-icon {
  border-color: color-mix(in srgb, var(--child) 42%, var(--line));
  background: color-mix(in srgb, var(--child) 14%, #ffffff);
  color: var(--child);
  transform: translateX(1px);
}

.today-row,
.plan-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  border-radius: 8px;
  padding: 14px;
  border: 1px solid rgba(32, 38, 40, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.today-row strong,
.plan-summary span {
  justify-self: end;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  padding: 5px 10px;
  color: var(--ink);
}

.today-row span,
.today-row small,
.metric-grid span,
.book-line span {
  color: var(--muted);
}

.today-row small {
  grid-column: 1 / -1;
  font-weight: 750;
}

.day-note {
  color: var(--muted);
  border-left: 3px solid color-mix(in srgb, var(--child) 35%, var(--line));
  padding-left: 10px;
}

.status-complete {
  background: linear-gradient(180deg, color-mix(in srgb, var(--done) 18%, white), var(--done-bg));
  border-color: color-mix(in srgb, var(--done) 34%, white);
}

.status-partial {
  background: linear-gradient(180deg, color-mix(in srgb, var(--partial) 20%, white), var(--partial-bg));
  border-color: color-mix(in srgb, var(--partial) 36%, white);
}

.status-empty {
  background: linear-gradient(180deg, color-mix(in srgb, var(--empty) 15%, white), var(--empty-bg));
  border-color: color-mix(in srgb, var(--empty) 28%, white);
}

.status-field-trip {
  background: linear-gradient(180deg, color-mix(in srgb, var(--field) 16%, white), var(--field-bg));
  border-color: color-mix(in srgb, var(--field) 30%, white);
}

.status-light,
.status-custom {
  background: linear-gradient(180deg, color-mix(in srgb, var(--light) 16%, white), var(--light-bg));
  border-color: color-mix(in srgb, var(--light) 30%, white);
}

.status-rest,
.status-weekend {
  background: linear-gradient(180deg, #f7f8f6, var(--rest-bg));
  border-color: color-mix(in srgb, var(--rest) 24%, white);
}

.progress-stack {
  display: grid;
  gap: 10px;
}

.progress-row {
  display: grid;
  gap: 6px;
}

.progress-row div:first-child,
.year-progress-meter > div:first-child,
.plan-summary > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.progress-row strong,
.year-progress-meter strong {
  color: var(--child);
}

.track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e4ece8, #f4f7f6);
  overflow: hidden;
  border: 1px solid #d8e2de;
  box-shadow: inset 0 1px 2px rgba(26, 38, 39, 0.08);
}

.track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--child) 92%, #1d2527), color-mix(in srgb, var(--child) 58%, white));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.track.is-empty span {
  display: none;
}

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

.metric-grid div,
.year-stats span {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
  padding: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.metric-grid div::before,
.year-stats span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: color-mix(in srgb, var(--child) 58%, white);
}

.metric-grid span,
.metric-grid strong {
  display: block;
}

.metric-grid span {
  font-size: 0.78rem;
  font-weight: 850;
}

.metric-grid strong {
  margin-top: 4px;
  color: var(--child);
  font-size: 1.45rem;
  line-height: 1;
}

.week-strip {
  display: flex;
  align-items: center;
  gap: 7px;
}

.day-dot {
  display: grid;
  place-items: center;
  width: 44px;
  height: 36px;
  border-radius: 8px;
  font-weight: 950;
  border: 1px solid rgba(32, 38, 40, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.book-line {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 4px;
}

.book-line strong {
  font-size: 1.05rem;
}

.teacher-reading-panel {
  display: grid;
  gap: 14px;
}

.reading-overview {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
}

.reading-current,
.reading-breakdown span,
.reading-card {
  border: 1px solid color-mix(in srgb, var(--child) 15%, var(--line));
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.reading-current {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.reading-current span,
.reading-card p {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.reading-current strong {
  color: var(--child);
  font-size: 1.25rem;
}

.reading-breakdown {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.reading-breakdown span {
  display: grid;
  gap: 3px;
  padding: 11px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.reading-breakdown strong {
  color: var(--child);
  font-size: 1.25rem;
  line-height: 1;
}

.teacher-book-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.teacher-book-columns > div {
  display: grid;
  align-content: start;
  gap: 9px;
}

.reading-card {
  display: grid;
  gap: 10px;
  border-left: 5px solid var(--child);
  padding: 12px;
}

.reading-card.status-finished {
  border-left-color: var(--done);
}

.reading-card.status-want-to-read {
  border-left-color: var(--partial);
}

.reading-card h3 {
  margin-bottom: 3px;
}

.reading-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reading-card-meta span {
  border: 1px solid color-mix(in srgb, var(--child) 14%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--child) 7%, #ffffff);
  color: var(--child);
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 850;
}

.reading-card-notes {
  display: grid;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--child) 5%, #ffffff);
  padding: 9px;
}

.reading-card-notes p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1.35;
  margin: 0;
}

.reading-card-notes strong {
  color: var(--ink);
  font-weight: 900;
}

.reports-panel {
  height: 100%;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
}

.reports-head {
  margin: 0;
}

.reports-head label {
  min-width: 180px;
}

.report-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.report-actions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  text-align: left;
  color: var(--child);
  background: linear-gradient(180deg, #ffffff, #f7faf9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.report-actions button span,
.open-planner span {
  min-width: 0;
}

.plan-editor,
.year-panel {
  margin-top: 20px;
  padding: 16px;
}

.plan-head,
.year-head {
  margin-bottom: 14px;
}

.plan-summary {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.plan-summary strong {
  color: var(--ink);
}

.plan-settings {
  display: grid;
  grid-template-columns: 180px auto 190px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.date-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.date-actions button {
  white-space: nowrap;
}

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

.routine-plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  display: grid;
  gap: 10px;
  background: var(--panel-soft);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.routine-plan:focus-within {
  border-color: color-mix(in srgb, var(--child) 44%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child) 10%, transparent);
}

.routine-plan.is-hidden {
  background: #efefeb;
  border-style: dashed;
}

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

.routine-plan-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.routine-plan-title > div {
  min-width: 0;
}

.routine-plan-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  margin-top: 4px;
}

.routine-code {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  margin-bottom: 7px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--child) 12%, white);
  color: var(--child);
  border: 1px solid color-mix(in srgb, var(--child) 20%, var(--line));
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.routine-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--child) 22%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--child) 11%, white);
  color: var(--child);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.routine-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hide-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  white-space: nowrap;
}

.hide-toggle input {
  width: auto;
}

.year-progress-meter {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.year-stats,
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.year-stats {
  margin-bottom: 13px;
}

.year-stats span {
  color: var(--muted);
}

.year-stats strong {
  color: var(--child);
}

.calendar-legend {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(32, 38, 40, 0.08);
}

.teacher-calendar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.teacher-month {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
  padding: 11px;
  box-shadow: var(--shadow-soft);
}

.teacher-month h3 {
  margin-bottom: 8px;
  color: var(--child);
  font-size: 0.95rem;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.weekday-row {
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
  margin-bottom: 4px;
  font-weight: 850;
}

.calendar-day,
.calendar-blank {
  aspect-ratio: 1;
  border-radius: 6px;
}

.calendar-day {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 0;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #f8faf9, #eef4f1);
  color: var(--ink);
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.calendar-day:hover {
  border-color: color-mix(in srgb, var(--child) 44%, var(--line));
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.calendar-day.is-selected {
  border: 2px solid var(--child);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child) 16%, transparent);
}

.calendar-day.is-today:not(.is-selected) {
  border-color: var(--child);
}

.calendar-day span {
  font-size: 0.72rem;
  font-weight: 900;
}

.calendar-day small {
  position: absolute;
  right: 2px;
  bottom: 1px;
  color: var(--muted);
  font-size: 0.55rem;
  line-height: 1;
}

.legend-dot.status-complete,
.calendar-day.status-complete,
.day-dot.status-complete {
  background: color-mix(in srgb, var(--done) 24%, white);
}

.legend-dot.status-partial,
.calendar-day.status-partial,
.day-dot.status-partial {
  background: color-mix(in srgb, var(--partial) 30%, white);
}

.legend-dot.status-empty,
.calendar-day.status-empty,
.day-dot.status-empty {
  background: color-mix(in srgb, var(--empty) 18%, white);
}

.legend-dot.status-field-trip,
.calendar-day.status-field-trip,
.day-dot.status-field-trip {
  background: color-mix(in srgb, var(--field) 26%, white);
}

.legend-dot.status-light,
.calendar-day.status-light,
.calendar-day.status-custom,
.day-dot.status-light,
.day-dot.status-custom {
  background: color-mix(in srgb, var(--light) 24%, white);
}

.legend-dot.status-rest,
.calendar-day.status-rest,
.calendar-day.status-weekend,
.day-dot.status-rest,
.day-dot.status-weekend {
  background: #eeeeea;
}

/* Modern app polish layer */
body {
  background: #eef4f1;
  background-size: auto;
}

button,
.open-planner,
.import-button,
input,
select,
textarea {
  min-height: 42px;
}

button,
.open-planner,
.import-button {
  background: linear-gradient(180deg, #ffffff, #f3f7f5);
  border-color: color-mix(in srgb, var(--brand) 12%, var(--line));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.82) inset, 0 6px 16px rgba(26, 38, 39, 0.055);
}

button:hover,
.open-planner:hover,
.import-button:hover {
  box-shadow: 0 10px 24px rgba(26, 38, 39, 0.11);
}

input,
select,
textarea {
  background: linear-gradient(180deg, #ffffff, #f7faf8);
  border-color: color-mix(in srgb, var(--brand) 10%, var(--line));
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, color-mix(in srgb, currentColor 72%, transparent) 50%),
    linear-gradient(135deg, color-mix(in srgb, currentColor 72%, transparent) 50%, transparent 50%),
    linear-gradient(180deg, #ffffff, #f7faf8);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.shell {
  padding-top: 28px;
}

.top {
  align-items: stretch;
  gap: 24px;
  border-color: rgba(255, 255, 255, 0.48);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teacher) 84%, #102225), color-mix(in srgb, var(--teacher-accent) 46%, #f7fcfb)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
  box-shadow: 0 20px 58px rgba(26, 38, 39, 0.15);
  padding: clamp(18px, 2.6vw, 28px);
}

.brand-mark {
  width: 52px;
  height: 52px;
}

.top-actions {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  padding: 12px;
}

.top-actions label {
  gap: 7px;
}

.top-actions select,
.top-actions button,
.shared-sync-menu summary,
.dashboard-theme-menu summary {
  min-height: 44px;
}

.dashboard-grid {
  gap: 22px;
}

.child-card,
.reports-panel,
.plan-editor,
.year-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-color: color-mix(in srgb, var(--child) 14%, rgba(255, 255, 255, 0.86));
  box-shadow: 0 16px 42px rgba(26, 38, 39, 0.09);
}

.child-head,
.reports-head,
.plan-head,
.year-head,
.today-row,
.plan-summary,
.metric-grid div,
.year-stats span,
.teacher-month,
.year-form,
.grade-year-row {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #f8fbfa);
  border-color: color-mix(in srgb, var(--child) 10%, var(--line));
}

.student-avatar,
.roster-item span {
  background: linear-gradient(180deg, color-mix(in srgb, var(--child) 13%, white), #ffffff);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--child) 13%, transparent);
}

.reports-panel,
.year-panel,
.plan-editor {
  padding: 18px;
}

.report-actions button,
.open-planner {
  justify-content: space-between;
  font-weight: 850;
}

.control-modal {
  border-color: rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.98);
}

.student-roster {
  background: linear-gradient(180deg, #f8fbfa, #eef5f2);
}

.roster-item {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76) inset;
}

.roster-item.is-active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--child) 8%, white), #ffffff);
}

/* Final product polish pass */
::selection {
  background: #ffe066;
  color: #172527;
}

::-moz-selection {
  background: #ffe066;
  color: #172527;
}

button,
.open-planner,
.import-button,
input,
select,
textarea {
  letter-spacing: 0;
}

button:active,
.open-planner:active,
.import-button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(26, 38, 39, 0.09);
}

.top {
  overflow: visible;
  isolation: isolate;
  z-index: 100;
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(210px, 1.2fr) minmax(150px, 0.8fr) auto auto auto auto;
  align-items: end;
  justify-content: end;
  max-width: min(100%, 860px);
  overflow: visible;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 30px rgba(26, 38, 39, 0.08);
}

.top-actions label {
  min-width: 0;
}

.top-actions button,
.shared-sync-menu summary,
.dashboard-theme-menu summary {
  border-color: rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.94);
  color: var(--teacher);
  box-shadow: 0 8px 18px rgba(26, 38, 39, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.top-actions button:hover,
.shared-sync-menu summary:hover,
.dashboard-theme-menu summary:hover {
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(26, 38, 39, 0.14);
}

.top-actions select {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 18px rgba(26, 38, 39, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.theme-current {
  border-color: rgba(255, 255, 255, 0.96);
}

.dashboard-theme-menu {
  z-index: 120;
}

.shared-sync-panel,
.dashboard-theme-panel {
  z-index: 140;
}

.modal-backdrop {
  z-index: 300;
}

.child-card,
.reports-panel,
.plan-editor,
.year-panel {
  outline: 1px solid rgba(255, 255, 255, 0.54);
  outline-offset: -2px;
}

.open-planner,
.report-actions button {
  border-color: color-mix(in srgb, var(--child) 24%, rgba(255, 255, 255, 0.72));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), color-mix(in srgb, var(--child) 4%, #f6faf8));
}

.metric-grid div,
.year-stats span {
  border-left: 3px solid color-mix(in srgb, var(--child) 54%, var(--line));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.routine-plan {
  border-color: color-mix(in srgb, var(--child) 12%, var(--line));
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--child) 3%, #f7faf9));
  box-shadow: 0 8px 22px rgba(26, 38, 39, 0.055);
}

.routine-plan:hover {
  border-color: color-mix(in srgb, var(--child) 28%, var(--line));
  box-shadow: 0 12px 26px rgba(26, 38, 39, 0.08);
}

@media (max-width: 1050px) {
  .dashboard-grid,
  .teacher-calendar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .shell {
    padding-top: 18px;
  }

  .top,
  .child-head,
  .year-head,
  .plan-head,
  .reports-head {
    align-items: start;
    flex-direction: column;
  }

  .brand-lockup,
  .student-lockup {
    align-items: start;
  }

  .reading-overview,
  .reading-breakdown,
  .teacher-book-columns {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .top-actions label,
  .top-actions button,
  .shared-sync-menu,
  .shared-sync-menu summary,
  .dashboard-theme-menu,
  .dashboard-theme-menu summary {
    width: 100%;
  }

  .shared-sync-panel,
  .dashboard-theme-panel {
    left: 0;
    right: auto;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 10px;
  }

  .control-modal {
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }

  .control-body,
  .profile-grid,
  .year-form,
  .grade-year-row {
    grid-template-columns: 1fr;
  }

  .control-body {
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .student-roster {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 220px;
  }

  .metric-grid,
  .plan-settings,
  .routine-plan-list {
    grid-template-columns: 1fr;
  }

  .routine-plan-head {
    flex-direction: column;
  }
}

@media (min-width: 1051px) and (max-width: 1240px) {
  .teacher-calendar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Solid color pass */
*,
*::before,
*::after {
  background-image: none !important;
}

html,
body {
  background: #eef4f1 !important;
  background-size: auto !important;
}

.shell {
  background: transparent !important;
}

button,
.open-planner,
.import-button,
input,
select,
textarea {
  background-color: #ffffff;
}

select {
  appearance: auto;
  padding-right: 11px;
}

.top {
  background: var(--teacher) !important;
}

.top::after {
  display: none;
}

.top-actions {
  background-color: #ffffff;
  border-color: color-mix(in srgb, var(--teacher) 18%, var(--line));
}

.top-actions label {
  color: color-mix(in srgb, var(--teacher) 74%, var(--ink));
}

.top-actions button,
.shared-sync-menu summary,
.dashboard-theme-menu summary {
  background-color: #ffffff;
}

.child-card,
.reports-panel,
.plan-editor,
.year-panel,
.control-modal,
.editor-card,
.year-grade-card,
.year-manager,
.backup-panel,
.shared-sync-panel,
.dashboard-theme-panel {
  background-color: #ffffff;
}

.child-head,
.reports-head,
.plan-head,
.year-head,
.today-row,
.plan-summary,
.metric-grid div,
.year-stats span,
.teacher-month,
.year-form,
.grade-year-row,
.routine-plan-card {
  background-color: #ffffff;
}

.brand-mark,
.student-avatar,
.roster-item span,
.day-dot,
.theme-current,
.sync-dot {
  background-image: none !important;
}

.student-roster,
.roster-item,
.roster-item.is-active,
.day-progress,
.status-chip,
.summary-card,
.reading-card {
  background-color: #f8faf9;
}

.year-progress-meter,
.calendar-day,
.teacher-month {
  background-color: #ffffff;
}

.year-progress-fill {
  background-color: var(--child);
}

.calendar-day.status-complete,
.legend-dot.status-complete {
  background-color: var(--done-bg);
}

.calendar-day.status-partial,
.legend-dot.status-partial {
  background-color: var(--partial-bg);
}

.calendar-day.status-empty,
.legend-dot.status-empty {
  background-color: var(--empty-bg);
}

.calendar-day.status-field-trip,
.legend-dot.status-field-trip {
  background-color: var(--field-bg);
}

.calendar-day.status-light,
.calendar-day.status-custom,
.legend-dot.status-light {
  background-color: var(--light-bg);
}

.calendar-day.status-rest,
.calendar-day.status-weekend,
.legend-dot.status-rest {
  background-color: var(--rest-bg);
}

/* Dashboard layout cleanup */
.shell {
  max-width: 1280px;
}

.top {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: clamp(14px, 2vw, 22px);
  padding: clamp(18px, 2.2vw, 26px);
}

.brand-lockup {
  min-width: 0;
}

.brand-lockup > div {
  min-width: 0;
}

.top h1 {
  font-size: clamp(1.9rem, 3vw, 3rem);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: start;
  align-items: end;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
}

.top-actions label {
  flex: 1 1 180px;
  min-width: min(180px, 100%);
}

.top-actions label:first-child {
  flex: 2 1 260px;
}

.top-actions button,
.shared-sync-menu,
.dashboard-theme-menu {
  flex: 0 1 auto;
  min-width: 0;
}

.top-actions button,
.shared-sync-menu summary,
.dashboard-theme-menu summary {
  white-space: nowrap;
}

.top-actions select {
  min-width: 0;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.42fr) minmax(280px, 0.72fr);
  gap: 20px;
}

.child-card,
.reports-panel,
.plan-editor,
.year-panel {
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(26, 38, 39, 0.075);
}

.child-card:hover,
.reports-panel:hover,
.plan-editor:hover,
.year-panel:hover {
  transform: none;
  box-shadow: 0 12px 30px rgba(26, 38, 39, 0.09);
}

.child-head,
.reports-head,
.plan-head,
.year-head {
  background-color: #f8faf9;
  border-color: color-mix(in srgb, var(--child) 15%, var(--line));
}

.today-row,
.plan-summary {
  border-color: color-mix(in srgb, var(--child) 13%, var(--line));
  box-shadow: none;
}

.today-row strong,
.plan-summary span {
  background-color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(32, 38, 40, 0.055);
}

.track {
  height: 10px;
  background-color: #e7efeb;
  border-color: #d7e2de;
  box-shadow: none;
}

.track span,
.year-progress-fill {
  background-color: var(--child);
  box-shadow: none;
}

.metric-grid {
  gap: 10px;
}

.metric-grid div,
.year-stats span {
  background-color: #ffffff;
  border-color: color-mix(in srgb, var(--child) 13%, var(--line));
  box-shadow: none;
}

.metric-grid div::before,
.year-stats span::before {
  background-color: var(--child);
}

.week-strip {
  flex-wrap: wrap;
}

.day-dot {
  box-shadow: none;
}

.report-actions button,
.open-planner {
  background-color: #ffffff;
  box-shadow: none;
}

.report-actions button:hover,
.open-planner:hover {
  background-color: color-mix(in srgb, var(--child) 5%, #ffffff);
}

.plan-settings {
  grid-template-columns: minmax(150px, 0.7fr) minmax(260px, auto) minmax(160px, 0.75fr) minmax(240px, 1.4fr);
}

.date-actions {
  align-items: end;
}

.routine-plan {
  background-color: #ffffff;
  box-shadow: none;
}

.routine-plan.is-hidden {
  background-color: #f0f1ee;
}

.teacher-calendar {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.teacher-month {
  box-shadow: none;
  border-color: color-mix(in srgb, var(--child) 11%, var(--line));
}

.calendar-grid {
  gap: 5px;
}

.calendar-day {
  border-color: rgba(32, 38, 40, 0.06);
  box-shadow: none;
}

.calendar-day:hover {
  transform: none;
  box-shadow: 0 6px 16px rgba(26, 38, 39, 0.08);
}

.calendar-day.is-selected {
  border: 2px solid var(--child);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child) 13%, transparent);
}

.calendar-legend {
  gap: 8px 12px;
}

.legend-dot {
  box-shadow: inset 0 0 0 1px rgba(32, 38, 40, 0.05);
}

.shared-sync-panel,
.dashboard-theme-panel {
  right: 0;
  max-width: calc(100vw - 48px);
}

@media (max-width: 720px) {
  .top {
    padding: 16px;
  }

  .top-actions {
    align-items: stretch;
  }

  .top-actions label,
  .top-actions label:first-child,
  .top-actions button,
  .shared-sync-menu,
  .shared-sync-menu summary,
  .dashboard-theme-menu,
  .dashboard-theme-menu summary {
    flex: 1 1 100%;
    width: 100%;
  }

  .plan-settings {
    grid-template-columns: 1fr;
  }
}

/* Teacher control-center layout */
.shell {
  width: min(1440px, 100%);
  padding-top: 18px;
}

.top {
  position: sticky;
  top: 12px;
  z-index: 180;
  grid-template-columns: minmax(230px, 0.62fr) minmax(0, 1.38fr);
  align-items: center;
  padding: 14px;
  gap: 14px;
  box-shadow: 0 12px 34px rgba(26, 38, 39, 0.14);
}

.brand-mark {
  width: 42px;
  height: 42px;
}

.top h1 {
  font-size: clamp(1.45rem, 2vw, 2.2rem);
}

.top p {
  margin-bottom: 2px;
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) minmax(136px, 0.72fr) minmax(360px, 1.4fr) repeat(4, auto);
  align-items: end;
  gap: 8px;
  padding: 8px;
}

.top-actions label,
.top-actions label:first-child {
  flex: none;
  min-width: 0;
}

.top-date-controls {
  display: grid;
  grid-template-columns: minmax(148px, 0.84fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.top-date-controls .date-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px;
}

.top-date-controls button {
  min-height: 42px;
  padding-inline: 10px;
}

.teacher-workspace {
  display: grid;
  gap: 12px;
}

.dashboard-section {
  border: 1px solid color-mix(in srgb, var(--child) 15%, var(--line));
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(26, 38, 39, 0.075);
  overflow: clip;
}

.dashboard-section > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  background: #f8faf9;
  border-left: 4px solid var(--child);
}

.dashboard-section > summary::-webkit-details-marker {
  display: none;
}

.dashboard-section > summary strong,
.dashboard-section > summary small {
  display: block;
}

.dashboard-section > summary strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.dashboard-section > summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.dashboard-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.dashboard-summary-actions .open-planner {
  min-height: 36px;
  padding: 7px 11px;
  background: #ffffff;
  white-space: nowrap;
}

.dashboard-section > summary i {
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--child) 22%, var(--line));
  border-radius: 999px;
  background: #ffffff;
  position: relative;
}

.dashboard-section > summary i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--child);
  border-bottom: 2px solid var(--child);
  transform: translate(-50%, -62%) rotate(45deg);
  transition: transform 150ms ease;
}

.dashboard-section[open] > summary i::before {
  transform: translate(-50%, -36%) rotate(225deg);
}

.section-body {
  padding: 14px;
}

.dashboard-section .child-card,
.dashboard-section .reports-panel,
.dashboard-section .plan-editor,
.dashboard-section .year-panel {
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
}

.dashboard-section .child-card:hover,
.dashboard-section .reports-panel:hover,
.dashboard-section .plan-editor:hover,
.dashboard-section .year-panel:hover {
  box-shadow: none;
}

.dashboard-section .plan-head,
.dashboard-section .year-head,
.dashboard-section .reports-head,
.dashboard-section .child-head {
  margin-bottom: 12px;
}

.dashboard-section-plan > summary {
  background: color-mix(in srgb, var(--child) 7%, #ffffff);
}

@media (max-width: 640px) {
  .dashboard-section > summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dashboard-summary-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .dashboard-summary-actions .open-planner {
    width: 100%;
    justify-content: center;
  }
}

.plan-settings {
  grid-template-columns: minmax(170px, 0.34fr) minmax(260px, 1fr);
  align-items: start;
}

.routine-plan-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dashboard-section-snapshot .child-card {
  grid-template-columns: minmax(240px, 0.9fr) minmax(260px, 1fr) minmax(260px, 1fr);
  align-items: stretch;
}

.dashboard-section-snapshot .child-head,
.dashboard-section-snapshot .book-line {
  grid-column: 1 / -1;
}

.report-generator {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  align-items: end;
  gap: 10px;
}

.report-generator button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--child);
  min-height: 42px;
}

.report-generator .action-icon {
  width: 22px;
  height: 22px;
}

@media (max-width: 1180px) {
  .top {
    position: relative;
    top: auto;
    grid-template-columns: 1fr;
  }

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

  .top-date-controls {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .top-actions,
  .top-date-controls,
  .report-generator,
  .dashboard-section-snapshot .child-card {
    grid-template-columns: 1fr;
  }

  .top-date-controls .date-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Teacher top bar wrap fix */
.top {
  grid-template-columns: 1fr;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: start;
}

.top-actions > label {
  flex: 1 1 170px;
}

.top-actions > label:first-child {
  flex: 1.4 1 230px;
}

.top-date-controls {
  flex: 2 1 420px;
}

.top-actions > button,
.top-actions > details {
  flex: 0 0 auto;
}

@media (max-width: 920px) {
  .top-date-controls {
    grid-template-columns: 1fr;
  }

  .top-date-controls .date-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .top-actions > button,
  .top-actions > details,
  .top-actions > details summary {
    flex: 1 1 auto;
  }
}

/* Teacher banner utility refinement */
.top {
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
}

.top-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 20;
}

.top-main .brand-lockup {
  flex: 1 1 auto;
}

.top-utilities {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
}

.top-utilities .shared-sync-menu,
.top-utilities .dashboard-theme-menu {
  flex: 0 0 auto;
}

.top-utilities .shared-sync-menu summary,
.top-utilities .dashboard-theme-menu summary {
  min-height: 30px;
  gap: 6px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.34);
  background: color-mix(in srgb, var(--teacher) 78%, #ffffff);
  color: #ffffff;
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 900;
  box-shadow: none;
}

.top-utilities .shared-sync-menu summary:hover,
.top-utilities .dashboard-theme-menu summary:hover {
  background: color-mix(in srgb, var(--teacher) 68%, #ffffff);
  box-shadow: 0 6px 16px rgba(26, 38, 39, 0.12);
}

.top-utilities .sync-dot {
  width: 7px;
  height: 7px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.top-utilities .theme-current {
  width: 14px;
  height: 14px;
  border-width: 1px;
  border-color: rgba(255, 255, 255, 0.9);
}

.top-utilities .shared-sync-panel,
.top-utilities .dashboard-theme-panel {
  top: calc(100% + 8px);
}

.top-utilities .dashboard-theme-menu[open] {
  z-index: 2000;
}

.top-utilities .dashboard-theme-panel {
  z-index: 2001;
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(150px, 0.62fr) minmax(500px, 1.7fr) auto auto;
  align-items: end;
  justify-content: stretch;
  gap: 8px;
  width: 100%;
  padding: 8px;
  position: relative;
  z-index: 5;
}

.top-actions > label,
.top-actions > label:first-child,
.top-date-controls,
.top-actions > button {
  flex: initial;
}

.top-actions label {
  gap: 4px;
  font-size: 0.72rem;
}

.top-actions select,
.top-actions button,
.top-date-controls button {
  min-height: 36px;
  padding-block: 7px;
}

.top-date-controls {
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) minmax(270px, 1fr);
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.top-date-controls .date-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.top-date-controls button {
  min-width: 0;
  padding-inline: 8px;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-date-controls {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .top-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-utilities {
    align-self: stretch;
    justify-content: flex-start;
  }

  .top-actions,
  .top-date-controls {
    grid-template-columns: 1fr;
  }

  .top-date-controls .date-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Match top selectors to the date field */
.top-actions > label select,
.top-date-controls input[type="date"] {
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--teacher) 14%, var(--line));
  border-radius: 8px;
  background-color: #ffffff;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(26, 38, 39, 0.04);
}

.top-actions > label select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, color-mix(in srgb, var(--teacher) 78%, var(--ink)) 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--teacher) 78%, var(--ink)) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding: 8px 34px 8px 11px;
}

.top-actions > label select:hover,
.top-date-controls input[type="date"]:hover {
  border-color: color-mix(in srgb, var(--teacher) 28%, var(--line));
}

.top-actions > label select:focus,
.top-date-controls input[type="date"]:focus {
  border-color: color-mix(in srgb, var(--teacher) 42%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teacher) 12%, transparent);
}

/* Teacher selector clarity */
.top-actions {
  gap: 10px;
}

.top-actions label,
.top-date-controls label {
  display: grid;
  gap: 5px;
  color: color-mix(in srgb, var(--ink) 72%, var(--muted));
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions > label select,
.top-date-controls input[type="date"] {
  min-height: 48px;
  padding-block: 10px;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
}

.top-actions > .top-year-select {
  flex: 1.2 1 240px;
  min-width: min(260px, 100%);
}

.top-actions [data-select-year] {
  min-width: 0;
  width: 100%;
}

.top-actions [data-select-child] {
  border-color: color-mix(in srgb, var(--child) 42%, var(--line));
  background-color: #ffffff;
  background-image:
    linear-gradient(90deg, var(--child) 0 6px, transparent 6px),
    linear-gradient(45deg, transparent 50%, var(--child) 50%),
    linear-gradient(135deg, var(--child) 50%, transparent 50%);
  background-position:
    0 0,
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size:
    100% 100%,
    5px 5px,
    5px 5px;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 950;
  padding-left: 17px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--child) 8%, transparent);
}

.top-date-controls button,
.top-actions > button {
  min-height: 48px;
}

.top-action-divider {
  align-self: end;
  flex: 0 0 auto;
  width: 1px;
  height: 36px;
  margin: 0 2px 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--teacher) 24%, var(--line));
}

@media (max-width: 900px) {
  .top-date-controls {
    grid-template-columns: 1fr;
  }

  .top-action-divider {
    display: none;
  }
}

.plan-settings select[data-plan-day-type],
.plan-settings input[data-plan-day-note] {
  min-height: 44px;
  height: 44px;
  padding-block: 10px;
}

/* Alignment refinement pass */
.dashboard-section {
  scroll-margin-top: 178px;
}

.section-body {
  display: grid;
  gap: 14px;
}

.plan-settings label,
.report-generator label {
  min-width: 0;
}

.plan-settings {
  align-items: end;
}

.routine-plan {
  align-content: start;
}

.dashboard-section-snapshot .child-card {
  gap: 14px;
}

.dashboard-section-snapshot .progress-stack,
.metric-grid {
  align-self: stretch;
}

.metric-grid div {
  min-height: 82px;
  display: grid;
  align-content: center;
}

.report-generator button {
  min-height: 44px;
}

@media (max-width: 820px) {
  .top-utilities {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .top-utilities .shared-sync-menu,
  .top-utilities .dashboard-theme-menu,
  .top-utilities .shared-sync-menu summary,
  .top-utilities .dashboard-theme-menu summary {
    width: 100%;
    min-width: 0;
  }

  .top-utilities .shared-sync-panel,
  .top-utilities .dashboard-theme-panel {
    left: 0;
    right: auto;
    width: min(286px, calc(100vw - 48px));
  }
}

/* Control Center refinement */
.modal-backdrop {
  background: rgba(20, 30, 32, 0.52);
  padding: clamp(10px, 2.4vw, 28px);
}

.control-modal {
  width: min(1120px, calc(100vw - 24px));
  height: min(780px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  border: 1px solid color-mix(in srgb, var(--child) 20%, var(--line));
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 86px rgba(20, 30, 32, 0.26);
}

.control-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  background: var(--child);
  color: #ffffff;
  padding: 16px;
}

.control-title-block {
  min-width: 0;
}

.control-title-block p,
.control-title-block h2 {
  color: #ffffff;
}

.control-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, auto));
  gap: 8px;
}

.control-summary span {
  display: grid;
  gap: 2px;
  min-height: 48px;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  padding: 7px 10px;
}

.control-summary strong,
.control-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-summary strong {
  color: #ffffff;
  font-size: 0.96rem;
  line-height: 1;
}

.control-summary small {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.modal-close {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.72);
  background: #ffffff;
  color: var(--child);
  box-shadow: none;
}

.modal-close:hover {
  background: color-mix(in srgb, var(--child) 6%, #ffffff);
  box-shadow: none;
  transform: none;
}

.control-body {
  grid-template-columns: 300px minmax(0, 1fr);
  background: #f5f8f7;
}

.student-roster {
  gap: 14px;
  border-right: 1px solid color-mix(in srgb, var(--child) 11%, var(--line));
  background: #f7faf9;
  padding: 16px;
}

.roster-head p,
.editor-title p,
.form-label,
.control-section .manager-head p,
.control-section small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.roster-head h3 {
  color: var(--ink);
  font-size: 1.1rem;
}

.roster-list {
  gap: 10px;
}

.roster-item {
  min-height: 68px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  box-shadow: none;
}

.roster-item:hover {
  transform: none;
  box-shadow: 0 8px 18px rgba(26, 38, 39, 0.08);
}

.roster-item.is-active {
  border-color: color-mix(in srgb, var(--child) 34%, var(--line));
  border-left-color: var(--child);
  background: color-mix(in srgb, var(--child) 6%, #ffffff);
  box-shadow: none;
}

.roster-item span {
  width: 42px;
  height: 42px;
  background: color-mix(in srgb, var(--child) 12%, #ffffff);
  box-shadow: none;
}

.add-student {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

.add-student span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--child) 14%, #ffffff);
  color: var(--child);
  font-weight: 950;
}

.student-editor {
  gap: 16px;
  padding: 18px;
  scroll-padding-bottom: 18px;
}

.control-section {
  border: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(26, 38, 39, 0.07);
}

.editor-card,
.year-grade-card,
.year-manager,
.backup-panel {
  gap: 16px;
  border-top: 0;
  padding-top: 16px;
}

.editor-title {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.editor-title small {
  display: block;
  margin-top: 3px;
}

.profile-grid {
  gap: 13px;
}

.planner-page-field {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
}

.planner-page-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.planner-page-row .open-planner {
  min-height: 40px;
  white-space: nowrap;
}

.student-editor .profile-actions {
  position: static;
  justify-content: flex-start;
  background: transparent;
  padding-top: 0;
}

.student-editor .profile-actions .danger-button {
  margin-left: auto;
}

.year-form,
.grade-year-row {
  background: #f9fbfa;
  box-shadow: none;
}

.year-pill-list {
  gap: 8px;
}

.year-pill {
  background: #ffffff;
}

.backup-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: #ffffff;
  padding-bottom: 16px;
  padding-inline: 16px;
}

.backup-panel small {
  display: block;
  margin-top: 3px;
}

@media (max-width: 900px) {
  .control-modal {
    width: min(100%, calc(100vw - 20px));
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }

  .control-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .control-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-close {
    justify-self: start;
  }

  .control-body {
    grid-template-columns: 1fr;
  }

  .student-roster {
    max-height: 246px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .roster-list {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .add-student {
    margin-top: 0;
  }

  .student-editor {
    padding: 14px;
  }

  .backup-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 620px) {
  .control-summary,
  .profile-grid,
  .planner-page-row,
  .year-form,
  .grade-year-row {
    grid-template-columns: 1fr;
  }

  .control-summary span {
    min-height: 42px;
  }

  .student-editor .profile-actions .danger-button {
    margin-left: 0;
  }
}

/* Control Center usability pass */
.control-modal button,
.control-modal .open-planner,
.control-modal .import-button,
.control-modal input,
.control-modal select,
.control-modal textarea {
  background-image: none;
}

.control-modal button,
.control-modal .open-planner,
.control-modal .import-button {
  background-color: #ffffff;
}

.control-modal .primary-action {
  border-color: var(--child);
  background-color: var(--child);
  color: #ffffff;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--child) 18%, transparent);
}

.control-modal .primary-action:hover {
  border-color: color-mix(in srgb, var(--child) 82%, #000000);
  background-color: color-mix(in srgb, var(--child) 92%, #000000);
  color: #ffffff;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--child) 22%, transparent);
}

.control-modal .primary-action:disabled,
.control-modal .primary-action:disabled:hover {
  border-color: var(--line);
  background-color: #e7ecea;
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.control-modal .danger-button {
  border-color: #efc4bf;
  background-color: #fff7f6;
  color: #9e2f28;
}

.control-modal .danger-button:hover {
  border-color: #d79a92;
  background-color: #fff0ee;
}

.year-pill.is-active {
  border-color: var(--child);
  background-color: var(--child);
  color: #ffffff;
  box-shadow: none;
}

.year-pill.is-active:hover {
  border-color: color-mix(in srgb, var(--child) 82%, #000000);
  background-color: color-mix(in srgb, var(--child) 92%, #000000);
  color: #ffffff;
}

.control-disclosure {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

details.control-disclosure[open] {
  gap: 14px;
}

details.control-disclosure:not([open]) > :not(summary) {
  display: none !important;
}

.control-section-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  cursor: pointer;
  list-style: none;
  padding: 15px 16px;
}

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

.control-section-summary span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.control-section-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-section-summary small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.control-section-summary em {
  border: 1px solid color-mix(in srgb, var(--child) 28%, var(--line));
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--child) 10%, #ffffff);
  color: var(--child);
  padding: 5px 10px;
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 950;
}

.control-section-summary i {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

details.control-disclosure[open] > .control-section-summary i {
  transform: rotate(225deg);
}

.year-grade-form,
.control-disclosure > .year-pill-list,
.control-disclosure > .year-form,
.control-disclosure > .backup-note,
.control-disclosure > .backup-actions {
  margin-inline: 16px;
}

.year-grade-form,
.control-disclosure > .new-year-form,
.control-disclosure > .backup-actions {
  margin-bottom: 16px;
}

.year-grade-form {
  display: grid;
  gap: 12px;
}

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

.student-overview-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  border-radius: 8px;
  background-color: #f8faf9;
  padding: 10px;
}

.student-overview-row strong,
.student-overview-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-overview-row strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.student-overview-row small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.backup-note {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.backup-actions {
  align-items: center;
}

@media (max-width: 900px) {
  .control-section-summary {
    min-height: 58px;
  }
}

@media (max-width: 620px) {
  .student-overview-row,
  .control-section-summary {
    grid-template-columns: 1fr;
  }

  .control-section-summary em {
    justify-self: start;
  }

  .control-section-summary i {
    display: none;
  }

  .year-grade-form,
  .control-disclosure > .year-pill-list,
  .control-disclosure > .year-form,
  .control-disclosure > .backup-note,
  .control-disclosure > .backup-actions {
    margin-inline: 12px;
  }
}

/* Teacher daily-plan subject rows */
.routine-plan-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

.routine-plan {
  grid-template-columns: minmax(230px, 0.72fr) minmax(360px, 1.45fr);
  align-items: stretch;
  gap: 14px;
  border-left: 5px solid color-mix(in srgb, var(--child) 52%, var(--line));
  padding: 12px 14px;
}

.routine-plan-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.routine-plan-head > div {
  min-width: 0;
}

.routine-plan-head h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.routine-plan-note {
  max-width: 32ch;
}

.routine-plan > label:not(.hide-toggle) {
  min-width: 0;
}

.routine-plan textarea {
  min-height: 76px;
  resize: vertical;
}

.routine-plan.is-hidden {
  border-left-color: color-mix(in srgb, var(--muted) 44%, var(--line));
}

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

  .routine-plan-head {
    align-items: start;
  }
}

/* Clean outline buttons */
.top-date-controls button,
.date-actions button,
.top-actions > button,
.dashboard-summary-actions .open-planner,
.report-generator button {
  border: 1px solid color-mix(in srgb, var(--child, var(--teacher)) 32%, var(--line));
  background: #ffffff;
  color: color-mix(in srgb, var(--child, var(--teacher)) 76%, var(--ink));
  box-shadow: none;
  font-weight: 900;
  transform: none;
}

.top-date-controls button:hover,
.date-actions button:hover,
.top-actions > button:hover,
.dashboard-summary-actions .open-planner:hover,
.report-generator button:hover {
  border-color: color-mix(in srgb, var(--child, var(--teacher)) 58%, var(--line));
  background: color-mix(in srgb, var(--child, var(--teacher)) 7%, #ffffff);
  box-shadow: none;
  transform: none;
}

.top-date-controls button:active,
.date-actions button:active,
.top-actions > button:active,
.dashboard-summary-actions .open-planner:active,
.report-generator button:active {
  background: color-mix(in srgb, var(--child, var(--teacher)) 11%, #ffffff);
  box-shadow: none;
  transform: none;
}

/* Control Center rebuild */
.modal-backdrop {
  z-index: 1000;
  align-items: stretch;
  padding: clamp(10px, 2vw, 24px);
}

.control-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1160px, calc(100vw - 20px));
  height: min(780px, calc(100vh - 20px));
  max-height: calc(100vh - 20px);
  overflow: hidden;
  border-radius: 10px;
  background: #ffffff;
}

.control-head {
  display: grid;
  grid-template-areas:
    "title close"
    "summary summary";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  background: var(--child);
}

.control-title-block {
  grid-area: title;
}

.control-title-block p {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, 0.78);
}

.control-title-block h2 {
  color: #ffffff;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 1;
}

.control-summary {
  grid-area: summary;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.control-summary span {
  min-width: 0;
  min-height: 42px;
  border-radius: 8px;
  padding: 7px 10px;
}

.modal-close {
  grid-area: close;
  justify-self: end;
  position: relative;
  min-height: 40px;
  border-radius: 8px;
}

.control-body {
  display: grid;
  grid-template-columns: minmax(230px, 282px) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: #f4f7f6;
}

.student-roster {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  background: #f8faf9;
  padding: 14px;
}

.roster-list {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.add-student {
  margin-top: 0;
}

.student-editor {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  scroll-padding: 16px;
}

.control-section {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--child) 13%, var(--line));
  border-radius: 9px;
  background: #ffffff;
  padding: 0;
  box-shadow: none;
}

.editor-card.control-section {
  display: grid;
  gap: 14px;
  overflow: visible;
  padding: 16px;
}

section.control-disclosure {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  overflow: visible;
}

section.control-disclosure > .control-section-summary {
  display: flex !important;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.editor-title {
  padding-bottom: 12px;
}

.control-section-body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

section.control-disclosure > .control-section-body {
  display: grid;
}

section.control-disclosure > .control-section-body[hidden] {
  display: none !important;
}

section.control-disclosure.is-open {
  gap: 0;
  grid-template-rows: auto auto;
}

.control-section-summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  padding: 13px 16px;
}

.control-section-summary em {
  flex: none;
  justify-self: end;
}

.control-section-summary span {
  flex: 1 1 auto;
}

.control-section-summary i {
  flex: none;
}

.control-disclosure.is-open > .control-section-summary i {
  transform: rotate(225deg);
}

.year-manager-body {
  gap: 16px;
}

.year-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.year-form,
.grade-year-row {
  background: #f9fbfa;
  box-shadow: none;
}

.form-subhead {
  display: grid;
  gap: 3px;
  color: var(--ink);
}

.form-subhead small {
  color: var(--muted);
  font-weight: 800;
}

.backup-panel {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  padding: 0;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.subject-manager-body {
  gap: 16px;
}

.subject-editor-form,
.subject-add-form {
  display: grid;
  gap: 12px;
}

.subject-list {
  display: grid;
  gap: 9px;
}

.subject-row {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) minmax(150px, auto) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  border-radius: 8px;
  background: #f9fbfa;
  padding: 10px;
}

.subject-order-actions {
  display: grid;
  gap: 5px;
}

.subject-order-actions button {
  min-height: 30px;
  min-width: 58px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.subject-order-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.subject-title-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.subject-title-cell .routine-icon {
  margin: 0;
}

.calculated-year-days {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--child) 14%, var(--line));
  border-radius: 8px;
  background: #f8fbfa;
  padding: 10px 12px;
}

.calculated-year-days span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
}

.calculated-year-days strong {
  color: var(--ink);
  font-size: 1.04rem;
}

.calculated-year-days small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.subject-default-row {
  align-self: end;
  min-height: 40px;
  white-space: nowrap;
}

.subject-remove {
  align-self: end;
  min-height: 40px;
}

.subject-add-form {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, auto) auto;
  align-items: end;
  border: 1px dashed color-mix(in srgb, var(--child) 22%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--child) 4%, #ffffff);
  padding: 12px;
}

.subject-add-form .form-subhead {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .control-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }

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

  .student-roster {
    grid-template-rows: auto minmax(0, auto) auto;
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .roster-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-height: 118px;
  }
}

@media (max-width: 620px) {
  .control-head {
    grid-template-areas:
      "title close"
      "summary summary";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .control-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-close span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .modal-close {
    padding: 6px;
  }

  .control-summary span {
    padding-inline: 7px;
  }

  .control-summary strong {
    font-size: 0.86rem;
  }

  .control-section-summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .year-form,
  .grade-year-row,
  .planner-page-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .control-section-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) and (min-width: 431px) {
  .student-overview-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planner-page-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Control Center review polish */
.control-modal {
  width: min(1180px, calc(100vw - 20px));
  height: min(820px, calc(100vh - 20px));
}

.control-head {
  grid-template-areas: "title summary close";
  grid-template-columns: minmax(180px, 0.8fr) minmax(300px, 1fr) auto;
  gap: 12px;
  padding: 12px 14px;
}

.control-title-block p {
  margin-bottom: 2px;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.control-title-block h2 {
  font-size: clamp(1.42rem, 2vw, 1.9rem);
}

.control-summary {
  align-items: center;
}

.control-summary span {
  min-height: 36px;
  padding: 6px 9px;
}

.modal-close {
  min-height: 38px;
  padding: 6px 7px 6px 11px;
}

.modal-close i {
  width: 24px;
  height: 24px;
}

.student-roster {
  gap: 10px;
}

.roster-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.roster-item {
  min-height: 62px;
  grid-template-columns: 34px minmax(0, 1fr);
  padding: 9px;
}

.roster-item span {
  width: 34px;
  height: 34px;
}

.editor-card.control-section {
  gap: 12px;
  padding: 14px;
}

.editor-title {
  padding-bottom: 10px;
}

.student-overview-row span {
  padding: 8px 10px;
}

.profile-grid {
  grid-template-columns: minmax(150px, 0.65fr) minmax(280px, 1.35fr);
  gap: 10px;
}

.profile-grid label:first-child,
.profile-grid label:last-child,
.planner-page-field {
  grid-column: auto;
}

.planner-page-row {
  gap: 7px;
}

.student-editor .profile-actions {
  gap: 8px;
}

.control-section-summary {
  min-height: 56px;
  padding: 12px 14px;
}

.control-section-body {
  padding: 0 14px 14px;
}

@media (max-width: 900px) {
  .control-head {
    grid-template-areas:
      "title close"
      "summary summary";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .student-roster {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    max-height: 154px;
  }

  .roster-head {
    grid-column: 1;
    grid-row: 1;
  }

  .add-student {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    width: auto;
    min-height: 38px;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .roster-list {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    max-height: 68px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
  }

  .roster-item {
    flex: 0 0 min(178px, 48vw);
    width: auto;
  }
}

@media (max-width: 620px) {
  .control-head {
    gap: 8px;
    padding: 10px 12px;
  }

  .control-summary span {
    min-height: 32px;
    padding: 5px 7px;
  }

  .control-summary small {
    font-size: 0.62rem;
  }

  .student-roster {
    max-height: 146px;
    padding: 12px;
  }

  .student-editor {
    padding: 12px;
    scroll-padding: 12px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .subject-row,
  .subject-add-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .subject-default-row,
  .subject-remove {
    align-self: stretch;
  }

  .profile-grid label:first-child,
  .profile-grid label:last-child,
  .planner-page-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) and (min-width: 431px) {
  .profile-grid {
    grid-template-columns: minmax(130px, 0.62fr) minmax(0, 1.38fr);
  }

  .profile-grid label:first-child,
  .planner-page-field {
    grid-column: auto;
  }
}

/* Control Center settings navigation */
.settings-menu {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid color-mix(in srgb, var(--child) 12%, var(--line));
  background: #f8faf9;
  padding: 14px;
}

.settings-menu-head p,
.settings-section-head p,
.settings-panel-head p {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.settings-menu-head h3,
.settings-section-head h3,
.settings-panel-head h3 {
  color: var(--ink);
  font-size: 1.08rem;
}

.settings-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.settings-nav-item {
  display: grid;
  gap: 3px;
  min-height: 58px;
  justify-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  background: #ffffff;
  box-shadow: none;
  text-align: left;
}

.settings-nav-item strong,
.settings-nav-item small {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-nav-item small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.settings-nav-item.is-active {
  border-color: color-mix(in srgb, var(--child) 34%, var(--line));
  border-left-color: var(--child);
  background: color-mix(in srgb, var(--child) 6%, #ffffff);
  color: var(--ink);
}

.settings-content {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.settings-section {
  display: grid;
  gap: 14px;
}

.settings-section-head,
.settings-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.settings-section-actions .add-student {
  width: auto;
  margin-top: 0;
  min-height: 40px;
  padding-inline: 14px;
  white-space: nowrap;
}

.settings-year-select {
  min-width: 190px;
}

.settings-year-select select {
  min-height: 40px;
}

.settings-panel {
  display: grid;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--child) 13%, var(--line));
  border-radius: 9px;
  background: #ffffff;
  padding: 14px;
  box-shadow: none;
}

.settings-panel-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.settings-panel-head span {
  flex: none;
  border: 1px solid color-mix(in srgb, var(--child) 22%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--child) 8%, #ffffff);
  color: var(--child);
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 950;
}

.students-settings-grid {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.settings-student-list {
  position: sticky;
  top: 0;
  display: grid;
  gap: 10px;
  min-height: 0;
}

.settings-student-list .roster-list {
  max-height: min(520px, calc(100vh - 250px));
}

.student-settings-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.subject-manager-card,
.year-manager,
.backup-panel {
  padding: 14px;
}

.subject-manager-body,
.year-manager-body {
  display: grid;
}

@media (max-width: 900px) {
  .control-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-menu {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-nav {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .settings-nav-item {
    flex: 0 0 168px;
  }

  .students-settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-student-list {
    position: static;
  }

  .settings-student-list .roster-list {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .settings-student-list .roster-item {
    flex: 0 0 min(178px, 48vw);
  }
}

@media (max-width: 620px) {
  .settings-menu {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .settings-content {
    padding: 12px;
  }

  .settings-section-head,
  .settings-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .settings-year-select {
    flex: 1 1 100%;
    min-width: 0;
  }

  .settings-section-actions .add-student {
    width: 100%;
  }
}
