/*
 * Оформление.
 *
 * Плотный, спокойный интерфейс без украшательств. Администратор смотрит сюда
 * весь день и делает одно и то же действие десятки раз — важнее, чтобы
 * попадалось с первого раза, чем чтобы было нарядно.
 *
 * Значения цветов, отступов и радиусов взяты из design/HANDOFF.md и эталона
 * design/CRM Центр.dc.html. Менять их здесь, а не по месту: иначе через месяц
 * в проекте будет пять оттенков серого, и ни один не будет тем самым.
 */

/* ---------------------------------------------------------------------------
 * Шрифт
 * -------------------------------------------------------------------------
 * Спецификация просит Public Sans. Он не подошёл: у него нет кириллицы —
 * только латиница и вьетнамский. Весь интерфейс на русском, то есть шрифт
 * не отобразил бы почти ни одной буквы, а браузер молча подставил бы
 * системный. Взят Inter: тот же нейтральный гротеск с теми же пропорциями,
 * но с полной кириллицей.
 *
 * Файлы лежат у нас, а не запрашиваются с серверов Google. Причина не в
 * скорости: на странице видны имена детей и телефоны родителей, и обращаться
 * при каждом открытии к стороннему сервису незачем — он узнаёт адрес страницы
 * и адрес посетителя. Заодно интерфейс не зависит от чужой доступности.
 */

@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------------------
 * Токены
 * Цвета — только через токены: иначе котиковая тема их не перекрасит.
 * ------------------------------------------------------------------------- */

:root {
  --bg:        #f4f3f1;
  --surface:   #ffffff;
  --border:    #e4e1dd;
  --border-2:  #f1efec;   /* разделители строк внутри таблиц */
  --hover:     #faf9f8;
  --ink:       #1b1a18;
  --ink-2:     #3a3631;
  --ink-muted: #6f6b66;
  --ink-dim:   #8d8781;

  --accent:      oklch(0.55 0.13 30);   /* терракота */
  --accent-dark: oklch(0.48 0.13 30);
  --accent-deep: oklch(0.42 0.13 30);
  --accent-bg:   oklch(0.97 0.025 30);
  --accent-line: oklch(0.88 0.05 30);

  --positive:    oklch(0.55 0.13 160);
  --positive-bg: oklch(0.96 0.03 160);

  --sidebar:        #1b1a18;
  --sidebar-ink:    #b6b0a9;
  --sidebar-active: #2e2b28;

  --field-border: #ddd9d4;
  --field-hover:  #bdb8b1;

  --radius-card: 12px;
  --radius:      8px;
  --radius-pill: 99px;

  --ring: 0 0 0 3px oklch(0.55 0.13 30 / 0.12);

  /* Прежние имена переменных. Экраны, до которых редизайн ещё не дошёл,
   * написаны на них — пусть берут новую палитру, не дожидаясь своей очереди. */
  --muted:     var(--ink-muted);
  --line:      var(--border);
  --card:      var(--surface);
  --ok:        var(--positive);
  --ok-bg:     var(--positive-bg);
  --warn:      var(--accent-deep);
  --warn-bg:   var(--accent-bg);
  --danger:    oklch(0.52 0.18 25);
  --danger-bg: oklch(0.96 0.03 25);

  /* Цвета поверх тёмной боковой панели и заливок */
  --sidebar-text:   #e9e6e2;
  --sidebar-strong: #fff;
  --sidebar-hover:  #26231f;
  --sidebar-dot:    #4a453f;
  --sidebar-quiet:  #5d574f;
  --sidebar-border: #2e2b28;
  --on-accent:      #fff;   /* текст на акцентной и зелёной заливке */
  --on-dark:        #fff;   /* текст на чёрной (ink) заливке */
  --dark-hover:     #000;

  /* Ссылки, подсказки, полоски, оттенки */
  --link:           oklch(0.52 0.14 30);
  --link-hover:     oklch(0.44 0.14 30);
  --placeholder:    #a7a29b;
  --track:          #eeebe7;
  --border-3:       #eeebe7;
  --accent-soft:    oklch(0.94 0.04 30);
  --positive-dark:  oklch(0.48 0.13 160);
  --positive-soft:  oklch(0.95 0.03 160);
  --positive-deep:  oklch(0.4 0.12 160);
  --danger-line:    oklch(0.86 0.08 25);
  --topbar-bg:      rgba(244, 243, 241, 0.92);   /* липкая панель сверху, полупрозрачная */

  /* Цепочка абонементов: «всё в порядке» */
  --chain-ok-bg:     oklch(0.97 0.025 160);
  --chain-ok-line:   oklch(0.88 0.05 160);
  --chain-ok-line-2: oklch(0.88 0.06 160);
  --chain-ok-ink:    oklch(0.45 0.06 160);
  --chain-ok-strong: oklch(0.38 0.12 160);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 400 13px/1.55 'Inter var', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

input, select, button, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--placeholder); }

h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }

.sub { color: var(--ink-muted); margin: 0 0 14px; font-size: 13px; }
.empty { color: var(--ink-muted); padding: 20px 0; }
.hint { color: var(--ink-dim); font-size: 12px; }
.detail { color: var(--ink-dim); font-size: 12px; margin-top: 2px; }
.muted { color: var(--ink-muted); }
.nowrap { white-space: nowrap; }
.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Надзаголовок раздела: 11px, прописные, разрядка. */
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-dim);
}

