:root {
  --bg: #f4f1ea; --panel: #fffdf9; --panel-2: #ece8df; --line: #ddd7ca;
  --text: #23211d; --muted: #6f6a60; --accent: #c8421b; --accent-ink: #fff;
  --danger: #b92f22; --ok: #23875a; --shadow: 0 1px 2px rgb(60 50 30 / .12), 0 6px 18px rgb(60 50 30 / .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --panel: #1f2127; --panel-2: #292c34; --line: #363943;
    --text: #eceae4; --muted: #a3a3ab; --accent: #ff7a55; --accent-ink: #1c0f0a;
    --danger: #ff8473; --ok: #4fd08f; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 22px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15161a; --panel: #1f2127; --panel-2: #292c34; --line: #363943;
  --text: #eceae4; --muted: #a3a3ab; --accent: #ff7a55; --accent-ink: #1c0f0a;
  --danger: #ff8473; --ok: #4fd08f; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 22px rgb(0 0 0 / .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; min-height: 36px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line); font-weight: 600; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.icon-only { padding: 6px; min-width: 32px; min-height: 32px; }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.input {
  width: 100%; padding: 8px 10px; min-height: 38px; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--line);
}
textarea.input { min-height: 110px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-error { color: var(--danger); font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px var(--panel); }
.swatch[aria-pressed="true"] { border-color: var(--text); }

/* Auth */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); }
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }
.brand-mark { display: inline-grid; grid-template-columns: repeat(3, 5px); gap: 2.5px; align-items: end; height: 20px; }
.brand-mark i { display: block; background: var(--accent); border-radius: 1.5px; }
.brand-mark i:nth-child(1) { height: 10px; } .brand-mark i:nth-child(2) { height: 15px; } .brand-mark i:nth-child(3) { height: 20px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; margin: 26px 0 4px; }
.auth-card > p { color: var(--muted); margin-bottom: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 13px; }

