@font-face { font-family: "Golos"; src: url("../fonts/golos-text.8b5157f31f32.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Literata"; src: url("../fonts/literata.726c2a45674f.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  --surface: #fffdfa;
  --surround: #eee9f1;
  --field: #f6f2f7;
  --field-deep: #e9e2ed;
  --text: #34313b;
  --muted: #66606d;
  --primary: #59416f;
  --primary-hover: #443054;
  --primary-soft: #f0eaf5;
  --berry: #993e53;
  --berry-dark: #7c3043;
  --link: #285a8b;
  --gold: #b68b43;
  --line: #dcd4df;
  --control-border: #8d8195;
  --danger: #973a43;
  --danger-bg: #fff0f1;
  --success: #205c50;
  --success-hover: #17483e;
  --success-bg: #e8f4ed;
  --warning: #755018;
  --warning-bg: #fff5d9;
  --shadow: 0 12px 32px rgba(52, 49, 59, .09);
  --radius: 7px;
  --sidebar: 252px;
  --page-gutter: 24px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--field); font-family: "Golos", system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #163f69; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
h1, h2, h3 { font-family: "Literata", Georgia, serif; font-weight: 600; line-height: 1.3; letter-spacing: 0; margin-top: 0; text-wrap: pretty; }
h1 { font-size: 1.875rem; margin-bottom: 12px; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 16px; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1rem; max-width: 720px; line-height: 1.65; }
.eyebrow { display: block; color: var(--berry); font-size: .8125rem; font-weight: 550; letter-spacing: 0; margin-bottom: 10px; }
.back-link { display: inline-block; margin-bottom: 20px; }
.breakable { overflow-wrap: anywhere; }
.skip-link { position: fixed; top: -100px; left: 24px; z-index: 100; padding: 12px; background: #fff; }
.skip-link:focus { top: 12px; }

.app-body { min-height: 100vh; }
.sidebar { position: fixed; inset: 24px auto 24px 0; z-index: 20; width: var(--sidebar); padding: 10px 16px 0 26px; display: flex; flex-direction: column; }
.sidebar::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 5px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); pointer-events: none; }
.brand { padding: 0 8px 20px; flex-shrink: 0; }
.brand a { color: var(--primary); font: 600 1.375rem/1.3 "Literata", serif; text-decoration: none; }
.brand-kicker { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: .8125rem; font-weight: 500; margin-bottom: 14px; }
.brand-caption { display: block; font-size: .75rem; color: var(--muted); margin-top: 10px; }
.season-label { color: var(--muted); font-size: .8125rem; padding: 10px 8px; border-top: 1px solid var(--line); flex-shrink: 0; }
.main-nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; min-height: 90px; padding: 4px 8px 12px 4px; margin-left: -4px; scrollbar-width: thin; }
.main-nav a { position: relative; min-height: 44px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 9px 12px; color: var(--text); text-decoration: none; border-radius: 4px; font-size: .875rem; }
.main-nav a:hover { background: var(--primary-soft); }
.main-nav a.active { color: #fff; background: var(--berry); border-radius: 3px 0 0 3px; box-shadow: inset 0 3px 0 #ffffff12, inset 0 -3px 0 #672c3a18, 0 2px 4px #993e5315; }
.main-nav a.active::before { content: ""; position: absolute; inset: 4px 8px 4px 4px; border-block: 1px dashed #ffffff45; pointer-events: none; }
.main-nav a.active::after { content: ""; position: absolute; right: -7px; top: 0; width: 8px; height: 100%; background: var(--berry); clip-path: polygon(0 0, 100% 0, 40% 50%, 100% 100%, 0 100%); }
.nav-number { width: 20px; flex-shrink: 0; color: var(--muted); font: 400 .75rem "Literata", serif; }
.active .nav-number { color: #fff; }
.nav-divider { margin: 12px 12px 4px; color: var(--muted); font-size: .75rem; font-weight: 500; }
.nav-badge { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--berry); font-size: .75rem; }
.active .nav-badge { color: var(--berry); background: #fff; }
.nav-badge { margin-left: auto; }
.sidebar-footer { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--line); font-size: .8125rem; flex-shrink: 0; }
.sidebar-footer strong { font-weight: 600; }
.sidebar-footer .small { font-size: .75rem; }
.sidebar-footer form { margin: 0; }
.link-button { border: 0; padding: 6px 0; background: transparent; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-button.danger { color: var(--danger); font-size: .875rem; }
.app-main { position: relative; min-height: calc(100vh - 48px); min-width: 0; margin: 24px var(--page-gutter) 30px calc(var(--sidebar) + 14px); padding: 0 36px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px 8px 5px 5px; box-shadow: 0 3px 0 -1px #fff, 0 4px 0 0 var(--line), 0 7px 0 -1px #fff, 0 8px 0 0 var(--line), 0 12px 28px #34313b06; }
.app-main::before { content: ""; position: absolute; top: 12px; left: 12px; bottom: 12px; width: 3px; border-left: 1px solid #e4d5b9; border-right: 1px solid #eee5d4; pointer-events: none; }
.running-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 65px; margin-bottom: 28px; color: var(--muted); font-size: .75rem; border-bottom: 1px solid #d6c49e; }
.running-head strong { color: var(--primary); font-weight: 600; margin-left: 6px; }
.running-ornament { flex-shrink: 0; object-fit: contain; }
.running-dot { color: var(--berry); padding: 0 6px; }
.timezone { margin-left: 3px; }
.page-colophon { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 48px; padding-top: 16px; color: var(--muted); font-size: .6875rem; border-top: 1px solid var(--line); }
.page-colophon img { flex-shrink: 0; }
.mobile-header { display: none; }

.impersonation-banner { position: sticky; top: 0; z-index: 50; min-height: 54px; margin-left: var(--sidebar); padding: 8px clamp(24px, 4vw, 60px); display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #50370f; background: var(--warning-bg); border-bottom: 1px solid #ead9ae; }
.impersonation-banner + .mobile-header + .sidebar + .app-main { padding-top: 32px; }
.impersonation-banner form { margin: 0; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 0 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.page-header > div { min-width: 0; }
.page-header .lead { margin-bottom: 0; }
.page-header > .button { flex-shrink: 0; }
.page-header-art { position: relative; min-height: 166px; padding-right: 195px; }
.margin-vignette { position: absolute; right: 0; top: -10px; width: 184px; height: 152px; object-fit: contain; }
.panel { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.panel-feature { padding: 22px 24px; border-top: 3px solid var(--primary); }
.panel-feature h2 { font-size: 1.375rem; margin: 0 0 8px; }
.upcoming-lesson { display: grid; grid-template-columns: 70px 1fr; gap: 20px; align-items: center; margin: 16px 0 22px; }
.calendar-leaf { min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--primary); border: 1px solid var(--line); border-top: 3px solid var(--primary); border-radius: 3px; background: var(--field); }
.calendar-leaf strong { font: 500 2rem/1.3 "Literata", serif; }
.calendar-leaf span { font-size: .6875rem; }
.calendar-leaf span:first-child { color: var(--berry); }
.lesson-time { color: var(--muted); font-size: .8125rem; margin: 0; }
.feature-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.feature-actions .small { font-size: .75rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(225px, .85fr); gap: 20px; margin-bottom: 36px; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.metric-panel { display: flex; flex-direction: column; justify-content: center; background: var(--field); border-top: 3px solid var(--line); }
.metric-panel a { margin-top: 8px; font-size: .8125rem; }
.metric { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 18px; }
.metric strong { font: 500 2.75rem/1 "Literata", serif; color: var(--primary); }
.metric span { font-size: .8125rem; }
.metric span { color: var(--muted); }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading > a { font-size: .8125rem; white-space: nowrap; }
.content-grid .section-heading { padding-bottom: 14px; border-bottom: 1px solid #d6c49e; }
.content-grid h2 { font-size: 1.25rem; }
.dashboard-news { align-items: flex-start; padding: 2px 0 20px; }
.dashboard-news strong { font-family: "Literata", serif; font-size: 1.125rem; font-weight: 550; line-height: 1.5; margin: 9px 0; }
.news-excerpt { font-size: .875rem; color: var(--muted); line-height: 1.65; }
.material-row { display: flex; align-items: center; gap: 16px; padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.material-row:hover strong { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.material-info { min-width: 0; }
.material-info strong { font-size: .875rem; font-weight: 550; }
.material-info small { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; }
.material-arrow { color: var(--link); margin-left: auto; }
.book-cover { position: relative; display: grid; place-items: center; width: 48px; height: 62px; flex-shrink: 0; color: var(--primary); background: var(--primary-soft); border: 1px solid var(--control-border); border-left: 5px solid var(--primary); border-radius: 2px 4px 4px 2px; box-shadow: 2px 2px 0 #e4e5dd; font: 500 1.125rem/1.25 "Literata", serif; text-align: center; }
.book-cover::before { content: ""; position: absolute; inset: 4px; border: 1px solid #b68b4350; pointer-events: none; }
.book-cover small { display: block; font: 400 .625rem "Golos", sans-serif; }
.book-cover-blue { color: var(--link); background: #edf2f6; border-left-color: var(--link); }
.book-cover-berry { color: var(--berry); background: #fbf1f3; border-left-color: var(--berry); }
.news-row, .conversation-row, .notification-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; padding: 13px 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.news-row:hover, .conversation-row:hover, .notification-row:hover { color: var(--text); background: linear-gradient(90deg, transparent, var(--field), transparent); }
.news-row span:first-child, .conversation-row span { display: flex; flex-direction: column; }
.news-row small, .conversation-row small, .notification-row small { display: block; color: var(--muted); margin-top: 2px; }
.empty-state { padding: 34px; text-align: center; color: var(--muted); background: var(--field); border: 1px dashed var(--control-border); border-radius: var(--radius); }
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; border-radius: 14px; color: var(--primary); background: var(--primary-soft); font-size: .78rem; white-space: nowrap; }
.tag-danger { color: var(--danger); background: var(--danger-bg); }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 17px; border: 1px solid transparent; border-radius: 6px; font-weight: 650; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { text-decoration: none; }
.button:active { transform: translateY(1px); }
.button:disabled { color: var(--muted); background: var(--field-deep); border-color: var(--control-border); box-shadow: none; cursor: not-allowed; }
.button-primary { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary-hover); }
.button-primary:hover { color: #fff; background: var(--primary-hover); }
.button-secondary { color: var(--primary); background: #fff; border-color: var(--control-border); }
.button-secondary:hover { color: var(--primary-hover); background: var(--field); border-color: var(--primary); }
.button-light { color: var(--text); background: rgba(255,255,255,.8); border-color: #dcc897; }
.button-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button-small { min-height: 36px; padding: 6px 11px; font-size: .85rem; }
.button-wide { width: 100%; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.lesson-cards { display: grid; gap: 14px; }
.lesson-card { min-height: 150px; display: grid; grid-template-columns: 92px minmax(0, 1fr); background: #fff; border-bottom: 1px solid var(--line); }
.lesson-card.is-cancelled { opacity: .68; }
.date-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; align-self: start; min-height: 98px; margin-top: 24px; color: var(--berry); background: #fcf7f7; border: 1px solid #ead9dd; border-top: 3px solid var(--berry); border-radius: 3px; }
.date-tile strong { font: 500 2rem/1.3 "Literata", serif; }
.date-tile span { font-size: .83rem; text-transform: uppercase; }
.lesson-card-body { padding: 21px 0 24px 24px; }
.lesson-card-body h2 { font-size: 1.375rem; }
.lesson-card-body h2 a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 4px; }
.lesson-card-body h2 { margin: 5px 0 8px; }
.lesson-card-body h2 a { color: var(--text); text-decoration: none; }
.lesson-card-body p { color: var(--muted); }
.card-meta, .post-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .83rem; }
.worksheet-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.worksheet-chips span { padding: 4px 9px; color: var(--primary); background: var(--primary-soft); border-radius: 4px; font-size: .8rem; }
.worksheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.worksheet-panel { position: relative; border-left: 5px solid var(--primary); padding-left: 26px; box-shadow: inset 4px 0 0 var(--primary-soft), 2px 3px 0 var(--line); }
.worksheet-panel:nth-child(even) { border-left-color: var(--link); }
.worksheet-panel .eyebrow { display: inline-block; padding: 3px 9px; margin-left: -10px; color: var(--primary); background: var(--field); }
.worksheet-panel h3 { margin: 26px 0 10px; }
.problem-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.problem-list > div { min-height: 44px; display: flex; align-items: baseline; gap: 9px; padding: 9px 10px; background: var(--field); border-radius: 5px; }
.problem-list strong { color: var(--berry); }

.filter-bar, .checking-selectors { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; padding: 14px 16px; margin-bottom: 18px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
label { display: flex; flex-direction: column; gap: 6px; color: var(--text); font-weight: 600; }
input, select, textarea { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; color: var(--text); background: #fff; border: 1px solid var(--control-border); border-radius: 5px; }
input[type="checkbox"], input[type="radio"] { width: 20px; min-height: 20px; accent-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--link); outline: 3px solid rgba(40, 90, 139, .15); }
.filter-bar label { min-width: 120px; max-width: 100%; flex: 1 1 140px; font-size: .8rem; }
.filter-bar input, .filter-bar select { min-height: 40px; }
.results-scroll { max-width: 100%; max-height: 68vh; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: inset 0 0 0 1px #fff; }
.results-table, .simple-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.results-table th, .results-table td, .simple-table th, .simple-table td { height: 40px; padding: 6px 9px; text-align: center; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.results-table thead th { position: sticky; top: 0; z-index: 5; background: var(--field); }
.results-table thead tr:nth-child(2) th { top: 45px; }
.results-table thead tr:nth-child(3) th { top: 90px; }
.results-table .lesson-heading { height: 45px; font-family: "Literata", serif; background: var(--field-deep); border-bottom-color: var(--control-border); }
.lesson-heading span { display: block; color: var(--muted); font: 400 .7rem "Golos", sans-serif; }
.results-table .sheet-heading { height: 45px; min-width: 90px; font-family: "Literata", serif; border-bottom-color: var(--control-border); }
.sheet-heading span { display: block; color: var(--muted); font: 400 .7rem "Golos", sans-serif; }
.results-table .student-column { position: sticky; left: 0; z-index: 6; min-width: 210px; max-width: 250px; text-align: left; box-shadow: 2px 0 0 rgba(214,224,220,.8); }
.results-table thead .student-column { z-index: 9; }
.student-column span, .student-column small { display: block; }
.student-column small { color: var(--muted); font-weight: 400; }
.result-cell { min-width: 42px; color: var(--muted); }
.result-cell.solved { color: var(--success); background: var(--success-bg); }
.result-symbol { font-weight: 800; font-size: 1rem; }
.results-table .subtotal { min-width: 44px; color: var(--berry); background: #fbf5f6; font-weight: 700; border-right: 2px solid #d8b8c0; }
.results-table .lesson-total { min-width: 48px; color: var(--primary); background: var(--field); font-weight: 750; border-right: 2px solid var(--control-border); }
.results-table .lesson-total small { font-size: .65rem; font-weight: 500; }
.results-table .total-column { position: sticky; right: 0; z-index: 4; min-width: 64px; color: var(--primary); background: var(--field-deep); box-shadow: -2px 0 0 rgba(182,139,67,.25); }
.results-table thead .total-column { z-index: 8; }
.results-table tr.own-row .student-column { color: var(--berry); background: #fbf5f6; }

.checking-selectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px; }
.checking-sheet { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.checking-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; color: #fff; background: var(--primary); }
.checking-summary h2 { margin-bottom: 4px; }
.checking-summary p { color: #efe8f5; margin: 0; }
.checking-summary .eyebrow { color: #efe8f5; }
.large-count { font: 700 2rem "Literata", serif; }
.problem-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); gap: 10px; padding: 22px; background: var(--field); }
.problem-button { min-height: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text); background: #fff; border: 1px solid var(--control-border); border-radius: 6px; cursor: pointer; }
.problem-button span { font: 700 1.35rem "Literata", serif; }
.problem-button small { color: var(--muted); }
.problem-button:hover { border-color: var(--primary); }
.problem-button.is-solved { color: #fff; background: var(--success); border-color: var(--success); }
.problem-button.is-solved small { color: #d9eee9; }
.problem-button:disabled { opacity: .65; cursor: wait; }
.checking-status { min-height: 48px; padding: 12px 22px; border-top: 1px solid var(--line); }
.checking-status.success { color: var(--success); background: var(--success-bg); }
.checking-status.error { color: var(--danger); background: var(--danger-bg); }

.feed { max-width: 900px; display: grid; gap: 18px; }
.post-card { padding: 24px 28px; border: 1px solid var(--line); border-left: 3px solid #d6c49e; border-radius: 4px; }
.post-card h2 { margin: 12px 0 10px; font-size: 1.5rem; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-footer { padding-top: 15px; border-top: 1px solid var(--line); }
.article-page { max-width: 820px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.article-page h1 { margin-top: 12px; }
.article-author { color: var(--muted); }
.article-body { font-size: 1.08rem; line-height: 1.7; margin: 30px 0; }
.article-body blockquote { margin-left: 0; padding-left: 20px; border-left: 3px solid var(--gold); color: var(--muted); }
.reaction-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 28px; }
.reaction-row form { margin: 0; }
.reaction { min-width: 44px; min-height: 44px; padding: 6px 11px; background: #fff; border: 1px solid var(--control-border); border-radius: 20px; cursor: pointer; }
.reaction.selected { color: var(--primary); background: var(--primary-soft); border-color: var(--control-border); }
.comments { max-width: 820px; margin-top: 34px; }
.comment-list { margin-top: 20px; }
.comment { padding: 17px 3px; border-bottom: 1px solid var(--line); }
.comment > div { display: flex; justify-content: space-between; gap: 16px; }
.comment time { color: var(--muted); font-size: .8rem; }
.comment p { margin: 7px 0; }

.conversation-list, .notification-list { max-width: 900px; border-top: 1px solid var(--line); }
.conversation-row { display: grid; grid-template-columns: 48px 1fr auto; padding: 14px 4px; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--berry); border-radius: 50%; font-weight: 700; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.chat-person { display: flex; align-items: center; gap: 12px; }
.chat-person > .avatar { flex: 0 0 42px; }
.chat-person > div:last-child { min-width: 0; }
.conversation-row time { color: var(--muted); font-size: .8rem; }
.chat-page { max-width: 900px; }
.chat-header { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.chat-header h1 { font-size: 2rem; margin-bottom: 2px; }
.message-stream { min-height: 320px; display: flex; flex-direction: column; gap: 10px; padding: 24px 0; }
.message-bubble { align-self: flex-start; max-width: min(620px, 82%); padding: 12px 15px; background: var(--field); border: 1px solid var(--line); border-radius: 4px 8px 8px 8px; }
.message-bubble.own { align-self: flex-end; background: var(--primary-soft); border-color: var(--line); border-radius: 8px 4px 8px 8px; }
.message-bubble strong, .message-bubble time { display: block; color: var(--muted); font-size: .75rem; }
.message-bubble p { margin: 4px 0; }
.chat-compose { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: var(--radius); }
.chat-compose textarea { min-height: 48px; max-height: 140px; }
.notification-row { justify-content: flex-start; }
.notification-row.unread { background: var(--field); }
.notification-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.unread .notification-dot { background: var(--berry); }

.management-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr); gap: 22px; }
.manage-row { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.manage-row > div:first-child { display: flex; flex-direction: column; }
.manage-row small { color: var(--muted); }
.manage-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 11px; font-size: .87rem; }
.quick-actions { align-self: start; }
.quick-actions > a { min-height: 50px; display: flex; align-items: center; justify-content: space-between; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.admin-list { display: grid; gap: 16px; }
.admin-lesson h2 { margin-bottom: 0; }
.admin-sheets { margin: 12px 0 18px; padding-left: 14px; border-left: 2px solid var(--line); }
.problem-admin-chip { display: inline-flex; min-width: 34px; min-height: 34px; align-items: center; justify-content: center; margin: 5px 4px 5px 0; color: var(--primary); background: var(--field); border-radius: 4px; text-decoration: none; }
.audit-list { border-top: 1px solid var(--line); }
.audit-row { min-height: 86px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.audit-row p { margin: 2px 0; color: var(--muted); }
.audit-row time { color: var(--muted); font-size: .8rem; }
.audit-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; }
.audit-icon.positive { color: var(--success); background: var(--success-bg); }
.audit-icon.negative { color: var(--danger); background: var(--danger-bg); }
.audit-secondary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; margin-top: 48px; }
.audit-row.compact { grid-template-columns: 38px minmax(0, 1fr); }
.roster-upload { margin-bottom: 32px; }
.roster-section { margin-top: 44px; }
.roster-list { border-top: 1px solid var(--line); }
.roster-row { min-height: 72px; display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, auto); align-items: center; gap: 18px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.roster-row.is-inactive { opacity: .65; }
.roster-row > div:first-child { display: flex; flex-direction: column; }
.roster-row small { color: var(--muted); }
.roster-row form { margin: 0; }

.form-stack { display: grid; gap: 18px; }
.form-stack > div, .form-stack > p { margin: 0; }
.form-stack ul.errorlist { margin: 0; padding-left: 20px; color: var(--danger); }
.form-stack .helptext { color: var(--muted); font-size: .82rem; font-weight: 400; }
.form-inline { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-narrow { max-width: 680px; }
.document-page { max-width: 760px; margin: 40px auto; padding: 34px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.simple-table { width: 100%; }
.credentials code { font-size: .9rem; }
.flash-stack { margin-bottom: 20px; }
.flash { padding: 12px 15px; margin-bottom: 8px; border-radius: 5px; }
.flash-success { color: var(--success); background: var(--success-bg); }
.flash-error { color: var(--danger); background: var(--danger-bg); }
.flash-warning { color: var(--warning); background: var(--warning-bg); }
.flash-info { color: var(--link); background: #edf4fb; }

.public-body { min-height: 100vh; background: var(--field); }
.public-main { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.auth-shell { position: relative; width: min(1040px, 100%); min-height: 630px; display: grid; grid-template-columns: 1fr 1fr; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 0 -1px #fff, 0 5px 0 var(--line), 0 8px 0 -1px #fff, 0 9px 0 var(--line), var(--shadow); }
.auth-shell::before { content: ""; position: absolute; inset: 12px; border: 1px solid #d6c49e; border-radius: 4px; pointer-events: none; }
.auth-intro { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 48px 52px 38px; color: var(--text); border-right: 1px solid var(--line); box-shadow: inset -6px 0 8px -9px var(--muted); }
.auth-brand { display: flex; align-items: center; gap: 12px; font: 500 1.125rem "Literata", serif; color: var(--primary); }
.auth-intro h1 { font-size: 2.25rem; color: var(--primary); margin: 32px 0 20px; }
.auth-intro p { color: var(--muted); font-size: .9375rem; line-height: 1.65; }
.auth-vignette { width: 230px; height: 190px; object-fit: contain; align-self: center; margin: 6px 0 16px; }
.auth-schedule { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; width: 100%; gap: 12px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.auth-schedule strong { font-weight: 500; color: var(--primary); font-size: 1.125rem; }
.auth-schedule small { font-size: .75rem; }
.auth-card { position: relative; align-self: center; padding: 70px 48px 40px; }
.auth-card h2 { font-size: 1.5rem; }
.auth-card > .muted { font-size: .875rem; }
.auth-card form { margin: 24px 0 20px; }
.auth-card label { font-size: .875rem; font-weight: 500; }
.auth-bookmark { position: absolute; top: 0; left: 48px; padding: 12px 16px 14px; color: #fff; background: var(--berry); font-size: .8125rem; }
.auth-bookmark::after { content: ""; position: absolute; bottom: -8px; left: 0; width: 100%; height: 8px; background: var(--berry); clip-path: polygon(0 0,100% 0,100% 100%,50% 0,0 100%); }

@media (min-width: 1024px) and (max-height: 850px) {
  .sidebar { inset-block: 16px; padding-top: 8px; }
  .brand { padding-bottom: 14px; }
  .brand-kicker { margin-bottom: 8px; }
  .brand-caption { display: none; }
  .season-label { padding-block: 8px; }
  .main-nav { gap: 0; padding-bottom: 6px; }
  .nav-divider { margin-top: 8px; }
  .sidebar-footer { position: relative; padding-top: 10px; padding-bottom: 8px; }
  .sidebar-footer form { position: absolute; right: 8px; bottom: 4px; }
  .sidebar-footer .link-button { font-size: .75rem; }
}

@media (max-width: 1023px) {
  .mobile-header { position: sticky; top: 0; z-index: 30; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 20px; background: var(--field); border-bottom: 1px solid var(--line); }
  .mobile-brand { color: var(--primary); font: 550 1rem/1.4 "Literata", serif; text-decoration: none; }
  .mobile-brand span { display: block; font: 400 .6875rem/1.5 "Golos", sans-serif; color: var(--muted); }
  .menu-toggle { min-width: 66px; min-height: 44px; color: var(--primary); background: #fff; border: 1px solid var(--control-border); border-radius: 4px; font-size: .8125rem; }
  .sidebar { inset: 72px auto 0 0; visibility: hidden; transform: translateX(-102%); width: min(310px, 88vw); padding: 20px 20px 16px; background: var(--field); transition: transform .18s ease, visibility .18s; box-shadow: 8px 0 20px #34313b20; }
  .sidebar.is-open { visibility: visible; transform: translateX(0); }
  .sidebar .brand { display: none; }
  .app-main { margin: 16px 20px 26px; padding-inline: 32px; min-height: calc(100vh - 114px); }
  .results-scroll { max-width: 100%; }
  .impersonation-banner { position: relative; margin-left: 0; padding: 8px 16px; flex-direction: column; align-items: stretch; }
  .content-grid, .worksheet-grid { grid-template-columns: 1fr; }
  .management-grid { grid-template-columns: 1fr; }
  .audit-secondary-grid { grid-template-columns: 1fr; }
  .auth-intro { padding-inline: 32px; }
  .auth-card { padding-inline: 32px; }
  .auth-bookmark { left: 32px; }
}

@media (max-width: 767px) {
  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.375rem; }
  .mobile-header { padding-inline: 14px; }
  .app-main { margin: 12px 10px 22px; padding: 0 18px 20px; }
  .app-main::before { left: 5px; top: 10px; bottom: 10px; width: 1px; border-right: 0; }
  .running-head { min-height: 52px; margin-bottom: 22px; font-size: .6875rem; }
  .running-head > span:first-child { display: none; }
  .running-ornament { width: 68px; height: 24px; }
  .page-colophon { margin-top: 30px; gap: 12px; font-size: .625rem; }
  .page-colophon img { display: none; }
  .impersonation-banner { position: relative; margin-left: 0; padding: 8px 12px; flex-direction: column; align-items: stretch; }
  .impersonation-banner + .mobile-header { top: 0; }
  .page-header { flex-direction: column; gap: 14px; margin-bottom: 22px; padding-bottom: 20px; }
  .page-header-art { min-height: auto; padding-right: 0; }
  .margin-vignette { display: none; }
  .dashboard-grid, .content-grid, .worksheet-grid, .checking-selectors { grid-template-columns: 1fr; }
  .dashboard-grid { gap: 16px; margin-bottom: 28px; }
  .panel { padding: 20px; }
  .panel-feature { padding: 18px; }
  .panel-feature h2 { font-size: 1.25rem; }
  .upcoming-lesson { grid-template-columns: 54px 1fr; gap: 12px; }
  .calendar-leaf { min-height: 84px; }
  .calendar-leaf strong { font-size: 1.75rem; }
  .calendar-leaf span { font-size: .625rem; }
  .feature-actions { gap: 12px; }
  .feature-actions .button { width: 100%; }
  .metric-panel { padding: 18px; }
  .metric { margin-bottom: 12px; }
  .metric strong { font-size: 2.25rem; }
  .metric-panel p { margin-bottom: 4px; }
  .content-grid { gap: 28px; }
  .lesson-card { grid-template-columns: 68px minmax(0, 1fr); }
  .lesson-card-body { padding: 17px 0 20px 14px; }
  .lesson-card-body h2 { font-size: 1.25rem; }
  .date-tile { min-height: 84px; margin-top: 20px; }
  .worksheet-chips { display: grid; }
  .filter-bar { align-items: stretch; }
  .filter-bar label { width: 100%; }
  .results-scroll { max-width: 100%; max-height: 68vh; }
  .results-table .student-column { min-width: 126px; max-width: 140px; }
  .student-column span { white-space: normal; }
  .button-small { min-height: 44px; }
  .problem-admin-chip { min-width: 44px; min-height: 44px; }
  .filter-bar input, .filter-bar select { min-height: 44px; }
  .problem-buttons { grid-template-columns: repeat(3, 1fr); padding: 12px; }
  .problem-button { min-width: 0; min-height: 76px; }
  .problem-button small { font-size: .6875rem; }
  .checking-summary { padding: 18px; }
  .checking-summary h2 { font-size: 1.25rem; }
  .large-count { font-size: 1.5rem; white-space: nowrap; }
  .page-checking .running-head { min-height: 44px; margin-bottom: 16px; }
  .page-checking .page-header { padding-bottom: 14px; margin-bottom: 16px; }
  .page-checking .page-header .eyebrow { display: none; }
  .page-checking .lead { font-size: .875rem; line-height: 1.5; }
  .page-checking .checking-selectors { padding: 12px; gap: 10px; }
  .page-checking .checking-selectors label { font-size: .8125rem; gap: 4px; }
  .page-checking .checking-summary { padding: 14px 16px; }
  .page-checking .checking-summary .eyebrow { margin-bottom: 4px; font-size: .75rem; }
  .page-checking .checking-summary p { font-size: .8125rem; }
  .post-card { padding: 22px 18px; }
  .post-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
  .chat-compose { grid-template-columns: 1fr; }
  .message-bubble { max-width: 90%; }
  .manage-row { align-items: flex-start; flex-direction: column; }
  .roster-row { grid-template-columns: 1fr; gap: 8px; }
  .manage-actions { justify-content: flex-start; }
  .audit-row { grid-template-columns: 34px 1fr; }
  .audit-row form { grid-column: 2; }
  .form-inline { align-items: stretch; flex-direction: column; }
  .auth-shell { min-height: auto; grid-template-columns: 1fr; }
  .auth-intro { padding: 28px 28px 24px; border-right: 0; box-shadow: none; }
  .auth-brand { font-size: .9375rem; }
  .auth-brand img { width: 26px; height: 26px; }
  .auth-intro h1 { margin-top: 20px; font-size: 1.875rem; }
  .auth-intro p { font-size: .875rem; margin-bottom: 0; }
  .auth-vignette { display: none; }
  .auth-schedule { margin-top: 20px; font-size: .75rem; }
  .auth-card { padding: 72px 28px 32px; border-top: 1px solid var(--line); }
  .auth-bookmark { left: 28px; }
  .public-main { padding: 16px 10px 26px; }
  .document-page { margin: 0; padding: 24px; }
}

@media (max-width: 420px) {
  .lesson-card { grid-template-columns: 54px minmax(0, 1fr); }
  .date-tile strong { font-size: 1.75rem; }
  .date-tile span { font-size: .6875rem; }
}

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

@media (forced-colors: active) {
  .main-nav a.active, .panel-feature, .problem-button.is-solved { border: 2px solid ButtonText; }
  .result-cell.solved .result-symbol { text-decoration: underline; }
}

@media print {
  .sidebar, .mobile-header, .impersonation-banner, .button, form, .margin-vignette, .page-colophon { display: none !important; }
  .app-main { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .app-main::before { display: none; }
  .results-scroll { max-width: none; max-height: none; overflow: visible; border: 0; }
}