/* ---------------------------------------------------------------------------
 * Каркас: боковое меню + липкая панель + содержимое
 * ------------------------------------------------------------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.sidebar-brand { padding: 20px 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-brand .name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--sidebar-strong); }
.sidebar-brand .kind { font-size: 12px; color: var(--ink-dim); }

.sidebar nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 10px; overflow-y: auto;
}

.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  color: var(--sidebar-ink); font-size: 13px; text-decoration: none;
}
.sidebar nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-text); text-decoration: none; }
.sidebar nav a.current { background: var(--sidebar-active); color: var(--sidebar-strong); font-weight: 500; }

.sidebar nav .label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar nav .label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Точка слева: у активного пункта акцентная, у остальных приглушённая. */
.sidebar nav .dot {
  width: 5px; height: 5px; border-radius: 50%; flex: 0 0 5px; background: var(--sidebar-dot);
}
.sidebar nav a.current .dot { background: var(--accent); }

.sidebar nav .badge {
  font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent);
}

.sidebar-foot {
  margin-top: auto; padding: 14px 18px 18px;
  border-top: 1px solid var(--sidebar-active);
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
  background: var(--ink-2); color: var(--sidebar-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.sidebar-user .who { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user .who b {
  font-size: 12px; font-weight: 500; color: var(--sidebar-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user .who span { font-size: 11px; color: var(--ink-dim); }
/* Тихая ссылка: видно, если искать, и не видно, если не искать. */
.sidebar-foot .quiet-link {
  font-size: 11px; color: var(--sidebar-quiet); text-decoration: none;
}
.sidebar-foot .quiet-link:hover { color: var(--sidebar-ink); text-decoration: underline; }

.sidebar-foot button.link {
  align-self: flex-start; background: none; border: none; padding: 0;
  color: var(--ink-dim); font-size: 12px; cursor: pointer;
}
.sidebar-foot button.link:hover { color: var(--sidebar-text); }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar .search { flex: 1 1 320px; max-width: 480px; min-width: 220px; display: flex; gap: 8px; }
.topbar .search input { flex: 1; min-width: 0; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

main { flex: 1; padding: 24px 28px 56px; }

/* Вход — единственная страница без каркаса. */
body.centered { display: grid; place-items: center; min-height: 100vh; }

/* ---------------------------------------------------------------------------
 * Компоненты
 * ------------------------------------------------------------------------- */

/*
 * Карточка сама расставляет отступы между тем, что внутри.
 *
 * Раньше не расставляла, и каждый блок внутри приходилось отбивать вручную —
 * где забыл, там строки слипались. Один gap вместо тридцати правок по месту.
 *
 * <details class="card"> сюда не входит намеренно: display:flex на нём
 * ломает сворачивание — содержимое показывается даже в закрытом виде.
 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 18px;
  margin-bottom: 16px;
}
.card:not(details) { display: flex; flex-direction: column; gap: 14px; }
/* Только прямые потомки: вложенному (полю внутри fieldset) свои отступы нужны. */
.card:not(details) > * { margin-top: 0; margin-bottom: 0; }

.card.narrow { max-width: 520px; margin: 40px auto; }

/*
 * Ритм между блоками страницы.
 *
 * Касается только тех, у кого своего отступа нет: у карточки и панели
 * фильтров он есть и остаётся. Последний блок не отбивается — иначе
 * внизу страницы появлялась бы лишняя пустота.
 */
main > * { margin-bottom: 16px; }
main > *:last-child { margin-bottom: 0; }

/* Заголовок, разделяющий два блока на одном экране. */
.section-title { margin: 26px 0 0; }

.btn, a.button-link,
button.primary, .form-actions button, .lesson-actions button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--field-border); background: var(--surface);
  color: var(--ink); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.btn:hover, a.button-link:hover { border-color: var(--field-hover); text-decoration: none; }

.btn-primary, button.primary {
  background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600;
}
.btn-primary:hover, button.primary:hover { background: var(--accent-dark); color: var(--on-accent); }

.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--on-dark); font-weight: 600; }
.btn-dark:hover { background: var(--dark-hover); color: var(--on-dark); }

.btn-positive { background: var(--positive); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn-positive:hover { background: var(--positive-dark); color: var(--on-accent); }

input[type="text"], input[type="search"], input[type="tel"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"], select, textarea {
  padding: 9px 12px; border: 1px solid var(--field-border);
  border-radius: var(--radius); background: var(--surface);
  font-size: 13px; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: var(--ring);
}
textarea { resize: vertical; }

/* Нативные чекбоксы на плотном фоне терялись — отсюда своя отрисовка. */
input[type="checkbox"] {
  appearance: none; width: 18px; height: 18px; flex: 0 0 18px;
  border: 1px solid var(--field-border); border-radius: 5px;
  background: var(--surface); cursor: pointer; vertical-align: -4px;
}
input[type="checkbox"]:checked {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.4l3 3 6-6.6'/%3E%3C/svg%3E") center/13px no-repeat;
  border-color: var(--accent);
}
input[type="checkbox"]:focus { box-shadow: var(--ring); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-pill);
  background: var(--bg); color: var(--ink-2);
}
.badge-accent { background: var(--accent-bg); color: var(--accent-deep); }
.badge-positive { background: var(--positive-soft); color: var(--positive-deep); }
.ok-badge, .warn-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-pill);
}
.ok-badge { background: var(--positive-bg); color: var(--positive); }
.warn-badge { background: var(--accent-bg); color: var(--accent-deep); }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.page-head .titles { display: flex; flex-direction: column; gap: 4px; }

/* ---------------------------------------------------------------------------
 * Списки-сетки
 * -------------------------------------------------------------------------
 * Вместо <table> — сетка из ссылок. Причина одна: строка целиком должна быть
 * кликабельной. Администратор целится в имя ребёнка и промахивается по нему
 * десятки раз за день; ссылка на всю строку убирает этот промах.
 */

.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow-x: auto;
}

