/* График смен — стилистика Т-Банка: жёлтый акцент, графитовый текст, крупные радиусы.
   Сетка остаётся сеткой (привычка Excel), но дышит воздухом и не пугает. */
:root {
  --t-yellow: #ffdd2d;
  --t-yellow-2: #ffe97a;
  --t-yellow-ink: #1c1c1c;
  --t-graphite: #333333;
  --t-graphite-2: #4a4a4a;
  --t-ink: #1c1c1c;
  --t-body: #2b2b2b;
  --t-muted: #8b8b8b;
  --t-line: #c6c6cf;
  --t-line-soft: #cfcfda;
  --t-bg: #f5f5f5;
  --t-panel: #ffffff;
  --t-head: #fbfbfb;
  --t-weekend: #fafafa;
  --t-today: #fff8d9;
  --t-after: #ffeceb;
  --t-after-ink: #d92d20;
  --t-radius: 20px;
  --t-radius-sm: 12px;
  --cell: 40px;
  --w-name: 200px;
  --w-region: 120px;
  --w-total: 64px;
  --w-day: 44px;
  --show-region: 1;   /* 0 в медиазапросе: колонка «Регион» скрыта */
  --w-ack: 34px;      /* колонка зелёной галочки «правки увидел» */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--t-bg);
  color: var(--t-body);
  font: 15.5px/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body { min-height: 100dvh; }
.hidden { display: none !important; }
.muted { color: var(--t-muted); }

