/* Расписание завуча — оформление.
   Рассчитано на рабочий компьютер в школе: плотные таблицы, крупный шрифт,
   аккуратная печать на А4. */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1c2330;
  --ink-soft: #5a6577;
  --ink-faint: #8a94a6;
  --line: #dde3ec;
  --line-strong: #c3ccda;
  --accent: #2f6fb3;
  --accent-soft: #e8f0fa;
  --error: #c0392b;
  --error-soft: #fdecea;
  --warn: #b7791f;
  --warn-soft: #fdf6e3;
  --ok: #2e7d4f;
  --ok-soft: #e9f6ee;
  --radius: 8px;
  /* Реальную высоту верхней панели проставляет app.js — от неё считаются
     отступы «прилипающих» шапок таблиц. */
  --topbar-h: 62px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 6px 18px rgba(20, 30, 50, .06);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ шапка */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  /* Вкладок семь, и на ноутбучном экране им тесно. Промежуток даём поменьше
     и разрешаем ему сжиматься, чтобы шапка не разъезжалась на две строки. */
  gap: clamp(8px, 1.6vw, 20px);
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(20, 30, 50, .04);
}

.topbar__title { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.topbar__mark { font-size: 24px; line-height: 1; }
.topbar__name { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.topbar__school { font-size: 12px; color: var(--ink-faint); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 2px; flex-wrap: wrap; }

.tab {
  padding: 7px clamp(9px, 1.1vw, 16px);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font-weight: 550;
  cursor: pointer;
}
.tab:hover { background: var(--bg); color: var(--ink); }
.tab.is-active { background: var(--accent-soft); border-color: #cfe0f2; color: var(--accent); }

.iconbtn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 16px;
  cursor: pointer;
}
.iconbtn:hover:not(:disabled) { background: var(--bg); }
.iconbtn:disabled { opacity: .35; cursor: default; }

.langpicker {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}

.status { font-size: 12px; color: var(--ink-faint); min-width: 150px; text-align: right; }
.status.is-ok { color: var(--ok); }
.status.is-pending { color: var(--warn); }
.status.is-error { color: var(--error); font-weight: 600; }

/* --------------------------------------------- полоса «открыт пример» */

/* display: flex перебивает атрибут hidden, и скрытая полоса остаётся
   тонкой жёлтой лентой. Гасим её явно. */
.demobar[hidden] { display: none; }

.demobar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 20px;
  background: var(--warn-soft);
  border-bottom: 1px solid #ecd9a8;
  font-size: 13.5px;
  color: #7d5510;
}
.demobar__text { flex: 1; }
.demobar__close {
  border: none;
  background: transparent;
  color: #7d5510;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  opacity: .6;
}
.demobar__close:hover { opacity: 1; }

/* ------------------------------------------------------------- раскладка */

.app { padding: 20px; max-width: 1680px; margin: 0 auto; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.panel__head {
  display: flex; align-items: center; gap: 12px;
  margin: -4px 0 14px;
  flex-wrap: wrap;
}
.panel__title { font-size: 17px; font-weight: 650; margin: 0; }
.panel__hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 14px; max-width: 78ch; }
.panel__tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; }

/* -------------------------------------------------------------- кнопки */

.btn {
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #275e99; }
.btn--danger { color: var(--error); border-color: #eebfba; }
.btn--danger:hover:not(:disabled) { background: var(--error-soft); }
.btn--small { padding: 4px 10px; font-size: 13px; }

/* -------------------------------------------------------------- поля */

.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--ink-soft); font-weight: 550; }