.grid-head {
  padding: 11px 18px; background: var(--hover);
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-dim); white-space: nowrap;
}

.grid-row {
  padding: 13px 18px; border-bottom: 1px solid var(--border-2);
  font-size: 13px; align-items: center; color: var(--ink); text-decoration: none;
}
.grid-row:last-child { border-bottom: none; }
a.grid-row:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.grid-row.dim { opacity: 0.6; }

.grid-head, .grid-row { display: grid; gap: 12px; }

.students-grid {
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1.4fr)
                         minmax(0, 1.1fr) minmax(0, 1fr) 92px;
  min-width: 820px;
}

.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stack b { font-weight: 600; }
.stack .detail { margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Полоса посещаемости: число рядом, потому что одна полоса без числа
 * отвечает «примерно столько», а разговор с родителем требует точного. */
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar {
  flex: 1; max-width: 56px; height: 5px; border-radius: var(--radius-pill);
  background: var(--track); overflow: hidden;
}
.bar > span { display: block; height: 5px; border-radius: var(--radius-pill); }
.bar-value { font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Чипы-фильтры */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 7px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--field-border); background: var(--surface);
  font-size: 12px; font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.chip:hover { border-color: var(--field-hover); color: var(--ink); text-decoration: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.chip.on:hover { color: var(--on-dark); }

/* Пустое состояние: объяснение и кнопка, а не одинокое «ничего нет».
 * Человек, попавший сюда впервые, должен понять, что делать дальше. */
.empty-state {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  max-width: 560px;
}
.empty-state h2 { margin: 0; font-size: 15px; }
.empty-state .sub { margin: 0 0 8px; }

/* ---------------------------------------------------------------------------
 * Экран дня
 * ------------------------------------------------------------------------- */

.day { display: flex; flex-direction: column; gap: 18px; }

.day-nav { display: flex; gap: 6px; align-items: center; }
.day-nav a, .day-nav span {
  display: inline-flex; align-items: center;
  padding: 8px 12px; border: 1px solid var(--field-border);
  background: var(--surface); border-radius: var(--radius);
  font-size: 13px; color: var(--ink); text-decoration: none;
}
.day-nav a:hover { border-color: var(--field-hover); text-decoration: none; }
.day-nav .today-on {
  background: var(--ink); border-color: var(--ink); color: var(--on-dark); font-weight: 600;
}

.day-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }

/* Колонки педагогов: раньше не уже 212 px, и на ноутбуке помещались три —
 * четвёртый педагог уезжал за правый край, а с ним и его занятия. Теперь
 * не уже 148 px, имя ребёнка переносится на вторую строку, и четыре колонки
 * рядом с панелью справа помещаются на экране в 1366 px. Если педагогов пять
 * и больше (класс .many), сетка занимает всю ширину, а панель уходит под неё. */
.day-grid {
  flex: 1 1 480px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow-x: auto;
}
.day-body.many .day-grid { flex-basis: 100%; }
/* Число колонок — класс, а не встроенный стиль (его блокирует политика безопасности). */
.day-grid.cols-1  { --cols: 1; }
.day-grid.cols-2  { --cols: 2; }
.day-grid.cols-3  { --cols: 3; }
.day-grid.cols-4  { --cols: 4; }
.day-grid.cols-5  { --cols: 5; }
.day-grid.cols-6  { --cols: 6; }
.day-grid.cols-7  { --cols: 7; }
.day-grid.cols-8  { --cols: 8; }
.day-grid.cols-9  { --cols: 9; }
.day-grid.cols-10 { --cols: 10; }
.day-grid.cols-11 { --cols: 11; }
.day-grid.cols-12 { --cols: 12; }
.day-grid .row {
  display: grid;
  grid-template-columns: 56px repeat(var(--cols, 3), minmax(0, 1fr));
  min-width: calc(56px + var(--cols, 3) * 148px);
  border-bottom: 1px solid var(--border-2);
  min-height: 62px;
}
.day-grid .row.head {
  background: var(--hover); border-bottom: 1px solid var(--border);
  min-height: 0; position: sticky; top: 0; z-index: 1;
}
.day-grid .row.head .teacher {
  padding: 10px 14px; border-left: 1px solid var(--border-3);
  display: flex; flex-direction: column; gap: 2px;
}
/* Имя педагога крупнее и жирнее имён детей в ячейках: раньше сливалось с ними. */
.day-grid .row.head .teacher b { font-size: 15px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.day-grid .row.head .teacher span { font-size: 11px; color: var(--ink-dim); }
.day-grid .row.head { background: var(--accent-bg); border-bottom: 2px solid var(--accent-line); }
.day-grid .row.head .corner { padding: 10px 8px; }

.day-grid .hour {
  padding: 8px; font-size: 11px; color: var(--ink-dim);
  text-align: right; font-variant-numeric: tabular-nums;
}
.day-grid .cell {
  border-left: 1px solid var(--border-2); padding: 6px; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}

/* Занятие в ячейке. Ссылка-якорь: щелчок открывает панель справа
 * без перезагрузки страницы и без единой строчки скриптов. */
.day-grid .lesson {
  display: flex; flex-direction: column; gap: 3px; width: 100%;
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.day-grid .lesson:hover { border-color: var(--field-hover); text-decoration: none; }
.day-grid .lesson .child {
  font-size: 13px; font-weight: 600; line-height: 1.25;
  overflow-wrap: anywhere;
}
.day-grid .lesson .line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px;
  font-size: 11px; color: var(--ink-muted); min-width: 0;
}
.day-grid .lesson .line .dir {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day-grid .lesson .line .state { flex: 0 0 auto; font-weight: 600; }

/* Значок «↗» в углу ячейки — прямая ссылка на карточку ученика. Лежит рядом
 * с блоком занятия, а не внутри: ссылка в ссылке недопустима. Имени справа
 * оставлен отступ, чтобы длинное имя не уходило под значок. */
.day-grid .lesson-item { position: relative; }
.day-grid .lesson .child { padding-right: 24px; }
.day-grid .to-card {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 6px; font-size: 13px; line-height: 1;
  color: var(--ink-muted); text-decoration: none;
}
.day-grid .to-card:hover,
.day-grid .to-card:focus-visible { background: var(--hover); color: var(--ink); text-decoration: none; }

/* Ждёт отметки — то единственное, ради чего этот экран открывают.
 * Поэтому акцентный фон: видно, не вчитываясь. */
.day-grid .lesson.waiting { background: var(--accent-bg); border-color: var(--accent-line); }
.day-grid .lesson.waiting .state { color: var(--accent-deep); }
.day-grid .lesson.done .state { color: var(--positive); }
.day-grid .lesson.idle { opacity: 0.75; }
.day-grid .lesson.idle .state { color: var(--ink-dim); }
/* Ребёнка ждали по расписанию, а занятия у него нет: пунктир, а не сплошная рамка. */
.day-grid .lesson.ghost { background: transparent; border-style: dashed; border-color: var(--field-border); }
.day-grid .lesson.ghost .child { color: var(--ink-2); }
.day-grid .lesson.ghost .state { color: var(--accent-deep); }

.day-side {
  flex: 0 1 300px; max-width: 320px; min-width: 260px;
  display: flex; flex-direction: column; gap: 14px;
}
/* Пять педагогов и больше: сетка на всю ширину, панель под ней — на всю ширину сетки. */
.day-body.many .day-side { flex-basis: 100%; max-width: none; }

/* Список дня для телефона. На широком экране его нет: там сетка и панель справа. */
.day-list { display: none; flex-direction: column; gap: 8px; width: 100%; }
.day-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 11px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
.day-row:hover { border-color: var(--field-hover); text-decoration: none; }
.day-row-time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.day-row .child { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.day-row .meta { font-size: 12px; color: var(--ink-muted); }
.day-row .teacher-name { color: var(--ink); font-weight: 800; }
.day-row-state { font-size: 12px; font-weight: 600; color: var(--ink-dim); text-align: right; max-width: 120px; }
.day-row.waiting { background: var(--accent-bg); border-color: var(--accent-line); }
.day-row.waiting .day-row-state { color: var(--accent-deep); }
.day-row.done .day-row-state { color: var(--positive); }
.day-row.ghost { background: transparent; border-style: dashed; border-color: var(--field-border); }
.day-row.ghost .day-row-state { color: var(--accent-deep); }

/* Панель занятия. Спрятана, пока на неё не указал адрес страницы.
 *
 * Селектор с .day-side > — не прихоть: панель это .card, а у .card:not(details)
 * стоит display: flex (правило отступов от 15.09), и обычное .lesson-panel
 * { display: none } проигрывало ему по весу. С 15.09 панели всех занятий
 * висели на экране подряд, хотя должны появляться только по нажатию. */
.day-side > .lesson-panel { display: none; }
.day-side > .lesson-panel:target { display: flex; flex-direction: column; gap: 14px; }
/* Подсказка «выберите занятие» уходит, как только панель открыта. */
.day-side:has(.lesson-panel:target) .lesson-pick { display: none; }

.lesson-panel .who { display: flex; flex-direction: column; gap: 3px; }
/* Микроподпись внутри карточки мельче, чем надзаголовок экрана, — как в эталоне. */
.lesson-panel .who .eyebrow { font-size: 11px; letter-spacing: 0.05em; }
.lesson-panel .who .name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.lesson-panel .who .meta { font-size: 13px; color: var(--ink-muted); }

.lesson-facts {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; background: var(--hover); border-radius: 9px; font-size: 13px;
}
.lesson-facts > span { display: flex; justify-content: space-between; gap: 10px; }
.lesson-facts .k { color: var(--ink-muted); }
.lesson-facts .v { font-weight: 600; }

.lesson-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lesson-buttons form { display: contents; }
.lesson-buttons .btn, .lesson-buttons button, .lesson-buttons a.button-link { width: 100%; padding: 10px; }

.lesson-panel .close {
  align-self: flex-start; font-size: 12px; color: var(--ink-dim);
}

.lesson-pick {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px;
  font-size: 13px; color: var(--ink-muted);
}

.attention {
  background: var(--accent-bg); border: 1px solid var(--accent-line);
  border-radius: var(--radius-card); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.attention h2 { margin: 0; font-size: 13px; font-weight: 700; color: var(--accent-deep); }
.attention ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.attention li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px; border-top: 1px solid var(--accent-line); padding-top: 9px;
}
.attention a { color: var(--ink-2); }
.attention .count { font-weight: 700; color: var(--accent-deep); font-variant-numeric: tabular-nums; }

/* Экран дня: кого ждали по расписанию, а занятия нет. */
.missing-card { margin-top: 20px; }
.missing-hint { margin: 0; padding: 12px 18px; }

/* ---------------------------------------------------------------------------
 * «Руководство» и «Что нового»
 * -------------------------------------------------------------------------
 * Текст руководства — src/web/views/manual-body.eta, тот же файл, из которого
 * собирается PDF (scripts/build-manual.ts). Печатные стили PDF лежат в скрипте,
 * а здесь — экранные, на переменных сайта. Всё под .manual, чтобы заголовки
 * и таблицы руководства не задели остальные страницы. */
.help-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px;
  border-bottom: 1px solid var(--border);
}
.help-tabs a {
  padding: 8px 14px; margin-bottom: -1px; color: var(--ink-muted);
  border: 1px solid transparent; border-radius: var(--radius) var(--radius) 0 0;
  font-size: 14px; font-weight: 600;
}
.help-tabs a:hover { color: var(--ink); }
.help-tabs a.current {
  color: var(--ink); background: var(--surface);
  border-color: var(--border); border-bottom-color: var(--surface);
}
.help-tabs .help-pdf { margin-left: auto; font-weight: 400; }

.manual { max-width: 860px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.manual h2 {
  font-size: 20px; margin: 34px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border); color: var(--ink);
  scroll-margin-top: 16px;
}
.manual section:first-of-type h2 { margin-top: 18px; }
.manual h3 { font-size: 15px; margin: 20px 0 6px; color: var(--ink); scroll-margin-top: 16px; }
.manual p { margin: 0 0 9px; }
.manual ul, .manual ol { margin: 0 0 10px; padding-left: 22px; }
.manual li { margin-bottom: 4px; }
.manual a { color: var(--accent-deep); }
.manual .back { float: right; font-size: 12px; font-weight: 400; color: var(--ink-dim); }
.manual table {
  border-collapse: collapse; width: 100%; margin: 8px 0 14px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
}
.manual th, .manual td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.manual th { background: var(--hover); color: var(--ink); font-weight: 600; }
.manual .note {
  background: var(--accent-bg); border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 9px 13px; margin: 10px 0 14px;
}
.manual .toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 14px 18px; margin: 14px 0 6px;
}
.manual .toc b.t { font-size: 15px; color: var(--ink); }
.manual .toc ol { list-style: none; padding: 0; margin: 10px 0 0; columns: 2; column-gap: 28px; }
.manual .toc > ol > li { break-inside: avoid; margin-bottom: 10px; font-weight: 600; }
.manual .toc ul { list-style: none; padding: 0 0 0 12px; margin: 3px 0 0; font-weight: 400; font-size: 13px; }
.manual .toc ul li { margin-bottom: 2px; }
.manual .fig { margin: 12px 0; }
.manual .fig svg { width: 100%; height: auto; }
.manual .foot { margin-top: 28px; color: var(--ink-dim); font-size: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
@media (max-width: 720px) {
  .manual .toc ol { columns: 1; }
}

.changelog { max-width: 760px; }
.changelog-entry { margin: 0 0 18px; }
.changelog-entry h2 { margin: 0 0 2px; font-size: 16px; }
.changelog-date { margin: 0 0 8px; color: var(--ink-dim); font-size: 12px; }
.changelog-entry ul { margin: 0; padding-left: 20px; }
.changelog-entry li { margin-bottom: 6px; font-size: 14px; line-height: 1.5; }

/* ---------------------------------------------------------------------------
 * Раскладки экранов
 * ------------------------------------------------------------------------- */

/* Таблица слева, форма добавления справа. Раньше форма стояла под таблицей
 * и ломала ритм страницы: глаз доходил до конца списка и упирался в поля. */
.two-columns {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
}
.side-form { margin-bottom: 0; }

.cards-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.cards-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.columns-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.stack-column { display: flex; flex-direction: column; gap: 16px; }
.narrow-page { max-width: 820px; }

.cards-2 .card, .cards-3 .card, .cards-grid .card, .stack-column .card { margin-bottom: 0; }

/* Заголовок человека: инициалы в кружке (ребёнок) или квадрате (педагог). */
.person { display: flex; align-items: center; gap: 14px; min-width: 0; }
.person-mark {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.person-mark.square {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px;
  background: var(--border-2); color: var(--ink-2); font-size: 13px;
}

.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Карточка с крупным числом: остаток абонемента, посещаемость. */
.big-number { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.big-number b { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.big-number span { font-size: 13px; color: var(--ink-muted); padding-bottom: 3px; }

.bar.tall { max-width: none; height: 8px; }
.bar.tall > span { height: 8px; }

.facts { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.facts > span { display: flex; justify-content: space-between; gap: 10px; }
.facts .k { color: var(--ink-muted); }
.facts .v { font-weight: 600; text-align: right; }
/* Свободный текст в строке фактов («Ещё контакт»): длинное не раздвигает карточку. */
.facts .v.wrap { min-width: 0; overflow-wrap: anywhere; }

/* Заметка о ребёнке: переводы строк из формы сохраняются. */
.student-note .note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Лента занятий: цвет несёт значение, высота одинаковая. */
.bars { display: flex; gap: 4px; align-items: stretch; height: 44px; }
.bars > span { flex: 1; border-radius: 3px; min-width: 4px; }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-outline {
  font-size: 12px; padding: 4px 9px; border-radius: var(--radius-pill);
  background: var(--hover); border: 1px solid var(--border-3); color: var(--ink-2);
}

.counters {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--border-2); font-size: 13px;
}
.counters > span { display: flex; flex-direction: column; }
.counters b { font-weight: 700; }

/* Колонки лидов */
.column { display: flex; flex-direction: column; gap: 10px; }
.column-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-dim); white-space: nowrap;
}
.lead-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 14px; display: flex; flex-direction: column; gap: 7px;
}
.lead-card b { font-size: 14px; font-weight: 600; }
.lead-actions { display: flex; gap: 6px; padding-top: 4px; }
.btn.small { padding: 6px 10px; border-radius: 7px; font-size: 12px; }

/* Задачи */
.task-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 0;
}
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stack-column .task { max-width: 760px; }

/* Заголовок внутри карточки-таблицы */
.table-title {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px; font-size: 13px;
}
.table-title b { font-size: 15px; font-weight: 700; }
.table-title .detail { margin: 0; }

.row-inline { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* Строки внутри карточек сводки */
.rows { display: flex; flex-direction: column; }
.row-3, .row-2 {
  display: grid; gap: 10px; align-items: center;
  border-top: 1px solid var(--border-2); padding-top: 9px; margin-top: 9px;
  font-size: 13px;
}
.row-3 { grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1.1fr); }
.row-2 { grid-template-columns: minmax(0, 1fr) auto; }
.rows > :first-child { border-top: none; padding-top: 0; margin-top: 0; }
.row-3 .num { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.fall { font-weight: 700; color: var(--accent-deep); white-space: nowrap; }

.mini-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini-tiles > span {
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 12px; background: var(--hover); border-radius: 9px;
}
.mini-tiles b { font-size: 20px; font-weight: 700; }
.mini-tiles .warn { background: var(--accent-bg); }
.mini-tiles .warn b { color: var(--accent-deep); }

/* Сетки конкретных списков */
.history-grid { grid-template-columns: 150px minmax(0, 1.6fr) 90px minmax(0, 1.2fr); min-width: 660px; }
.leads-grid { grid-template-columns: minmax(0,1.3fr) minmax(0,1.3fr) minmax(0,1.4fr) 120px 140px; min-width: 760px; }
.failed-grid { grid-template-columns: minmax(0,1fr) minmax(0,2fr) minmax(0,1.2fr) 150px; min-width: 720px; }
.staff-grid { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr) minmax(0,1.2fr) minmax(0,1.1fr) 110px; min-width: 740px; }
.directions-grid { grid-template-columns: minmax(0,2fr) 90px 110px 90px; min-width: 520px; }
.directions-stats-grid { grid-template-columns: minmax(0,2fr) 100px 160px; min-width: 460px; }
.audit-grid { grid-template-columns: 170px minmax(0,1.3fr) minmax(0,1.6fr) minmax(0,1fr); min-width: 800px; }
.teachers-grid { grid-template-columns: minmax(0,2fr) repeat(4, minmax(0,1fr)); min-width: 780px; }

.grid-row.adjustment { background: var(--positive-bg); }

/* Плашка целостности журнала */
.chain {
  border-radius: var(--radius-card); padding: 14px 16px; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 3px; font-size: 13px;
}
.chain b { font-weight: 700; }
.chain-ok {
  background: var(--chain-ok-bg); border: 1px solid var(--chain-ok-line);
  color: var(--chain-ok-ink);
}
.chain-ok b { color: var(--chain-ok-strong); }
.chain-broken {
  background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger);
}

/* Настройки */
.setting.bordered { border-top: 1px solid var(--border-2); padding-top: 12px; margin-top: 4px; }
.check-text { display: flex; flex-direction: column; gap: 2px; }
.check-text .hint { margin: 0; }

/* ---------------------------------------------------------------------------
 * Вход
 * ------------------------------------------------------------------------- */

.login-card { width: min(360px, 92vw); }
.login-card h1 { font-size: 20px; margin-bottom: 16px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--ink-muted); }
.login-card input { display: block; width: 100%; margin-top: 4px; }
.login-card button { width: 100%; }

