/* MyUIB — стили. Цвета и формы в духе платформы университета (индиго, мягкие скругления). */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #17213c;
  --muted: #667089;
  --faint: #9aa1b5;
  --line: #e4e7f0;
  --accent: #393781;
  --accent-hover: #2e2c6d;
  --accent-soft: #eeeefa;
  --accent-text: #393781;
  --gold: #f5b544;
  --ok-bg: #e9f7ef; --ok-text: #17663a;
  --warn-bg: #fff4e0; --warn-text: #8a5300;
  --err-bg: #fdeceb; --err-text: #a12b22;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(23, 33, 60, .04), 0 4px 16px rgba(57, 55, 129, .05);
  --shadow-btn: 0 6px 16px rgba(57, 55, 129, .22);
  --c0: #4f6bed; --c1: #d97706; --c2: #e11d48; --c3: #0d9488; --c4: #7c3aed; --c5: #2563eb; --c6: #65a30d; --c7: #c026d3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10121a; --surface: #181b26; --surface-2: #1e2230; --text: #eceef6; --muted: #a0a6ba; --faint: #6f768c;
    --line: #2a2f40; --accent: #6f6cd9; --accent-hover: #807de6; --accent-soft: #24264a; --accent-text: #b7b5ff;
    --ok-bg: #12291c; --ok-text: #7ed69f; --warn-bg: #2d2412; --warn-text: #f3c56b; --err-bg: #331816; --err-text: #f4a29a;
    --shadow: none; --shadow-btn: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Onest, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -.2px; }
h2 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 12px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.code { display: block; padding: 10px 12px; white-space: pre-wrap; margin: 0 0 12px; }
.muted { color: var(--muted); font-weight: 400; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Каркас ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.workspace { min-width: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 20px 14px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 2px 8px 14px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 9px; }
.brand b { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
.group-switch { display: flex; flex-direction: column; gap: 4px; margin: 0 8px 12px; }
.group-switch label { font-size: 12px; color: var(--muted); }
.group-switch select { padding: 8px 10px; }
.group-chip { margin: 0 8px 12px; align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-label { margin: 18px 10px 6px; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.me form { margin: 0; }
.me-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--text); padding: 2px; border-radius: 8px; }
.me-link:hover { text-decoration: none; background: var(--surface-2); }
.me-text { min-width: 0; }
.me-text b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 13px; }
.avatar:hover { text-decoration: none; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.icon-btn, .btn-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover, .btn-icon:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.active { color: var(--accent-text); background: var(--accent-soft); }
.btn-icon.danger:hover { color: var(--err-text); background: var(--err-bg); }

.main { padding: 30px 40px 64px; max-width: 1180px; }
.topbar, .tabbar { display: none; }

/* ---------- Заголовки и общие блоки ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.overline { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 8px; }
.card-head a { font-size: 13px; font-weight: 500; }
.empty { padding: 14px 20px 20px; color: var(--muted); margin: 0; }
.empty p { margin: 0 0 12px; }
.empty-state { padding: 32px; text-align: center; }
.empty-state h1, .empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.page-foot { margin-top: 20px; }
.stack { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.section-title { margin: 0 0 12px; }
.date-title { margin: 22px 0 10px; font-size: 15px; }
.date-title:first-of-type { margin-top: 8px; }
.link-back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.link-back .icon { width: 16px; height: 16px; }
.link-sm { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.link-sm .icon { width: 16px; height: 16px; }

.notice { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; background: var(--ok-bg); color: var(--ok-text); }
.notice-error { background: var(--err-bg); color: var(--err-text); }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.notice-key { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--accent-soft); color: var(--text); }
.notice-key > div { flex: 1 1 320px; }
.notice-key small { flex-basis: 100%; color: var(--muted); }
.secret { font-size: 16px; font-weight: 600; letter-spacing: .5px; background: var(--surface); }

/* ---------- Кнопки и формы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-btn); transition: background-color .15s; }
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn .icon { width: 18px; height: 18px; }
.btn-wide { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--err-bg); color: var(--err-text); box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--err-text) 18%, var(--surface)); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions form { margin: 0; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1 1 240px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.field small { color: var(--faint); font-weight: 400; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; min-height: 44px; transition: border-color .15s, background-color .15s; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; margin-top: 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check small { display: block; color: var(--muted); font-size: 13px; }
.hint { margin: -4px 0 0; color: var(--muted); font-size: 13px; }
.code-input { font-size: 22px; letter-spacing: 6px; text-align: center; font-weight: 600; }
.form-card { padding: 20px; }
.form-card h2 { margin-bottom: 14px; }
.inline-form { margin: 0; }
.inline-form select { min-width: 200px; }
.search { max-width: 360px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toolbar .segmented { margin-bottom: 0; }
.segmented a { padding: 8px 16px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--accent); color: #fff; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.badge-hw { background: var(--warn-bg); color: var(--warn-text); }
.badge-today { background: var(--accent-soft); color: var(--accent-text); }
.badge-role { background: var(--accent-soft); color: var(--accent-text); }
.badge-off { background: var(--err-bg); color: var(--err-text); }
.badge-now { display: none; background: var(--accent); color: #fff; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c0); }
.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); }
.c4 { background: var(--c4); } .c5 { background: var(--c5); } .c6 { background: var(--c6); } .c7 { background: var(--c7); }

/* ---------- Сегодня ---------- */
.week-strip { display: flex; gap: 8px; align-items: stretch; margin-bottom: 22px; }
.week-arrow { display: grid; place-items: center; width: 36px; flex: none; border-radius: 12px; color: var(--muted); }
.week-arrow:hover { background: var(--surface); color: var(--text); }
.day { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.day:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.day small { display: block; font-size: 12px; color: var(--muted); }
.day b { font-size: 18px; font-weight: 650; }
.day span { float: right; margin-top: 5px; font-size: 12px; color: var(--faint); }
.day.is-today small { color: var(--accent-text); font-weight: 600; }
.day.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-btn); }
.day.active small, .day.active span { color: rgba(255, 255, 255, .8); }

.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 20px; }

