/*
  Дизайн-система «Бригадир», облик «Кольца смены» (прототип design/v3/p1-ios-v3).
  Правила применения: DESIGN.md в корне проекта. Поведение компонентов: js/ui.js.
  Внешних адресов нет: шрифт Onest лежит в static/fonts/onest.
*/

/* ===== Шрифт: системный на Apple, на остальных Onest (переменный, 100-900) ===== */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/onest/onest-cyrillic-wght-normal.fe2bd26ae82a.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/onest/onest-latin-wght-normal.3db826ed1c5d.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Токены. Светлая тема ===== */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "Onest", system-ui, sans-serif;

  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --tile: #F2F2F7;
  --tile-press: #E8E8ED;
  --label: #1D1D1F;
  --label-2: #6E6E73;
  --sep: rgba(60, 60, 67, .16);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .22);
  --press: rgba(118, 118, 128, .10);
  --chev: #C4C4C7;
  --primary: #1D1D1F;
  --on-primary: #FFFFFF;
  --focus: #0A84FF;

  --hours: #FF6A1A;
  --hours-hot: #FFD7BD;
  --ring-neutral: #C7C7CC;
  --ok: #1E7B34;
  --ok-text: #1E7B34;
  --ok-soft: #E9F7EC;
  --err-text: #C4161C;
  --err-soft: #FFEDEC;
  --err-tag-bg: #FFDCDA;
  --err-tag: #A8120F;
  --info-text: #0060D1;
  --info-soft: #E8F1FF;
  --badge: #D70015;
  --avatar: #E3E3E8;
  --flash: #FFF1E6;
  --thumb: #FFFFFF;
  --shine: rgba(255, 255, 255, .6);
  --toast: rgba(29, 29, 31, .92);
  --toast-link: #FFB48A;
  --scrim: rgba(0, 0, 0, .32);

  /* Стекло в духе iOS 26. Материал взят из набора lensglass (MIT): плотная матовая заливка со светом
     по диагонали, размытие 30 px с насыщенностью 1,8, блик кольцом по кромке, большая мягкая тень */
  --glass-1: rgba(255, 255, 255, .78);
  --glass-2: rgba(255, 255, 255, .56);
  --glass-edge: rgba(255, 255, 255, .95);
  --glass-low: rgba(24, 30, 48, .03);
  --glass-rim: rgba(255, 255, 255, .55);
  --glass-line: rgba(0, 0, 0, .07);
  --glass-solid: #F7F7F9;
  --glass-shadow: 0 24px 60px rgba(24, 30, 48, .13), 0 4px 14px rgba(24, 30, 48, .06);
  --glass-shadow-sm: 0 8px 24px rgba(24, 30, 48, .08), 0 1px 4px rgba(24, 30, 48, .04);
  --glass-spec: linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .28) 24%, rgba(255, 255, 255, .05) 46%, rgba(255, 255, 255, .02) 58%, rgba(255, 255, 255, .4) 100%);
  --lens-1: rgba(255, 255, 255, .98);
  --lens-2: rgba(255, 255, 255, .78);
  --lens-shadow: inset 0 1px 0 #FFFFFF, inset 0 -8px 14px -10px rgba(24, 30, 48, .16), 0 0 0 .5px rgba(24, 30, 48, .06), 0 8px 18px -8px rgba(24, 30, 48, .3);
  --sheet-1: rgba(248, 248, 251, .9);
  --sheet-2: rgba(244, 244, 248, .8);
  --sheet-solid: #F2F2F7;
  --card-shadow: 0 1px 2px rgba(24, 30, 48, .04), 0 10px 28px -18px rgba(24, 30, 48, .16);
  --tile-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 0 0 .5px rgba(24, 30, 48, .05);
  --raised-fill: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .8));
  --raised-shadow: inset 0 1px 0 #FFFFFF, 0 0 0 .5px rgba(24, 30, 48, .08), var(--glass-shadow-sm);
  --primary-fill: linear-gradient(180deg, #3A3A3D 0%, #1D1D1F 46%, #161618 100%);
  --path-done: linear-gradient(180deg, #48484C, #1D1D1F);
  --ring-neutral-1: #E4E4EA;
  --ring-neutral-2: #B9B9C2;

  /* Фон по месту: на странице, в карточке, в листе (переопределяется ниже) */
  --raised: var(--surface);
  --field-bg: var(--surface);

  /* Скругления и отступы */
  --r-group: 22px;
  --r-card: 20px;
  --r-alert: 18px;
  --r-field: 16px;
  --r-sheet: 30px;
  --r-float: 34px;
  --r-pill: 999px;
  --gutter: 16px;

  /* Тени */
  --shadow-primary: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(0, 0, 0, .5), 0 12px 26px -12px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .18);
  --shadow-fab: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(0, 0, 0, .5), 0 14px 28px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .2);
  --shadow-thumb: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04);
  --shadow-toast: 0 12px 30px rgba(0, 0, 0, .25);

  /* Типографика: насыщенность, размер, высота строки */
  --text-large: 700 30px/36px var(--font);
  --text-title: 700 22px/28px var(--font);
  --text-title-sm: 700 20px/25px var(--font);
  --text-headline: 600 17px/22px var(--font);
  --text-body: 400 17px/22px var(--font);
  --text-sub: 400 15px/20px var(--font);
  --text-sub-em: 500 15px/20px var(--font);
  --text-sub-strong: 600 15px/20px var(--font);
  --text-caption: 500 13px/16px var(--font);
  --text-caption-2: 400 13px/18px var(--font);
  --text-tiny: 600 12px/14px var(--font);

  /* Движение: кривая iOS и лёгкая пружина (перелёт около 7 %) */
  --ease-ios: cubic-bezier(.32, .72, 0, 1);
  --spring: linear(0, .1 5.5%, .36 12%, .64 19.5%, .86 27%, 1 34.5%, 1.065 42%, 1.072 48%, 1.05 56%, 1.02 65%, 1.004 75%, .998 86%, 1);
}
/* Браузер без linear(): та же пружина приближённо */
@supports not (transition-timing-function: linear(0, 1)) {
  :root { --spring: cubic-bezier(.34, 1.36, .64, 1); }
}