.error {
  background: var(--danger-bg); color: var(--danger);
  padding: 9px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px;
}

/* ---------------------------------------------------------------------------
 * Ниже — экраны, до которых редизайн ещё не дошёл.
 * Они работают на прежних правилах, но уже в новой палитре.
 * ------------------------------------------------------------------------- */

.status { font-weight: 500; }
.status-conducted { color: var(--positive); }
.status-no_show, .status-late_cancel, .status-burned { color: var(--accent-deep); }
.status-center_fault, .status-sick_certified, .status-early_cancel { color: var(--ink-muted); }
.debit { color: var(--ink-muted); }

button.link {
  background: none; border: none; padding: 0;
  color: var(--accent); cursor: pointer; font-size: 13px;
}
button.link:hover { text-decoration: underline; }

/* --- Карточка ученика --- */

.contact { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 14px; font-size: 13px; }
.contact dt { color: var(--ink-muted); }
.contact dd { margin: 0; }

.attendance { margin: 0; font-size: 13px; }
.attendance .hint { display: block; margin-top: 2px; }

.subscription.past { opacity: 0.82; }
.tag {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: var(--radius-pill); background: var(--bg); color: var(--ink-2);
}
/* Закрытый абонемент: срок вышел или закрыт досрочно. Не должен выглядеть живым. */
.tag.closed { background: var(--accent-bg); color: var(--accent-deep); }
.closed-note { margin: 8px 0 6px; font-size: 13px; color: var(--accent-deep); }