.lessons { list-style: none; margin: 0; padding: 4px 10px 12px; }
.lesson { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; padding: 12px 10px; border-radius: 12px; }
.lesson + .lesson { border-top: 1px solid var(--line); }
.lesson time { font-variant-numeric: tabular-nums; line-height: 1.3; }
.lesson time b { display: block; font-size: 15px; font-weight: 600; }
.lesson time small { color: var(--faint); font-size: 13px; }
.lesson h3 { font-size: 15px; font-weight: 600; }
.lesson h3 .dot { margin: 0 8px 2px 0; vertical-align: middle; }
.lesson h3 .badge { margin-left: 6px; vertical-align: 1px; }
.lesson-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.lesson-no { color: var(--faint); font-size: 12px; font-weight: 500; white-space: nowrap; }
.lesson .progress { display: none; height: 4px; margin-top: 10px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 15%, transparent); overflow: hidden; }
.lesson .progress i { display: block; height: 100%; width: var(--done, 0%); background: var(--accent); border-radius: 4px; }
.lessons:not(.compact) .lesson.done { opacity: .5; }
.lesson.now { background: var(--accent-soft); }
.lesson.now + .lesson, .lesson + .lesson.now { border-top-color: transparent; }
.lesson.now .badge-now { display: inline-flex; }
.lesson.now .progress { display: block; }
.lesson-task { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--text); font-size: 14px; }
.lesson-task b { display: block; color: var(--warn-text); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
.lessons.compact .lesson { grid-template-columns: 50px minmax(0, 1fr); }
.lessons.compact .lesson-no { display: none; }

.tasks { list-style: none; margin: 0; padding: 0 10px 10px; }
.task { padding: 12px 10px; }
.task + .task { border-top: 1px solid var(--line); }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.task-top b { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.task p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.due { color: var(--muted); white-space: nowrap; }
.due.soon { color: var(--warn-text); font-weight: 600; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; padding: 6px 20px 18px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }

/* ---------- Расписание ---------- */
.week-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.week-title { font-weight: 600; padding: 0 6px; }
.push-right { margin-left: auto; }
.day-tabs { display: none; }
.week-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.day-card.is-today { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow); }
.day-card .card-head h2 .muted { font-size: 14px; }
.day-card .empty { padding-top: 6px; }
.loose-task { display: flex; gap: 10px; margin: 0 16px 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); font-size: 14px; }
.loose-task .dot { margin-top: 7px; }
.loose-task b { display: block; font-size: 13px; }
.loose-task p { margin: 2px 0 0; }

/* ---------- Задания ---------- */
.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.task-card { padding: 16px 18px; }
.task-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.task-card header b { display: flex; align-items: center; gap: 8px; }
.task-card p { margin: 0; overflow-wrap: anywhere; }
.task-card footer { margin-top: 10px; color: var(--faint); font-size: 13px; }

