/* School register direction. Visual craft: unslop by Damir Sokolovsky
   (@heydamir), https://heydamir.design/unslop, CC BY 4.0. */
@font-face {
  font-family: "Hogwarts Sans";
  src: url("/static/fonts/golos-text-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Hogwarts Serif";
  src: url("/static/fonts/literata-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  --page: #f7f6f2;
  --surface: #fffefa;
  --raised: #efeee9;
  --ink: #292c29;
  --secondary: #62655e;
  --muted: #6d7067;
  --line: #e3e3dc;
  --accent: #7c303c;
  --accent-hover: #632630;
  --sidebar: #222522;
  --sidebar-text: #f1f1e9;
  --sidebar-muted: #aaaDA4;
  --positive: #3c6748;
  --negative: #9b3441;
  --sans: "Hogwarts Sans", "Segoe UI", Arial, sans-serif;
  --serif: "Hogwarts Serif", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.6; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, summary, select, input[type="checkbox"] { cursor: pointer; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 500; }
h1, h2 { text-wrap: balance; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
small { font-size: 12px; }
input, textarea, select { min-width: 0; color: var(--ink); background: var(--surface); border: 1px solid #cfcfc6; border-radius: 8px; padding: 8px 12px; }
input:hover, select:hover, textarea:hover { border-color: #a4a69a; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
textarea { resize: vertical; }
[hidden] { display: none !important; }
.icon { display: inline-block; width: 18px; height: 18px; flex: 0 0 18px; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 12px 20px; background: var(--surface); border: 1px solid var(--accent); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 248px; display: flex; flex-direction: column; background: var(--sidebar); color: var(--sidebar-text); padding: 32px 20px 20px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand:hover { color: var(--sidebar-text); }
.brand > span:last-child { font-family: var(--serif); font-size: 24px; line-height: 1.3; }
.brand small { display: block; margin-top: 4px; font-family: var(--sans); color: var(--sidebar-muted); font-size: 12px; line-height: 1.6; }
.school-seal { width: 36px; flex: 0 0 36px; color: #c4b799; }
.school-seal svg { display: block; width: 100%; }
.sidebar-divider { margin: 28px 8px 24px; border-top: 1px solid #3a3d37; }
.nav-caption { margin: 0 12px 12px; color: var(--sidebar-muted); font-size: 12px; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link { position: relative; display: flex; align-items: center; min-height: 40px; gap: 12px; padding: 8px 12px; border-radius: 8px; color: #c4c7bd; font-size: 14px; }
.nav-link .icon { color: #989e91; }
.nav-link:hover { background: #2e322d; color: white; }
.nav-link.active { background: #363a32; color: #fffefa; }
.nav-link.active::before { content: ""; position: absolute; left: -20px; top: 12px; bottom: 12px; width: 4px; background: #c4b799; }
.nav-link.active .icon { color: #dbd7c7; }
.sidebar a:focus-visible, .sidebar button:focus-visible { outline-color: #ded3ba; }
.sidebar-bottom { margin-top: auto; padding-top: 64px; }
.school-motto { padding: 0 12px 24px; font-family: var(--serif); font-size: 14px; line-height: 1.7; color: #9b9f93; }
.account { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 20px 4px 0; border-top: 1px solid #3a3d37; }
.account:hover { color: white; }
.account strong { font-weight: 500; font-size: 14px; }
.account small { display: block; font-size: 12px; color: var(--sidebar-muted); margin-top: 4px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: center 24%; background: #e4e2da; }
.account-avatar { width: 40px; height: 40px; border: 1px solid #5a5f53; flex-shrink: 0; }
.main-shell { margin-left: 248px; min-width: 0; }
.topbar { height: 64px; border-bottom: 1px solid var(--line); padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--surface); font-size: 12px; }
.topbar-start { display: flex; align-items: center; gap: 16px; }
.breadcrumb { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); }
.breadcrumb > span:last-child { color: var(--secondary); }
.school-term { color: var(--secondary); white-space: nowrap; font-size: 12px; }
.term-separator { padding: 0 8px; color: var(--muted); }
.menu-toggle { display: none; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; width: 40px; height: 40px; background: var(--surface); }
.page-content { max-width: 1600px; padding: 32px 32px 0; margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1 { font-family: var(--serif); font-size: 32px; line-height: 1.3; font-weight: 400; }
.page-heading p { color: var(--secondary); font-size: 14px; margin-top: 8px; }
.week-label { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; color: var(--secondary); padding: 8px 0; }
.week-label .icon { color: var(--muted); width: 18px; height: 18px; flex-basis: 18px; }
.castle-panel { position: relative; min-height: 284px; display: grid; grid-template-columns: 42% 58%; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #eeede5; margin-bottom: 28px; }
.castle-copy { padding: 32px; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.eyebrow { font-size: 12px; color: var(--secondary); }
.castle-copy .eyebrow { font-size: 12px; }
.castle-copy h2 { font-family: var(--serif); font-size: 36px; font-weight: 400; line-height: 1.25; margin: 12px 0; }
.castle-copy p { color: var(--secondary); font-size: 14px; line-height: 1.8; margin-bottom: 20px; }
.castle-image { height: 100%; min-height: 284px; width: 100%; object-fit: cover; object-position: center; }
.castle-caption { position: absolute; right: 16px; bottom: 12px; padding: 4px 8px; background: #222522db; color: #fffefa; font-size: 12px; border-radius: 4px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 1.5; text-align: center; }
.button.primary { background: var(--accent); color: #fffefa; }
.button.primary:hover { background: var(--accent-hover); color: #fffefa; }
.button.secondary { background: var(--surface); color: var(--ink); border-color: #cfcfc6; }
.button.secondary:hover { background: var(--raised); }
button:disabled { cursor: wait; opacity: .65; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.panel { min-width: 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-heading h2 { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.4; }
.text-link { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; }
.text-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 4px; }
.text-link .icon { width: 18px; height: 18px; flex-basis: 18px; }
.section-meta { color: var(--muted); font-size: 12px; margin-top: 4px; margin-bottom: 20px; }
.table-scroll { overflow-x: auto; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
caption { text-align: left; }
th { font-weight: 400; }
thead th { background: #f4f3ee; color: var(--secondary); font-size: 12px; padding: 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody td, tbody th { padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
tbody tr:hover { background: #faf9f5; }
td small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.subject-name { display: block; font-weight: 500; min-width: 112px; }
.lesson-time { width: 72px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lesson-time > span { font-size: 13px; }
.lesson-time small { margin-top: 0; }
.room { color: var(--secondary); min-width: 100px; }
.person-link { display: inline-flex; align-items: center; gap: 8px; color: var(--secondary); }
.person-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.panel-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.lessons-panel .schedule-table th:nth-child(3), .lessons-panel .schedule-table td:nth-child(3) { display: none; }
.lessons-panel .room { min-width: 80px; font-size: 12px; }
.homework-shortcuts > li { border-top: 1px solid var(--line); }
.homework-shortcuts > li:first-child { border-top: none; }
.homework-shortcut { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; font-size: 13px; }
.homework-shortcuts > li:first-child .homework-shortcut { padding-top: 0; }
.homework-shortcuts > li:last-child .homework-shortcut { padding-bottom: 0; }
.meta { color: var(--accent); font-size: 12px; }
.small { font-size: 12px; }
.muted { color: var(--secondary); }
.homework-shortcut > span:last-child { display: flex; align-items: center; justify-content: space-between; }
.homework-shortcut .icon { width: 18px; height: 18px; flex-basis: 18px; }
.notice { padding: 20px 0; border-top: 1px solid var(--line); }
.notice:first-child { padding-top: 0; border-top: none; }
.notice:last-child { padding-bottom: 0; }
.notice-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.notice-meta > span:first-child { color: var(--accent); }
.notice h3 { font-size: 14px; margin-bottom: 8px; }
.notice p { font-size: 14px; color: var(--secondary); line-height: 1.8; margin-bottom: 12px; }
.notice .person-link { font-size: 12px; }
.house-points { display: flex; flex-direction: column; gap: 20px; margin-top: 24px; }
.house-point > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; }
.house-point small { margin-left: 8px; color: var(--muted); font-size: 12px; }
.point-value { font-variant-numeric: tabular-nums; font-size: 16px; }
.current-house .point-value { color: var(--accent); }
.house-point meter { display: block; appearance: none; width: 100%; height: 4px; border: none; background: #eeeee7; margin-top: 8px; border-radius: 0; }
.house-point meter::-webkit-meter-bar { border: none; background: #eeeee7; border-radius: 0; }
.house-point meter::-webkit-meter-optimum-value { background: #b9bdb0; border-radius: 0; }
.house-point meter::-moz-meter-bar { background: #b9bdb0; }
.current-house meter::-webkit-meter-optimum-value { background: var(--accent); }
.current-house meter::-moz-meter-bar { background: var(--accent); }
.quiet-note { font-size: 12px; color: var(--muted); margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.page-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0 24px; font-size: 12px; color: var(--muted); }
.day-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
.day-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.day-tab small { color: var(--muted); font-size: 12px; }
.day-tab.active { border-color: var(--accent); box-shadow: inset 0 -2px var(--accent); color: var(--accent); }
.day-tab.active small { color: var(--accent); }
.register-note { display: flex; align-items: flex-start; gap: 12px; color: var(--secondary); font-size: 12px; margin-top: 24px; }
.register-note .icon { color: var(--muted); }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 0 0 20px; font-size: 12px; }
.filter-buttons { display: inline-flex; padding: 4px; gap: 4px; background: #edede6; border-radius: 8px; }
.filter-buttons button { border: none; border-radius: 4px; padding: 8px 12px; background: transparent; color: var(--secondary); font-size: 12px; }
.filter-buttons button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #2225220d; }
.homework-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.homework-item { scroll-margin-top: 24px; border: 1px solid var(--line); border-radius: 12px; padding: 24px; background: var(--surface); }
.homework-item:target { outline: 2px solid var(--accent); outline-offset: 4px; }
.homework-item-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.homework-item-top .eyebrow { color: var(--accent); }
.due-date { font-size: 12px; color: var(--secondary); white-space: nowrap; }
.homework-item h2 { font-family: var(--serif); font-size: 24px; font-weight: 400; margin-bottom: 12px; }
.homework-item > p:not(.status) { font-size: 14px; color: var(--secondary); line-height: 1.8; }
.homework-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.assignment-teacher { display: flex; flex-direction: column; gap: 8px; }
.assignment-teacher .person-link { font-size: 12px; }
.avatar-small { width: 28px; height: 28px; flex-shrink: 0; }
.completion-control { display: flex; align-items: center; gap: 8px; font-size: 12px; min-height: 40px; white-space: nowrap; }
.is-complete h2 { color: var(--secondary); }
.is-complete .completion-control { color: var(--positive); }
.empty-inline { color: var(--secondary); padding: 16px 0; font-size: 12px; }
.status { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status:not(:empty) { margin-top: 16px; padding: 12px 16px; border-left: 2px solid #b4b8a9; background: #f1f2ec; color: var(--secondary); }
.status[data-kind="error"] { color: var(--negative); background: #f7eeed; border-color: var(--negative); }
.status[data-kind="success"] { color: var(--positive); background: #eef2eb; border-color: var(--positive); }
.notice-fallback { color: var(--secondary); font-size: 12px; margin-top: 20px; padding: 16px; border: 1px solid var(--line); }
.grades-table { min-width: 760px; }
.grades-table tbody th { font-weight: 500; min-width: 160px; }
.grades-table td:nth-child(2) { min-width: 160px; font-size: 12px; }
.grades-table td:nth-child(3) { min-width: 148px; }
.grade-list { display: flex; align-items: center; gap: 8px; }
.grade { position: relative; display: inline-flex; justify-content: center; align-items: center; width: 32px; height: 36px; border: 1px solid var(--line); border-radius: 4px; font-family: var(--serif); font-size: 20px; color: var(--accent); background: #f8f7f2; cursor: help; }
.grade-tooltip { display: none; position: absolute; z-index: 10; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 200px; border-radius: 4px; padding: 12px; background: var(--sidebar); color: var(--sidebar-text); font-family: var(--sans); font-size: 12px; line-height: 1.7; }
.grade:hover .grade-tooltip, .grade:focus .grade-tooltip { display: block; }
.grade-summary { min-width: 180px; max-width: 300px; font-size: 12px; color: var(--secondary); }
.grade-legend { padding: 24px 0 32px; }
.grade-legend h2 { font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.grade-legend ul { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 16px; }
.grade-legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--secondary); }
.legend-mark { font-family: var(--serif); font-size: 16px; color: var(--accent); }
.archive-panel { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.archive-panel summary { padding: 20px 0; color: var(--secondary); }
.archive-panel summary > span { margin-left: 16px; }
.archive-body { padding: 4px 0 24px; max-width: 600px; }
.archive-body > p { margin-bottom: 20px; color: var(--secondary); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12px; color: var(--secondary); }
.field small { font-size: 12px; color: var(--muted); }
.directory-search { display: flex; align-items: flex-end; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 24px; }
.search-field { flex: 1; }
.search-input { position: relative; }
.search-input input { width: 100%; padding-left: 40px; height: 44px; }
.search-input .icon { position: absolute; top: 12px; left: 12px; color: var(--muted); }
.role-field { width: 200px; }
.role-field select { height: 44px; }
.directory-search .button { min-height: 44px; }
.reset-search { align-self: flex-end; min-height: 44px; }
.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.person-card { position: relative; display: flex; align-items: flex-start; gap: 16px; padding: 24px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.person-card:hover { background: #f3f2ec; color: var(--ink); border-color: #c8c9be; }
.directory-avatar { width: 56px; height: 64px; flex: 0 0 56px; border-radius: 8px; }
.person-card-copy { min-width: 0; }
.person-role { color: var(--accent); font-size: 12px; }
.person-card h2 { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.4; margin: 4px 0 8px; }
.person-card p { color: var(--secondary); font-size: 12px; line-height: 1.8; }
.nickname { display: block; font-size: 12px; color: var(--muted); margin-top: 12px; overflow-wrap: anywhere; }
.person-card-arrow { position: absolute; right: 12px; bottom: 12px; color: var(--muted); }
.person-card-arrow .icon { width: 18px; height: 18px; }
.empty-state { padding: 48px 24px; color: var(--secondary); text-align: center; }
.empty-state h2 { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--ink); margin-bottom: 12px; }
.empty-state p { max-width: 520px; margin: 0 auto 16px; }
.back-link { display: inline-flex; gap: 8px; color: var(--secondary); font-size: 12px; margin-bottom: 20px; }
.profile-panel { padding: 32px; }
.profile-identity { display: flex; align-items: center; gap: 32px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.profile-avatar { width: 128px; height: 152px; border-radius: 8px; flex-shrink: 0; }
.profile-identity .eyebrow { color: var(--accent); font-size: 12px; }
.profile-identity h2 { font-family: var(--serif); font-weight: 400; font-size: 32px; margin: 8px 0; }
.profile-identity p { color: var(--secondary); font-size: 12px; }
.profile-nickname { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.profile-nickname code { display: inline-block; font-family: var(--sans); font-size: 12px; background: var(--raised); padding: 4px 8px; border-radius: 4px; user-select: all; overflow-wrap: anywhere; }
.profile-details { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(200px, 1fr); gap: 32px; padding-top: 32px; }
.profile-details h3 { font-size: 13px; margin-bottom: 12px; }
.profile-about { max-width: 640px; color: var(--secondary); font-size: 14px; line-height: 1.9; white-space: pre-line; }
.profile-facts { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.profile-facts dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.profile-facts dd { margin: 0; color: var(--ink); font-size: 12px; }
.subject-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.subject-tags li { background: #f1f0e9; padding: 8px 12px; border-radius: 4px; font-size: 12px; color: var(--secondary); }
.notes-panel { max-width: 1040px; }
.notes-panel textarea { display: block; width: 100%; min-height: 320px; background: #fffefa; border-radius: 8px; padding: 20px; line-height: 2; font-size: 14px; }
.notes-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 20px; }
.error-panel { padding: 64px 32px; text-align: center; }
.error-panel .school-seal { display: block; width: 44px; margin: 0 auto 24px; color: var(--accent); }
.error-panel .eyebrow { display: block; margin-bottom: 12px; }
.error-panel h2 { font-family: var(--serif); font-size: 32px; font-weight: 400; }
.error-panel p { color: var(--secondary); max-width: 520px; margin: 16px auto 28px; }
@media (min-width: 1600px) {
  .castle-panel { min-height: 324px; }
  .castle-image { min-height: 324px; }
  .castle-copy { padding: 40px; }
  .castle-copy h2 { font-size: 40px; }
}
@media (max-width: 1200px) {
  .topbar { padding: 0 28px; }
  .page-content { padding: 28px 28px 0; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 20px; }
  .castle-copy { padding: 24px; }
  .castle-copy h2 { font-size: 32px; }
  .castle-copy .eyebrow { font-size: 12px; }
  .panel { padding: 20px; }
  .section-heading { gap: 12px; flex-wrap: wrap; }
  .section-heading h2 { font-size: 20px; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .homework-list { grid-template-columns: minmax(0, 1fr); }
  .day-tab { font-size: 13px; }
  .directory-search { gap: 12px; }
  .role-field { width: 168px; }
  .school-term { display: none; }
}
@media (max-width: 1000px) and (min-width: 901px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .castle-panel { grid-template-columns: 48% 52%; }
  .week-label { display: none; }
  .directory-search { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
}
@media (max-width: 900px) {
  .sidebar { position: relative; width: 100%; padding: 24px; }
  .brand { padding: 0; }
  .sidebar-divider { margin: 20px 0; }
  .nav-caption { margin-left: 0; }
  .main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar-bottom { display: none; }
  .main-shell { margin-left: 0; }
  .ui-ready .sidebar { position: fixed; inset: 0 auto 0 0; display: none; width: 280px; padding: 28px 20px 20px; }
  .ui-ready .sidebar .main-nav { display: flex; }
  .ui-ready .sidebar .sidebar-bottom { display: block; }
  .ui-ready body.nav-open .sidebar { display: flex; }
  .ui-ready .menu-toggle { display: inline-flex; }
  body.nav-open { overflow: hidden; }
  .sidebar-backdrop { position: fixed; z-index: 30; inset: 0; width: 100%; height: 100%; border: none; padding: 0; background: #171b1866; }
  .topbar { height: 64px; padding: 0 24px; }
  .page-content { padding: 28px 24px 0; }
  .castle-panel { grid-template-columns: 43% 57%; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); }
  .school-term { display: block; }
}
@media (max-width: 700px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .castle-panel { grid-template-columns: 1fr 1fr; }
  .castle-copy { padding: 24px; }
  .castle-copy h2 { font-size: 28px; }
  .castle-copy p { font-size: 14px; }
  .castle-copy .eyebrow { font-size: 12px; }
  .castle-copy .button { font-size: 14px; padding: 8px 12px; gap: 8px; }
  .castle-image { object-position: 57% center; }
  .week-label { display: none; }
  .school-term { display: none; }
  .page-heading { margin-bottom: 24px; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person-card { flex-direction: column; padding: 20px; }
  .directory-search { flex-wrap: wrap; padding: 20px; gap: 16px; }
  .search-field { flex-basis: 100%; }
  .role-field { flex: 1; }
  .day-tabs { overflow-x: auto; grid-template-columns: repeat(5, minmax(112px, 1fr)); padding-bottom: 8px; }
  .profile-details { grid-template-columns: minmax(0, 1fr); }
  .profile-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-panel { padding: 24px; }
  .profile-identity { gap: 24px; }
  .profile-identity h2 { font-size: 28px; }
  .profile-avatar { width: 96px; height: 120px; }
  .notes-footer { align-items: flex-start; }
  .page-footer { flex-direction: column; gap: 4px; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 16px; }
  .topbar-start { gap: 12px; }
  .breadcrumb { font-size: 12px; gap: 8px; }
  .page-content { padding: 24px 16px 0; }
  h1 { font-size: 28px; }
  .page-heading p { font-size: 14px; }
  .castle-panel { display: flex; flex-direction: column; }
  .castle-copy { padding: 24px; }
  .castle-copy h2 { font-size: 32px; }
  .castle-copy .eyebrow { font-size: 12px; }
  .castle-copy p { font-size: 14px; }
  .castle-image { min-height: 0; height: 196px; object-position: center; }
  .castle-caption { bottom: 12px; right: 12px; }
  .panel { padding: 20px 16px; }
  .section-heading h2 { font-size: 20px; }
  .homework-item { padding: 20px; }
  .homework-item-top { gap: 8px; }
  .homework-item-bottom { flex-wrap: wrap; }
  .assignment-teacher { flex: 1 0 100%; }
  .filter-buttons button { padding: 8px 12px; }
  .people-grid { grid-template-columns: minmax(0, 1fr); }
  .person-card { flex-direction: row; }
  .directory-search { padding: 16px; }
  .reset-search { flex-basis: 100%; min-height: 24px; }
  .profile-identity { align-items: flex-start; flex-direction: column; gap: 20px; }
  .profile-avatar { width: 112px; height: 136px; }
  .profile-facts { grid-template-columns: minmax(0, 1fr); }
  .notes-footer { flex-direction: column; gap: 16px; }
  .notes-footer .button { width: 100%; }
  .notes-panel textarea { min-height: 360px; padding: 16px; }
  .archive-panel summary > span { display: block; margin-left: 16px; margin-top: 4px; }
  .main-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .sidebar, .topbar, .page-footer, .menu-toggle, .sidebar-backdrop, .archive-panel { display: none !important; }
  .main-shell { margin: 0; }
  .page-content { max-width: none; padding: 0; }
  .panel { break-inside: avoid; }
  body { background: white; }
  .table-scroll { overflow: visible; }
}
.sidebar-close { display: none; }
@media (max-width: 900px) {
  .ui-ready .sidebar-close { display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; padding: 8px; background: transparent; color: var(--sidebar-text); border: none; border-radius: 8px; }
}