table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
table.history th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-dim);
  padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border);
}
table.history td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--border-2); vertical-align: top; }
table.history .who { color: var(--ink-dim); font-size: 12px; white-space: nowrap; }
table.history tr.adjustment td { background: var(--positive-bg); }

/* --- Фильтры на списках --- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { min-width: 260px; flex: 1; }
.filters button { cursor: pointer; padding: 9px 12px; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); }
.filters .reset { color: var(--ink-muted); font-size: 13px; }
.filters a { font-size: 13px; }
.filters a.current-filter { color: var(--ink); font-weight: 600; }

/* --- Таблицы-списки --- */

table.list {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow: hidden;
}
table.list th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-dim);
  padding: 11px 18px; border-bottom: 1px solid var(--border); background: var(--hover);
  white-space: nowrap;
}
table.list td { padding: 13px 18px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: var(--hover); }
table.list tr.dim { opacity: 0.6; }
table.list a { color: var(--ink); }
table.list select:disabled { color: var(--ink-muted); background: var(--bg); }
table.list td.num, table.list th.num {
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
table.compact td { padding: 8px 12px 8px 0; }

.low { color: var(--accent-deep); font-weight: 600; }

/* --- Задачи --- */

.task-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 10px; flex-wrap: wrap; }
.task-head .when { margin-left: auto; font-size: 12px; color: var(--ink-dim); }
pre.message {
  background: var(--hover); border: 1px solid var(--border); border-radius: 9px;
  padding: 12px; margin: 0 0 12px; white-space: pre-wrap; font: inherit; font-size: 13px;
}