/* ===== Тёмная тема для ночной смены: графит, кольца остаются оранжевыми ===== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1C1C1E; --card: #2C2C2E; --tile: #2C2C2E; --tile-press: #3A3A3C;
    --label: #F5F5F7; --label-2: #A1A1A6;
    --sep: rgba(84, 84, 88, .55); --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .36);
    --primary: #F5F5F7; --on-primary: #1D1D1F; --ring-neutral: #48484A;
    --ok-text: #30D158; --ok-soft: rgba(48, 209, 88, .16);
    --err-text: #FF6961; --err-soft: rgba(255, 69, 58, .16); --err-tag-bg: rgba(255, 69, 58, .26); --err-tag: #FF8A84;
    --info-text: #64A8FF; --info-soft: rgba(10, 132, 255, .2);
    --avatar: #3A3A3C; --flash: rgba(255, 106, 26, .2); --thumb: #636366; --shine: rgba(255, 255, 255, .08);
    --toast: rgba(58, 58, 60, .95); --scrim: rgba(0, 0, 0, .5);
    --glass-1: rgba(44, 44, 48, .62); --glass-2: rgba(44, 44, 48, .46); --glass-low: rgba(0, 0, 0, .2);
    --glass-edge: rgba(255, 255, 255, .18); --glass-rim: rgba(255, 255, 255, .08); --glass-line: rgba(0, 0, 0, .5);
    --glass-solid: #1C1C1E; --glass-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .3);
  --glass-shadow-sm: 0 8px 24px rgba(0, 0, 0, .4), 0 1px 4px rgba(0, 0, 0, .24);
  --glass-spec: linear-gradient(135deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .12) 24%, rgba(255, 255, 255, .03) 46%, rgba(255, 255, 255, .01) 58%, rgba(255, 255, 255, .16) 100%);
  --lens-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 .5px rgba(0, 0, 0, .5), 0 8px 18px -8px rgba(0, 0, 0, .6);
  --card-shadow: inset 0 .5px 0 rgba(255, 255, 255, .08); --tile-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  --raised-fill: rgba(60, 60, 64, .7); --raised-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), var(--glass-shadow-sm);
  --primary-fill: linear-gradient(180deg, #FFFFFF 0%, #F2F2F4 50%, #DCDCE0 100%);
  --shadow-primary: inset 0 1px 0 #FFFFFF, 0 12px 26px -12px rgba(0, 0, 0, .8);
  --shadow-fab: inset 0 1px 0 #FFFFFF, 0 14px 28px -12px rgba(0, 0, 0, .85);
  --path-done: linear-gradient(180deg, #FFFFFF, #D0D0D5); --ring-neutral-1: #66666B; --ring-neutral-2: #48484A;
    --lens-1: rgba(255, 255, 255, .26); --lens-2: rgba(255, 255, 255, .12);
    --sheet-1: rgba(34, 34, 37, .9); --sheet-2: rgba(34, 34, 37, .8); --sheet-solid: #1C1C1E;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #1C1C1E; --card: #2C2C2E; --tile: #2C2C2E; --tile-press: #3A3A3C;
  --label: #F5F5F7; --label-2: #A1A1A6;
  --sep: rgba(84, 84, 88, .55); --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .36);
  --primary: #F5F5F7; --on-primary: #1D1D1F; --ring-neutral: #48484A;
  --ok-text: #30D158; --ok-soft: rgba(48, 209, 88, .16);
  --err-text: #FF6961; --err-soft: rgba(255, 69, 58, .16); --err-tag-bg: rgba(255, 69, 58, .26); --err-tag: #FF8A84;
  --info-text: #64A8FF; --info-soft: rgba(10, 132, 255, .2);
  --avatar: #3A3A3C; --flash: rgba(255, 106, 26, .2); --thumb: #636366; --shine: rgba(255, 255, 255, .08);
  --toast: rgba(58, 58, 60, .95); --scrim: rgba(0, 0, 0, .5);
  --glass-1: rgba(44, 44, 48, .62); --glass-2: rgba(44, 44, 48, .46); --glass-low: rgba(0, 0, 0, .2);
  --glass-edge: rgba(255, 255, 255, .18); --glass-rim: rgba(255, 255, 255, .08); --glass-line: rgba(0, 0, 0, .5);
  --glass-solid: #1C1C1E; --glass-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .3);
  --glass-shadow-sm: 0 8px 24px rgba(0, 0, 0, .4), 0 1px 4px rgba(0, 0, 0, .24);
  --glass-spec: linear-gradient(135deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .12) 24%, rgba(255, 255, 255, .03) 46%, rgba(255, 255, 255, .01) 58%, rgba(255, 255, 255, .16) 100%);
  --lens-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 .5px rgba(0, 0, 0, .5), 0 8px 18px -8px rgba(0, 0, 0, .6);
  --card-shadow: inset 0 .5px 0 rgba(255, 255, 255, .08); --tile-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  --raised-fill: rgba(60, 60, 64, .7); --raised-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), var(--glass-shadow-sm);
  --primary-fill: linear-gradient(180deg, #FFFFFF 0%, #F2F2F4 50%, #DCDCE0 100%);
  --shadow-primary: inset 0 1px 0 #FFFFFF, 0 12px 26px -12px rgba(0, 0, 0, .8);
  --shadow-fab: inset 0 1px 0 #FFFFFF, 0 14px 28px -12px rgba(0, 0, 0, .85);
  --path-done: linear-gradient(180deg, #FFFFFF, #D0D0D5); --ring-neutral-1: #66666B; --ring-neutral-2: #48484A;
  --lens-1: rgba(255, 255, 255, .26); --lens-2: rgba(255, 255, 255, .12);
  --sheet-1: rgba(34, 34, 37, .9); --sheet-2: rgba(34, 34, 37, .8); --sheet-solid: #1C1C1E;
}
:root[data-theme="light"] { color-scheme: light; }

/* ===== Переходы между страницами ===== */
/* Страницы листаются, как экраны в телефоне: вглубь новая наезжает справа, назад верхняя уезжает
   вправо, соседние вкладки меню едут вместе. Сторону выбирает nav.js, там же правила.
   Снимки страниц непрозрачные и идут вплотную: пустого экрана между ними не видно.
   Движется только transform: прозрачность и тени у целой страницы телефон считает каждый кадр.
   Все значения здесь записаны числами, без var(), min() и max(): если браузер не поймёт хоть одно
   значение в слое перехода (::view-transition-*), он отбросит правило целиком, и страница сменится мгновенно */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
::view-transition-old(root),
::view-transition-new(root) { animation: .4s cubic-bezier(.35, .15, .15, 1) both; }
::view-transition-old(root) { animation-name: vt-under-out; }
::view-transition-new(root) { animation-name: vt-over-in; }
html:active-view-transition-type(back)::view-transition-old(root) { animation-name: vt-over-out; z-index: 1; }
html:active-view-transition-type(back)::view-transition-new(root) { animation-name: vt-under-in; }
html:active-view-transition-type(next)::view-transition-old(root) { animation-name: vt-left-out; }
html:active-view-transition-type(prev)::view-transition-old(root) { animation-name: vt-over-out; }
html:active-view-transition-type(prev)::view-transition-new(root) { animation-name: vt-left-in; }
/* Та же страница открылась заново: новая проявляется поверх прежней */
html:active-view-transition-type(same)::view-transition-old(root) { animation: none; }
html:active-view-transition-type(same)::view-transition-new(root) { animation: .2s ease both vt-fade-in; }
@keyframes vt-over-in { from { transform: translateX(100%); } }
@keyframes vt-over-out { to { transform: translateX(100%); } }
@keyframes vt-under-out { to { transform: translateX(-30%); } }
@keyframes vt-under-in { from { transform: translateX(-30%); } }
@keyframes vt-left-out { to { transform: translateX(-100%); } }
@keyframes vt-left-in { from { transform: translateX(-100%); } }
@keyframes vt-fade-in { from { opacity: 0; } }
/* Широкое окно (планшет, компьютер): страницы едут на всю ширину окна, как в панели администратора,
   без обрезки по колонке. С обрезкой у владельца в Chrome на компьютере переход дёргался и за колонкой
   был белый фон (13.11), на телефоне обрезки не было и всё шло ровно */
/* Смена вкладки: меню стоит на месте, линза переезжает, подписи и кнопка действия сменяются.
   Имена действуют только на время смены вкладки (класс nav-tabs ставят ui.js и nav.js):
   при переходе вглубь меню - часть страницы и уезжает вместе с ней */
.nav-tabs .dock { view-transition-name: dock; }
/* Отдельный снимок меню не видит страницу под собой, размывать ему нечего: на время смены вкладки подложка плотная */
.nav-tabs .tabbar.glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); }
.nav-tabs .tabbar__lens { view-transition-name: tab-lens; }
.nav-tabs .tabbar__tab:nth-of-type(1) { view-transition-name: tab-1; }
.nav-tabs .tabbar__tab:nth-of-type(2) { view-transition-name: tab-2; }
::view-transition-group(tab-lens) { animation-duration: .4s; animation-timing-function: cubic-bezier(.35, .15, .15, 1); }

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
html.is-locked { overflow: hidden; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--label);
  font: var(--text-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a:not([class]):focus-visible { border-radius: 4px; }
[hidden] { display: none !important; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--label-2); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Нажатие: лёгкое уменьшение и упругий возврат */
.press { transition: transform .45s var(--spring), background-color .15s; }
.press:active { transform: scale(.96); transition-duration: .12s; }

/* ===== Стекло: верхняя панель, нижнее меню, полоса сохранения, нижние листы ===== */
.glass {
  position: relative;
  background: linear-gradient(150deg, var(--glass-1), var(--glass-2));
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 var(--glass-low), var(--glass-shadow);
}
.glass-sheet {
  background: linear-gradient(150deg, var(--sheet-1), var(--sheet-2));
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 -18px 50px rgba(24, 30, 48, .2);
}
.sheet--float.glass-sheet { box-shadow: inset 0 1px 0 var(--glass-edge), 0 20px 60px rgba(0, 0, 0, .28); }
/* Блик по кромке стекла: яркий слева сверху, слабый отсвет справа снизу. Кольцо 1,2 px,
   вырезанное маской, повторяет скругление поверхности и не мешает нажатиям */
.glass::after, .glass-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  padding: 1.2px;
  background: var(--glass-spec);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
/* Мягкий край под плавающим меню и полосой сохранения (как scroll edge в iOS 26): содержимое
   растворяется, стекло над ним читается. Элемент стоит в foreman/base.html вне .app */
.edge { display: none; position: fixed; left: 0; right: 0; z-index: 29; pointer-events: none; }
.edge--bottom {
  bottom: 0;
  height: calc(128px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 78%);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 52%);
  mask-image: linear-gradient(to bottom, transparent, #000 52%);
  opacity: .92;
}
body:has(.dock, .savebar:not([hidden])) .edge--bottom { display: block; }

/* ===== Каркас экрана бригадира ===== */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  transform-origin: 50% 0;
  transition: transform .34s var(--ease-ios), border-radius .34s var(--ease-ios);
}
/* Открыт нижний лист: экран уходит назад, как карточка в iOS. Темнит затемнение, не фильтр:
   фильтр на длинной странице перерисовывает её целиком и на телефоне дёргается */
