/* ============================================================
   График смен — светлая тема в духе дизайн-системы Apple
   Фирменные цвета Freeman's: коралл #FF8562, тил #00A3C4
   ============================================================ */

:root {
  /* поверхности */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --fill: #f0f0f3;          /* пустая ячейка / вторичная заливка */

  /* текст */
  --text: #1d1d1f;
  --text-2: rgba(0, 0, 0, 0.56);
  --text-3: rgba(0, 0, 0, 0.40);

  /* линии */
  --hair: rgba(0, 0, 0, 0.08);
  --stroke: rgba(0, 0, 0, 0.12);

  /* фирменные цвета */
  --coral: #FF8562;
  --coral-d: #F2704B;
  --coral-tint: #FFF0EA;
  --teal: #00A3C4;
  --teal-tint: #E6F6FA;

  /* смены */
  --shift1: #FF8562;
  --shift1-text: #1d1d1f;
  --shift2: #00A3C4;
  --shift2-text: #ffffff;
  --off: #E8E8ED;
  --off-text: rgba(0, 0, 0, 0.40);
  --full: #1d1d1f;

  /* статусы */
  --ok: #00758C;
  --bad: #B23A20;
  --focus: #0071e3;

  /* геометрия */
  --r-card: 12px;
  --r-ctl: 8px;
  --r-pill: 980px;
}

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

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.01em;
}

body { min-height: 100vh; }

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

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------- шапка ---------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  background: rgba(245, 245, 247, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hair);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  min-width: 0;
}

.brand .logo {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--coral);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand .logo svg { width: 19px; height: 19px; stroke: #fff; }

.brand .bt { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.brand .bt b {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
}
.brand .bt .bt-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral-d);
  line-height: 1.3;
  white-space: nowrap;
}

.brand .bt b .short { display: none; }

.top nav {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--r-pill);
  padding: 3px;
}
.top nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.top nav a.on {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.top nav a:active { opacity: 0.6; }

/* ---------------- каркас страницы ---------------- */

main {
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  max-width: 1180px;
  margin: 0 auto;
}

main.has-bar { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

h1 {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 4px 0 10px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 28px 0 12px;
}

.sub {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.4;
  margin: -4px 0 16px;
}

.small { font-size: 13px; }

/* ---------------- карточки ---------------- */

.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-card);
  padding: 16px;
  margin-bottom: 12px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.narrow { max-width: 560px; }

/* ---------------- кнопки ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  background: var(--text);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover { background: #000; }
.btn:active { opacity: 0.75; }

.btn.ghost {
  background: transparent;
  border-color: var(--stroke);
  color: var(--text);
  font-weight: 500;
}
.btn.ghost:hover { background: rgba(0, 0, 0, 0.04); }

.btn.danger {
  background: transparent;
  border-color: rgba(178, 58, 32, 0.22);
  color: var(--bad);
  font-weight: 500;
}
.btn.danger:hover { background: #FFF4F1; }

.btn.wide { width: 100%; }
.person .savebtn { flex: 1 1 auto; }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 14px; line-height: 1.15; border-radius: var(--r-ctl); }
.btn svg { width: 19px; height: 19px; flex: 0 0 19px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ---------------- раскладка ---------------- */

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }

/* ---------------- поля ---------------- */

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  font-family: inherit;
  letter-spacing: -0.01em;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(0,0,0,0.45)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}

input:focus, select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: transparent;
}

label.fld {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin: 0 0 6px;
}

/* ---------------- таблица графика ---------------- */

.scroll::-webkit-scrollbar { height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 980px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

.scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 0;
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 6px 6px 8px;
}

table.grid {
  border-collapse: separate;
  border-spacing: 3px;
  /* гарантируем, что колонка имён не схлопнется */
  width: auto;
}

table.grid th, table.grid td { padding: 0; text-align: center; }

table.grid thead th {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 0 6px;
  min-width: 46px;
  line-height: 1.2;
  vertical-align: bottom;
}
table.grid thead th .d {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  margin-bottom: 1px;
}

