/* =====================================================================
   Sappa · единый стиль в духе iOS (экраны сотрудника и панель управления)
   Цвета и размеры — по системной палитре и типографике iOS.
   Компоненты и примеры — /manage/kit/ (страница-образец).
   ===================================================================== */

/* ---------- Токены: светлая тема ---------- */
:root {
  color-scheme: light dark;

  --blue: #007AFF;
  --green: #34C759;
  --indigo: #5856D6;
  --orange: #FF9500;
  --pink: #FF2D55;
  --purple: #AF52DE;
  --red: #FF3B30;
  --teal: #30B0C7;
  --yellow: #FFCC00;
  --gray: #8E8E93;
  --gray2: #AEAEB2;
  --gray3: #C7C7CC;
  --gray4: #D1D1D6;
  --gray5: #E5E5EA;
  --gray6: #F2F2F7;

  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --label-4: rgba(60, 60, 67, 0.18);

  --bg: #FFFFFF;                 /* systemBackground */
  --bg-grouped: #F2F2F7;         /* systemGroupedBackground — фон страниц */
  --bg-grouped-2: #FFFFFF;       /* secondarySystemGroupedBackground — карточки и списки */
  --bg-grouped-3: #F2F2F7;       /* tertiary — поля внутри карточек */

  --fill: rgba(120, 120, 128, 0.20);
  --fill-2: rgba(120, 120, 128, 0.16);
  --fill-3: rgba(118, 118, 128, 0.12);
  --fill-4: rgba(116, 116, 128, 0.08);

  --separator: rgba(60, 60, 67, 0.29);
  --separator-opaque: #C6C6C8;
  --highlight: #D1D1D6;          /* подсветка нажатой строки */

  --bar-bg: rgba(249, 249, 249, 0.86);
  --bar-border: rgba(0, 0, 0, 0.3);
  --switch-off: rgba(120, 120, 128, 0.16);
  --segment-on: #FFFFFF;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.18);

  /* Подсветка коэффициентов (как цвета ручных отчётов, но в палитре iOS) */
  --tint-double: rgba(175, 82, 222, 0.16);
  --tint-weekend: rgba(52, 199, 89, 0.16);
  --tint-evening: rgba(48, 176, 199, 0.18);
  --tint-manual: rgba(255, 149, 0, 0.18);
  --tint-blue: rgba(0, 122, 255, 0.12);
  --tint-red: rgba(255, 59, 48, 0.12);
  --tint-green: rgba(52, 199, 89, 0.14);
  --tint-orange: rgba(255, 149, 0, 0.15);
  --tint-gray: rgba(120, 120, 128, 0.12);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius-list: 10px;
  --radius-card: 12px;
  --radius-button: 12px;
  --inset: 16px;
  --cell-min: 44px;
  --tabbar-h: 49px;
  --navbar-h: 44px;
  --sidebar-w: 300px;
  --content-narrow: 680px;
  --content-wide: 1040px;
}

/* ---------- Токены: тёмная тема ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #0A84FF;
    --green: #30D158;
    --indigo: #5E5CE6;
    --orange: #FF9F0A;
    --pink: #FF375F;
    --purple: #BF5AF2;
    --red: #FF453A;
    --teal: #40C8E0;
    --yellow: #FFD60A;
    --gray: #8E8E93;
    --gray2: #636366;
    --gray3: #48484A;
    --gray4: #3A3A3C;
    --gray5: #2C2C2E;
    --gray6: #1C1C1E;

    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --label-4: rgba(235, 235, 245, 0.16);

    --bg: #000000;
    --bg-grouped: #000000;
    --bg-grouped-2: #1C1C1E;
    --bg-grouped-3: #2C2C2E;

    --fill: rgba(120, 120, 128, 0.36);
    --fill-2: rgba(120, 120, 128, 0.32);
    --fill-3: rgba(118, 118, 128, 0.24);
    --fill-4: rgba(118, 118, 128, 0.18);

    --separator: rgba(84, 84, 88, 0.65);
    --separator-opaque: #38383A;
    --highlight: #3A3A3C;

    --bar-bg: rgba(29, 29, 31, 0.86);
    --bar-border: rgba(255, 255, 255, 0.15);
    --switch-off: rgba(120, 120, 128, 0.32);
    --segment-on: #636366;
    --shadow-card: none;
    --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.6);

    --tint-double: rgba(191, 90, 242, 0.26);
    --tint-weekend: rgba(48, 209, 88, 0.22);
    --tint-evening: rgba(64, 200, 224, 0.22);
    --tint-manual: rgba(255, 159, 10, 0.24);
    --tint-blue: rgba(10, 132, 255, 0.22);
    --tint-red: rgba(255, 69, 58, 0.2);
    --tint-green: rgba(48, 209, 88, 0.2);
    --tint-orange: rgba(255, 159, 10, 0.2);
    --tint-gray: rgba(120, 120, 128, 0.24);
  }
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-grouped);
  color: var(--label);
  font: 17px/1.29 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Типографика iOS */