.app.is-behind { transform: scale(.94); border-radius: 18px; overflow: hidden; overflow: clip; transition-duration: .5s; }
.page {
  padding: 0 calc(var(--gutter) + env(safe-area-inset-right)) calc(118px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
}
body:has(.savebar--stack) .page { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }

/* ===== Верхняя панель: стекло с мягким краем появляется при прокрутке ===== */
.navbar { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.navbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -18px;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  background: linear-gradient(180deg, var(--glass-1) 0%, var(--glass-2) 65%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
  mask-image: linear-gradient(#000 62%, transparent);
}
.navbar.is-scrolled::before { opacity: 1; }
.navbar__in {
  height: 44px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 calc(10px + env(safe-area-inset-right)) 0 calc(10px + env(safe-area-inset-left));
}
.navbar__in:has(.navbar__back) { height: 52px; }
.navbar__back {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 0 16px 0 8px;
  border-radius: 22px;
  font: 500 17px/22px var(--font);
}
.navbar__back .ic { width: 24px; height: 24px; stroke-width: 2.4; }
/* Маленькая стеклянная кнопка: размытие вдвое меньше, тень короче */
.navbar__back.glass {
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  backdrop-filter: blur(15px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow-sm);
}
.navbar__title {
  grid-column: 2;
  font: var(--text-headline);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
}
.navbar.is-scrolled .navbar__title { opacity: 1; transform: none; }
.navbar__end { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 8px; }

/* ===== Крупный заголовок ===== */
.large-title { padding: 4px 4px 12px; }
.large-title--aside { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 4px 6px; }
.large-title__row { display: flex; align-items: center; gap: 12px; }
.large-title__eyebrow { font: var(--text-sub-em); color: var(--label-2); }
.large-title__h { font: var(--text-large); letter-spacing: -.022em; min-width: 0; }
.large-title__sub { font: var(--text-body); color: var(--label-2); margin-top: 4px; }
.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--avatar);
  font: 600 15px/1 var(--font);
}

/* ===== Заголовки разделов и групп ===== */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  margin: 26px 4px 10px;
  scroll-margin-top: calc(60px + env(safe-area-inset-top));
}
.section-head--first { margin-top: 14px; }
.section-head--bar { align-items: center; margin-bottom: 4px; }
.section-head__title { font: var(--text-title); letter-spacing: -.014em; }
.section-head__aside { font: var(--text-sub-em); color: var(--label-2); white-space: nowrap; }
.section-head__sub { font: var(--text-sub-em); color: var(--label-2); margin-top: 2px; }
.section-head__sub b { color: var(--label); font-weight: 600; }
.count {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  align-self: center;
  background: rgba(118, 118, 128, .16);
  box-shadow: var(--tile-shadow);
  color: var(--label);
  font: 600 13px/16px var(--font);
  font-variant-numeric: tabular-nums;
}
.group-head { display: flex; align-items: center; gap: 8px; margin: 18px 4px 8px; font: var(--text-headline); }
.group-head > .ic { width: 20px; height: 20px; }
.group-head--err > .ic { color: var(--err-text); }
.group-head--info > .ic { color: var(--info-text); }
.group-head--idle > .ic { color: var(--label-2); }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary.group-head { min-height: 44px; }
summary .chev { margin-left: auto; transition: transform .45s var(--spring); }
details[open] > summary .chev { transform: rotate(90deg); }
/* Плавное раскрытие (data-fold, ui.js, раздел 11): содержимое обрезается, только пока едет,
   стрелка поворачивается назад сразу, а не когда блок уже закрылся */
.is-folding { overflow: hidden; }
details.is-closing > summary .chev { transform: none; }

/* ===== Сгруппированный список и карточка ===== */
.group { list-style: none; background: var(--raised); border-radius: var(--r-group); overflow: hidden; }
.card { background: var(--raised); border-radius: var(--r-group); padding: 16px; }
.group, .card { --field-bg: var(--tile); box-shadow: var(--card-shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card__title { font: var(--text-title); letter-spacing: -.014em; }

/* ===== Строка списка: значок или кольцо, две линии текста, значение, шеврон ===== */
.row {
  --row-lead: 40px;
  --row-pad: 16px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 14px 10px var(--row-pad);
  text-align: left;
}
.row + .row::before,
.row + .tiles::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--row-sep, calc(var(--row-pad) + var(--row-lead) + 12px));
  right: 0;
  height: 1px;
  background: var(--sep);
  transform: scaleY(.5);
  transform-origin: 0 0;
}
.row + .tiles::before { left: 16px; }
.row__body { flex: 1; min-width: 0; }
.row__title { display: block; width: fit-content; max-width: 100%; font: var(--text-headline); }
.row__sub { display: block; font: var(--text-sub); color: var(--label-2); margin-top: 1px; }
.row__value {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font: var(--text-headline);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.row__value small { font: var(--text-caption-2); color: var(--label-2); margin-top: 1px; }
.row__value small.row__manual { font: 600 12px/16px var(--font); color: var(--info-text); margin-top: 0; }
.row__meta { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--label-2); font: var(--text-sub); }
.row__end { flex: none; display: grid; }
.row__end > * { grid-area: 1 / 1; }
.chev { width: 12px; height: 22px; flex: none; color: var(--chev); stroke-width: 2.6; }
/* Вся строка нажимается: ссылка или кнопка растягивает нажатие на строку */
.row__link { text-align: left; font: inherit; }
.row__link::after { content: ""; position: absolute; inset: 0; z-index: 1; transition: background-color .15s; }
.row__link:active::after { background: var(--press); }
.row__link:focus-visible { outline: none; }
.row__link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--r-group); }
.row__action { position: relative; z-index: 2; flex: none; }
button.row:active, summary.row:active, a.row:active { background: var(--press); }
button.row:focus-visible { outline-offset: -3px; }
/* Виды строк */
.row--top { align-items: flex-start; min-height: 72px; padding: 14px 14px 14px var(--row-pad); }
.row--top > .ring { margin-top: 1px; }
.row--person { --row-lead: 30px; min-height: 62px; padding: 10px 16px; }
.row--cell { --row-sep: 16px; min-height: 52px; padding: 10px 16px; }
.row--cell > .ic { color: var(--label-2); }
.row--cell > .row__title { width: auto; }
.row--no-lead { --row-sep: 16px; }
/* Строка-подпись с файлом (снять подписанный лист): фокус на скрытом поле обводит строку */
label.row__link { cursor: pointer; }
.row:has(input:focus-visible) .row__link::after { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--r-group); }
/* Состояния строки */
.row.is-err { background: linear-gradient(90deg, var(--err-soft), transparent); }
.row.is-absent .row__body { opacity: .55; }
.row.is-gone { animation: row-gone .26s var(--ease-ios) forwards; }
.row.is-new { animation: row-flash 1.4s ease-out; }
.row.is-in { animation: row-in .55s var(--spring); }
@keyframes row-gone { to { opacity: 0; transform: translateX(-24px); } }
@keyframes row-flash { 0% { background-color: var(--flash); } 100% { background-color: transparent; } }
@keyframes row-in { from { opacity: .3; transform: scale(.97); } }