/* --- Журнал --- */

.chain { font-size: 13px; }
.chain-ok { background: var(--positive-bg); border-color: var(--chain-ok-line-2); }
.chain-broken { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chain .detail { margin-top: 8px; }
table.audit .details { color: var(--ink-dim); font-size: 12px; }

/* --- Настройки --- */

.setting { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.setting input[type="number"] { width: 90px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.check > input[type="checkbox"] { margin-top: 1px; }
/* Подсказка прямым потомком уходит на свою строку под текстом.
 * Без этого она вставала сбоку и сплющивала подпись до пары слов в строке. */
.check > .hint { flex-basis: 100%; margin: 2px 0 0 28px; }
.saved {
  background: var(--positive-bg); color: var(--positive);
  padding: 9px 12px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px;
}

/* --- Исправление списания --- */

details.fix summary, details.cancel summary, details.absence summary, details.single summary,
.row-actions details summary, .teacher details summary {
  cursor: pointer; color: var(--accent); font-size: 13px; list-style: none;
}
details summary::-webkit-details-marker { display: none; }
.fix-form, .cancel-form, .absence-form, .single-form, .mini-form {
  margin-top: 8px; padding: 12px; width: min(340px, 80vw);
  border: 1px solid var(--border); border-radius: 9px; background: var(--hover);
}
.fix-form .radio, .absence-form .radio { display: block; margin-bottom: 8px; font-size: 13px; }
.cancel-form .hint { margin: 0 0 10px; }
.fix-form textarea, .mini-form input { width: 100%; margin: 8px 0; }

/* --- Формы --- */

.form { max-width: 560px; }
.form fieldset { border: none; padding: 0; margin: 0 0 22px; }
.form legend {
  padding: 0; margin-bottom: 12px; font-size: 11px; font-weight: 600;
  color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.05em;
}

.field { display: block; margin-bottom: 14px; }
.field > span:first-child { display: block; font-size: 12px; color: var(--ink-muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { display: block; width: 100%; }
.field .hint { display: block; margin-top: 4px; }
.field .row { display: flex; gap: 8px; }
.field .row input { width: auto; flex: 1; }

.form-actions { display: flex; gap: 14px; align-items: center; }
.form-actions a { color: var(--ink-muted); font-size: 13px; }

.note-box { background: var(--hover); font-size: 13px; }
.error-box { background: var(--danger-bg); border-color: var(--danger-line); font-size: 13px; }

/* --- Действия в карточке --- */

.card-actions {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-2);
  font-size: 13px;
}
.close-sub { float: right; font-size: 12px; font-weight: 400; }

/* --- Расписание --- */

ul.rules { list-style: none; padding: 0; margin: 0; }
ul.rules li {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--border-2);
}
ul.rules li:last-child { border-bottom: none; }
.rule-day { min-width: 120px; }
.rule-time { font-variant-numeric: tabular-nums; font-weight: 600; }
select.slots { font-variant-numeric: tabular-nums; }

/* --- Лиды, сотрудники, педагоги, направления --- */

.inline { display: inline; }
.inline-status select { font-size: 12px; padding: 4px 8px; }
a.convert { display: block; margin-top: 4px; font-size: 12px; }
.row-actions { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.teacher-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.teacher details > * { margin-top: 12px; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; margin-right: 16px; margin-bottom: 6px; }

/* --- Сводка --- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px;
}
.tile-warn { background: var(--accent-bg); border-color: var(--accent-line); }
.tile-value {
  display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.tile-warn .tile-value { color: var(--accent-deep); }
.tile-label { display: block; color: var(--ink-muted); font-size: 13px; margin-top: 4px; }

/* ---------------------------------------------------------------------------
 * Узкий экран
 * -------------------------------------------------------------------------
 * Полноценная мобильная версия — отдельный шаг работы. Пока делаем так,
 * чтобы с телефона всё было доступно и ничего не уезжало за край.
 */

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: auto; flex: none; height: auto; position: static;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 16px;
  }
  .sidebar-brand { padding: 0; margin-right: auto; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; padding: 0; gap: 4px; }
  .sidebar nav a { padding: 6px 10px; }
  .sidebar-foot {
    margin-top: 0; padding: 0; border-top: none;
    flex-direction: row; align-items: center; gap: 12px;
  }
  .topbar { padding: 10px 16px; }
  main { padding: 16px 16px 48px; }
  .day-side { max-width: none; }
  .two-columns { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------------------
 * Телефон
 * -------------------------------------------------------------------------
 * Администратор работает и с телефона — чаще всего чтобы отметить занятие
 * между детьми, стоя. Поэтому здесь важнее не красота, а размер кнопки:
 * промахнуться по «Был» и поставить «Не пришёл» — это разговор с родителем,
 * которого могло не быть.
 */

@media (max-width: 640px) {
  /* Меню внизу, как панель вкладок. Наверху оно съедало первый экран,
   * а нужно оно реже, чем то, ради чего страницу открыли. */
  .app { flex-direction: column; padding-bottom: 64px; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; z-index: 20;
    flex-direction: column; padding: 0; gap: 0;
    border-top: 1px solid var(--sidebar-border);
  }
  .sidebar-brand, .sidebar-foot { display: none; }
  .sidebar nav {
    flex-direction: row; overflow-x: auto; padding: 6px 8px; gap: 4px;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { flex: 0 0 auto; padding: 9px 12px; }
  .sidebar nav .dot { display: none; }

  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar .search { flex: 1 1 100%; max-width: none; }
  .topbar .actions { width: 100%; }
  .topbar .actions .btn { flex: 1 1 auto; justify-content: center; }

  main { padding: 14px 14px 40px; }

  h1 { font-size: 21px; }
  .page-head { gap: 12px; }
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Сетка дня на телефоне не читается — вместо неё компактный список дня.
   * Карточка с кнопками открывается только у того занятия, на которое
   * нажали, — как панель справа на широком экране, — и пропадает после
   * отметки. Раньше подряд висели карточки всех занятий, и отмеченные тоже. */
  .day-grid { display: none; }
  .day-list { display: flex; }
  .day-side { max-width: none; width: 100%; }
  .lesson-pick { display: none; }
  .lesson-buttons .btn, .lesson-buttons button { min-height: 44px; }

  /* Таблицы превращаются в карточки: строка → две строки текста. */
  .table-card { overflow-x: visible; }
  .grid-head { display: none; }
  .grid-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-width: 0 !important;
    padding: 12px 14px; gap: 6px 10px;
  }
  .grid-row > span:nth-child(n + 3) { grid-column: 1 / -1; }
  .bar { max-width: none; }

  .cards-2, .cards-3, .cards-grid, .columns-3, .two-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .mini-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > span { gap: 14px; }

  .btn, button.primary, a.button-link { min-height: 40px; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------------------------------------------------------------------------
 * Доработки по вопросам первого пользователя (03.10.2026)
 * ------------------------------------------------------------------------- */

/* «← Имя ребёнка» над заголовком вложенных страниц: вернуться в карточку
 * можно было только ссылкой «Отмена» внизу формы. */
a.back { display: inline-block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }

/* Кнопки у запланированного занятия в карточке. */
.lesson-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.lesson-actions form { display: inline; }
.lesson-actions details.cancel, .lesson-actions details.absence { flex-basis: 100%; }

/* Строка заморозки под заголовком абонемента. */
.freeze-line {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 10px 18px; font-size: 13px;
  background: var(--hover); border-bottom: 1px solid var(--border);
}

/* Справки в карточке. */
.cert-grid { grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1.2fr); }

/* Свой день и время при переносе — рядом со списком окон. */
.or-divider { margin: 6px 0 10px; font-size: 13px; color: var(--ink-muted); }

/* Журнал оплат. */
.payments-grid { grid-template-columns: 100px minmax(0, 1.6fr) 90px 120px minmax(0, 1fr); min-width: 560px; }

/* Сколько абонементов по какой цене: короткая таблица, строка — ссылка на выбор этой суммы. */
.amounts { max-width: 520px; margin-bottom: 16px; }
.amounts-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); min-width: 360px; }
.grid-row.picked { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }

/* Поля «сумма от … до …» над журналом и подписи полей в строке фильтров. */
.filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-muted); }
.filters input.amount { width: 110px; min-width: 0; flex: none; }

/* Заголовки столбцов списка учеников — ссылки: щелчок упорядочивает список. */
.grid-head a.sort-link { color: inherit; text-decoration: none; }
.grid-head a.sort-link:hover { color: var(--ink); text-decoration: underline; }
.grid-head a.sort-link.on { color: var(--ink); font-weight: 800; }

/* ---------------------------------------------------------------------------
 * Пропуск по причине (09.10.2026)
 * ------------------------------------------------------------------------- */

/* «Не пришёл» / «Не придёт»: два варианта, причина, перенос сразу.
 * Подпись варианта и пояснение к нему — столбиком рядом с кружком. */
.absence-form .radio { display: flex; align-items: flex-start; gap: 8px; }
.absence-form .radio > input { margin-top: 3px; flex: 0 0 auto; }
.absence-form .radio > span { display: flex; flex-direction: column; gap: 1px; }
.absence-form .radio b { font-weight: 600; }
.absence-form .field { margin: 12px 0; }
.absence-form .field .row input { min-width: 0; }
/* Группы вариантов и «перенести сразу» — fieldset ради доступности,
 * а выглядят как прежде: без рамки, подпись — как у обычного поля. */
.absence-form fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
.absence-form fieldset.field { margin: 12px 0; }
.absence-form legend,
.absence-form .field > label:first-child {
  display: block; padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--ink-muted);
}

/* В боковой панели экрана дня форма не шире самой панели. */
.lesson-panel .absence-form, .lesson-panel .cancel-form { width: auto; }

/* «Ждёт переноса»: не исход, а несделанное дело — пустой значок с рамкой,
 * а не залитый, как у отмеченных занятий. */
.badge-wait {
  background: var(--surface); color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* Текст причины переносится, а не обрезается многоточием, как подписи в списках. */
.reason-text { overflow-wrap: anywhere; }
.stack .detail.reason-text { white-space: normal; overflow: visible; text-overflow: clip; }

/* «Ждут переноса» */
.awaiting-grid {
  grid-template-columns: minmax(0, 1.4fr) 72px 130px minmax(0, 1.8fr) 110px 112px;
  min-width: 840px;
}
.grid-row.long-wait { background: var(--accent-bg); }
.grid-row.long-wait .wait-days { color: var(--accent-deep); font-weight: 700; }
