/* ==========================================================================
   График администрации: таблица «человек × день»

   Главное требование к такой таблице — не потерять строку и столбец на
   пересечении. Поэтому столбец с ФИО липкий, выходные подкрашены, а
   сегодняшний день обведён: взгляд сразу находит «кто сегодня».
   ========================================================================== */

.sch-page { max-width: 100%; }

.sch-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: -6px 0 14px;
}
.sch-nav { display: flex; align-items: center; gap: 8px; }
.sch-period {
  min-width: 180px; text-align: center;
  font-size: 17px; font-weight: 800;
}
/* Стрелка «назад» — тот же значок, развёрнутый: отдельного в наборе нет */
.sch-arrow { padding: 0 10px; }
#sch-prev .icon { transform: rotate(180deg); }

.sch-shift { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.sch-shift input[type="text"] {
  width: 56px; min-height: 36px; padding: 6px 10px; text-align: center;
  font-size: 14px; font-weight: 700;
}

.sch-wrap {
  background: var(--surface); border: 1px solid var(--separator);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  overflow: auto;
}
table.sch {
  min-width: 0; border-collapse: separate; border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
/* Общее оформление th в портале — мелкие прописные подписи столбцов. Здесь
   th стоит и у строки (ФИО), и у подписи филиала, а прописными фамилия
   читается хуже, поэтому наследство снимаем на всю таблицу */
table.sch th, table.sch td { border: 0; }
table.sch th { text-transform: none; letter-spacing: 0; color: var(--text); }

/* Шапка остаётся на виду при прокрутке месяца вниз */
table.sch thead th {
  position: sticky; top: 0; z-index: 3;
  padding: 6px 0; text-align: center; text-transform: none; letter-spacing: 0;
  background: var(--surface-2); border-bottom: 1px solid var(--separator);
}
.sch-day { width: 34px; min-width: 34px; }
.sch-wd { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); }
.sch-num { display: block; font-size: 14px; font-weight: 800; color: var(--text-1); }
table.sch thead .sch-day.we { background: var(--surface-inset); }
.sch-day.we .sch-num, .sch-day.we .sch-wd { color: var(--orange); }
.sch-day.now { background: var(--accent-soft); }
.sch-day.now .sch-num { color: var(--accent); }

/* Столбец с именами виден всегда: без него на 31-м числе не понять, чья строка */
table.sch .sch-name {
  position: sticky; left: 0; z-index: 2;
  min-width: 190px; max-width: 240px;
  padding: 8px 12px; text-align: left;
  background: var(--surface); border-right: 1px solid var(--separator);
}
thead .sch-corner { z-index: 4; background: var(--surface-2); }
.sch-person { display: flex; flex-direction: column; min-width: 0; }
.sch-fio { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch-post { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

tbody tr[data-person] { position: relative; }
tbody tr[data-person] .sch-name { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.sch-del {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-3);
  cursor: pointer; opacity: 0; transition: opacity .15s var(--ease), background .15s var(--ease);
}
.sch-del .icon { width: 15px; height: 15px; }
tr[data-person]:hover .sch-del, .sch-del:focus-visible { opacity: 1; }
.sch-del:hover { background: var(--red-soft); color: var(--red); }

/* Подпись филиала — строка той же таблицы, как в списке пользователей.
   Липким делается не th (он тянется на всю ширину, и при прокрутке вправо
   название уезжало за край), а текст внутри него */
.sch-group th {
  padding: 0; text-align: left;
  background: var(--surface-inset);
}
.sch-group-head {
  position: sticky; left: 0;
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px;
}
.sch-group-name { font-size: 12.5px; font-weight: 800; color: var(--text-2); }

/* Стрелки порядка филиалов. Появляются при наведении на строку, как крестик
   у человека: постоянно видимые кнопки в каждой подписи превратили бы
   таблицу в пульт */
.sch-group-move { display: flex; gap: 2px; }
.sch-move {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 24px; padding: 0;
  border: 0; border-radius: var(--r-xs); background: transparent; color: var(--text-3);
  cursor: pointer; opacity: 0; transition: opacity .15s var(--ease), background .15s var(--ease);
}
.sch-move .icon { width: 14px; height: 14px; }
.sch-group:hover .sch-move, .sch-move:focus-visible { opacity: 1; }
.sch-move:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.sch-move:disabled { cursor: default; }
.sch-group:hover .sch-move:disabled { opacity: .25; }

/* min-width обязателен: клетка пустая или с одной цифрой, а внутри поле
   шириной 100% — без него браузер схлопывает столбец в несколько пикселей
   и месяц превращается в кашу из чисел */
table.sch .sch-cell {
  width: 34px; min-width: 34px; height: 38px; padding: 0;
  text-align: center; font-size: 13px;
  border-bottom: 1px solid var(--separator); border-right: 1px solid var(--separator);
}
/* Выходные подкрашены колонкой целиком: по заливке месяц читается быстрее,
   чем по подписям «сб» и «вс» в шапке */
table.sch .sch-cell.we { background: var(--surface-inset); }
table.sch .sch-cell.now { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
/* Рабочий день — заливка, а не только цифра: месяц читается полосами */
table.sch .sch-cell.on { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
table.sch .sch-cell.on.we { background: var(--accent-soft); }

/* Пометки дня. Выходной намеренно бледный: он и так виден по пустоте вокруг,
   а отпуск и больничный должны бросаться в глаза при взгляде на месяц */
table.sch .sch-cell.mark { font-weight: 800; font-size: 12px; }
table.sch .sch-cell.m-off { background: var(--surface-inset); color: var(--text-3); }
table.sch .sch-cell.m-vac { background: var(--amber-soft); color: var(--amber); }
table.sch .sch-cell.m-sick { background: var(--orange-soft); color: var(--orange); }

/* Селектор с именем тега намеренно: общее правило input[type="text"]
   специфичнее одного класса и превратило бы клетку в поле с рамкой,
   скруглением и своей высотой — тот же случай, что с input.sheet-addr */
input.sch-in {
  width: 100%; height: 38px; min-height: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; text-align: center;
  font: inherit; font-size: 13px; font-weight: 700; color: inherit; cursor: pointer;
}
input.sch-in:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
input.sch-in.saving { opacity: .45; }
input.sch-shift-field { width: 56px; }

table.sch .sch-total {
  min-width: 48px; padding: 0 10px;
  text-align: center; font-size: 13px; color: var(--text-2);
  background: var(--surface-2); border-bottom: 1px solid var(--separator);
}
thead .sch-total { font-size: 11px; font-weight: 600; color: var(--text-3); }
.sch-total.sch-strong { font-weight: 800; color: var(--text-1); }

table.sch tfoot th, table.sch tfoot td {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--surface-2); border-top: 1px solid var(--separator); border-bottom: 0;
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
}
table.sch tfoot .sch-name { z-index: 3; }
table.sch tfoot .sch-cell.on { color: var(--text-1); background: var(--surface-2); }

/* Что значат буквы — рядом с таблицей, а не в памяти у того, кто её ведёт */
.sch-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 12px 2px 0; font-size: 13px; color: var(--text-2);
}
.sch-leg { display: inline-flex; align-items: center; gap: 7px; }
.sch-leg-box {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 5px;
  border-radius: var(--r-xs); font-size: 12px; font-weight: 800;
}
.sch-leg-box.on { background: var(--accent-soft); color: var(--accent); }
.sch-leg-box.m-off { background: var(--surface-inset); color: var(--text-3); }
.sch-leg-box.m-vac { background: var(--amber-soft); color: var(--amber); }
.sch-leg-box.m-sick { background: var(--orange-soft); color: var(--orange); }

.sch-hint { margin: 8px 2px 0; font-size: 13px; color: var(--text-3); }