/* ===== Статус: значок и слово ===== */
.status { display: flex; align-items: flex-start; gap: 6px; font: var(--text-sub-em); color: var(--label-2); }
.status > .ic, .status > .spin, .status__dot { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.status > span:last-child { text-wrap: pretty; }
.status--ok { color: var(--ok-text); }
.status--err { color: var(--err-text); }
.status--sign, .status--info { color: var(--info-text); }
.status--wait, .status--idle, .status--lock, .status--prev { color: var(--label-2); }
.status--prev { font-weight: 400; }
.status--unsaved { color: var(--label); font-weight: 600; }
.status__dot { display: grid; place-items: center; }
.status__dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status--sm { align-items: center; gap: 5px; }
.status--sm > .ic { width: 16px; height: 16px; margin-top: 0; }
.row__body .status { margin-top: 6px; }
.row__body .status + .status { margin-top: 2px; }
.row__body .status--sm { margin-top: 2px; }
/* Статус табеля под заголовком: замок крупнее и тёмным */
.status-list { display: flex; flex-direction: column; gap: 4px; padding: 0 4px 16px; }
.status-list .status--lock { color: var(--label); font-weight: 600; }
/* --clock (ставит ui.js): бесконечные анимации идут по часам, и замена куска экрана не сбрасывает их в начало */
.spin { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; animation: spin 1s linear var(--clock, 0s) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Кольцо часов (эффект FX-91). Серое замкнутое: как надо; оранжевое: часы отличаются ===== */
.ring {
  --ring-size: 40px;
  --ring-stroke: 10;
  position: relative;
  flex: none;
  width: var(--ring-size);
  height: var(--ring-size);
  display: grid;
  place-items: center;
}
.ring--xs { --ring-size: 22px; --ring-stroke: 14; }
.ring--sm { --ring-size: 30px; --ring-stroke: 13; }
.ring--day { --ring-size: 34px; --ring-stroke: 11; }
.ring--md { --ring-size: 36px; --ring-stroke: 12; }
.ring--lg { --ring-size: 48px; --ring-stroke: 11; }
.ring__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transform: rotate(-90deg); overflow: visible; }
.ring__svg circle { fill: none; }
.ring__track { stroke: var(--ring-neutral); stroke-opacity: .4; }
/* Обводка с переходом цвета: градиенты #ring-cool и #ring-hot лежат в спрайте значков
   (includes/icons.html). Цвет после url() - запас, если градиент не нашёлся */
.ring__bar { stroke: url(#ring-cool) var(--ring-neutral); stroke-linecap: round; }
.ring.is-dev .ring__track { stroke: var(--hours); stroke-opacity: .18; }
.ring.is-dev .ring__bar { stroke: url(#ring-hot) var(--hours); }
.ring.is-dev .ring__svg { filter: drop-shadow(0 2px 5px rgba(255, 106, 26, .32)); }
#ring-cool stop:first-child { stop-color: var(--ring-neutral-1); }
#ring-cool stop:last-child { stop-color: var(--ring-neutral-2); }
.ring.is-drawn .ring__bar { transition: stroke-dashoffset .6s var(--spring), opacity .2s; }

/* ===== Главный экран бригадира: быстрые кнопки, карточки складов на сегодня, дела, неделя, прошлые дни ===== */
/* Быстрые кнопки под заголовком: то, что нужно каждый день и не привязано к одному табелю */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.quick__form { display: contents; }
.quick__item { display: grid; justify-items: center; align-content: start; gap: 8px; min-width: 0; padding: 0 2px; font: 500 13px/16px var(--font); color: var(--label); text-align: center; }
.quick__icon { position: relative; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--raised-fill); box-shadow: var(--raised-shadow); }
.quick__icon .ic { width: 26px; height: 26px; stroke-width: 1.8; }
.quick__label { max-width: 12ch; text-wrap: balance; }
.quick__badge { position: absolute; top: -3px; right: -5px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: var(--label); color: var(--on-primary); font: 700 12px/1 var(--font); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg); }
.quick__item:focus-visible { outline: none; }
.quick__item:focus-visible .quick__icon { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Карточка склада в «Сегодня»: состояние табеля и следующий шаг на самой карточке */
.site + .site { margin-top: 12px; }
.site__main { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 14px 14px 16px; }
.site__main--plain { padding-bottom: 12px; }
.site__text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.site__title { width: fit-content; max-width: 100%; font: 600 19px/24px var(--font); letter-spacing: -.01em; overflow-wrap: anywhere; }
.site__sub { font: var(--text-sub); color: var(--label-2); overflow-wrap: anywhere; }
.site__text .status { margin-top: 4px; }
.site__text .status + .status { margin-top: 0; }
.site__next { display: grid; gap: 10px; padding: 12px 12px 12px 16px; box-shadow: inset 0 .5px 0 var(--sep); }
.site__hint { font: var(--text-sub); color: var(--label-2); text-wrap: pretty; overflow-wrap: anywhere; }
.site__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: -4px; }
.site__actions .btn { flex: 1 1 0; min-width: 120px; height: 46px; padding: 0 14px; }
.site--calm .site__next { background: var(--ok-soft); }
.site--calm .site__hint { color: var(--ok-text); font-weight: 500; }
.site--err .site__hint { color: var(--err-text); font-weight: 500; }

/* Дело с кнопкой: значок в кружке, что сделать, где, и действие справа. Нажимается вся строка */
.act { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 68px; padding: 12px 12px 12px 14px; }
.act + .act::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; height: 1px; background: var(--sep); transform: scaleY(.5); transform-origin: 0 0; }
.act__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.act__icon .ic { width: 22px; height: 22px; }
.act__icon--err { background: var(--err-soft); color: var(--err-text); }
.act__icon--info { background: var(--info-soft); color: var(--info-text); }
.act__title { display: block; width: fit-content; max-width: 100%; font: var(--text-headline); overflow-wrap: anywhere; }
.act__sub { display: block; margin-top: 1px; font: var(--text-sub); color: var(--label-2); overflow-wrap: anywhere; }
.act .noscript-only { grid-column: 2 / -1; justify-self: start; }
/* На узком экране у кнопки «Снять» остаётся значок: заголовок дела не рвётся на две строки */
@media (max-width: 370px) {
  .act .btn__word { display: none; }
  .act .btn--sm { min-width: 52px; }
}

/* Прошлые дни: день одной строкой, табели дня открываются под ней */
/* Итог дня идёт под часами во всю ширину, поэтому не рвётся на узком экране */
.dayrow__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "ring title value chev" "ring sub sub chev"; gap: 1px 12px; align-items: start; }
.dayrow__head > .ring { grid-area: ring; }
.dayrow__head > .row__title { grid-area: title; width: auto; }
.dayrow__head > .row__value { grid-area: value; }
.dayrow__head > .row__sub { grid-area: sub; margin-top: 0; }
.dayrow__head > .chev { grid-area: chev; align-self: center; }
.dayrow + .dayrow > summary::before { content: ""; position: absolute; top: 0; left: calc(var(--row-pad) + var(--row-lead) + 12px); right: 0; height: 1px; background: var(--sep); transform: scaleY(.5); transform-origin: 0 0; }
.dayrow__list > .row { background: var(--press); }
.dayrow { scroll-margin-top: calc(60px + env(safe-area-inset-top)); }

/* Неделя: кольца по дням и часы под ними */
.weekcard { padding: 12px 10px 10px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); }
.week__day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0 6px; border-radius: 14px; min-height: 44px; }
.week__day:not([aria-disabled="true"]):active { background: var(--fill); }
.week__day[aria-disabled="true"] { cursor: default; }
.week__name { font: var(--text-caption); color: var(--label-2); }
.week__date {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 500 13px/1 var(--font);
  font-variant-numeric: tabular-nums;
}
.week__day[aria-current="date"] .week__name { color: var(--label); font-weight: 600; }
.week__day[aria-current="date"] .week__date { background: var(--label); color: var(--on-primary); font-weight: 600; }
.week__day[aria-disabled="true"] .week__date { color: var(--label-2); }
.week__day[aria-current="date"][aria-disabled="true"] .week__date { color: var(--on-primary); }
.week__hours { font: 600 12px/14px var(--font); font-variant-numeric: tabular-nums; }
.week__day[aria-disabled="true"] .week__hours { color: var(--label-2); font-weight: 400; }