table.grid th.name, table.grid td.name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  text-align: left;
  padding: 0 10px 0 4px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  min-width: 104px;
  max-width: 144px;
  white-space: normal;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 1px 0 0 var(--hair);
}
table.grid thead th.name {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-3);
  font-weight: 500;
  vertical-align: bottom;
}

table.grid td.total, table.grid th.total {
  min-width: 34px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding-left: 6px;
  vertical-align: middle;
}
table.grid th.total { color: var(--text-3); }

/* ячейка */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--fill);
  color: var(--text-3);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 0.12s ease, transform 0.12s ease;
}
.cell:active { filter: brightness(0.94); }

.cell.c-none { background: var(--fill); color: var(--text-3); }
.cell.c-1 { background: var(--shift1); color: var(--shift1-text); }
.cell.c-2 { background: var(--shift2); color: var(--shift2-text); }
.cell.c-B { background: var(--off); color: var(--off-text); }
.cell.c-F, .cell.c-both { background: var(--full); color: #fff; }

/* «1/вых» и «2/вых»: цвет смены 55% + диагональная штриховка */
.cell.c-1B {
  background-color: rgba(255, 133, 98, 0.55);
  background-image: repeating-linear-gradient(135deg,
      rgba(255, 255, 255, 0.45) 0 3px, rgba(255, 255, 255, 0) 3px 7px);
  color: var(--text);
}
.cell.c-2B {
  background-color: rgba(0, 163, 196, 0.55);
  background-image: repeating-linear-gradient(135deg,
      rgba(255, 255, 255, 0.45) 0 3px, rgba(255, 255, 255, 0) 3px 7px);
  color: #083A45;
}
.cell.ro { cursor: default; }

/* итоговые строки */
tr.sum td {
  font-size: 12px;
  color: var(--text-2);
  padding-top: 6px;
  font-variant-numeric: tabular-nums;
}
tr.sum td.bad { color: var(--bad); font-weight: 600; }
tr.sum td.ok { color: var(--ok); }
tr.sum td.name {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

th.bad-h { color: var(--bad); }
th.bad-h .d { color: var(--bad); }

/* легенда */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 12px;
  align-items: center;
}
.legend span { display: inline-flex; align-items: center; }
.legend i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 0;
  height: 22px;
  border-radius: 6px;
  margin-right: 7px;
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
}

.mode {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-3);
  margin-top: 2px;
}

/* ---------------- итоги по людям (компактная таблица) ---------------- */
.mini-table { width: 100%; max-width: 640px; border-collapse: collapse; font-size: 15px; }
.mini-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
  padding: 6px 4px 8px;
  border: 0;
}
.mini-table th:first-child { text-align: left; padding-left: 2px; }
.mini-table td {
  padding: 10px 4px;
  text-align: center;
  border-top: 1px solid var(--hair);
  font-variant-numeric: tabular-nums;
}
.mini-table td:first-child {
  text-align: left;
  padding-left: 2px;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.mini-table td.b { font-weight: 600; }
.mini-table td.diff.ok { color: var(--ok); }
.mini-table td.diff.bad { color: var(--bad); }
.mini-table td.muted { color: var(--text-2); }
.mini-table tbody tr:first-child td { border-top: 0; }

/* ---------------- метрики ---------------- */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 18px;
}
.stat {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-card);
  padding: 14px 16px;
}
.stat b {
  display: block;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 13px; color: var(--text-2); line-height: 1.3; display: block; margin-top: 2px; }
.stat.ok b { color: var(--ok); }
.stat.bad b { color: var(--bad); }

/* ---------------- люди ---------------- */

ul.people { list-style: none; margin: 0; padding: 0; }
ul.people li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hair);
  flex-wrap: wrap;
}
ul.people li:last-child { border-bottom: none; }
ul.people li.arch { opacity: 0.55; }
ul.people form { display: flex; gap: 8px; flex: 1 1 auto; }
ul.people input { min-height: 44px; font-size: 16px; }