.t-large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.01em; }
.t-title1 { font-size: 28px; line-height: 34px; font-weight: 700; }
.t-title2 { font-size: 22px; line-height: 28px; font-weight: 700; }
.t-title3 { font-size: 20px; line-height: 25px; font-weight: 600; }
.t-headline { font-size: 17px; line-height: 22px; font-weight: 600; }
.t-body { font-size: 17px; line-height: 22px; }
.t-callout { font-size: 16px; line-height: 21px; }
.t-subhead { font-size: 15px; line-height: 20px; }
.t-footnote { font-size: 13px; line-height: 18px; }
.t-caption { font-size: 12px; line-height: 16px; }
.t-caption2 { font-size: 11px; line-height: 13px; }
.secondary { color: var(--label-2); }
.tertiary { color: var(--label-3); }
.text-blue { color: var(--blue); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.text-purple { color: var(--purple); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.rounded-num { font-family: var(--font-rounded); font-variant-numeric: tabular-nums; }

/* Иконки (SVG-спрайт ui/icons.html) */
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 17px; height: 17px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 54px; height: 54px; stroke-width: 1.5; }
.icon.fill { fill: currentColor; stroke: none; }

/* ---------- Навигационная панель (сверху, полупрозрачная) ---------- */
.navbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top);
  background: transparent;
  transition: background-color .2s, box-shadow .2s;
}
.navbar.scrolled, .navbar.solid {
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--bar-border);
}
.navbar-inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: var(--navbar-h); padding: 0 8px; margin: 0 auto;
}
.navbar-left { justify-self: start; display: flex; align-items: center; min-width: 0; }
.navbar-right { justify-self: end; display: flex; align-items: center; gap: 4px; }
.navbar-title {
  font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60vw; opacity: 0; transition: opacity .15s;
}
.navbar.scrolled .navbar-title, .navbar.show-title .navbar-title { opacity: 1; }
.nav-back, .nav-action {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px;
  color: var(--blue); font-size: 17px; background: none; border: 0; white-space: nowrap;
}
.nav-back .icon { width: 24px; height: 24px; stroke-width: 2.4; margin-left: -6px; }
.nav-action.bold { font-weight: 600; }
.nav-action .icon { width: 24px; height: 24px; }
.nav-back:active, .nav-action:active { opacity: .4; }

/* Крупный заголовок страницы */
.large-title { padding: 2px 20px 8px; }
.large-title h1 { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.01em; }
.large-title .subtitle { margin-top: 2px; font-size: 15px; color: var(--label-2); }
.large-title.with-action { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

/* ---------- Раскладка ---------- */
.content { margin: 0 auto; padding-bottom: 32px; }
.content-narrow { max-width: var(--content-narrow); }
.content-wide { max-width: var(--content-wide); }
.has-tabbar .content { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }

/* ---------- Секции и сгруппированные списки (как «Настройки») ---------- */
.section { margin: 0 0 35px; }
.section:first-child { margin-top: 8px; }
.section-header {
  padding: 0 calc(var(--inset) + 16px) 7px; font-size: 13px; line-height: 18px; color: var(--label-2);
  text-transform: uppercase; letter-spacing: 0.02em;
}
.section-header.plain { text-transform: none; font-size: 20px; line-height: 25px; font-weight: 600; color: var(--label); letter-spacing: 0; padding-bottom: 8px; }
.section-header .action { float: right; text-transform: none; color: var(--blue); font-size: 15px; letter-spacing: 0; }
.section-footer { padding: 7px calc(var(--inset) + 16px) 0; font-size: 13px; line-height: 18px; color: var(--label-2); }
.section-footer.error, .section-header.error { color: var(--red); }

.list {
  margin: 0 var(--inset); background: var(--bg-grouped-2); border-radius: var(--radius-list);
  overflow: hidden; box-shadow: var(--shadow-card);
}
.list.flush { margin: 0; border-radius: 0; }

.cell {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: var(--cell-min); padding: 0 16px; background: var(--bg-grouped-2);
  color: var(--label); text-decoration: none;
}
.cell + .cell::before, .list > * + .cell::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 0.5px; background: var(--separator);
}
.cell.inset-icon + .cell::before, .list.with-icons > * + .cell::before { left: 57px; }
.cell.no-sep::before { display: none; }
a.cell:active, button.cell:active, label.cell.tappable:active, .cell.tappable:active { background: var(--highlight); }
button.cell { width: 100%; border: 0; text-align: left; font-size: 17px; }