/* ===== Сегментированный переключатель (эффект FX-74): подложка перетекает пружиной ===== */
.segmented {
  position: relative;
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  height: 44px;
  padding: 3px;
  border-radius: 13px;
  background: var(--fill);
}
.segmented__option {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border-radius: 10px;
  font: var(--text-sub-em);
  color: var(--label);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.segmented__option .ic { width: 18px; height: 18px; }
.segmented__option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented__option:has(input:checked) { font-weight: 600; }
.segmented__option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.segmented__thumb {
  position: absolute;
  top: 3px;
  left: 0;
  width: 0;
  height: 38px;
  border-radius: 10px;
  background: var(--thumb);
  box-shadow: var(--shadow-thumb);
  pointer-events: none;
}
.segmented.is-animated .segmented__thumb { transition: transform .4s var(--ease-ios), width .4s var(--ease-ios); }
/* Без JS подложка стоит прямо на выбранном варианте */
.segmented:not(.is-ready) .segmented__option:has(input:checked) { background: var(--thumb); box-shadow: var(--shadow-thumb); }
.segmented[aria-disabled="true"] { pointer-events: none; }

/* ===== Плитки времени смены ===== */
.tiles { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: var(--r-field);
  background: var(--tile);
  box-shadow: var(--tile-shadow);
  text-align: left;
}
button.tile:active { background: var(--tile-press); }
.tile__label { font: var(--text-caption); color: var(--label-2); }
.tile__value { font: 500 22px/28px var(--font); letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile__value small { font-size: 15px; font-weight: 500; color: var(--label-2); margin-left: 2px; }
/* «+1» после времени конца ночной смены: конец на следующий день. Над временем метка сдвигала его вниз */
.tile__next { position: relative; top: 2px; margin-left: 3px; vertical-align: top; font: 600 12px/16px var(--font); letter-spacing: 0; color: var(--info-text); }
.shift-note { display: flex; align-items: center; gap: 10px; padding: 0 16px 14px; font: var(--text-sub); color: var(--label-2); }
.shift-note b { color: var(--label); font-weight: 600; }

/* ===== Метки и чипы ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  background: var(--fill);
  color: var(--label);
  font: var(--text-caption);
  white-space: nowrap;
}
.tag--info { background: var(--info-soft); color: var(--info-text); }
.tag--ok { background: var(--ok-soft); color: var(--ok-text); }
.tag--err { background: var(--err-tag-bg); color: var(--err-tag); }
.tag--next { height: 20px; padding: 0 7px; border-radius: 10px; background: var(--info-soft); color: var(--info-text); font: 600 12px/16px var(--font); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; scroll-padding: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--raised);
  font: var(--text-sub-em);
  white-space: nowrap;
  box-shadow: inset 0 0 0 .5px var(--sep);
  cursor: pointer;
  transition: transform .45s var(--spring), background-color .25s, color .25s, box-shadow .25s;
}
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip[aria-pressed="true"], .chip:has(input:checked) { background: var(--label); color: var(--bg); box-shadow: none; }
.chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ===== Кнопки ===== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--label);
  font: 600 16px/20px var(--font);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: transform .45s var(--spring), background-color .35s, color .2s;
}
.btn:active { transform: scale(.96); transition-duration: .12s; }
.btn .ic { width: 20px; height: 20px; }
.btn--primary { background: var(--primary-fill); color: var(--on-primary); box-shadow: var(--shadow-primary); }
.btn--raised { background: var(--raised-fill); box-shadow: var(--raised-shadow); }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--raised); color: var(--err-text); border-radius: var(--r-field); font: 600 17px/22px var(--font); }
.btn--lg { height: 54px; font: 600 17px/22px var(--font); }
.btn--sm { height: 44px; padding: 0 16px; font: var(--text-sub-strong); }
.btn--sm:has(> .ic:first-child) { padding-left: 12px; }
.btn--sm .ic { stroke-width: 2.4; }
.btn--block { display: flex; width: 100%; }
.btn--two-line { height: 60px; padding: 0 14px 0 12px; border-radius: 30px; gap: 10px; justify-content: flex-start; text-align: left; }
.btn--two-line .ic { width: 22px; height: 22px; }
.btn__lines > span { display: block; font: 600 16px/19px var(--font); }
.btn__lines > small { display: block; font: 500 13px/16px var(--font); opacity: .8; }
@media (max-width: 370px) {
  .btn--two-line { padding: 0 10px; gap: 8px; }
  .btn__lines > span { font-size: 15px; }
}
.btn[aria-pressed="true"] > .ic { color: var(--ok-text); }
.btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.btn:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:disabled:not(.is-loading):not(.is-wait):not(.is-done), .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--label);
}
.link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: var(--text-sub-strong);
  color: var(--label);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
/* Подсказка-ссылка в конце списка: «Нет в списке? Подать заявку на оформление» */
.hint-link { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; font: var(--text-sub); color: var(--label-2); text-align: left; }
.hint-link b { color: var(--label); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover, .icon-btn:hover { background-color: var(--fill-2); }
  .btn--primary:hover { opacity: .9; }
  .btn--raised:hover, .btn--danger:hover { background-color: var(--raised); box-shadow: inset 0 0 0 .5px var(--label-2); }
  .btn--ghost:hover { background-color: var(--fill); }
  .quick__item:hover .quick__icon { box-shadow: inset 0 0 0 .5px var(--label-2), var(--glass-shadow-sm); }
}

/* ===== Прогресс внутри кнопки или строки и галочка (эффект FX-164) =====
   Примесь .progress к .btn или .row. Состояния: is-loading, is-wait, is-done. Заливка: --p от 0 до 1. */
.progress { position: relative; overflow: hidden; isolation: isolate; }
.progress__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  background: rgba(118, 118, 128, .2);
  pointer-events: none;
}
.btn--primary.progress > .progress__fill { background: linear-gradient(90deg, rgba(255, 106, 26, .55), var(--hours)); }
.progress__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .3) 50%, transparent 65%);
  background-size: 220% 100%;
}
.btn--primary.progress.is-loading > .progress__fill::after { opacity: 1; animation: progress-shine 1.4s linear infinite; }
@keyframes progress-shine { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.progress__layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .22s ease, transform .45s var(--spring);
}
/* Надпись покоя стоит в потоке и задаёт ширину кнопки, остальные лежат поверх */
.progress__layer--idle { position: relative; inset: auto; }
.btn--two-line.progress .progress__layer--idle { padding: 0; }
.progress__layer--pct, .progress__layer--wait, .progress__layer--done { opacity: 0; transform: translateY(9px); }
.progress.is-loading .progress__layer--idle,
.progress.is-wait .progress__layer--idle,
.progress.is-done .progress__layer--idle { opacity: 0; transform: translateY(-9px); }
.progress.is-loading .progress__layer--pct { opacity: 1; transform: none; }
.progress.is-wait .progress__layer--wait { opacity: 1; transform: none; }
.progress.is-done .progress__layer--pct, .progress.is-done .progress__layer--wait { opacity: 0; transform: translateY(-9px); }
.progress.is-done .progress__layer--done { opacity: 1; transform: none; transition-delay: .06s; }
.btn--primary.progress.is-wait { background: #2C2C2E; color: #FFFFFF; }
.btn--primary.progress.is-done { background: var(--ok); color: #FFFFFF; }
.btn--primary.progress.is-wait > .progress__fill, .btn--primary.progress.is-done > .progress__fill { opacity: 0; }
.btn--two-line.progress .progress__layer { justify-content: flex-start; gap: 10px; padding: 0 14px 0 12px; }
.btn--primary.progress.is-done.btn--two-line { color: #FFFFFF; }
/* Галочка рисуется штрихом */
.draw-check { stroke-dasharray: 26; stroke-dashoffset: 26; }
.is-done .draw-check { stroke-dashoffset: 0; transition: stroke-dashoffset .34s cubic-bezier(.4, 0, .2, 1) .14s; }
/* Строка с прогрессом (лист «Новая смена»): заливка, затем зелёный фон и галочка */
.row.progress > .progress__fill { background: rgba(118, 118, 128, .14); }
.row.progress .draw-check { opacity: 0; color: var(--ok-text); }
.row.progress .progress__go { color: var(--label-2); transition: opacity .2s; }
.row.progress.is-done .draw-check { opacity: 1; transition-delay: .1s; }
.row.progress.is-done .progress__go { opacity: 0; }
.row.progress.is-done > .progress__fill { transform: scaleX(1); background: var(--ok-soft); transition: background .3s; }

/* Луч по рамке, пока 1С не ответила (эффект FX-25). Без размытого свечения: на стеклянной полосе
   оно перерисовывалось каждый кадр, и телефон подтормаживал. Фаза по часам (--clock): опрос
   статуса раз в 4 с заменяет кнопку, а луч продолжает круг, а не прыгает в начало */
@property --beam-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.beam::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  padding: 1.5px;
  background: conic-gradient(from var(--beam-angle), transparent 0%, transparent 72%, var(--hours) 90%, var(--hours-hot) 97%, transparent 100%);
  animation: beam-spin 3.2s linear var(--clock, 0s) infinite;
}
@keyframes beam-spin { to { --beam-angle: 360deg; } }

/* ===== Плавающее нижнее меню: стеклянные вкладки с линзой и кнопка действия ===== */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0 calc(16px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  pointer-events: none;
}
.dock__in { max-width: 398px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
/* Ширина вкладок постоянная, остаток забирает кнопка действия: иначе «Новая смена» и «Новая заявка»
   разной длины двигали вкладки при переходе между разделами */
.tabbar { position: relative; pointer-events: auto; flex: 0 0 164px; min-width: 0; display: flex; height: 62px; padding: 5px; border-radius: var(--r-pill); }
.dock__in > .tabbar:only-child { flex: 1 1 auto; }
.tabbar__tab {
  position: relative;
  isolation: isolate;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--r-pill);
  font: var(--text-tiny);
  color: var(--label-2);
}
.tabbar__tab .ic { width: 24px; height: 24px; transition: transform .3s var(--ease-ios); }
.tabbar__tab { transition: color .3s; }
.tabbar__tab[aria-current="page"] { color: var(--label); }
.tabbar__tab[aria-current="page"] .ic { transform: scale(1.06); }
/* Нажали другую вкладку: подписи меняются сразу, это отклик на нажатие. Линза ждёт новую страницу
   и едет вместе с ней одним движением (её ведёт переход между страницами, ui.js, раздел 8) */
.tabbar__tab.is-going { color: var(--label); }
.tabbar:has(> .is-going) > .tabbar__tab[aria-current="page"] { color: var(--label-2); }
/* Линза выбранной вкладки: внутри меню, стоит под выбранной вкладкой */
.tabbar__lens {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px) / 2);
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--lens-1), var(--lens-2));
  box-shadow: var(--lens-shadow);
  pointer-events: none;
  transition: transform .4s var(--ease-ios), opacity .2s;
}
.tabbar:has(> .tabbar__tab:nth-of-type(2)[aria-current="page"]) > .tabbar__lens { transform: translateX(100%); }
.tabbar:not(:has(> [aria-current="page"])) > .tabbar__lens { opacity: 0; }
.tabbar__icon { position: relative; }
.tabbar__badge {
  position: absolute;
  top: -5px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--badge);
  color: #FFFFFF;
  font: 700 12px/1 var(--font);
  box-shadow: 0 0 0 2px var(--surface), 0 4px 10px -2px rgba(215, 0, 21, .5);
}
.fab {
  pointer-events: auto;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 62px;
  padding: 0 14px;
  white-space: nowrap;
  border-radius: var(--r-pill);
  background: var(--primary-fill);
  color: var(--on-primary);
  font: var(--text-headline);
  box-shadow: var(--shadow-fab);
}
.fab .ic { width: 22px; height: 22px; stroke-width: 2.4; }
@media (max-width: 370px) {
  .tabbar { flex-basis: 150px; }
  .fab { padding: 0 10px; font-size: 16px; }
}
/* Кнопка действия без вкладок рядом: своя ширина, прижата вправо */
.dock__in--end > .fab { flex: none; padding: 0 22px 0 18px; }