input[type="text"], input[type="number"], select, textarea {
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.checkline { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ------------------------------------------------------- таблица нагрузки */

.table-wrap { overflow-x: auto; }

table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td {
  border: 1px solid var(--line);
  padding: 0;
  text-align: left;
  vertical-align: middle;
}
table.grid thead th {
  background: #eef2f7;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* Строку класса когда-то держали на виду через position: sticky — от этого
   пришлось отказаться. Chrome неверно раскладывает «липкие» ячейки внутри
   таблицы: ячейка выпадает из потока и закрывает собой соседнюю строку,
   причём и при border-collapse: collapse, и при separate. Навигацию по
   классам решает список слева на экране расписания. */
table.grid tbody tr:hover { background: #fafbfd; }

.cellinput {
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 10px;
  outline: none;
}
.cellinput:focus { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cellinput--num { text-align: center; width: 100%; }
.cellinput.is-invalid { background: var(--error-soft); }

/* Кабинет теперь выбирают списком, а у списка ещё и стрелка занимает место —
   «Қизлар устахонаси» в сотню пикселей не умещается. */
.col-narrow { width: 146px; }
.col-tiny { width: 56px; }
/* Подгруппе нужно место: «♂ ўғил болалар» много шире, чем «1», и обрезать
   это нельзя — по-узбекски подпись длиннее, чем по-русски. */
.col-group { width: 152px; }
.rowbtn {
  width: 100%; height: 100%;
  border: none; background: transparent;
  color: var(--ink-faint); cursor: pointer; padding: 6px;
}
.rowbtn:hover { color: var(--error); background: var(--error-soft); }

.group-head td {
  background: #f0f4f9;
  font-weight: 650;
  padding: 7px 10px !important;
  border-top: 2px solid var(--line-strong) !important;
}
.group-head .badge { font-weight: 500; }

/* Строка сетки звонков, где время не сходится. */
tr.bells--bad td { background: var(--warn-soft); }

/* Строка «+ Предмет» под списком класса — добавлять удобнее там, где
   закончил печатать, а не возвращаясь к шапке. */
tr.addrow td { padding: 0 !important; }
.addrow__btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
.addrow__btn:hover { background: var(--accent-soft); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.badge--ok { background: var(--ok-soft); border-color: #bfe0cc; color: var(--ok); }
.badge--warn { background: var(--warn-soft); border-color: #ecd9a8; color: var(--warn); }
.badge--error { background: var(--error-soft); border-color: #eebfba; color: var(--error); }

/* --------------------------------------------------------- сетка расписания */

.sched-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }

.sidebar { position: sticky; top: calc(var(--topbar-h) + 12px); }

/* На узком экране боковая панель уезжает наверх, а не сжимает сетку. */
@media (max-width: 1100px) {
  .sched-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

.chips { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; }

.chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fff;
  cursor: grab;
  user-select: none;
}
.chip:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.chip.is-dragging { opacity: .4; }
.chip.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip__name { flex: 1; font-weight: 550; font-size: 13.5px; }
.chip__meta { font-size: 11.5px; color: var(--ink-faint); }
.chip__count {
  font-size: 12px; font-weight: 650;
  background: var(--bg); border-radius: 10px; padding: 0 7px;
}

/* min-width не даёт колонкам схлопнуться в нечитаемую полоску:
   при нехватке ширины таблица прокручивается внутри .table-wrap. */
.sched-table { border-collapse: collapse; width: 100%; table-layout: fixed; min-width: 640px; }
.sched-table th, .sched-table td { border: 1px solid var(--line); }
.sched-table thead th {
  background: #eef2f7; padding: 7px 6px;
  font-size: 12.5px; font-weight: 650; color: var(--ink-soft);
}
.sched-table th.lesson-col { width: 62px; }
.sched-table td.lesson-num {
  background: #f7f9fc; text-align: center;
  font-size: 12px; color: var(--ink-soft); font-weight: 600;
}
.sched-table td.lesson-num small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 10.5px; }

.cell {
  min-height: 48px; height: 48px; padding: 2px;
  position: relative;
  vertical-align: top;
}
.cell.is-drop { background: var(--ok-soft); outline: 2px dashed #7cb894; outline-offset: -3px; }
.cell.is-blocked { background: var(--error-soft); }
.cell.is-hint { background: #f2f8f4; }
.cell.is-pinned { background: #fdfaef; }

/* В поделённом классе в клетке стоят две карточки — по одной на подгруппу. */
.cell__stack { display: flex; flex-direction: column; gap: 2px; height: 100%; }

.cell__pin {
  position: absolute; top: 1px; right: 2px;
  border: none; background: transparent;
  font-size: 10px; line-height: 1; padding: 1px 2px;
  cursor: pointer; opacity: 0;
}
.cell:hover .cell__pin { opacity: .4; }
.cell__pin.is-on { opacity: 1; }
.cell__pin:hover { opacity: 1; }

.lesson {
  height: 100%;
  border-radius: 5px;
  border-left: 4px solid var(--accent);
  background: #f8fafc;
  padding: 3px 6px;
  cursor: grab;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.lesson:hover { background: #eef3f9; }
.lesson.is-dragging { opacity: .4; }
.lesson__subject { font-weight: 600; font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson__meta { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson.has-error { box-shadow: inset 0 0 0 2px var(--error); background: var(--error-soft); }
.lesson.has-warning { box-shadow: inset 0 0 0 2px #e3c169; }

.lesson.is-split { padding: 1px 5px; }
.lesson.is-split .lesson__subject { font-size: 11.5px; }
.lesson.is-split .lesson__meta { font-size: 10px; }

.lesson__group {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(20, 30, 50, .09);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}

/* Значок пола крупнее номера: его и ставят ради того, чтобы читалось сразу. */
.lesson__group.is-tag {
  background: rgba(20, 30, 50, .04);
  font-size: 12px;
  font-weight: 500;
}

/* Стрелки — знак того, что урок идёт в один час с другим классом. */
.lesson__link {
  display: inline-block;
  margin-left: 3px;
  color: var(--accent, #2b6cb0);
  font-size: 10px;
  vertical-align: 1px;
}

.lesson.is-linked { border-left-style: double; border-left-width: 5px; }

/* Кнопка связки: включённую видно, не наводя мышь. */
.rowbtn.is-on { color: var(--accent, #2b6cb0); font-weight: 700; }
.rowbtn.is-on:hover { color: var(--accent, #2b6cb0); background: rgba(43, 108, 176, .1); }

.cellinput--group { width: 100%; }
.cellcheck { width: 16px; height: 16px; cursor: pointer; }
.cellcheck:disabled { cursor: default; opacity: .35; }

/* Список может быть на все классы школы — даём ему свою прокрутку, чтобы
   кнопки окна оставались на виду, а не уезжали за край. */
.linklist {
  display: flex; flex-direction: column; gap: 2px; margin-top: 10px;
  max-height: 46vh; overflow-y: auto;
  border: 1px solid var(--line, #dde3ea); border-radius: 8px; padding: 6px;
}
.linklist__head {
  position: sticky; top: -6px;
  margin: 6px 0 2px; padding: 4px 8px;
  background: var(--panel, #fff);
  color: var(--ink-faint); font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .04em;
}
.linklist__head:first-child { margin-top: 0; }
.linklist__row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 8px; border-radius: 5px; cursor: pointer;
}
.linklist__row:hover { background: var(--line-soft, #f0f4f9); }
.linklist__class { font-weight: 650; min-width: 56px; }
.linklist__meta { color: var(--ink-faint); font-size: 12px; }

.print-lesson + .print-lesson { margin-top: 3px; padding-top: 3px; border-top: 1px dotted #999; }

/* ------------------------------------------------------------ список классов */

.classlist { display: flex; flex-direction: column; gap: 1px; max-height: 40vh; overflow-y: auto; }

.classitem {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.classitem:hover { background: var(--bg); }
.classitem.is-active { background: var(--accent-soft); border-color: #cfe0f2; }

.classitem__name { font-weight: 650; font-size: 13.5px; min-width: 34px; }
.classitem__bar { flex: 1; height: 5px; background: #e6eaf1; border-radius: 3px; overflow: hidden; }
.classitem__fill { display: block; height: 100%; background: var(--ok); }
.classitem__fill.is-partial { background: #d9a441; }
.classitem__count {
  font-size: 11.5px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; min-width: 42px; text-align: right;
}
.classitem__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--error); flex: none; }

/* --------------------------------- занятость учителя во время перетаскивания */

.dragteacher {
  position: fixed;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  z-index: 70;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(20, 30, 50, .18);
  padding: 10px 14px;
  pointer-events: none;
}
.dragteacher__title { font-size: 12.5px; font-weight: 650; margin-bottom: 7px; }
.dragteacher__grid { display: grid; gap: 2px; }
.dragteacher__head { font-size: 10px; color: var(--ink-faint); text-align: center; line-height: 18px; }
.dragteacher__slot {
  height: 18px;
  border-radius: 3px;
  background: #eef1f5;
  font-size: 9.5px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  overflow: hidden;
}
.dragteacher__slot.is-busy { background: #ccdcec; color: #2b4a68; font-weight: 600; }
.dragteacher__slot.is-off { background: #f0dbd7; }

/* -------------------------------------------------------- варианты расписания */

table.grid.variants td,
table.grid.variants th { padding: 7px 10px; }

table.grid.variants th.num,
table.grid.variants td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  width: 104px;
}

/* Лучшее значение в столбце — чтобы видеть, чем вариант выигрывает. */
table.grid.variants td.num.is-best { background: var(--ok-soft); font-weight: 650; color: var(--ok); }
table.grid.variants td.num.is-bad { background: var(--error-soft); font-weight: 650; color: var(--error); }

tr.variants__current td { background: #f7f9fc; border-bottom: 2px solid var(--line-strong); }
tr.variants__current td.num.is-best { background: var(--ok-soft); }

/* ------------------------------------------------- расшифровка столбцов */

.legend {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 10px 16px;
}
.legend__head {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-soft);
  list-style: none;
}
.legend__head::marker, .legend__head::-webkit-details-marker { display: none; }
.legend__head::before { content: '▾ '; color: var(--ink-faint); }
.legend:not([open]) .legend__head::before { content: '▸ '; }

.legend__list {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  gap: 7px 18px;
  margin: 12px 0 0;
}
.legend__name { font-weight: 650; font-size: 13.5px; }
.legend__text { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.legend__foot {
  margin: 14px 0 2px;
  font-size: 13px;
  color: var(--ink-faint);
  max-width: 78ch;
}

@media (max-width: 720px) {
  .legend__list { grid-template-columns: 1fr; gap: 2px 0; }
  .legend__text { margin-bottom: 8px; }
}

/* --------------------------------------------------------------- замечания */

.issue.is-clickable { cursor: pointer; }

/* Клетка, о которой говорит замечание, коротко мигает — иначе её искать глазами. */
@keyframes cellflash {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(192, 57, 43, 0); }
  25%, 75% { box-shadow: inset 0 0 0 3px var(--error); }
}
.cell.is-flash { animation: cellflash 1.2s ease-in-out 2; }

@media (prefers-reduced-motion: reduce) {
  .cell.is-flash { animation: none; box-shadow: inset 0 0 0 3px var(--error); }
}

.issues { display: flex; flex-direction: column; gap: 5px; max-height: 320px; overflow-y: auto; }
.issue {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
}
.issue--error { background: var(--error-soft); border-color: #f2cfca; color: #8f2b1f; }
.issue--warning { background: var(--warn-soft); border-color: #eddcb0; color: #7d5510; }
.issue--hint { background: var(--bg); border-color: var(--line); color: var(--ink-soft); }
.issue:hover { filter: brightness(.98); }
.issue__mark { font-weight: 700; }

/* ---------------------------------------------------------------- уведомления */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #232c3a; color: #fff;
  padding: 10px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 13.5px; max-width: 380px;
  animation: slidein .18s ease-out;
}
.toast--error { background: #a33325; }
.toast--ok { background: #276b47; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------------------- окно */

.modal { border: none; border-radius: 10px; padding: 0; box-shadow: 0 20px 60px rgba(15,25,45,.3); max-width: 520px; }
.modal::backdrop { background: rgba(20, 28, 44, .35); }
.modal__inner { padding: 20px 22px; }
.modal__title { margin: 0 0 10px; font-size: 17px; }
.modal__body { font-size: 14px; color: var(--ink-soft); margin-bottom: 18px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; }

/* ------------------------------------------------------------------- пустo */

.empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty h3 { margin: 0 0 8px; color: var(--ink); font-size: 18px; }
.empty p { margin: 0 auto 16px; max-width: 56ch; }

/* -------------------------------------------------------------------- печать */

.print-page { background: #fff; padding: 14mm; margin: 0 auto 16px; max-width: 297mm; box-shadow: var(--shadow); }
.print-page h2 { margin: 0 0 4px; font-size: 18px; }
.print-page .print-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 12px; }
.print-table { border-collapse: collapse; width: 100%; }
.print-table th, .print-table td { border: 1px solid #333; padding: 4px 6px; font-size: 12px; }
.print-table th { background: #eef2f7; font-weight: 650; }
.print-table td.num { text-align: center; width: 34px; background: #f7f9fc; }
.print-table .sub { display: block; font-size: 10.5px; color: #555; }

/* Колонки одинаковой ширины: иначе класс с длинным названием предмета
   растягивает свой столбец, и сетка выглядит перекошенной. */
/* Сводное на всю школу: на экране даём прокрутку вбок, чтобы колонки были
   читаемой ширины, а на печати ужимаем — там лист всё равно один. */
.print-wide { overflow-x: auto; }
.print-hint { color: var(--ink-soft); font-size: 12px; margin: 0 0 8px; }
.print-table--tall { min-width: 860px; }
.print-table--tall th { padding: 4px 2px; vertical-align: bottom; }
.print-table--tall td { padding: 3px 2px; }

/* Название класса стоймя — так его не приходится переносить. */
.print-vert {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: inline-block;
  white-space: nowrap;
  font-weight: 650;
  line-height: 1;
}

.print-table--even { table-layout: fixed; }
.print-table--even td, .print-table--even th { overflow-wrap: anywhere; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .topbar, .toasts, .no-print, .panel__tools { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .app { padding: 0; max-width: none; }
  .panel { border: none; box-shadow: none; padding: 0; margin: 0; }
  .print-page { box-shadow: none; padding: 0; margin: 0; max-width: none; page-break-after: always; }
  .print-page:last-child { page-break-after: auto; }
  .print-table th, .print-table td { padding: 3px 4px; }
  .print-wide { overflow-x: visible; }
  .print-hint { display: none; }
  .print-table--tall { min-width: 0; }
  .print-table--tall th, .print-table--tall td { padding: 2px 1px; font-size: 9px; }
}

/* ------------------------------------------------------------------ мелочи */

.hr { height: 1px; background: var(--line); margin: 16px 0; border: none; }

.stat-row { display: flex; gap: 18px; flex-wrap: wrap; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 120px; }
.stat__value { font-size: 21px; font-weight: 650; line-height: 1.1; }
.stat__label { font-size: 12px; color: var(--ink-soft); }

datalist { display: none; }

/* ------------------------------------------------------------------ вход */

/* Экран входа закрывает собой всё: пока школа не назвалась, показывать нечего. */
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.gate[hidden] { display: none; }

.gate__box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(20, 30, 50, .10);
  padding: 32px 28px 24px;
  text-align: center;
}
.gate__mark { font-size: 40px; line-height: 1; }
.gate__title { margin: 10px 0 4px; font-size: 20px; }
.gate__hint { margin: 0 0 20px; color: var(--ink-soft); font-size: 13px; }

.gate__input {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.gate__input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.gate__btn { width: 100%; margin-top: 6px; padding: 10px; font-size: 15px; }

.gate__error {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: #fdecea;
  color: #a3231a;
  font-size: 13px;
}
.gate__error[hidden] { display: none; }

.gate__foot {
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

/* ------------------------------------------------------- управление школами */

.plan {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}
.plan--pro { background: #eef2f7; color: #46566b; }
.plan--max { background: #ede7f6; color: #5b3fa8; }

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #c7ccd4;
}
.dot--on { background: #3aa06a; }

.journal {
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.journal__row { white-space: pre; color: var(--ink-soft); }
.journal__row b { color: var(--ink); font-weight: 600; }

.secret {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 17px;
  letter-spacing: .04em;
  background: #fffbe6;
  border: 1px solid #e6d9a0;
  border-radius: var(--radius);
  padding: 10px 14px;
  display: inline-block;
  user-select: all;
}

/* ------------------------------------------------------- учебный год */

/* Архив выглядит иначе, чем полоса примера: там подсказка, тут запрет. */
.archivebar { background: #eef1f6; border-bottom-color: #d5dce6; color: #44506a; }

/* ------------------------------------------------- начальный экран: годы */

.yeargrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.yearcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.yearcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.yearcard.is-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }

.yearcard__top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.yearcard__name { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }

.yearcard__tag {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 10px;
  background: #eef1f6;
  color: #5a6577;
  font-size: 11px;
  font-weight: 650;
}
.yearcard__tag.is-working { background: var(--ok-soft); color: var(--ok); }

.yearcard__stats { display: flex; gap: 24px; }
.yearcard__value { font-size: 21px; font-weight: 650; line-height: 1.1; }
.yearcard__label { font-size: 12px; color: var(--ink-faint); }
.yearcard__foot { margin-top: 14px; font-size: 12px; color: var(--ink-faint); }

/* Карточка «завести год» — такая же по размеру, но пунктиром. */
.yearcard--new {
  border-style: dashed;
  border-color: var(--line-strong);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.yearcard--new:hover { background: var(--accent-soft); }
.yearcard__plus { font-size: 28px; line-height: 1; color: var(--accent); font-weight: 300; }
.yearcard--new .yearcard__name { font-size: 15px; margin-top: 6px; }

/* Архив: поля видно, но они погашены — правка идёт в рабочем году. */
.app.is-readonly input:disabled,
.app.is-readonly select:disabled,
.app.is-readonly textarea:disabled {
  background: #f4f6f9;
  color: var(--ink-soft);
  cursor: default;
}
.app.is-readonly .btn:disabled { opacity: .4; }

/* Свёрнутый класс: строка-заголовок остаётся, содержимое скрыто. */
.foldbtn {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}
.foldbtn:hover { background: var(--line-strong); color: var(--ink); }

/* Треугольник рисуем рамками: так он выглядит одинаково в любом шрифте. */
.foldbtn::before {
  content: '';
  width: 0; height: 0;
  border-left: 6px solid currentColor;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  transform: rotate(90deg);
  transition: transform .12s;
}
.group-head.is-folded .foldbtn::before { transform: rotate(0deg); }
.group-head.is-folded td { background: #f7f9fc; }

/* Заслонка на время расчёта: без неё пауза выглядит зависанием. */
.busy {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(28, 35, 48, .28);
}
.busy__card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 26px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(20, 30, 50, .22);
  font-weight: 550;
}
.busy__spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busyspin .7s linear infinite;
}
@keyframes busyspin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .busy__spinner { animation: none; border-top-color: var(--accent); }
}

/* ------------------------------------------------------------------ справка */

/* Рамка справки идёт во всю ширину, как все панели программы, — иначе край
   получается рваным. А вот строку внутри рамки придерживаем: длиннее сотни
   знаков текст читается тяжело, сколько бы места ни было. */
.helppage { width: 100%; }

.helplayout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.helpnav {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card, #fff);
  border: 1px solid var(--line, #dde3ea);
  border-radius: 10px;
  padding: 8px;
  position: sticky;
  top: 12px;
}

.helpnav__item {
  display: flex; align-items: baseline; gap: 10px;
  text-align: left;
  padding: 8px 10px;
  border: none; border-radius: 7px;
  background: transparent;
  color: var(--ink, #1a2433);
  font: inherit; font-size: 13.5px;
  cursor: pointer;
}
.helpnav__item:hover { background: var(--line-soft, #f0f4f9); }
.helpnav__item.is-active { background: var(--accent, #2b6cb0); color: #fff; font-weight: 600; }

.helpnav__num {
  min-width: 18px;
  color: var(--ink-faint, #8a97a8);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.helpnav__item.is-active .helpnav__num { color: rgba(255, 255, 255, .75); }

.helpbody {
  background: var(--card, #fff);
  border: 1px solid var(--line, #dde3ea);
  border-radius: 10px;
  padding: 26px 38px 34px;
  font-size: 16px;
}

/* Мера строки: по ней равняется всё читаемое внутри рамки. */
.helpbody__title,
.helpbody__p,
.helpbody__list,
.helpnote,
.helpbody .table-wrap { max-width: 88ch; }

.helpbody__title { margin: 0 0 16px; font-size: 22px; }
.helpbody__p { margin: 0 0 13px; line-height: 1.65; }
.helpbody__list { margin: 0 0 12px; padding-left: 20px; line-height: 1.62; }
.helpbody__list li { margin-bottom: 6px; }

.helpnote {
  margin: 14px 0;
  padding: 11px 14px;
  border-left: 3px solid var(--accent, #2b6cb0);
  border-radius: 0 7px 7px 0;
  background: var(--line-soft, #f0f4f9);
  line-height: 1.55;
}

.helptable { border-collapse: collapse; width: 100%; margin: 6px 0 14px; }
.helptable th, .helptable td {
  border: 1px solid var(--line, #dde3ea);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
.helptable thead th { background: var(--line-soft, #f0f4f9); font-weight: 650; }
.helptable tbody th { font-weight: 600; white-space: nowrap; width: 1%; }

@media (max-width: 900px) {
  .helplayout { grid-template-columns: minmax(0, 1fr); }
  .helpnav { position: static; flex-direction: row; flex-wrap: wrap; }
}

@media print {
  .helpnav { display: none; }
  .helplayout { grid-template-columns: minmax(0, 1fr); }
  .helpbody { border: none; padding: 0; }
}

/* Кнопка про Max: заметная, но не кричащая — возможности за ней пока нет. */
.btn--max {
  border-color: #d9c48a;
  background: linear-gradient(180deg, #fdf6e3, #f8ecd0);
  color: #7a5c12;
  font-weight: 650;
}
.btn--max:hover { background: linear-gradient(180deg, #fdf9ee, #f6e6c2); }

.maxlead { margin: 0 0 12px; line-height: 1.6; }
.maxlist { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; }
.maxlist li { margin-bottom: 8px; }
.maxlist b { color: var(--ink); }
.maxfoot {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #d9c48a;
  border-radius: 0 7px 7px 0;
  background: #fdf6e3;
  color: #7a5c12;
  font-size: 13px;
}

/* Сводка администратора: пары «что — сколько», без лишней таблицы. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2px 18px; }
.factrow {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px dashed var(--line, #dde3ea);
}
.factrow__k { color: var(--ink-soft); font-size: 13px; }
.factrow__v { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.factrow__v.is-warn { color: var(--error, #c0392b); }

/* Точка «сейчас в программе» рядом с логином школы. */
.dot-live { color: #2e9e5b; }
tr.is-off { opacity: .5; }

/* Языки на экране входа: до входа язык школы неизвестен, выбираем сами. */
.gate__langs { display: flex; justify-content: center; gap: 4px; margin-bottom: 14px; }
.gate__lang {
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-faint);
  font: inherit; font-size: 13px;
  cursor: pointer;
}
.gate__lang:hover { background: var(--bg); color: var(--ink); }
.gate__lang.is-active {
  background: var(--accent-soft);
  border-color: #cfe0f2;
  color: var(--accent);
  font-weight: 600;
}