.cell-icon {
  display: grid; place-items: center; flex: none; width: 29px; height: 29px; border-radius: 7px;
  color: #fff; background: var(--gray);
}
.cell-icon .icon { width: 19px; height: 19px; stroke-width: 2; }
.ic-blue { background: var(--blue); }
.ic-green { background: var(--green); }
.ic-indigo { background: var(--indigo); }
.ic-orange { background: var(--orange); }
.ic-pink { background: var(--pink); }
.ic-purple { background: var(--purple); }
.ic-red { background: var(--red); }
.ic-teal { background: var(--teal); }
.ic-yellow { background: var(--yellow); }
.ic-gray { background: var(--gray); }

.cell-body { flex: 1; min-width: 0; padding: 11px 0; }
.cell-title { display: block; font-size: 17px; line-height: 22px; }
.cell-subtitle { display: block; font-size: 15px; line-height: 20px; color: var(--label-2); }
.cell-subtitle + .cell-subtitle { margin-top: 1px; }
.cell-body.truncate .cell-title, .cell-body.truncate .cell-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-value { margin-left: auto; padding-left: 8px; color: var(--label-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-value.strong { color: var(--label); font-weight: 600; }
.cell-chevron { flex: none; color: var(--gray3); margin-right: -4px; }
.cell-chevron .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.cell-check { flex: none; color: var(--blue); visibility: hidden; }
.cell-check .icon { width: 20px; height: 20px; stroke-width: 2.6; }

.cell.button-cell { justify-content: center; color: var(--blue); }
.cell.button-cell.left { justify-content: flex-start; }
.cell.destructive { color: var(--red); }
.cell.disabled, .cell[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Поля ввода внутри ячеек */
.cell-input, .cell-select {
  flex: 1; min-width: 0; height: var(--cell-min); padding: 0; border: 0; background: transparent;
  color: var(--label); font-size: 17px; outline: none; -webkit-appearance: none; appearance: none;
}
.cell-input.right, .cell-select { text-align: right; text-align-last: right; color: var(--label-2); }
.cell-input::placeholder, .cell-textarea::placeholder { color: var(--label-3); }
.cell-input[type="date"], .cell-input[type="time"] { color: var(--blue); }
.cell-input.amount { font-size: 28px; font-weight: 600; height: 56px; font-variant-numeric: tabular-nums; }
.cell-select { cursor: pointer; padding-right: 2px; }
.cell-select option { color: initial; }
.cell.stacked { flex-direction: column; align-items: stretch; gap: 2px; padding-top: 10px; padding-bottom: 10px; }
.cell.stacked .cell-label { font-size: 13px; color: var(--label-2); }
.cell-textarea {
  width: 100%; min-height: 66px; padding: 0; border: 0; background: transparent; color: var(--label);
  font-size: 17px; line-height: 22px; resize: vertical; outline: none;
}
.cell .cell-label { flex: none; display: block; }
.cell.error .cell-title, .cell.error .cell-label { color: var(--red); }

/* Выбор одного из списка: строки с галочкой */
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked ~ .cell-check { visibility: visible; }
.choice input:focus-visible ~ .cell-body { text-decoration: underline; }

/* ---------- Переключатель iOS ---------- */
.switch {
  position: relative; flex: none; width: 51px; height: 31px; margin: 0; border-radius: 16px;
  background: var(--switch-off); -webkit-appearance: none; appearance: none; cursor: pointer;
  transition: background-color .25s;
}
.switch::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform .25s cubic-bezier(.3, .7, .4, 1);
}
.switch:checked { background: var(--green); }
.switch:checked::before { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Сегментный переключатель ---------- */
.segmented {
  display: flex; padding: 2px; border-radius: 9px; background: var(--fill-3); gap: 0; position: relative;
}
.segmented label { position: relative; flex: 1; min-width: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .segmented a {
  display: block; padding: 6px 10px; border-radius: 7px; text-align: center; font-size: 13px; font-weight: 500;
  color: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.segmented input:checked + span, .segmented a.active {
  background: var(--segment-on); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
}
.segmented-wrap { margin: 0 var(--inset) 16px; }

/* ---------- Кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 50px;
  padding: 0 20px; border: 0; border-radius: var(--radius-button); background: none; color: var(--blue);
  font-size: 17px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { opacity: .7; }
.btn:disabled, .btn.disabled { opacity: .35; pointer-events: none; }
.btn-filled { background: var(--blue); color: #fff; }
.btn-tinted { background: var(--tint-blue); color: var(--blue); }
.btn-gray { background: var(--fill-3); color: var(--label); }
.btn-destructive { background: var(--tint-red); color: var(--red); }
.btn-plain { min-height: 44px; font-weight: 400; }
.btn-small { display: inline-flex; width: auto; min-height: 30px; padding: 0 14px; border-radius: 15px; font-size: 15px; }
.btn-medium { display: inline-flex; width: auto; min-height: 36px; padding: 0 16px; border-radius: 18px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.button-block { margin: 0 var(--inset); display: grid; gap: 10px; }
.icon-button {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--fill-3); color: var(--blue);
}
.icon-button .icon { width: 17px; height: 17px; stroke-width: 2.4; }

/* ---------- Метки и счётчики ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 13px; line-height: 18px; font-weight: 600; white-space: nowrap; background: var(--tint-gray); color: var(--label-2);
}
.badge-blue { background: var(--tint-blue); color: var(--blue); }
.badge-green { background: var(--tint-green); color: var(--green); }
.badge-orange { background: var(--tint-orange); color: var(--orange); }
.badge-red { background: var(--tint-red); color: var(--red); }
.badge-purple { background: var(--tint-double); color: var(--purple); }
.badge-teal { background: var(--tint-evening); color: var(--teal); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.count.gray { background: var(--gray3); color: var(--label); }
.coef { display: inline-block; min-width: 38px; padding: 2px 7px; border-radius: 7px; text-align: center; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; background: var(--fill-3); }
.coef.double { background: var(--tint-double); color: var(--purple); }
.coef.weekend { background: var(--tint-weekend); color: var(--green); }
.coef.evening { background: var(--tint-evening); color: var(--teal); }
.coef.other { background: var(--tint-manual); color: var(--orange); }

/* Плашка-пояснение с цветом коэффициента */
.callout { margin: 0 var(--inset) 16px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--fill-4); font-size: 15px; line-height: 20px; }
.callout b { font-weight: 600; }
.callout .big { display: block; font-size: 22px; line-height: 28px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.callout.double { background: var(--tint-double); }
.callout.weekend { background: var(--tint-weekend); }
.callout.evening { background: var(--tint-evening); }
.callout.other, .callout.warn { background: var(--tint-manual); }
.callout.info { background: var(--tint-blue); }
.callout.danger { background: var(--tint-red); color: var(--red); }

/* ---------- Плитки сводки (как «Здоровье») ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 0 var(--inset) 28px; }
.tile {
  display: block; padding: 12px 14px 14px; border-radius: var(--radius-card); background: var(--bg-grouped-2);
  color: var(--label); box-shadow: var(--shadow-card);
}
a.tile:active { background: var(--highlight); }
.tile-head { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; }
.tile-head .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.tile-value { margin-top: 8px; font-size: 28px; line-height: 34px; font-weight: 700; font-family: var(--font-rounded); font-variant-numeric: tabular-nums; }
.tile-note { font-size: 13px; color: var(--label-2); }
.tile.blue .tile-head { color: var(--blue); }
.tile.green .tile-head { color: var(--green); }
.tile.orange .tile-head { color: var(--orange); }
.tile.purple .tile-head { color: var(--purple); }
.tile.red .tile-head { color: var(--red); }
.tile.teal .tile-head { color: var(--teal); }

/* Крупная сумма */
.amount-hero { margin: 0 var(--inset) 20px; text-align: center; }
.amount-hero .label { font-size: 15px; color: var(--label-2); }
.amount-hero .value { font-size: 40px; line-height: 48px; font-weight: 700; font-family: var(--font-rounded); font-variant-numeric: tabular-nums; }

/* ---------- Поиск ---------- */
.search { position: relative; margin: 0 var(--inset) 14px; }
.search .icon { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--label-2); }
.search input {
  width: 100%; height: 36px; padding: 0 10px 0 32px; border: 0; border-radius: 10px; background: var(--fill-3);
  font-size: 17px; outline: none;
}
.search input::placeholder { color: var(--label-2); }

/* Фильтры-«пилюли» над списком */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 0 var(--inset) 14px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--bg-grouped-2); color: var(--label); font-size: 15px; box-shadow: var(--shadow-card); white-space: nowrap; }
.filter.active { background: var(--blue); color: #fff; }
.filter select { border: 0; background: transparent; outline: none; -webkit-appearance: none; appearance: none; font-size: 15px; cursor: pointer; }

/* ---------- Нижняя панель вкладок ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  padding: 0 4px env(safe-area-inset-bottom);
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -0.5px 0 var(--bar-border);
}
.tabbar a {
  position: relative; flex: 1; max-width: 120px; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--gray); font-size: 10px; font-weight: 500; letter-spacing: 0.01em;
}
.tabbar a .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.tabbar a.active { color: var(--blue); }
.tabbar a.active .icon { stroke-width: 2.1; }
.tabbar .count { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 12px; }

/* ---------- Боковое меню (панель управления на широком экране, как iPad) ---------- */
.split { min-height: 100vh; }
.sidebar { display: none; }
@media (min-width: 1024px) {
  .split { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
  .sidebar {
    display: block; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: calc(14px + env(safe-area-inset-top)) 12px 20px; background: var(--bg-grouped-2);
    border-right: 0.5px solid var(--separator);
  }
  .split .tabbar { display: none; }
  .split.has-tabbar .content { padding-bottom: 40px; }
  .split .main { min-width: 0; }
}
.sidebar-title { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-size: 22px; font-weight: 700; }
.sidebar-title img { border-radius: 8px; }
.sidebar-section { margin: 18px 10px 6px; font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.02em; }
.side-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border-radius: 10px;
  color: var(--label); font-size: 17px;
}
.side-item .icon { color: var(--blue); width: 24px; height: 24px; }
.side-item .count { margin-left: auto; }
.side-item:hover { background: var(--fill-4); }
.side-item.active { background: var(--blue); color: #fff; }
.side-item.active .icon { color: #fff; }
.side-item.active .count { background: #fff; color: var(--blue); }

/* ---------- Окна снизу (sheet) и диалоги (alert) на <dialog> ---------- */
dialog { padding: 0; border: 0; color: var(--label); }
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.sheet {
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: 640px; max-height: 92vh; margin: 0 auto;
  border-radius: 12px 12px 0 0; background: var(--bg-grouped); overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .32s cubic-bezier(.2, .9, .3, 1); }
@media (min-width: 700px) {
  .sheet { inset: 0; margin: auto; max-height: 86vh; border-radius: 14px; box-shadow: var(--shadow-pop); }
  .sheet[open] { animation: sheet-pop .22s ease-out; }
}
.sheet-grabber { width: 36px; height: 5px; margin: 6px auto 0; border-radius: 3px; background: var(--gray3); flex: none; }
@media (min-width: 700px) { .sheet-grabber { display: none; } }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 52px; padding: 0 8px; flex: none; }
.sheet-bar .sheet-title { font-size: 17px; font-weight: 600; text-align: center; }
.sheet-bar .left { justify-self: start; }
.sheet-bar .right { justify-self: end; }
.sheet-body { overflow-y: auto; padding: 4px 0 24px; -webkit-overflow-scrolling: touch; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheet-pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.alert {
  width: 270px; border-radius: 14px; background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  text-align: center; box-shadow: var(--shadow-pop); overflow: hidden;
}
.alert[open] { animation: sheet-pop .2s ease-out; }
.alert-body { padding: 19px 16px 16px; }
.alert-title { font-size: 17px; line-height: 22px; font-weight: 600; }
.alert-message { margin-top: 4px; font-size: 13px; line-height: 18px; }
.alert-actions { display: flex; border-top: 0.5px solid var(--separator); }
.alert-actions button {
  flex: 1; height: 44px; border: 0; background: none; color: var(--blue); font-size: 17px;
}
.alert-actions button + button { border-left: 0.5px solid var(--separator); }
.alert-actions button.primary { font-weight: 600; }
.alert-actions button.destructive { color: var(--red); }
.alert-actions button:active { background: var(--fill-4); }

/* ---------- Уведомления-баннеры ---------- */
.banners {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 60;
  display: grid; gap: 8px; justify-items: center; padding: 0 12px; pointer-events: none;
}
.banner {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; padding: 12px 14px;
  border-radius: 14px; background: var(--bar-bg); box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  font-size: 15px; line-height: 20px; pointer-events: auto; animation: banner-in .35s cubic-bezier(.2, .9, .3, 1);
}
.banner .icon { color: var(--green); }
.banner.error .icon { color: var(--red); }
.banner.warning .icon { color: var(--orange); }
.banner.info .icon { color: var(--blue); }
.banner.hide { transition: transform .3s, opacity .3s; transform: translateY(-120%); opacity: 0; }
@keyframes banner-in { from { transform: translateY(-120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Ошибки форм вне ячеек */
.form-errors { margin: 0 var(--inset) 16px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--tint-red); color: var(--red); font-size: 15px; }

/* ---------- Пустое состояние ---------- */
.empty { padding: 48px 32px; text-align: center; color: var(--label-2); }
.empty .icon { margin: 0 auto 12px; color: var(--gray3); }
.empty-title { font-size: 20px; line-height: 25px; font-weight: 600; color: var(--label); }
.empty-text { margin-top: 6px; font-size: 15px; line-height: 20px; }

/* ---------- Полоска недели (как «Календарь») ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); margin: 0 var(--inset) 12px; padding: 8px 4px; border-radius: var(--radius-card); background: var(--bg-grouped-2); box-shadow: var(--shadow-card); }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0 4px; color: var(--label); }
.week-day .wd { font-size: 11px; font-weight: 600; color: var(--label-2); text-transform: uppercase; }
.week-day .dn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.week-day .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.week-day.filled .dot { background: var(--gray2); }
.week-day.today .dn { color: var(--red); font-weight: 600; }
.week-day.current .dn { background: var(--blue); color: #fff; font-weight: 600; }
.week-day.current.today .dn { background: var(--red); }
.week-day.future { opacity: .35; pointer-events: none; }
.day-switcher { display: flex; align-items: center; justify-content: space-between; margin: 0 var(--inset) 10px; }

/* ---------- Таблица (предпросмотр отчёта в панели управления) ---------- */
.table-wrap { margin: 0 var(--inset); border-radius: var(--radius-list); background: var(--bg-grouped-2); overflow-x: auto; box-shadow: var(--shadow-card); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { position: sticky; top: 0; padding: 9px 10px; text-align: left; font-size: 12px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; background: var(--bg-grouped-2); box-shadow: inset 0 -0.5px 0 var(--separator); white-space: nowrap; }
.table td { padding: 8px 10px; border-top: 0.5px solid var(--separator); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table td.money, .table th.money { text-align: right; white-space: nowrap; }
.table tr.week-end td { box-shadow: inset 0 -1.5px 0 var(--red); }
.table td.k-double { background: var(--tint-double); }
.table td.k-weekend { background: var(--tint-weekend); }
.table td.k-evening { background: var(--tint-evening); }
.table td.k-manual { background: var(--tint-manual); }
.table td.advance { background: var(--red); color: #fff; font-weight: 600; }
.table tr.total td { font-weight: 600; background: var(--fill-4); }

/* ---------- Разное ---------- */
.hstack { display: flex; align-items: center; gap: 8px; }
.vstack { display: grid; gap: 4px; }
.spacer { flex: 1; }
.pad { padding: 0 var(--inset); }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.center { text-align: center; }
.divider { height: 0.5px; margin: 0 var(--inset); background: var(--separator); }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; padding: 1px 6px; border-radius: 6px; background: var(--fill-3); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: .06em; user-select: all; }

/* Экран входа */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { display: grid; justify-items: center; gap: 12px; margin-bottom: 28px; text-align: center; }
.auth-logo img { width: 84px; height: 84px; border-radius: 19px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.auth-logo h1 { font-size: 28px; line-height: 34px; font-weight: 700; }

/* =====================================================================
   Дополнения, найденные при вёрстке экранов (были вставками в шаблонах)
   ===================================================================== */

/* Строки списка */
.section-header .header-value { float: right; text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.cell-input.amount { color: var(--label); }
.cell-value.wrap { white-space: normal; overflow-wrap: anywhere; padding-top: 11px; padding-bottom: 11px; }
.cell-trail { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; padding: 10px 0 10px 8px; }
.cell-trail .cell-value { margin-left: 0; padding-left: 0; }
.cell-end { display: grid; justify-items: end; gap: 3px; flex: none; margin-left: auto; padding-left: 8px; }
.cell-end .cell-value { padding-left: 0; }
.cell-title .coef { min-width: 0; margin-left: 6px; padding: 0 6px; font-size: 13px; line-height: 18px; vertical-align: 1px; }
.cell-subtitle.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-subtitle .badge { margin-top: 3px; }
.inline-icon { display: inline-block; vertical-align: -3px; margin-left: 4px; }
.badge .icon { width: 12px; height: 12px; stroke-width: 2.4; }

/* Аватар с инициалами (как в «Контактах»): маленький в строке, крупный в списке сотрудников */
.cell-icon.avatar { border-radius: 50%; font-size: 13px; font-weight: 600; letter-spacing: 0; }
.list.with-avatars .cell-icon.avatar { width: 38px; height: 38px; font-size: 15px; letter-spacing: .02em; }
.list.with-avatars > * + .cell::before { left: 66px; }

/* Отметки «вчера / сегодня» в сводке */
.day-marks { display: flex; gap: 4px; flex: none; }
.day-mark { display: grid; justify-items: center; gap: 1px; min-width: 46px; font-size: 11px; line-height: 13px; color: var(--label-2); }
.day-mark .icon { width: 22px; height: 22px; }
.day-mark.ok .icon { color: var(--green); }
.day-mark.miss .icon { color: var(--red); }
.day-mark.wait .icon { color: var(--gray3); }

/* Строка проверки: запись слева, сумма и кнопки справа; на телефоне кнопки — второй строкой */
.review-cell { flex-wrap: wrap; }
.review-cell a.cell-body { color: var(--label); }
.review-cell a.cell-body:active { opacity: .5; }
.review-cell .badge .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.review-pay { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.review-pay .cell-value { padding-left: 0; }
.review-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.review-group { scroll-margin-top: calc(var(--navbar-h) + 12px); }
@media (max-width: 699px) {
  .review-actions { width: calc(100% - 41px); justify-content: flex-end; margin: -8px 0 9px auto; }
  .review-flag { margin-right: auto; }
}

/* Кнопки и переключатели */
.link-button { padding: 0; border: 0; background: none; }
.icon-button[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.segmented > a { flex: 1; min-width: 0; }
.filters.tight { padding-bottom: 8px; }
.filter select option { color: initial; }
.empty .btn { margin-top: 16px; }

/* Форма на всё окно снизу: шапка и содержимое остаются частями окна */
.sheet-form { display: contents; }

/* Плитки и заголовки */
.tile-value.compact { font-size: 22px; }
.tile-value.tiny { font-size: 18px; }
@media (max-width: 559px) { .tile.wide { grid-column: 1 / -1; } }
.large-title .subtitle.hstack { flex-wrap: wrap; }

/* Таблица отчёта */
.table td.pending { color: var(--orange); }
/* Ячейки в одну строку — таблица прокручивается вбок, как в «Числах»; пояснение переносится */
.table td, .table th { white-space: nowrap; }
.table td.desc { min-width: 220px; white-space: normal; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Строки ошибок и подсказок под полем формы */
.cell.cell-error-row { min-height: 0; padding: 6px 16px 10px; color: var(--red); font-size: 13px; line-height: 18px; }
.cell.cell-help-row { min-height: 0; padding: 0 16px 10px; color: var(--label-2); font-size: 13px; line-height: 18px; }

/* Окно снизу: в тёмной теме — «приподнятый» фон, как у системных окон iOS */
:root { --sheet-bg: #F2F2F7; --sheet-cell: #FFFFFF; }
@media (prefers-color-scheme: dark) { :root { --sheet-bg: #1C1C1E; --sheet-cell: #2C2C2E; } }
.sheet { background: var(--sheet-bg); }
.sheet .list, .sheet .cell { background: var(--sheet-cell); }

/* Кнопка-ссылка в заголовке секции («Убрать» у второго и третьего проекта дня) */
.section-header .header-action {
  float: right; padding: 0; border: 0; background: none; color: var(--blue);
  font: inherit; font-size: 15px; text-transform: none; letter-spacing: 0;
}
.section-header .header-action:active { opacity: .4; }