/* ===== Полоса сохранения: всегда следующий шаг табеля ===== */
.savebar {
  position: fixed;
  left: calc(8px + env(safe-area-inset-left));
  right: calc(8px + env(safe-area-inset-right));
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: 414px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 32px;
}
/* Следующий шаг всплывает мягко и только при смене шага: опрос статуса и правки строк
   присылают ту же полосу, ui.js снимает с неё data-enter, и она стоит на месте */
.savebar[data-enter] > * { animation: savebar-in .42s var(--ease-ios); }
@keyframes savebar-in { from { opacity: .2; transform: translateY(6px); } }
.savebar__row { display: flex; align-items: center; gap: 12px; padding-left: 10px; }
.savebar__sum { flex: 1; min-width: 0; }
.savebar__sum b { display: block; font: var(--text-headline); }
.savebar__sum span { display: block; font: var(--text-caption-2); color: var(--label-2); }
.savebar__save { flex: none; width: 176px; height: 56px; font: 600 17px/22px var(--font); }
@media (max-width: 370px) { .savebar__save { width: 156px; } }
.savebar--stack .savebar__row { flex-direction: column; align-items: stretch; gap: 8px; padding: 4px 0 0; }
.savebar--stack .savebar__sum { padding: 0 10px; }
.savebar--stack .savebar__save { width: 100%; }
.savebar__next { display: grid; grid-template-columns: 1.15fr 1fr; gap: 8px; }
.savebar__calm { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 12px; }
.savebar__calm > .ic { width: 26px; height: 26px; color: var(--ok-text); }
.savebar__calm b { display: block; font: var(--text-headline); }
.savebar__calm span { display: block; font: var(--text-caption-2); color: var(--label-2); }

/* ===== Нижний лист и затемнение ===== */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .34s; touch-action: none; }
.scrim.is-on { opacity: 1; pointer-events: auto; }
.scrim.is-dragging { transition: none; }
.sheet {
  --raised: var(--card);
  --field-bg: var(--card);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  max-width: 430px;
  max-height: calc(100vh - 44px - env(safe-area-inset-top));
  max-height: calc(100dvh - 44px - env(safe-area-inset-top));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  transform: translateY(105%);
  visibility: hidden;
  /* Без пружины: лист въезжает и встаёт на место без раскачки, как в iOS. Уходит быстрее, чем приходит */
  transition: transform .34s var(--ease-ios), visibility 0s .34s;
}
/* Плотная подложка под листом: при смахивании вверх не открывается щель снизу */
.sheet::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 120px; background: var(--sheet-solid); }
.sheet.is-open { transform: none; visibility: visible; transition: transform .5s var(--ease-ios), visibility 0s; }
/* Палец тянет лист вниз: лист идёт за пальцем без задержки */
.sheet.is-dragging { transition: none; }
.sheet--tall { height: calc(100vh - 44px - env(safe-area-inset-top)); height: calc(100dvh - 44px - env(safe-area-inset-top)); }
.sheet__grab { flex: none; width: 36px; height: 5px; margin: 8px auto 4px; border-radius: 3px; background: var(--fill-2); }
.sheet__head { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 12px; align-items: center; padding: 8px 16px 14px; }
.sheet__head--lead { grid-template-columns: 48px minmax(0, 1fr) 44px; }
.sheet__head > .icon-btn { align-self: start; }
.sheet__title { font: var(--text-title-sm); letter-spacing: -.01em; }
.sheet__title:focus { outline: none; }
.sheet__sub { font: var(--text-sub); color: var(--label-2); margin-top: 1px; }
.sheet__text { padding: 0 4px 16px; font: 400 17px/23px var(--font); }
.sheet__text b { font-weight: 600; }
.sheet__icon { width: 26px; height: 26px; color: var(--err-text); }
/* max-content: строки не сжимаются, лента чипов с прокруткой не схлопывается, лишнее прокручивается */
.sheet__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-auto-rows: max-content; gap: 14px; align-content: start; padding: 0 16px 16px; }
.sheet__foot { flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -.5px 0 var(--sep); }
.sheet__actions { display: grid; gap: 8px; }
/* Плавающий лист: короткий выбор или подтверждение */
.sheet--float {
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  max-width: 414px;
  display: block;
  padding: 8px 16px 16px;
  border-radius: var(--r-float);
  transform: translateY(calc(100% + 40px));
}
.sheet--float::after { content: none; }
.sheet--float.is-open { transform: none; }
.sheet--float .sheet__grab { margin: 0 auto 10px; }
.sheet--float .sheet__head { padding: 0 4px 6px; }
.sheet--float .sheet__head--lead { grid-template-columns: 26px minmax(0, 1fr) 44px; gap: 10px; padding-bottom: 8px; }
.sheet--float .sheet__head > .icon-btn { align-self: center; }
.sheet--float .sheet__title { font: var(--text-title); letter-spacing: -.014em; }
.sheet--float .sheet__sub { margin: 0; padding: 0 4px 14px; }
.sheet--float .sheet__body { padding: 0; overflow: visible; }