/* Shell */
.shell { height: 100%; display: grid; grid-template-columns: 212px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 22px; padding: 18px 12px 14px; border-right: 1px solid var(--line); overflow-y: auto; }
.sidebar .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .sub { padding: 6px 10px 6px 38px; font-size: 14px; }
.nav .sub .count { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-left: 8px; }
.side-foot .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 16px 24px 12px; }
.topbar h1 { font-size: 21px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.topbar .spacer { flex: 1; }
.topbar .sub-title { color: var(--muted); font-weight: 600; }
.view { flex: 1; min-height: 0; overflow: auto; padding: 4px 24px 24px; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }
.muted { color: var(--muted); font-size: 14px; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.crumb { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumb:hover { color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.class-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 5px; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--c, var(--muted)) 20%, transparent); color: var(--text); white-space: nowrap;
}
.section { margin-bottom: 28px; max-width: 980px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 11px; }
.section-head h2 { font-size: 16px; }
.section-head .btn { margin-left: auto; }
.mobile-only { display: none; }

/* Week toolbar */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-label { font-weight: 700; min-width: 0; font-variant-numeric: tabular-nums; }
.date-jump { width: auto; min-height: 36px; padding: 4px 8px; }

/* Week grid (calendar and timetable editor) */
.week-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; min-width: 0; }
.day { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.day-head { display: flex; align-items: baseline; gap: 7px; padding: 0 4px 4px; border-bottom: 2px solid var(--line); }
.day-head b { font-size: 15px; }
.day-head span { color: var(--muted); font-size: 13px; }
.day.today .day-head { border-color: var(--accent); }
.day.today .day-head b, .day.today .day-head span { color: var(--accent); }
.lesson {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 92px;
  padding: 7px 9px 7px 12px; border-radius: 7px; border: 1px solid transparent; background: var(--panel); box-shadow: var(--shadow);
  text-align: left; cursor: pointer; overflow: hidden; color: var(--text);
}
.lesson::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, transparent); }
.lesson:hover { border-color: var(--muted); }
.lesson.free { background: transparent; box-shadow: none; border: 1px dashed var(--line); color: var(--muted); }
.lesson.free .lesson-add { margin: auto; opacity: 0; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.lesson.free:hover .lesson-add, .lesson.free:focus-visible .lesson-add { opacity: 1; }
.lesson.done { opacity: .72; }
.lesson.past:not(.done):not(.free) { background: color-mix(in srgb, var(--panel) 80%, var(--panel-2)); }
.lesson-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-top .class-badge { margin-left: auto; }
.lesson-subject { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-title { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-title.none { color: var(--muted); font-weight: 400; font-style: italic; font-size: 13px; }
.lesson-meta { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 12px; color: var(--muted); }
.lesson-meta .icon { width: 13px; height: 13px; }
.lesson-meta span { display: inline-flex; align-items: center; gap: 3px; }
.lesson-meta .is-done { color: var(--ok); font-weight: 700; }
.lesson.extra::after { content: attr(data-badge); position: absolute; right: 6px; bottom: 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Special classes (home schooling etc.): hatched cell, dashed outline, labelled */
.lesson.special, .lesson.special.past:not(.done):not(.free) {
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 14%, var(--panel)) 0 8px, var(--panel) 8px 16px);
  border: 1.5px dashed var(--c);
}
.lesson.special::before { width: 6px; }
.lesson-tag {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 99px;
  background: var(--c, var(--accent)); color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: .01em; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lesson-tag .icon { width: 11px; height: 11px; fill: currentColor; stroke: none; flex: none; }
.class-badge.special { outline: 1.5px dashed var(--c); outline-offset: -1.5px; }
.class-badge .icon { width: 11px; height: 11px; fill: currentColor; stroke: none; }
.class-tile.special {
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 10%, var(--panel)) 0 10px, var(--panel) 10px 20px);
}
.lesson-heading .lesson-tag, .main .topbar .lesson-tag { margin-top: 4px; }

/* Timetable editor */
.tt .lesson { min-height: 72px; }
.bells { display: grid; gap: 6px; max-width: 420px; }
.bell { display: grid; grid-template-columns: 70px 1fr 1fr; align-items: center; gap: 8px; }
.bell b { font-size: 14px; }
.bell-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* Grade folders */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.folder {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px 16px 14px; border-radius: 4px 10px 10px 10px;
  background: var(--panel); box-shadow: var(--shadow); color: inherit; text-decoration: none; margin-top: 12px; min-height: 130px;
}
.folder::before {
  content: ""; position: absolute; left: 0; top: -12px; width: 44%; height: 14px; border-radius: 8px 8px 0 0; background: var(--panel);
  box-shadow: 0 -1px 2px rgb(60 50 30 / .08);
}
.folder::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 0 10px 0 0; background: var(--accent); opacity: .8; }
.folder:hover h2 { color: var(--accent); }
.folder h2 { font-size: 22px; letter-spacing: -.02em; }
.folder-classes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.class-tile {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 15px 13px; border-radius: 10px; background: var(--panel);
  color: inherit; text-decoration: none; box-shadow: var(--shadow); border-top: 4px solid var(--c);
}
.class-tile:hover h2 { color: var(--accent); }
.class-tile h2 { font-size: 22px; letter-spacing: -.02em; }
.class-tile p { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stats { display: flex; gap: 18px; margin: auto 0 0; }
.stats div { display: flex; flex-direction: column; }
.stats dd { margin: 0; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dt { color: var(--muted); font-size: 12px; }
.class-add { min-height: 120px; border: 1px dashed var(--line); background: transparent; box-shadow: none; border-top: 1px dashed var(--line); align-items: center; justify-content: center; color: var(--muted); cursor: pointer; font-weight: 600; }
.class-add:hover { color: var(--text); border-color: var(--muted); }

/* Class page */
.note { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 760px; padding: 12px 14px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; min-height: 28px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; }
.chip b { color: var(--text); }
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { border-bottom: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 9px 4px;
  background: none; border: 0; text-align: left; cursor: pointer; color: var(--text);
}
.row:hover .row-title { color: var(--accent); }
.row-date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-date b { display: block; color: var(--text); font-size: 14px; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-title.none { color: var(--muted); font-weight: 400; font-style: italic; }
.row-sub { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.row-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.row-meta .icon { width: 13px; height: 13px; }
.row-meta span { display: inline-flex; align-items: center; gap: 3px; }
.row-meta .is-done { color: var(--ok); font-weight: 700; }

/* Attachments */
.attachments { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 9px; }
.attachments.file-over { border-color: var(--accent); background: var(--panel-2); }
.att-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.att-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.att-hint { color: var(--muted); font-size: 12px; }
.att-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.att-tile { position: relative; }
.att-thumb { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--panel-2); }
.att-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.att-tile .att-remove { position: absolute; top: 4px; right: 4px; }
.att-list { display: flex; flex-direction: column; gap: 4px; }
.att-file { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 4px 5px 8px; border-radius: 6px; background: var(--panel-2); font-size: 14px; }
.att-file > .icon { flex: none; color: var(--muted); }
.att-file a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.att-remove {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.att-remove .icon { width: 14px; height: 14px; }
.att-remove:hover, .att-remove.armed { color: var(--danger); border-color: var(--danger); }
.att-progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.att-progress span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-progress progress { flex: none; width: 40%; accent-color: var(--accent); }
.section .attachments { max-width: 760px; background: var(--panel); }

/* Lesson page */
.lesson-page { max-width: 820px; }
.lesson-page .section { max-width: none; }
.lesson-page .note { max-width: none; font-size: 15px; line-height: 1.6; }
.lesson-heading h1 { margin-top: 2px; }
.lesson-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; color: var(--muted); font-size: 14px; }
.lesson-head-meta .icon { width: 14px; height: 14px; }
.is-done { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-weight: 700; }
.lesson-form { display: flex; flex-direction: column; gap: 15px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }

/* Lesson preview */
.preview { display: flex; flex-direction: column; gap: 14px; }
.preview-block { display: flex; flex-direction: column; gap: 4px; }
.preview-block > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.preview-block p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.done-toggle {
  display: flex; align-items: center; gap: 9px; align-self: flex-start; padding: 8px 14px 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); font-weight: 700; cursor: pointer; user-select: none;
}
.done-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--ok); }
.done-toggle .icon { display: none; }
.done-toggle:hover { border-color: var(--muted); }
.done-toggle.on { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.preview-files { display: inline-flex; align-items: center; gap: 5px; }
.preview-files .icon { width: 15px; height: 15px; }

/* Bulk plan */
.bulk { max-width: 900px; display: flex; flex-direction: column; }
.bulk-card { max-width: none; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 14px; }
.bulk-card .attachments { background: transparent; }
.bulk-grades { display: flex; flex-direction: column; gap: 8px; }
.bulk-grade { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
button.chip { background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
button.chip:hover { color: var(--text); border-color: var(--muted); }
button.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c, var(--accent)) 18%, var(--panel)); color: var(--text); border-color: var(--c, var(--text)); }
.grade-chip { min-width: 64px; justify-content: center; }
.grade-chip[aria-pressed="true"] { --c: var(--accent); }
.bulk-range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.bulk-classes { display: flex; flex-direction: column; gap: 14px; }
.bulk-class { border-left: 3px solid var(--c); padding-left: 12px; }
.bulk-class-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bulk-class-head .class-badge { font-size: 14px; padding: 2px 10px; }
.bulk-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 5px; }
.bulk-lesson { display: flex; align-items: flex-start; gap: 8px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 14px; }
.bulk-lesson:hover { border-color: var(--muted); }
.bulk-lesson.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); }
.bulk-lesson input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.bulk-lesson-text { min-width: 0; }
.bulk-note { display: block; font-size: 12px; color: var(--muted); }
.bulk-note.warn { color: var(--danger); }
.bulk-foot {
  position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow);
}
.bulk-foot .spacer { flex: 1; }
.bulk-count { font-weight: 700; }
label.att-file { cursor: pointer; }
label.att-file input { accent-color: var(--accent); }