/* Шапка */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px max(16px, env(safe-area-inset-left)) 14px max(16px, env(safe-area-inset-right));
  background: var(--t-panel);
  border-bottom: 1px solid var(--t-line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--t-yellow); color: var(--t-yellow-ink);
  font-weight: 800; font-size: 19px; letter-spacing: -.5px; flex: 0 0 auto;
}
.brand-text { font-weight: 700; font-size: 17px; color: var(--t-ink); white-space: nowrap; letter-spacing: -.2px; }
.who { color: var(--t-muted); font-size: 13.5px; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.who b { color: var(--t-ink); font-weight: 700; }

main {
  padding: 16px max(12px, env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom))
          max(12px, env(safe-area-inset-right));
  max-width: 100%;
}

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 10px 18px;
  border: 1.5px solid var(--t-line); border-radius: 12px;
  background: #f4f4f6; color: var(--t-ink);
  font-weight: 600; font-size: 14.5px; cursor: pointer;
  white-space: nowrap; transition: background .15s ease, transform .06s ease, border-color .15s ease;
  box-shadow: 0 1px 2px rgba(28,28,28,.06);
}
.btn:hover { background: #ececef; border-color: #b9b9c4; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--t-yellow); color: var(--t-yellow-ink); font-weight: 700; border-color: #e8c400; }
.btn.primary:hover { background: var(--t-yellow-2); }
.btn.ghost { background: #fff; border: 1.5px solid var(--t-line); }
.btn.ghost:hover { background: #f7f7f7; }
.btn.icon { min-width: 44px; padding: 8px 12px; font-size: 22px; font-weight: 500; background: #fff; border: 1.5px solid var(--t-line); border-radius: 12px; }
.btn.icon:hover { background: #f1f1f1; border-color: #b9b9c4; }
.btn.danger { background: #fde9e7; color: var(--t-after-ink); }

input, select, button { font: inherit; color: inherit; }
input, select {
  min-height: 48px; padding: 12px 16px; width: 100%;
  border: 1.5px solid var(--t-line); border-radius: 12px;
  background: #fff; font-size: 15.5px;
  transition: border-color .12s ease;
}
input:focus, select:focus { outline: none; border-color: var(--t-graphite); }
input::placeholder { color: #b4b4b4; }

/* Вход */
.gate {
  max-width: 430px; margin: 5vh auto 0;
  background: var(--t-panel); border-radius: var(--t-radius);
  padding: 30px 26px 26px;
}
.gate h1 { font-size: 26px; line-height: 1.15; margin: 0 0 8px; color: var(--t-ink); letter-spacing: -.5px; }
.gate .lead { color: var(--t-muted); font-size: 14.5px; margin: 0 0 22px; }
.gate-form { display: grid; gap: 14px; }
.gate-form label { display: grid; gap: 7px; font-size: 13px; color: var(--t-muted); font-weight: 500; }
.gate-form .btn.primary { margin-top: 6px; min-height: 52px; font-size: 16px; }
.err { color: var(--t-after-ink); font-size: 13.5px; margin: 0; min-height: 20px; }

/* Панель месяца: липкая, одна компактная строка + фильтры.
   Верхний бар «График смен / администратор» убран — место не занимает. */
.board-head {
  position: sticky; top: 0; z-index: 25;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 0; margin-top: -8px; margin-bottom: 12px;
  background: var(--t-bg);
}
.board-toprow {
  display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0;
}
.month-nav {
  display: flex; align-items: stretch; gap: 0; flex: 0 0 auto;
  background: var(--t-panel); border: 1.5px solid var(--t-line); border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(28,28,28,.06);
}
.month-nav .btn.icon {
  border: 0; border-radius: 0; background: transparent; min-width: 40px;
}
.month-nav .btn.icon:hover { background: #f1f1f1; }
.month-nav .btn.icon:first-child { border-right: 1.5px solid var(--t-line); }
.month-nav .btn.icon:last-child { border-left: 1.5px solid var(--t-line); }
.month-title {
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--t-ink);
  padding: 0 12px; text-align: center; text-transform: capitalize; letter-spacing: -.3px;
  white-space: nowrap; background: #fbfbfd;
}
.board-actions {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  flex: 1 1 auto;
}
.menu-btn { font-size: 19px; flex: 0 0 auto; }
/* Выпадающая панель функций за шестирёнкой */
.menu-panel {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px; border: 1.5px solid var(--t-line); border-radius: var(--t-radius-sm);
  background: var(--t-panel); box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.menu-panel.hidden { display: none; }
.menu-panel .btn { min-height: 40px; padding: 8px 14px; font-size: 13.5px; }
.menu-btn.open { background: var(--t-yellow); border-color: #e8c400; }
.who-chip {
  flex: 0 1 auto; min-width: 0; max-width: 34vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--t-muted);
  padding: 6px 10px; background: var(--t-panel);
  border: 1.5px solid var(--t-line); border-radius: 999px;
}
.who-chip.hidden { display: none; }
.who-chip b { color: var(--t-ink); font-weight: 700; }
.search { min-width: 0; flex: 1 1 130px; max-width: none; min-height: 40px; }
.team-filter { min-width: 0; flex: 1 1 120px; max-width: none; min-height: 40px; }

.hint { color: var(--t-muted); font-size: 13px; margin: 12px 4px 0; }

/* Плашка забора */
.take-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 14px;
  background: #fffbe6; border-radius: var(--t-radius-sm);
  font-size: 14px; color: #7a5c00; font-weight: 500;
}
.take-banner.alert { background: var(--t-after); color: var(--t-after-ink); }

/* Сетка */
.sheet-wrap {
  background: var(--t-panel);
  border-radius: var(--t-radius);
  overflow: auto; max-width: 100%;
  max-height: calc(100dvh - 210px);
  -webkit-overflow-scrolling: touch;
}
.sheet { display: grid; grid-auto-rows: var(--cell); font-variant-numeric: tabular-nums; min-width: 0; }
/* drag-выделение пальцем: без этого браузер перехватывает жест скроллом */
.sheet .cell.day { touch-action: none; }

.cell {
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--t-line-soft);
  border-bottom: 1px solid var(--t-line-soft);
  font-size: 14px; position: relative; min-width: 0;
}
.cell.head {
  background: linear-gradient(#fbfbfd, #eef0f5); font-weight: 700; font-size: 12px;
  color: var(--t-graphite-2); position: sticky; top: 0; z-index: 5;
  border-bottom: 2px solid var(--t-line);
  box-shadow: 0 1px 0 rgba(28,28,28,.05);
}
.cell.head.wkd { background: linear-gradient(#f5f5fa, #e7e7f0); color: #7d7d8a; }
.cell.day { color: var(--t-body); }
.cell.day.other { color: #c4c4c4; }
/* выходные читаются как полоса: чуть темнее и с холодным оттенком.
   :not(.head) обязателен — заголовки дней тоже несут класс day, и без этого
   правило выходных перебивало заливку шапки. */
.sheet .cell.day.wkd:not(.head) { background: #e9e9f3; box-shadow: inset 1px 0 0 #dcdce9, inset 0 1px 0 #dcdce9; }
/* выделение поверх серого фона выходных — чуть плотнее заливка и тёмная рамка */
.sheet .cell.day.wkd.sel-range:not(.sel) {
  background-color: rgba(255, 214, 10, .62);
  box-shadow: inset 0 0 0 1.5px rgba(150, 120, 0, .55), inset 1px 0 0 #dcdce9, inset 0 1px 0 #dcdce9;
}
.sheet .cell.day.wkd.sel {
  box-shadow: inset 0 0 0 3px var(--t-yellow), inset 0 0 0 5px rgba(28, 28, 28, .7);
  background-color: rgba(255, 221, 45, .8);
}
/* шапка дат: мягкая заливка. Селектор с .head перебивает общее правило .cell.head */
.sheet .cell.head.day { background: linear-gradient(#fbfbfd, #eef0f5); }
.sheet .cell.head.day.wkd { background: linear-gradient(#f5f5fa, #e7e7f0); }
.cell.day.today { background: var(--t-today); box-shadow: inset 0 0 0 2px var(--t-yellow); }
.cell.day.editable { cursor: pointer; }
.cell.day.editable:hover { background: #f3f3f3; }
.cell.day.editable.mine { box-shadow: inset 0 0 0 1.5px rgba(255,221,45,.85); }
.cell.day.after-take { box-shadow: inset 0 0 0 1px rgba(217,45,32,.35); }

.cell.name, .cell.ack, .cell.prev, .cell.region, .cell.team, .cell.total {
  position: sticky; z-index: 6; background: var(--t-panel);
  justify-content: flex-start; padding: 0 12px; font-size: 14px;
  border-right: 2px solid var(--t-line);
  box-shadow: 1px 0 0 rgba(28,28,28,.04);
}
.cell.name { left: 0; width: var(--w-name); min-width: var(--w-name); max-width: var(--w-name);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; color: var(--t-ink); }
.cell.region { left: calc(var(--w-name) + var(--w-ack) + var(--w-prev, 40px));
  width: var(--w-region); min-width: var(--w-region);
  max-width: var(--w-region); color: var(--t-muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.ack {
  left: var(--sticky-ack, var(--w-name)); width: var(--w-ack); min-width: var(--w-ack);
  max-width: var(--w-ack); justify-content: center; padding: 0 2px;
}
.cell.prev {
  left: var(--sticky-prev, calc(var(--w-name) + var(--w-ack)));
  width: var(--w-prev, 40px); min-width: var(--w-prev, 40px); max-width: var(--w-prev, 40px);
  justify-content: center; padding: 0 2px;
}
.cell.head.ack { background: linear-gradient(#fbfbfd, #eef0f5); }
.prev-btn {
  width: 30px; height: 26px; border: 1.5px solid var(--t-line); border-radius: 7px;
  background: #fff; color: var(--t-graphite-2); font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0; box-shadow: 0 1px 2px rgba(28,28,28,.08);
}
.prev-btn:hover { background: var(--t-yellow); border-color: var(--t-yellow); color: #3a3000; }
.prev-btn:active { transform: translateY(1px); }
.cell.total { left: var(--sticky-total, var(--w-name)); width: var(--w-total);
  min-width: var(--w-total); max-width: var(--w-total); justify-content: center; font-weight: 700; color: var(--t-ink); }
.cell.head.name, .cell.head.ack, .cell.head.prev, .cell.head.region, .cell.head.team, .cell.head.total {
  z-index: 8; background: linear-gradient(#fbfbfd, #eef0f5); justify-content: center;
  padding: 0 6px; color: var(--t-graphite-2);
  border-bottom: 2px solid var(--t-line);
}
.cell.day { width: var(--w-day); min-width: var(--w-day); }
.cell.head.day { width: var(--w-day); min-width: var(--w-day); flex-direction: column; gap: 0; line-height: 1.1; }
.cell.head.day small { font-size: 10px; color: var(--t-muted); font-weight: 500; text-transform: uppercase; }

.row-mine .cell.name { background: #fffbe6; }
.row-inactive { opacity: .5; }

.legend { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; background: #f8f8f8; border-radius: 12px;
  font-size: 13.5px; color: var(--t-graphite-2);
}
.legend-item b { font-weight: 700; color: var(--t-ink); }

/* Модальные окна — лист снизу */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(28, 28, 28, .45);
}
.modal-box {
  background: #fff; width: min(580px, 100%);
  border-radius: 24px 24px 0 0;
  padding: 22px max(20px, env(safe-area-inset-left)) calc(22px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow: auto;
}
.modal-box.wide { width: min(820px, 100%); }
.modal h3 { margin: 0 0 4px; font-size: 20px; color: var(--t-ink); letter-spacing: -.3px; }
.modal .sub { color: var(--t-muted); font-size: 13.5px; margin: 0 0 14px; }

.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.slot {
  min-width: 72px; min-height: 60px; padding: 10px 14px;
  border: 1.5px solid var(--t-line); border-radius: 14px;
  background: #fff; cursor: pointer; text-align: center;
  transition: border-color .12s ease, background .12s ease;
}
.slot:hover { background: #fffdf0; border-color: var(--t-yellow); }
.slot b { display: block; font-size: 16px; color: var(--t-ink); font-weight: 700; }
.slot small { color: var(--t-muted); font-size: 11.5px; }
.slot.nonwork b { color: #9a7b00; }

.range-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 0; border-top: 1px solid var(--t-line-soft);
  font-size: 14px; color: var(--t-muted);
}
.range-row input { width: 74px; min-height: 44px; text-align: center; padding: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

.log-filters { margin-bottom: 12px; font-size: 14px; color: var(--t-muted); }
.log-list { display: grid; gap: 8px; max-height: 56dvh; overflow: auto; }
.log-item {
  display: grid; grid-template-columns: 118px 1fr auto; gap: 10px;
  padding: 12px 14px; border-radius: 14px; background: #f8f8f8;
  font-size: 14px; align-items: center;
}
.log-item .ts { color: var(--t-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.log-item .who { font-weight: 700; color: var(--t-ink); }
.log-item .chg { font-variant-numeric: tabular-nums; color: var(--t-graphite-2); font-weight: 600; }
.log-item.after { background: var(--t-after); }
.log-item.after .chg { color: var(--t-after-ink); }
.log-empty { color: var(--t-muted); padding: 18px; text-align: center; }

/* Выбор команды */
.team-grid { display: grid; gap: 10px; margin: 6px 0 18px; }
.team-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-radius: 16px; background: #f8f8f8;
  border: 1.5px solid transparent; cursor: pointer; text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.team-card:hover { background: #fffdf0; border-color: var(--t-yellow); }
.team-card .tname { font-size: 16.5px; font-weight: 700; color: var(--t-ink); }
.team-card .tcount { font-size: 13px; color: var(--t-muted); }
.team-card .arrow { font-size: 20px; color: var(--t-muted); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom));
  background: var(--t-graphite); color: #fff;
  padding: 14px 22px; border-radius: 14px;
  font-size: 14.5px; font-weight: 600; z-index: 80;
  max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.24);
}
.toast.err { background: var(--t-after-ink); }
.toast.ok { background: var(--t-graphite); }

/* Админка */
.admin-sec { border-top: 1px solid var(--t-line-soft); padding: 18px 0; }
.admin-sec:first-of-type { border-top: 0; padding-top: 2px; }
.admin-sec h4 { margin: 0 0 4px; font-size: 15.5px; color: var(--t-ink); font-weight: 700; }
.small { font-size: 13px; margin: 0 0 12px; line-height: 1.35; }
.admin-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.admin-form input, .admin-form select { flex: 1 1 140px; min-width: 0; min-height: 44px; padding: 10px 14px; }
.admin-form .btn { flex: 0 0 auto; }
.chief-list, .people-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.chief-row, .people-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  font-size: 14px; padding: 10px 14px; background: #f8f8f8; border-radius: 12px;
}
.people-row { grid-template-columns: 1fr 1fr auto; }
.people-row .link { color: var(--t-muted); font-size: 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.people-row .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; border-radius: 10px; }

/* Телефон */
@media (max-width: 820px) {
  :root { --cell: 38px; --w-name: 172px; --w-region: 0px; --w-total: 56px; --w-day: 38px; }
  .month-title { font-size: 18px; min-width: 0; }
  .sheet-wrap { max-height: calc(100dvh - 275px); border-radius: 16px; }
  .cell.name { font-size: 13px; flex-direction: column; align-items: flex-start;
    justify-content: center; gap: 0; padding: 0 6px 0 10px; line-height: 1.15; }
  /* Регион на телефоне — второй строкой внутри ФИО, колонку не держим */
  .cell.name::after { content: attr(data-region); font-size: 10.5px; color: var(--t-muted);
    font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%; }
  :root { --w-ack: 28px; }
  .cell.region, .cell.head.region { display: none; }
  :root { --show-region: 0; }
  .cell.total { left: var(--w-name); }
  .log-item { grid-template-columns: 1fr auto; }
  .log-item .ts { grid-column: 1 / -1; }
  .people-row { grid-template-columns: 1fr auto; }
  .people-row .link { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  :root { --w-name: 150px; --w-total: 50px; --w-day: 36px; --cell: 36px; }
  .gate { padding: 24px 18px; margin-top: 2vh; }
  .gate h1 { font-size: 22px; }
  .who { font-size: 12px; }
}

@media print {
  .topbar, .board-head, .hint, .take-banner, .modal, .toast { display: none !important; }
  .sheet-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; }
  .cell.head { position: static; }
}

/* ---------- вход выбором себя ---------- */
.pick-wrap { margin: 18px 0 10px; }
.pick-input {
  width: 100%; padding: 16px 18px; font-size: 17px; border: 2px solid var(--t-line);
  border-radius: var(--t-radius-sm); background: #fff; color: var(--t-ink); outline: none;
}
.pick-input:focus { border-color: var(--t-yellow); box-shadow: 0 0 0 4px rgba(255,221,45,.35); }
.pick-list {
  margin-top: 10px; max-height: 54vh; overflow-y: auto; background: #fff;
  border-radius: var(--t-radius-sm); border: 1px solid var(--t-line);
}
.pick-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  width: 100%; text-align: left; padding: 14px 16px; background: none; border: 0;
  border-bottom: 1px solid var(--t-line-soft); font: inherit; color: var(--t-ink); cursor: pointer;
}
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover, .pick-item:focus-visible { background: #fffbe6; }
.pick-item b { font-weight: 600; }
.pick-team { grid-column: 1; font-size: 13px; color: var(--t-muted); }
.pick-mark { grid-column: 2; grid-row: 1; font-size: 11.5px; color: #8a6d00; background: var(--t-yellow); padding: 2px 8px; border-radius: 999px; }
.pick-item.last { background: #fffdf3; }
.pick-empty { padding: 18px; color: var(--t-muted); text-align: center; }

/* ---------- отметка своей строки ---------- */
.mine-mark { margin-left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #1c1c1c; background: var(--t-yellow); padding: 1px 7px; border-radius: 999px; }

/* ---------- админка ---------- */
.admin-page { max-width: 760px; margin: 0 auto; padding: 16px max(12px, env(safe-area-inset-left)) calc(60px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right)); }
.tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: rgba(0,0,0,.06); border-radius: 999px; padding: 3px; width: fit-content; max-width: 100%;
}
.tab {
  padding: 8px 14px; border-radius: 999px; border: 0;
  background: transparent; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink-2, #6b7280); cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--t-yellow); color: var(--t-yellow-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.panel {
  background: #fff; border: 1.5px solid var(--t-line); border-radius: var(--t-radius);
  padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  overflow-x: hidden;
}
.panel h4 { margin: 0 0 6px; font-size: 16px; color: var(--t-ink); }
.admin-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.admin-form input, .admin-form select {
  padding: 10px 12px; border: 1.5px solid var(--t-line); border-radius: var(--t-radius-sm);
  font: inherit; color: var(--t-ink); background: #fff; min-width: 0; flex: 1 1 120px; min-height: 44px;
}
.admin-form .btn { flex: 0 0 auto; }
.chk { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--t-body); flex: 0 0 auto; white-space: nowrap; }
.team-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.team-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--t-head);
  border: 1.5px solid var(--t-line); border-radius: 999px; padding: 5px 5px 5px 12px; font-size: 14px;
}
.chip-count { color: var(--t-muted); font-size: 12.5px; }
.team-chip button {
  border: 1.5px solid var(--t-line); background: #fff; width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; color: var(--t-muted); font-size: 13px; line-height: 1;
}
.roster-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.roster-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center;
  padding: 10px 12px; border-radius: var(--t-radius-sm); background: var(--t-head);
  border: 1px solid var(--t-line-soft);
}
.roster-row.inactive { opacity: .55; }
.roster-main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.roster-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--t-yellow); color: var(--t-yellow-ink); font-weight: 600; white-space: nowrap; }
.badge.warn { background: var(--t-after); color: var(--t-after-ink); }
/* Метка графика в составе: ТК и ГПХ должны различаться с одного взгляда */
.badge.chart-badge { background: #e8f0fe; color: #1a44a8; }
.badge.chart-badge:empty { display: none; }
.btn.mini { padding: 6px 10px; font-size: 13px; min-height: 36px; }
.btn.danger { color: var(--t-after-ink); }
select.mini { padding: 6px 8px; border: 1.5px solid var(--t-line); border-radius: 10px; font: inherit; font-size: 13px; min-height: 36px; max-width: 180px; }

/* ---------- архив ---------- */
.archive-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.arch-day { background: var(--t-head); border: 1px solid var(--t-line-soft); border-radius: var(--t-radius-sm); padding: 10px 12px; }
.arch-head { display: flex; gap: 10px; align-items: baseline; padding-bottom: 6px; border-bottom: 1px solid var(--t-line); }
.arch-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 14px; flex-wrap: wrap; border-bottom: 1px dashed var(--t-line-soft); }
.arch-item:last-child { border-bottom: 0; }
.arch-item.after { background: #fff5f4; border-radius: 8px; padding: 6px 8px; }
.arch-time { color: var(--t-muted); font-variant-numeric: tabular-nums; flex: 0 0 44px; }
.arch-who { font-weight: 600; color: var(--t-ink); }
.arch-what { color: var(--t-body); min-width: 0; flex: 1 1 200px; }
.admin-footer { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
/* Слоты смен в админке — карточки в ряд, не простыня */
.slot-admin { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.slot-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--t-line); border-radius: 12px; padding: 8px 10px; background: #fff;
}
.slot-chip b { font-size: 15px; }
.slot-chip input { width: 64px; min-height: 34px; padding: 4px 8px; text-align: center;
  border: 1.5px solid var(--t-line); border-radius: 8px; font: inherit; }
.slot-chip button { border: 1.5px solid var(--t-line); background: #fff; border-radius: 8px;
  color: var(--t-muted); cursor: pointer; font-size: 15px; padding: 2px 9px; line-height: 1.4; }
.slot-chip button:hover { background: #fde9e7; color: var(--t-after-ink); }
@media (max-width: 640px) {
  .admin-page { padding: 12px 10px 50px; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 8px 6px; font-size: 13px; }
  .panel { padding: 14px 12px; }
  .admin-form input, .admin-form select { flex: 1 1 100%; }
  .admin-form .btn, .admin-form .chk { flex: 1 1 100%; justify-content: center; }
  .roster-row { grid-template-columns: 1fr; align-items: stretch; }
  .roster-acts { justify-content: flex-start; }
  select.mini { max-width: none; flex: 1 1 120px; }
  .arch-time { flex-basis: 38px; font-size: 12.5px; }
  .pick-list { max-height: 48vh; }
}


/* ---------- развилка графиков: ТК / ГПХ ---------- */
.chart-switch {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex: 0 0 auto;
}
.chart-tab {
  border: 0;
  background: transparent;
  color: var(--ink-2, #6b7280);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.chart-tab:hover { color: var(--ink, #1c1c1e); }
.chart-tab.on {
  background: #ffdd2d;
  color: #1c1c1e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
@media (max-width: 640px) {
  .chart-switch { width: auto; }
  .chart-tab { padding: 8px 14px; }
  .month-title { font-size: 17px; }
  /* вся шапка — строго одна строка */
  .board-head { flex-wrap: nowrap; }
  .board-toprow { flex: 0 1 auto; }
  .board-actions { flex: 1 1 auto; }
  .search { flex: 1 1 60px; min-width: 0; }
  .team-filter { flex: 1 1 60px; min-width: 0; }
}


/* ---------- правки и подтверждение ---------- */

/* Лёгкая красная пульсация: кто-то изменил строку после вашего входа.
   Пульсируем тенью и наложением, а не фоном — иначе затрём подсветку выходных
   и цвет команды, и ячейка перестанет читаться. */
@keyframes fresh-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(217, 45, 32, .28); }
  50%      { box-shadow: inset 0 0 0 2px rgba(217, 45, 32, .62); }
}
@keyframes fresh-fio-pulse {
  0%, 100% { background-color: rgba(217, 45, 32, .06); }
  50%      { background-color: rgba(217, 45, 32, .17); }
}
.cell.day.fresh { animation: fresh-pulse 2.6s ease-in-out infinite; }
.cell.day.fresh::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: rgba(217, 45, 32, .07);
}
.cell.name.row-fresh { animation: fresh-fio-pulse 2.6s ease-in-out infinite; }
.cell.name.row-fresh::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #d92d20; opacity: .55; border-radius: 0 2px 2px 0;
}
/* строка ждёт подтверждения ответственного */
.cell.name.row-await { box-shadow: inset 5px 0 0 rgba(217, 45, 32, .55); }

/* Зелёная пульсация: ответственный правки увидел */
@keyframes acked-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(18, 140, 74, .26); }
  50%      { box-shadow: inset 0 0 0 2px rgba(18, 140, 74, .55); }
}
@keyframes acked-fio-pulse {
  0%, 100% { background-color: rgba(18, 140, 74, .05); }
  50%      { background-color: rgba(18, 140, 74, .14); }
}
.cell.day.acked { animation: acked-pulse 3.4s ease-in-out infinite; }
.cell.day.acked::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: rgba(18, 140, 74, .05);
}
.cell.name.row-acked { animation: acked-fio-pulse 3.4s ease-in-out infinite; }

/* Уважаем настройку «меньше движения»: пульсацию заменяем статичной меткой */
@media (prefers-reduced-motion: reduce) {
  .cell.day.fresh, .cell.name.row-fresh,
  .cell.day.acked, .cell.name.row-acked { animation: none; }
  .cell.day.fresh { box-shadow: inset 0 0 0 2px rgba(217, 45, 32, .55); }
  .cell.day.acked { box-shadow: inset 0 0 0 2px rgba(18, 140, 74, .5); }
}

/* ---------- выделение и копирование ячеек ---------- */

.sheet .cell.day { user-select: none; }
/* Выделение должно читаться с первого взгляда: жирная жёлтая рамка у фокуса
   и плотная заливка всего диапазона, а не едва заметный фон. */
.sheet .cell.day.sel {
  box-shadow: inset 0 0 0 3px var(--t-yellow), inset 0 0 0 5px rgba(28, 28, 28, .55);
  background-color: rgba(255, 221, 45, .55);
  z-index: 3;
}
.sheet .cell.day.sel-range {
  background-color: rgba(255, 221, 45, .38);
  box-shadow: inset 0 0 0 1px rgba(255, 221, 45, .9);
}

/* Панель действий над выделением: появляется только когда есть что копировать */
.sel-bar {
  position: sticky; left: 0; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; padding: 8px 10px; margin: 0 0 8px; border-radius: 12px;
  background: #fffbe6; border: 1px solid rgba(255, 221, 45, .8);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06); font-size: 13px;
}
.sel-bar.hidden { display: none; }
.sel-bar b { font-weight: 700; }
.sel-bar .spacer { flex: 1 1 auto; }
.sel-hint { font-size: 11.5px; color: #8a6d00; opacity: .85; }
@media (max-width: 700px) { .sel-hint { display: none; } }

/* Кнопка «правки увидел» в строке */
.ack-btn {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  background: #128c4a; color: #fff; font-size: 13px; line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); flex: 0 0 auto;
}
.ack-btn:hover { background: #0f7a40; }
.ack-btn:active { transform: scale(.94); }