/* ===== Тост: короткое сообщение внизу, при необходимости с отменой ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 45;
  width: min(398px, calc(100% - 32px));
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 16px;
  border-radius: 18px;
  background: var(--toast);
  color: #FFFFFF;
  font: var(--text-sub);
  box-shadow: var(--shadow-toast);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity .25s, transform .4s var(--ease-ios);
}
.toast.is-on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast__text { min-width: 0; padding: 4px 0; }
.toast__undo { margin-left: auto; flex: none; height: 44px; padding: 0 14px; border-radius: 12px; color: var(--toast-link); font: var(--text-sub-strong); }
body:has(.savebar--stack) .toast { bottom: calc(132px + env(safe-area-inset-bottom)); }

/* ===== Путь табеля: Сохранён, Принят 1С, Подписан, Передан на расчёт ===== */
.path { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-top: 14px; }
.path__bar { position: relative; display: block; height: 5px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.path__label { display: flex; align-items: flex-start; gap: 3px; margin-top: 6px; font: 500 12px/15px var(--font); color: var(--label-2); }
.path__label .ic { display: none; width: 12px; height: 12px; margin-top: 1.5px; stroke-width: 3; }
.path__step.is-done .path__bar { background: var(--path-done); }
.path__step.is-done .path__label .ic { display: block; }
.path__step[aria-current="step"] .path__bar { background: var(--fill-2); background: color-mix(in srgb, var(--label) 35%, transparent); }
.path__step[aria-current="step"] .path__label { color: var(--label); font-weight: 700; }
/* Пока 1С не ответила, текущий шаг переливается (эффект FX-33) */
.path__step.is-live .path__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--hours), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear var(--clock, 0s) infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ===== Карточка действия: подписанный лист ===== */
.action-card { padding: 16px; }
.action-card__top { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; }
.action-card__title { font: var(--text-headline); }
.action-card__text { font: var(--text-sub); color: var(--label-2); margin-top: 2px; }
/* Две кнопки рядом; на узком телефоне (360) встают друг под другом */
.action-card__actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.action-card__actions > :only-child { grid-column: 1 / -1; }
.action-card__actions .btn { padding: 0 8px; }
.icon-badge { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--info-soft); color: var(--info-text); }
.icon-badge--ok { background: var(--ok-soft); color: var(--ok-text); }
.icon-badge--err { background: var(--err-soft); color: var(--err-text); }

/* ===== Отправка в 1С: три состояния карточкой ===== */
.send-states { list-style: none; display: grid; gap: 8px; }
.send-state {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--r-alert);
  background: var(--raised);
  font: var(--text-sub);
  color: var(--label-2);
}
.send-state > .ic { width: 20px; height: 20px; }
.send-state__text { color: var(--label); }
.send-state__text b { font-weight: 600; }
.send-state--ok { color: var(--ok-text); }
.send-state--ok .send-state__text b { color: var(--ok-text); }
.send-state--err { color: var(--err-text); }
.send-state--err .send-state__text b { color: var(--err-text); }
.send-state__retry { grid-column: 2; justify-self: start; margin-top: 6px; }

/* ===== Сообщения: подсказка-баннер, сообщения после действий, ошибка в листе ===== */
.banner { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; margin-bottom: 16px; padding: 14px 16px; border-radius: var(--r-card); background: var(--info-soft); }
.banner > .ic { width: 24px; height: 24px; color: var(--info-text); }
.banner__title { display: block; font: var(--text-headline); }
.banner__text { display: block; margin-top: 2px; font: var(--text-sub); color: var(--label-2); }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.alert {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 14px 12px;
  border-radius: var(--r-alert);
  background: var(--fill);
  color: var(--label);
  font: var(--text-sub);
}
.alert:not(:has(> .ic)) { grid-template-columns: minmax(0, 1fr); }
.alert > .ic { width: 22px; height: 22px; }
.alert b { font-weight: 600; }
.alert--success { background: var(--ok-soft); color: var(--ok-text); }
.alert--error { background: var(--err-soft); color: var(--err-text); }
.alert--info { background: var(--info-soft); color: var(--info-text); }
.alert__action {
  grid-column: -2;
  justify-self: start;
  margin-top: 8px;
  background: var(--card);
  color: inherit;
  box-shadow: 0 0 0 .5px rgba(196, 22, 28, .25);
  box-shadow: 0 0 0 .5px color-mix(in srgb, currentColor 25%, transparent);
}
/* Баннер «нет связи»: висит сверху поверх экрана, пока запрос не пройдёт */
.net-banner {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
  right: 8px;
  z-index: 60;
  max-width: 414px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 8px 14px;
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--label);
  font: var(--text-sub);
  box-shadow: var(--glass-shadow), 0 0 0 .5px var(--glass-line);
  animation: net-banner-in .5s var(--spring);
}
.net-banner > .ic { width: 24px; height: 24px; color: var(--err-text); }
@keyframes net-banner-in { from { opacity: 0; transform: translateY(-12px); } }

/* ===== Пустое состояние и загрузка ===== */
.empty { display: grid; justify-items: center; gap: 6px; padding: 28px 24px 24px; text-align: center; }
.empty__icon { width: 40px; height: 40px; margin-bottom: 4px; color: var(--label-2); stroke-width: 1.6; }
.empty__title { font: var(--text-headline); }
.empty__text { max-width: 30ch; font: var(--text-sub); color: var(--label-2); }
.empty .btn { margin-top: 10px; }
.skeleton {
  display: block;
  height: 13px;
  border-radius: 6px;
  background-color: var(--fill);
  background-image: linear-gradient(90deg, transparent, var(--shine), transparent);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.4s linear infinite;
}
.skeleton--circle { flex: none; width: 40px; height: 40px; border-radius: 50%; }
.skeleton--title { width: 62%; height: 17px; margin: 2px 0 7px; }
.skeleton--text { width: 44%; }
.skeleton--value { flex: none; width: 44px; height: 17px; }

/* ===== Поля форм ===== */
.form { max-width: 40rem; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label { padding-left: 4px; font: var(--text-caption); color: var(--label-2); }
.field > label.check { padding-left: 0; font: var(--text-body); color: var(--label); }
.sheet__body .field { margin-bottom: 0; }
.input,
.field :where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"]), select, textarea) {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-field);
  background-color: var(--field-bg);
  color: var(--label);
  font: var(--text-body);
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow .15s;
}
.field textarea, textarea.input { min-height: 76px; padding: 12px 14px; resize: vertical; }
.field select, select.input {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--label-2) 50%), linear-gradient(135deg, var(--label-2) 50%, transparent 50%);
  background-position: calc(100% - 21px) 50%, calc(100% - 15px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.input::placeholder, .field ::placeholder, .search input::placeholder { color: var(--label-2); opacity: 1; }
/* Обводка внутрь: у края прокручиваемого листа внешняя обводка обрезается */
.input:focus, .field :where(input, select, textarea):focus { outline: none; box-shadow: inset 0 0 0 2px var(--label-2); }
.field--invalid :where(input, select, textarea), .input[aria-invalid="true"], .field [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--err-text); }
.field__help { padding-left: 4px; font: var(--text-caption-2); color: var(--label-2); }
.field__help ul { margin-top: 4px; padding-left: 18px; }
.field__error { display: flex; align-items: flex-start; gap: 6px; padding-left: 4px; font: var(--text-sub-em); color: var(--err-text); }
.field__error .ic { width: 18px; height: 18px; margin-top: 1px; }
fieldset { min-width: 0; margin: 0 0 16px; border: 0; }
legend { padding: 0 4px 8px; font: var(--text-headline); }
/* Поиск со значком */
.search { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 14px; border-radius: var(--r-field); background: var(--field-bg); cursor: text; transition: box-shadow .15s; }
.search > .ic { color: var(--label-2); }
.search input { flex: 1; min-width: 0; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font: var(--text-body); outline: none; -webkit-appearance: none; appearance: none; }
.search input:focus { box-shadow: none; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--label-2); }
/* Отметка */
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font: var(--text-body); color: var(--label); cursor: pointer; }
.check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1.5px var(--label-2);
  cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.check input[type="checkbox"]::before {
  content: "";
  width: 12px;
  height: 7px;
  border: solid var(--on-primary);
  border-width: 0 0 2.5px 2.5px;
  transform: translateY(-1.5px) rotate(-45deg) scale(0);
  transition: transform .3s var(--spring);
}
.check input[type="checkbox"]:checked { background: var(--primary); box-shadow: none; }
.check input[type="checkbox"]:checked::before { transform: translateY(-1.5px) rotate(-45deg) scale(1); }
/* Список отметок с поиском (подразделения бригадира) */