.person.arch { opacity: 0.62; }

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--coral-tint);
  color: #C6522F;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
  white-space: nowrap;
}
.badge.new { background: var(--coral-tint); color: #B4491F; }
.badge.arch { background: var(--fill); color: var(--text-2); }

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--text-2);
  white-space: nowrap;
}
.tag.ready { background: var(--teal-tint); color: #00697F; }
.tag.draft { background: #FFF6E5; color: #8A5A00; }

/* дни недели у руководителя */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 62px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-ctl);
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.day:has(input:checked) {
  border-color: var(--coral);
  background: var(--coral-tint);
  color: var(--text);
  font-weight: 500;
}
.day span { line-height: 1; }

/* ---------------- вход ---------------- */

.login-box {
  max-width: 400px;
  margin: 6vh auto 0;
  text-align: left;
}
.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--coral);
  margin-bottom: 18px;
}
.login-logo svg { width: 34px; height: 34px; stroke: #fff; }
.login-box h1 { font-size: 34px; margin-bottom: 6px; }
.login-box .sub { margin-bottom: 20px; }
.login-box .card { padding: 18px; }

/* ---------------- сообщения ---------------- */

.flash {
  background: var(--teal-tint);
  border: 0;
  border-left: 3px solid var(--teal);
  color: #005E73;
  padding: 12px 14px;
  border-radius: var(--r-card);
  margin-bottom: 14px;
  font-size: 15px;
}
.warn {
  background: #FFF6E8;
  border: 0;
  border-left: 3px solid #E0A33A;
  color: #7A4E00;
  padding: 12px 14px;
  border-radius: var(--r-card);
  font-size: 15px;
}
.problems { margin: 0; padding-left: 20px; font-size: 15px; color: var(--text); }
.problems li { margin-bottom: 8px; }
.problems li:last-child { margin-bottom: 0; }

/* ---------------- месяцы ---------------- */

.month-list { display: grid; gap: 10px; margin-bottom: 8px; }

.month-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 0;
  border-radius: var(--r-card);
  padding: 16px;
}
.month-item .t { flex: 1 1 auto; min-width: 0; }
.month-item .t b {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.month-item .t span { font-size: 13px; color: var(--text-2); }
.month-item a.go {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.month-item a.go svg { width: 17px; height: 17px; }

/* ---------------- файл ---------------- */

.file-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type="file"] { font-size: 14px; color: var(--text-2); max-width: 100%; }
input[type="file"]::file-selector-button {
  min-height: 44px;
  padding: 0 16px;
  margin-right: 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

/* ---------------- чекбоксы ---------------- */

.day input, label.chk input {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  position: relative;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid rgba(0, 0, 0, 0.22);
  background: var(--surface);
  flex: 0 0 auto;
}
.day input:checked, label.chk input:checked {
  background: var(--text);
  border-color: var(--text);
}
.day input:checked::after, label.chk input:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
label.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  margin: 12px 0;
  color: var(--text);
  cursor: pointer;
}
label.chk input { width: 24px; height: 24px; }
label.chk input:checked::after { left: 8px; top: 3px; }

/* ---------------- нижняя панель действий (мобильный) ---------------- */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: none;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  background: rgba(245, 245, 247, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--hair);
}
.actionbar .btn { flex: 1 1 0; min-height: 50px; font-size: 16px; white-space: nowrap; }

/* ---------------- шторка выбора кода ---------------- */

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.sheet[hidden] { display: none; }