/* Settings */
.settings { max-width: 620px; display: flex; flex-direction: column; gap: 28px; }
.settings h2 { font-size: 16px; margin-bottom: 9px; }
.settings form { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }

/* Modal */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / .35); }
dialog.modal.wide { width: min(720px, calc(100vw - 24px)); border-top: 4px solid var(--c, var(--line)); }
dialog.modal::backdrop { background: rgb(15 14 12 / .55); }
.modal form { display: flex; flex-direction: column; gap: 15px; padding: 18px 20px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.modal-head h2 { font-size: 18px; }
.modal-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal-actions .danger { margin-right: auto; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 9px 15px; border-radius: 8px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; }
#toast.show { opacity: 1; }

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 22px; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .main { grid-row: 1; }
  .sidebar { grid-row: 2; flex-direction: row; align-items: center; gap: 4px; padding: 4px 8px; border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .sidebar .brand, .side-foot, .nav .sub { display: none; }
  .nav { flex: 1; flex-direction: row; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 1px; padding: 5px 3px; font-size: 11px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 2px 0 var(--accent); }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 12px 16px 9px; }
  .view { padding: 4px 16px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: minmax(0, 1fr); }
  .lesson { min-height: 0; }
  .lesson.free { min-height: 34px; }
  .lesson.free .lesson-add { opacity: 1; }
  .row { grid-template-columns: 92px minmax(0, 1fr); }
  .row-meta { grid-column: 2; }
  .bell { grid-template-columns: 54px 1fr 1fr; }
}

/* Lesson notes */
.notes-field > span { display: flex; align-items: baseline; gap: 8px; }
.notes-state { font-weight: 400; font-size: 12px; color: var(--ok); }
.notes-input { background: color-mix(in srgb, #f2c94c 9%, var(--panel)); min-height: 96px; font-variant-numeric: tabular-nums; }