/* ===== Правка времени человека (лист табеля) ===== */
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-field { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 10px; border-radius: var(--r-card); background: var(--raised); }
.time-field__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; padding-left: 4px; }
.time-field__head label { font: var(--text-caption); color: var(--label-2); }
.time-field__input {
  width: 100%;
  height: 48px;
  padding: 0 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  font: 500 30px/48px var(--font);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  caret-color: var(--hours);
}
.time-field__input:focus { outline: none; background: var(--tile); }
.time-field.is-dev .time-field__input { color: var(--info-text); }
.time-field.is-err .time-field__input { color: var(--err-text); }
.stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.stepper--hours { grid-template-columns: 64px 64px; margin-top: 0; }
.stepper > button { height: 44px; border-radius: 12px; background: var(--fill); font: var(--text-sub-strong); font-variant-numeric: tabular-nums; }
.hours-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 12px 12px 16px; border-radius: var(--r-card); background: var(--raised); }
.hours-box__cap { display: flex; align-items: center; gap: 8px; font: var(--text-caption); color: var(--label-2); }
.hours-box__value { display: block; font: 500 28px/34px var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hours-box.is-manual .hours-box__value { color: var(--info-text); }
.hours-box__note { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; font: var(--text-sub); color: var(--label-2); }
.hours-box__manual { color: var(--info-text); font-weight: 600; }
.hours-box__note .link-btn { margin: -12px 0; }

/* ===== Узкая страница: вход, ошибки ===== */
.narrow { max-width: 400px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top)) 16px 48px; }

/* ===== Шаблоны Django ===== */
/* Лист, чьё содержимое приходит с сервера: обёртка и форма не мешают раскладке листа (шапка, прокрутка, подвал) */
.sheet__content, .sheet__content > form { display: contents; }
/* Нижнее меню без вкладок: одна кнопка действия справа */
.dock__in--end { justify-content: flex-end; }
/* Касание без задержки и без увеличения от двойного нажатия */
a, button, input, select, textarea, label, summary { touch-action: manipulation; }
/* Заголовки переносятся ровно */
.large-title__h, .section-head__title, .sheet__title, .empty__title { text-wrap: balance; }
/* Поле времени в листе: заметная рамка при вводе, как у остальных полей */
.time-field:focus-within { box-shadow: inset 0 0 0 2px var(--label-2); }
/* Загрузка фото листа: форма не мешает раскладке, видна только кнопка */
.upload { display: contents; }
/* Кнопка «Отправить» у загрузки нужна только без JavaScript */
.js .noscript-only { display: none; }
@media (scripting: enabled) { .noscript-only { display: none; } }
/* Страницы подписанного листа в карточке: плашки, как поля внутри карточки */
.sheet-files { list-style: none; display: grid; gap: 8px; margin-top: 14px; }
.sheet-file { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: var(--r-field); background: var(--field-bg); }
.sheet-file > .ic:first-child { flex: none; color: var(--label-2); }
.sheet-file__body { flex: 1; min-width: 0; }
.sheet-file__title { display: block; font: var(--text-headline); }
.sheet-file__sub { display: block; font: var(--text-caption-2); color: var(--label-2); }
a.sheet-file:active { background: var(--tile-press); }
@media (hover: hover) and (pointer: fine) { a.sheet-file:hover { background: var(--tile-press); } }
.sheet-file:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Фото листа в нижнем листе: целиком, без обрезки */
/* Место под фото занято сразу (рамка 3:4, как у снимка листа): кнопки ниже не прыгают, пока оно грузится */
.sheet-photo { display: block; width: 100%; aspect-ratio: 3 / 4; max-height: 52vh; border-radius: var(--r-field); overflow: hidden; background: var(--tile); }
.sheet-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Подтверждение необратимого действия прямо в листе: кнопка раскрывает пояснение и вторую кнопку */
.confirm > summary::-webkit-details-marker { display: none; }
.confirm[open] > summary { display: none; }
.confirm__body { display: grid; gap: 10px; }
.confirm__text { font: var(--text-sub); color: var(--label-2); padding: 0 4px; }
/* Ссылка «Открыть» в тосте уведомления о новом статусе заявки: как кнопка «Вернуть» */
a.toast__undo { display: inline-flex; align-items: center; }
/* Кадровые заявки: заявка на оформление из поиска в табеле, файлы без шапки карточки, ошибка под карточкой */
.hire-link { margin-top: 16px; }
.sheet-files--first { margin-top: 0; }
.action-card > .field__error { margin-top: 10px; }
.group + .field__error { margin: 8px 4px 0; }
/* Заявка у кадровика: поля списком «название - значение», длинное значение переносится */
.group--values .row__meta { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.row__text { display: block; margin-top: 2px; font: var(--text-body); overflow-wrap: anywhere; white-space: pre-line; }
/* Ошибка строки человека: метка «Пересечение» и спокойная серая подробность под ней */
.row__problem { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; }
.row__problem .tag { height: 22px; padding: 0 8px; border-radius: 11px; font: 600 12px/16px var(--font); }
.row__problem-text { min-width: 0; font: var(--text-caption-2); color: var(--label-2); }
/* Дата: видна словами («Воскресенье, 8 ноября»), календарь телефона открывает невидимое поле поверх.
   Без JavaScript видно обычное поле даты */
.date-pick { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: var(--r-field); background: var(--field-bg); transition: box-shadow .15s; }
.date-pick > .ic { color: var(--label-2); }
.date-pick__text { flex: 1; min-width: 0; font: var(--text-body); }
.date-pick__text.is-empty { color: var(--label-2); }
.date-pick > input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; opacity: 0; font-size: 17px; cursor: pointer; }
.date-pick:focus-within { box-shadow: inset 0 0 0 2px var(--label-2); }
.field--invalid .date-pick { box-shadow: inset 0 0 0 2px var(--err-text); }
@media (scripting: none) {
  .date-pick { display: block; padding: 0; background: none; }
  .date-pick > .ic, .date-pick__text { display: none; }
  .date-pick > input { position: static; height: auto; min-height: 52px; padding: 0 14px; opacity: 1; }
}

/* Экран бригадира на этапе 1 пилота (foreman/stage_wait.html): «Выйти» отдельно от карточек */
.stage-wait__out { margin-top: 28px; }

/* ===== Планшет и компьютер (12.11, 13.11). ТЗ А1.1: «для телефонов Android и iPhone, планшетов и ПК».
   На телефоне раскладка прежняя. От 700 px экран шире телефона (680 px), листы шире. От 1100 px главный
   экран и табель (page--split) шириной 1040 px и в две колонки: на главном слева «Сегодня» карточками
   по одной, под ними неделя и прошлые дни, справа «Ещё нужно сделать»; на табеле слева люди, справа
   смена и подписанный лист. Карточки в два столбца и узкий список справа владелец счёл некрасивыми
   (13.11): разная высота карточек, названия дел переносились. Порядок в разметке тот же, что на
   телефоне. Остальные экраны остаются шириной 680 px, меню и полоса сохранения не растягиваются ===== */
@media (min-width: 700px) {
  .app { max-width: 680px; }
  .quick { max-width: 420px; }
  .sheet { max-width: 560px; }
}
@media (min-width: 1100px) {
  .app:has(.page--split) { max-width: 1040px; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto auto 1fr; grid-template-areas: "today todo" "week todo" "earlier todo"; column-gap: 32px; align-items: start; }
  .split__today { grid-area: today; }
  .split__todo { grid-area: todo; }
  .split__week { grid-area: week; }
  .split__earlier { grid-area: earlier; }
  .page--split #ts-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr; grid-template-areas: "people shift" "people sheet"; column-gap: 32px; align-items: start; }
  .page--split #ts-body > .ts-people { grid-area: people; }
  .page--split #ts-body > .ts-shift { grid-area: shift; margin-top: 26px; }
  .page--split #ts-body > #ts-sheet { grid-area: sheet; }
}

/* ===== Запасной плотный фон, если стекло не поддерживается или прозрачность уменьшена ===== */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-solid); }
  .glass-sheet { background: var(--sheet-solid); }
  .navbar::before { background: var(--glass-solid); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .navbar__back.glass { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .edge--bottom { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glass-sheet { background: var(--sheet-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .navbar::before { background: var(--glass-solid) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

/* ===== Уменьшение движения: всё мгновенно, луч и пружины замирают ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .app.is-behind { transform: none; filter: none; border-radius: 0; }
  .beam::before { animation: none; background: conic-gradient(from 140deg, transparent 0%, var(--hours) 20%, transparent 45%, transparent 60%, var(--hours) 82%, transparent 100%); opacity: .6; }
  .draw-check { stroke-dasharray: none; stroke-dashoffset: 0; }
  .skeleton { animation: none; background-image: none; }
}