.sheet-box {
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 640px;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  border: 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sheet-head b { font-weight: 600; }
.sheet-head .x {
  background: var(--fill);
  border: 0;
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sheet-head .x svg { width: 16px; height: 16px; display: block; }

.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  min-height: 58px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.pick b { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.pick span { font-size: 12px; color: var(--text-2); }
.pick:active { background: var(--fill); }


/* ---------------- имена-кнопки в сетке ---------------- */

.name-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}
.name-btn .nm { display: inline; }
.name-btn:hover .nm { color: var(--teal); }
.name-btn .mode { pointer-events: none; }

.grid-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--teal);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.grid-add:active { background: #f0f0f3; }
.grid-add svg { width: 17px; height: 17px; flex: 0 0 17px; }
.name-btn.add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.name-btn.add svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* ---------------- список людей ---------------- */

.people-list { display: grid; gap: 8px; }

.prow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.prow:active { background: #f0f0f3; }
.prow .t { flex: 1 1 auto; min-width: 0; }
.prow .t b {
  display: block;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prow .t span { display: block; font-size: 13px; color: var(--text-2); line-height: 1.35; }
.prow .chev { width: 20px; height: 20px; flex: 0 0 20px; color: var(--text-3); }
.prow.arch { opacity: 0.6; }

.prow-add {
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  background: transparent;
  border: 1px dashed rgba(0, 0, 0, 0.16);
  color: var(--teal);
  font-size: 16px;
  font-weight: 500;
}
.prow-add svg { width: 18px; height: 18px; flex: 0 0 18px; }
.prow-add:active { background: rgba(0, 163, 196, 0.06); }

/* ---------------- карточка сотрудника (модальное окно) ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.modal[hidden] { display: none; }

.modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 17px;
}
.modal-head b { font-weight: 600; letter-spacing: -0.01em; }
.modal-head .x {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.modal-head .x svg { width: 16px; height: 16px; display: block; }

.modal .chk { margin: 10px 0; }
.modal .row-chk {
  min-height: 52px;
  margin: 2px 0;
  padding: 6px 0;
  font-size: 17px;
  border-top: 1px solid var(--hair);
}
.modal .chk input { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; }
.modal .chk input:checked::after { left: 9px; top: 4px; width: 6px; height: 11px; }

.mgr-block {
  background: var(--fill);
  border-radius: var(--r-card);
  padding: 12px 12px 14px;
  margin: 4px 0 8px;
}
.mgr-block .sub { margin: 0 0 10px; }
.mgr-block .days { gap: 4px; }
.mgr-block .day { background: var(--surface); min-height: 58px; border-color: transparent; }
.mgr-block .day span { font-size: 12px; }
.mgr-block .day input { width: 24px; height: 24px; }
.mgr-block .day input:checked::after { left: 8px; top: 3px; }

.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.modal-actions .btn.wide { flex: 1 1 100%; }
.modal-actions .btn.ghost,
.modal-actions .btn.danger { flex: 1 1 40%; min-height: 46px; font-size: 16px; }

@media (min-width: 720px) {
  .modal { align-items: center; padding: 24px; }
  .modal-box {
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  }
}

/* ---------------- десктоп ---------------- */

@media (min-width: 720px) {
  main { padding: 28px 24px 48px; }
  h1 { font-size: 40px; }
  h2 { font-size: 24px; }
  .sub { font-size: 17px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .stat b { font-size: 32px; }
  table.grid th.name, table.grid td.name { min-width: 176px; font-size: 14px; }
  table.grid thead th { min-width: 50px; }
  .cell { min-width: 50px; height: 48px; }
  .month-item { padding: 18px 20px; }
  .brand .bt b { font-size: 17px; }
  .genform, .actions { max-width: 560px; }
  .person .savebtn { flex: 0 0 260px; }
  .person > .row { max-width: 540px; }
}

/* на очень узких экранах шапка компактнее */
@media (max-width: 430px) {
  .brand .bt .bt-sub { display: none; }
  .brand .bt b { font-size: 15px; }
  .brand .bt b .full { display: none; }
  .brand .bt b .short { display: inline; }
  .top nav a { padding: 0 10px; font-size: 13px; min-height: 32px; }
  h1 { font-size: 34px; }
  main { padding: 16px 12px calc(28px + env(safe-area-inset-bottom, 0px)); }
  main.has-bar { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .month-item { padding: 14px; }
  .stat b { font-size: 26px; }
}

@media (max-width: 374px) {
  h1 { font-size: 30px; }
  .top nav a { padding: 0 8px; }
}

@media (max-width: 364px) {
  .brand .bt { display: none; }
}

@media (max-width: 719px) {
  .actionbar { display: flex; }
}

/* на десктопе нижняя панель не нужна, но если разметка осталась — не мешает */
@media (min-width: 720px) {
  main.has-bar { padding-bottom: 48px; }
}


/* подсказка под галочкой «Новенький» */
.chk-hint {
  margin: -2px 0 10px 34px;
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: rgba(0, 0, 0, 0.56);
  max-width: 46ch;
}
@media (max-width: 480px) {
  .chk-hint { margin-left: 0; margin-top: 2px; }
}