/* ---------- Люди и меню ---------- */
.people, .menu-list { list-style: none; margin: 0; padding: 6px; }
.people li + li, .menu-list li + li { border-top: 1px solid var(--line); }
.people a, .menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; color: var(--text); width: 100%; }
.people a:hover, .menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.people li.is-off { opacity: .6; }
.person { flex: 1; min-width: 0; }
.person b { display: block; font-weight: 600; }
.person small { color: var(--muted); font-size: 13px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chevron { color: var(--faint); width: 18px; height: 18px; }
.menu-list a, .menu-list button { font: inherit; font-weight: 500; border: 0; background: none; cursor: pointer; text-align: left; }
.menu-list .chevron { margin-left: auto; }
.menu-list form { margin: 0; }
.menu-list button { color: var(--err-text); }
.profile { max-width: 640px; padding-bottom: 6px; }
.profile-head { display: flex; gap: 16px; align-items: center; padding: 22px 20px 12px; }
.profile-head h1 { font-size: 22px; }
.profile-head p { margin: 2px 0 0; }
.profile .facts dd { text-align: left; }
.profile .actions { padding: 0 20px 16px; }

/* ---------- Журнал и админка ---------- */
.journal { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; }
.journal-form { position: sticky; top: 20px; }
.journal-week { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.journal-week > .week-nav { margin-bottom: 2px; }
.j-day .card-head { padding-bottom: 4px; }
.j-day.is-today { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.j-list { list-style: none; margin: 0; padding: 4px 10px 10px; }
.j-list li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; }
.j-list li + li { border-top: 1px solid var(--line); }
.j-list li.is-editing { background: var(--accent-soft); }
.j-list li.is-past { opacity: .6; }
.j-list form { margin: 0; }
.j-info { flex: 1; min-width: 0; }
.j-info b { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.j-info small { display: block; color: var(--muted); font-size: 13px; }
.j-tasks { padding: 6px 10px; }
.lesson-no-badge { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.bells { max-width: 560px; }
.bell-rows { display: flex; flex-direction: column; gap: 10px; }
.bell-row { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 12px; align-items: end; }
.bell-row .lesson-no-badge { margin-bottom: 8px; }

/* ---------- Вход ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 22%, var(--bg)), var(--bg)); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { display: flex; justify-content: center; padding: 36px 16px 8px; }
.auth-top .brand { padding: 0; }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 16px 16px 40px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 40px rgba(57, 55, 129, .10); padding: 32px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 20px; }
.auth-card .form { margin-top: 18px; }
.auth-card .btn-wide { margin-top: 6px; }
.auth-links { margin: 18px 0 0; text-align: center; font-size: 14px; }
.auth-foot { margin-top: 20px; color: var(--faint); font-size: 13px; text-align: center; }

/* ---------- Загрузка страницы ---------- */
html.is-loading::before { content: ""; position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: 3px; background: var(--gold); transform-origin: left; animation: loading 1s ease-in-out infinite; }
@keyframes loading { 0% { transform: scaleX(.1); } 60% { transform: scaleX(.7); } 100% { transform: scaleX(1); opacity: .4; } }
.fade-in { animation: fade-in .16s ease-out; }
@keyframes fade-in { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.is-loading::before, .fade-in { animation: none; } }

/* ---------- Планшет ---------- */
@media (max-width: 1180px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1000px) {
  .journal { grid-template-columns: 1fr; }
  .journal-form { position: static; }
  .main { padding: 24px 24px 64px; }
}

/* ---------- Телефон ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 23px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
  .grid-main { grid-template-columns: 1fr; }

  .week-strip { gap: 6px; margin: 0 -16px 18px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
  .week-strip::-webkit-scrollbar { display: none; }
  .week-arrow { display: none; }
  .day { flex: 0 0 auto; min-width: 58px; text-align: center; padding: 8px 6px; }
  .day span { float: none; display: block; margin: 0; font-size: 11px; }

  .day-tabs { display: flex; gap: 6px; margin: 0 -16px 14px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
  .day-tabs a { flex: 1 0 48px; text-align: center; padding: 8px 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
  .day-tabs a:hover { text-decoration: none; }
  .day-tabs small { display: block; font-size: 12px; color: var(--muted); }
  .day-tabs b { font-size: 17px; }
  .day-tabs a.is-today small { color: var(--accent-text); font-weight: 600; }
  .day-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .day-tabs a.active small { color: rgba(255, 255, 255, .8); }
  .week-grid { grid-template-columns: 1fr; }
  .week-grid .day-card { display: none; }
  .week-grid .day-card.is-selected { display: block; }

  .lesson { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 12px 8px; }
  .lesson-no { display: none; }
  .task-cards { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr auto; }
  .card-head { padding: 14px 16px 6px; }
  .form-card { padding: 16px; }
  .search, .inline-form, .inline-form select { width: 100%; max-width: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .people .tags { display: none; }

  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 500; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent-text); }
  .tabbar a.active .icon { stroke-width: 2.2; }

  .auth-card { padding: 24px 20px; border-radius: 20px; }
  .auth-top { padding-top: 28px; }
}
