/*
  ERP Staff World — рабочее место недельных выплат.

  Цвет: зелёный Staff World (с сайта компании) — только для действий, выделения и графиков;
  остальное — спокойные нейтральные с лёгким зелёным оттенком. Статусы: зелёный — готово,
  янтарный — проверьте, красный — не уйдёт в выплату.
  Шрифт: Golos Text (ParaType, OFL) — один на весь интерфейс; цифры в колонках — табличные.
  Раскладка: боковое меню + рабочая область; неделя Пн–Вс — главная единица экрана выплат.
*/

@font-face {
  font-family: "Golos Text";
  src: url("../fonts/golos-text.woff") format("woff");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: #f2f4f3;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #ebefed;
  --ink: #17201d;
  --ink-2: #55625e;
  --ink-3: #5f6c68;
  --line: #dde3e0;
  --line-2: #c6cfcb;
  --control-line: #8a9692;
  --brand: #17634f;
  --brand-ink: #0f4b3c;
  --brand-soft: #e2f0ea;
  --brand-line: #a9d3c3;
  --brand-fill: #17634f;
  --brand-fill-hover: #11523f;
  --on-brand: #ffffff;
  --amber: #8a4f00;
  --amber-soft: #fcf0db;
  --amber-line: #efd19c;
  --red: #b0261c;
  --red-soft: #fce9e7;
  --red-line: #f1c0ba;
  --viz-1: #0f7d5c;
  --viz-grid: #e3e8e5;
  --viz-base: #c6cfcb;
  --weekend: #f4f6f5;
  --toast-bg: #1d2925;
  --toast-ink: #f2f6f4;
  --overlay: rgba(14, 24, 21, 0.38);
  --shadow-pop: 0 16px 40px rgba(18, 38, 32, 0.16), 0 2px 8px rgba(18, 38, 32, 0.08);
  --shadow-tab: 0 1px 2px rgba(18, 38, 32, 0.12);

  --font: "Golos Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, Arial, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 15px;
  --fs-lg: 17px;
  --fs-h2: 18px;
  --fs-h1: 26px;
  --fs-total: 34px;

  --r-panel: 12px;
  --r-control: 8px;
  --r-tag: 6px;
  --sidebar-w: 248px;
  --gutter: 32px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0e1412;
    --surface: #151c19;
    --surface-2: #19221f;
    --surface-3: #212c28;
    --ink: #e3ebe7;
    --ink-2: #9fafa9;
    --ink-3: #849590;
    --line: #26312d;
    --line-2: #34423d;
    --control-line: #5f6f69;
    --brand: #6fd0b0;
    --brand-ink: #8fe0c3;
    --brand-soft: #16382f;
    --brand-line: #2b6352;
    --brand-fill: #24785e;
    --brand-fill-hover: #2b8a6c;
    --on-brand: #ffffff;
    --amber: #f0b65c;
    --amber-soft: #2e2410;
    --amber-line: #5a4419;
    --red: #f39a90;
    --red-soft: #391c19;
    --red-line: #6a2f29;
    --viz-1: #34a27e;
    --viz-grid: #222c28;
    --viz-base: #34423d;
    --weekend: #18201d;
    --toast-bg: #dfe8e3;
    --toast-ink: #17201d;
    --overlay: rgba(0, 0, 0, 0.56);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-tab: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0e1412;
  --surface: #151c19;
  --surface-2: #19221f;
  --surface-3: #212c28;
  --ink: #e3ebe7;
  --ink-2: #9fafa9;
  --ink-3: #849590;
  --line: #26312d;
  --line-2: #34423d;
  --control-line: #5f6f69;
  --brand: #6fd0b0;
  --brand-ink: #8fe0c3;
  --brand-soft: #16382f;
  --brand-line: #2b6352;
  --brand-fill: #24785e;
  --brand-fill-hover: #2b8a6c;
  --on-brand: #ffffff;
  --amber: #f0b65c;
  --amber-soft: #2e2410;
  --amber-line: #5a4419;
  --red: #f39a90;
  --red-soft: #391c19;
  --red-line: #6a2f29;
  --viz-1: #34a27e;
  --viz-grid: #222c28;
  --viz-base: #34423d;
  --weekend: #18201d;
  --toast-bg: #dfe8e3;
  --toast-ink: #17201d;
  --overlay: rgba(0, 0, 0, 0.56);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-tab: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ---------- Основа ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  font-feature-settings: "lnum";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); font-weight: 620; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-base); font-weight: 620; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-soft); color: var(--ink); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.num, .tnum { font-variant-numeric: tabular-nums lining-nums; }
.nowrap { white-space: nowrap; }
.money { white-space: nowrap; }
.money .kop { color: var(--ink-2); }
.zero { color: var(--ink-3); }
.text-warn { color: var(--amber); }
.text-bad { color: var(--red); }
.text-ok { color: var(--brand-ink); }
.stack { display: grid; gap: 12px; align-content: start; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Каркас ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand .logo-dark { display: block; }
}
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.brand-name { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.env {
  margin: 0 8px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-control);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.nav { display: grid; gap: 2px; }
.nav-label { padding: 14px 10px 6px; font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 10px;
  border-radius: var(--r-control);
  color: var(--ink-2);
  font-weight: 500;
  font-size: var(--fs-base);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a .icon { color: var(--ink-3); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--brand); }
.nav .badge-count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--red-soft); color: var(--red);
  font-size: var(--fs-xs); font-weight: 650;
}
.nav .badge-count.badge-info { background: var(--brand-soft); color: var(--brand-ink); }

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.who { display: grid; gap: 2px; }
.who-name { font-weight: 600; font-size: var(--fs-md); }
.who-role { font-size: var(--fs-sm); color: var(--ink-2); }
.sidebar-foot form { margin: 0; }
.foot-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.theme-toggle > span { display: inline-flex; align-items: center; gap: 6px; }
/* Подпись — то, на что переключит кнопка: в светлой теме «Тёмная», в тёмной «Светлая». */
.theme-toggle .theme-to-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-to-light { display: inline-flex; }
  :root:not([data-theme="light"]) .theme-toggle .theme-to-dark { display: none; }
}
:root[data-theme="dark"] .theme-toggle .theme-to-light { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .theme-to-dark { display: none; }

.topbar { display: none; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.page {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding-block: 28px 64px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  display: grid;
  gap: 28px;
  align-content: start;
}
.page-narrow { max-width: 1040px; }

/* Шапка страницы */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.page-head > div:first-child { min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; font-size: var(--fs-sm); color: var(--ink-2); }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); }
.crumbs .icon { color: var(--ink-3); }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.lead { margin-top: 6px; color: var(--ink-2); max-width: 72ch; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 12px 0 0; font-size: var(--fs-md); }
.meta > div { display: flex; gap: 6px; min-width: 0; }
.meta dt { color: var(--ink-2); }
.meta dd { margin: 0; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Разделы страницы */
.section { display: grid; gap: 14px; min-width: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.section-head p { color: var(--ink-2); font-size: var(--fs-md); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); min-width: 0; }
.panel-pad { padding: 20px 22px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 14px; }
.panel-head h2 { font-size: var(--fs-lg); }
.panel-head .muted { font-size: var(--fs-md); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split > * { min-width: 0; }
.split > * + * { border-left: 1px solid var(--line); }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: var(--fs-md); font-weight: 550; line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--control-line); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-fill-hover); border-color: var(--brand-fill-hover); color: var(--on-brand); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-lg { min-height: 44px; padding: 0 20px; font-size: var(--fs-base); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.htmx-request .btn-primary, .btn-primary.htmx-request { opacity: 0.75; cursor: progress; }
form.inline { display: inline; margin: 0; }

/* ---------- Метки статусов ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 24px; padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.25;
  white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; }
.chip-lg { min-height: 28px; padding: 3px 12px; font-size: var(--fs-md); }
.chip-ok { background: var(--brand-soft); color: var(--brand-ink); }
.chip-warn { background: var(--amber-soft); color: var(--amber); }
.chip-bad { background: var(--red-soft); color: var(--red); }
.chip-neutral { background: var(--surface-3); color: var(--ink-2); }
.chip-line { background: transparent; border-color: var(--brand-line); color: var(--brand-ink); }
.chip-solid { background: var(--brand-fill); color: var(--on-brand); }
.chip-ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 24px; padding: 1px 8px;
  border-radius: var(--r-tag);
  background: var(--surface-3);
  color: var(--ink);
  font-size: var(--fs-sm); font-weight: 500;
  white-space: nowrap;
}
.tag .icon { width: 14px; height: 14px; color: var(--ink-2); }
.tag-muted { color: var(--ink-2); }

/* ---------- Шаги пакета ---------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.step { min-width: 0; padding-right: 14px; }
.step-rail { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.step-rail::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--line); }
.step:last-child .step-rail::after { visibility: hidden; }
.step.is-done .step-rail::after { background: var(--brand-fill); }
.step-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 650;
}
.step-mark .icon { width: 16px; height: 16px; }
.step.is-done .step-mark { border-color: var(--brand-fill); background: var(--brand-fill); color: var(--on-brand); }
.step.is-current .step-mark { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step.is-blocked .step-mark { border-color: var(--red); color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.step-title { font-weight: 620; font-size: var(--fs-md); }
.step:not(.is-done):not(.is-current):not(.is-blocked) .step-title { color: var(--ink-2); }
.step-detail { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }

/* ---------- Деньги пакета: как кассовый расчёт ---------- */

.ledger { display: grid; }
.ledger-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 20px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.ledger-row:first-child { padding-top: 0; }
.ledger-label { font-weight: 550; display: flex; align-items: center; gap: 8px; }
.ledger-label .icon { color: var(--ink-3); }
.ledger-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.ledger-sub { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--ink-2); }
.ledger-total { border-bottom: 0; border-top: 3px double var(--line-2); margin-top: -1px; padding: 14px 0 0; align-items: end; }
.ledger-total .ledger-label { font-size: var(--fs-base); }
.ledger-total .ledger-value { font-size: var(--fs-total); font-weight: 650; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: proportional-nums lining-nums; }
.ledger-total .kop { font-size: 0.62em; letter-spacing: 0; }

/* ---------- Неделя по дням ---------- */

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { display: grid; grid-template-rows: auto 132px auto; gap: 8px; text-align: center; border-radius: var(--r-control); padding: 8px 2px 10px; position: relative; }
.day.is-weekend { background: var(--weekend); }
.day-value { font-size: var(--fs-xs); color: var(--ink-2); font-variant-numeric: tabular-nums; min-height: 18px; white-space: nowrap; }
.day-plot { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--viz-base); }
.day-bar {
  width: 24px; height: var(--h, 0%); min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--viz-1);
  transition: filter 0.12s;
}
.day-bar.is-empty { background: transparent; }
.day:hover .day-bar, .day:focus-visible .day-bar { filter: brightness(1.15); }
.day-name { font-size: var(--fs-sm); font-weight: 620; line-height: 1.2; }
.day-date { font-weight: 450; color: var(--ink-2); }
.day-meta { font-size: var(--fs-xs); color: var(--ink-2); margin-top: 2px; }
.day[tabindex]:focus-visible { outline-offset: -2px; }
.viz-tip {
  position: absolute; left: 50%; bottom: calc(100% - 6px); transform: translateX(-50%); display: none;
  z-index: 5; min-width: 150px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-control);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm); text-align: left; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity 0.12s;
}
.viz-tip strong { display: block; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.viz-tip span { color: var(--ink-2); }
.day:hover .viz-tip, .day:focus-visible .viz-tip, .col:hover .viz-tip, .col:focus-visible .viz-tip { display: block; opacity: 1; visibility: visible; }
.day:first-child .viz-tip, .col:first-child .viz-tip { left: 0; transform: none; }
.day:nth-last-child(-n+2) .viz-tip, .col:nth-last-child(-n+2) .viz-tip { left: auto; right: 0; transform: none; }
.week-foot { margin-top: 14px; font-size: var(--fs-sm); color: var(--ink-2); }
.week-foot summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; cursor: pointer; list-style: none; }
.week-foot summary::-webkit-details-marker { display: none; }
.summary-link { color: var(--brand); font-weight: 550; }
.week-foot[open] .summary-link::after { content: " — скрыть"; color: var(--ink-3); font-weight: 400; }

/* Недельный график на главной */
.cols { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 4px; align-items: end; }
.col { display: grid; grid-template-rows: auto 150px auto; gap: 8px; text-align: center; position: relative; padding: 0 2px; }
.col-plot { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--viz-base); background-image: linear-gradient(var(--viz-grid) 1px, transparent 1px); background-size: 100% 50%; background-position: 0 0; }
.col-bar { width: 24px; height: var(--h, 0%); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--viz-1); }
.col.is-current .col-bar { background: var(--viz-1); }
.col:not(.is-current) .col-bar { opacity: 0.55; }
.col:hover .col-bar, .col:focus-visible .col-bar { opacity: 1; filter: brightness(1.1); }
.col-value { font-size: var(--fs-xs); color: var(--ink-2); min-height: 18px; white-space: nowrap; }
.col.is-current .col-value { color: var(--ink); font-weight: 600; }
.col-label { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.25; }
.col a { color: inherit; }
.col[tabindex]:focus-visible { outline-offset: 2px; }

/* ---------- Что решить ---------- */

.issues { display: grid; }
.issue {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 12px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.issue:first-child { padding-top: 2px; }
.issue:last-child { border-bottom: 0; padding-bottom: 0; }
.issue > .icon { margin-top: 1px; }
.issue-bad > .icon { color: var(--red); }
.issue-warn > .icon { color: var(--amber); }
.issue-info > .icon { color: var(--ink-3); }
.issue-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.issue-count { font-weight: 500; color: var(--ink-2); font-size: var(--fs-md); }
.issue-text { grid-column: 2; color: var(--ink-2); font-size: var(--fs-md); max-width: 70ch; }
.issue-action { grid-column: 3; grid-row: 1 / span 2; align-self: center; }

.callout {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 12px; align-items: start;
  padding: 12px 14px; border-radius: var(--r-control); border: 1px solid var(--line); background: var(--surface-2);
}
.callout > .icon { margin-top: 2px; color: var(--ink-2); }
.callout-title { font-weight: 600; }
.callout-text { grid-column: 2; color: var(--ink-2); font-size: var(--fs-md); }
.callout-bad { background: var(--red-soft); border-color: var(--red-line); }
.callout-bad > .icon { color: var(--red); }
.callout-warn { background: var(--amber-soft); border-color: var(--amber-line); }
.callout-warn > .icon { color: var(--amber); }
.callout-ok { background: var(--brand-soft); border-color: var(--brand-line); }
.callout-ok > .icon { color: var(--brand); }
.callout-bad .callout-text, .callout-warn .callout-text, .callout-ok .callout-text { color: var(--ink); }

/* ---------- Таблицы ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Свой период «с … по» под переключателем недели и месяца */
.range-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range-form label { font-size: var(--fs-md); color: var(--ink-2); }
.range-form .input-date { width: auto; min-width: 150px; }

.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 10px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 0 12px;
  border-radius: 8px;
  color: var(--ink-2); font-size: var(--fs-md); font-weight: 550; white-space: nowrap;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab[aria-current="true"], .tab:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tab); }
label.tab { cursor: pointer; }
.tab:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 1px; }
.tab .count { font-size: var(--fs-xs); font-weight: 650; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tab .count-bad { color: var(--red); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); font-variant-numeric: tabular-nums lining-nums; }
.data th {
  padding: 11px 14px; text-align: left; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.data thead th:first-child { border-top-left-radius: var(--r-panel); }
.data thead th:last-child { border-top-right-radius: var(--r-panel); }
.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; line-height: 1.35; }
.status-ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; }
.status-ok .icon { color: var(--brand); }
.data tbody tr:last-child td { border-bottom: 0; }
.data .num { text-align: right; white-space: nowrap; }
.data .strong { font-weight: 620; }
.data tbody tr:hover td { background: var(--surface-2); }
.data tr.is-clickable { cursor: pointer; }
.data tr.is-selected td { background: var(--brand-soft); }
.data tfoot td { background: var(--surface-2); border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 620; }
.data tfoot tr:last-child td:first-child { border-bottom-left-radius: var(--r-panel); }
.data tfoot tr:last-child td:last-child { border-bottom-right-radius: var(--r-panel); }
.data tfoot th { border-top: 1px solid var(--line-2); border-bottom: 0; color: var(--ink); font-size: var(--fs-md); font-weight: 620; }
.data tfoot tr:last-child th:first-child { border-bottom-left-radius: var(--r-panel); }
.data tr.is-warn td { background: var(--amber-soft); }
.data.registry td { padding-top: 7px; padding-bottom: 7px; }
.data.registry tr.reg-day:not(:first-child) td { box-shadow: inset 0 1px 0 var(--line-2); }
.registry .reg-where { color: var(--ink-2); }
.data tr.is-warn:hover td { background: var(--amber-soft); }
.cell-title { font-weight: 550; color: var(--ink); }
a.cell-title:hover { color: var(--brand); }
.cell-sub { margin-top: 2px; font-size: var(--fs-sm); color: var(--ink-2); }
.cell-icons { display: inline-flex; gap: 6px; color: var(--ink-3); vertical-align: middle; }
.cell-icons .ok { color: var(--brand); }
.cell-icons .bad { color: var(--red); }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: var(--fs-md); color: var(--ink-2); }

/* ---------- Формы ---------- */

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field-label { font-weight: 550; font-size: var(--fs-md); }
.field .hint { font-size: var(--fs-sm); color: var(--ink-2); }
input.input { height: 40px; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--control-line); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-md);
}
.textarea { min-height: 80px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 53%, calc(100% - 13px) 53%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.input::placeholder { color: var(--ink-3); }
.search { position: relative; min-width: 300px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--red); font-size: var(--fs-sm); }
.form-grid { display: grid; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: var(--fs-md); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-fill); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; }

.choice-cards { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 8px; }
.choice {
  position: relative; display: grid; gap: 2px; align-content: start;
  padding: 11px 12px; border: 1px solid var(--line-2); border-radius: var(--r-control);
  cursor: pointer; background: var(--surface);
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-title { font-weight: 600; font-size: var(--fs-md); display: flex; align-items: center; gap: 8px; }
.choice-sub { font-size: var(--fs-sm); color: var(--ink-2); }
.choice:hover { border-color: var(--control-line); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Пустые состояния ---------- */

.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 24px; text-align: center; }
.empty > .icon { color: var(--ink-3); margin-bottom: 4px; }
.empty-title { font-weight: 600; font-size: var(--fs-lg); }
.empty-text { color: var(--ink-2); max-width: 52ch; }
.empty .actions { margin-top: 8px; justify-content: center; }

/* ---------- Окна и выезжающая панель ---------- */

dialog { color: var(--ink); }
dialog::backdrop { background: var(--overlay); }
dialog:focus, dialog:focus-visible { outline: none; }
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-pop);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 0; }
.modal-body { padding: 16px 22px 20px; display: grid; gap: 16px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }

dialog.drawer {
  margin: 0 0 0 auto; width: min(600px, 100vw); height: 100dvh; max-height: 100dvh; max-width: 100vw;
  padding: 0; border: 0; border-left: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-pop);
}
dialog.drawer[open] { animation: drawer-in 0.18s ease-out; }
@keyframes drawer-in { from { transform: translateX(28px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.drawer-shell { display: flex; flex-direction: column; height: 100%; }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 22px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 20px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; display: grid; gap: 26px; align-content: start; }
.drawer-loading { display: grid; place-items: center; height: 60vh; color: var(--ink-2); }
.drawer-section { display: grid; gap: 12px; }
.drawer-section h3 { font-size: var(--fs-base); }

/* Смены исполнителя: 7 клеток недели */
.mini-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mini-day { border: 1px solid var(--line); border-radius: var(--r-control); padding: 6px 4px 7px; text-align: center; min-height: 64px; display: grid; align-content: start; gap: 2px; }
.mini-day.is-weekend { background: var(--weekend); }
.mini-day.is-worked { border-color: var(--brand-line); background: var(--brand-soft); }
.mini-day-name { font-size: var(--fs-xs); color: var(--ink-2); }
.mini-day-hours { font-weight: 650; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.mini-day-sub { font-size: 11px; color: var(--ink-2); line-height: 1.2; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: var(--fs-md); }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Табель на карточке исполнителя */
.timesheet { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.timesheet th { font-weight: 600; color: var(--ink-2); font-size: var(--fs-xs); padding: 0 2px 2px; text-align: center; }
.timesheet th.week-label { text-align: left; white-space: nowrap; padding-right: 8px; }
.timesheet td { height: 40px; border-radius: 6px; text-align: center; background: var(--surface-2); color: var(--ink-3); }
.timesheet td.is-weekend { background: var(--weekend); }
.timesheet td.is-worked { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.timesheet td.is-long { background: var(--amber-soft); color: var(--amber); }
.timesheet td.week-total { background: transparent; color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; padding-left: 8px; }

/* ---------- Уведомления ---------- */

.toasts {
  position: fixed; z-index: 60; display: grid; gap: 8px;
  right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px));
  width: min(400px, calc(100vw - 32px));
}
.toast {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 12px 12px 12px 14px; border-radius: 10px;
  background: var(--toast-bg); color: var(--toast-ink);
  box-shadow: var(--shadow-pop); font-size: var(--fs-md);
  animation: toast-in 0.2s ease-out;
}
.toast .icon { margin-top: 1px; }
.toast-close { background: none; border: 0; color: inherit; opacity: 0.7; cursor: pointer; padding: 0; line-height: 0; }
.toast-close:hover { opacity: 1; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Вход ---------- */

.auth {
  min-height: 100vh; display: grid; place-items: center;
  padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px 28px; display: grid; gap: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { height: 40px; width: auto; }
.auth-card h1 { font-size: 22px; }
.auth-foot { font-size: var(--fs-sm); color: var(--ink-2); }
.qr { display: flex; justify-content: center; padding: 14px; background: #ffffff; border-radius: var(--r-control); border: 1px solid var(--line); }
.secret { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; background: var(--surface-2); border: 1px solid var(--line); padding: 8px 12px; border-radius: var(--r-control); word-break: break-all; font-size: var(--fs-md); }

/* ---------- Сетки страниц ---------- */

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 32px; }
.fact { display: grid; gap: 2px; }
.fact-label { font-size: var(--fs-sm); color: var(--ink-2); }
.fact-value { font-size: var(--fs-lg); font-weight: 620; }
.list-plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }

/* ---------- Прототип ---------- */

.proto-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px;
  padding: 7px 16px; background: var(--amber-soft); color: var(--amber);
  font-size: var(--fs-sm); font-weight: 550; border-bottom: 1px solid var(--amber-line);
}
.proto-bar a { color: var(--amber); text-decoration: underline; }

/* ---------- Узкие экраны ---------- */

@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .split > * + * { border-left: 0; border-top: 1px solid var(--line); }
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
}

@media (max-width: 1023px) {
  :root { --gutter: 20px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100dvh;
    transform: translateX(-102%); transition: transform 0.2s ease-out;
    box-shadow: var(--shadow-pop);
    padding-left: max(14px, env(safe-area-inset-left, 0px));
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 25; }
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 20;
    min-height: 56px;
    padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px));
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .topbar img { height: 28px; width: auto; }
  .topbar .brand { padding: 0; }
  .page { padding-block: 20px 48px; gap: 22px; }
  .steps { grid-template-columns: 1fr; gap: 0; }
  .step { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; padding: 0 0 14px; position: relative; }
  .step-rail { grid-row: 1 / span 2; margin: 0; flex-direction: column; align-items: center; height: 100%; }
  .step-rail::after { width: 2px; height: auto; flex: 1; min-height: 12px; }
  .step-title { padding-top: 4px; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; --fs-h1: 22px; --fs-total: 28px; }
  .panel-pad { padding: 16px; }
  .meta { gap: 4px 18px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .toolbar-right { width: 100%; }
  .form-row-2, .form-row-3, .choice-cards { grid-template-columns: 1fr; }
  .issue { grid-template-columns: 22px minmax(0, 1fr); }
  .issue-action { grid-column: 2; grid-row: auto; margin-top: 8px; }
  .day { grid-template-rows: auto 100px auto; padding: 6px 0 8px; }
  .day-bar, .col-bar { width: 16px; }
  .day-word { display: none; }
  .day-name { display: grid; }
  .step { padding-bottom: 8px; }
  .step.is-done .step-detail, .step.is-todo .step-detail { display: none; }
  .day-value { font-size: 11px; }
  .col { grid-template-rows: auto 120px auto; }
  .col-value { font-size: 11px; }
  .col:not(.is-current):not(:last-child) .col-value { visibility: hidden; }
  .data.responsive thead { display: none; }
  .data.responsive, .data.responsive tbody, .data.responsive tr, .data.responsive td { display: block; width: 100%; }
  .data.responsive tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .data.responsive tbody tr:last-child { border-bottom: 0; }
  .data.responsive td { padding: 0; border: 0; text-align: left; }
  .data.responsive td[data-label]::before { content: attr(data-label) " "; color: var(--ink-2); font-weight: 400; }
  .data.responsive td.m-hide { display: none; }
  .data.responsive td.m-wide { grid-column: 1 / -1; }
  .data.responsive td.m-end { text-align: right; order: 2; }
  .data.responsive td.m-route { order: 3; }
  .data.responsive td.m-status { order: 4; text-align: right; }
  .data.responsive tfoot { display: none; }
  dialog.drawer { width: 100vw; border-left: 0; }
  .drawer-head, .drawer-body { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .mini-day { min-height: 58px; padding: 5px 2px; }
  .timesheet { border-spacing: 3px; }
  .timesheet td { height: 34px; }
}

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

@media (forced-colors: active) {
  .day-bar, .col-bar { background: CanvasText; }
  .chip, .tag { border: 1px solid CanvasText; }
}

/* ---------- Главная ---------- */

.steps-compact .step-mark { width: 26px; height: 26px; font-size: var(--fs-xs); }
.steps-compact .step-rail { margin-bottom: 8px; }
.steps-compact .step-title { font-size: var(--fs-sm); }
.steps-compact .step-detail { font-size: var(--fs-xs); }
.steps-compact .step.is-done .step-detail, .steps-compact .step.is-todo .step-detail { display: none; }
.rowlist { list-style: none; margin: 0; padding: 0; display: grid; }
.rowlist a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: var(--fs-md); }
.rowlist li:last-child a { border-bottom: 0; }
.rowlist a:hover { color: var(--brand); text-decoration: none; }
.rowlist-count { font-weight: 650; font-variant-numeric: tabular-nums; }
.rowlist a { align-items: center; }
.rowlist .strong { font-weight: 620; }
.rowlist .cell-sub { display: block; }
.rowlist .chip { flex: none; }
/* Главная: завтра по заказчикам и сменам, заявки на аванс */
.home-col { display: grid; gap: 20px; align-content: start; min-width: 0; }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.day-customer { font-weight: 650; margin-bottom: 2px; }
.day-shift {
  display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line);
  color: var(--ink); font-size: var(--fs-md); text-decoration: none;
}
.day-list li .day-shift:last-child { border-bottom: 0; }
.day-shift:hover { color: var(--brand); text-decoration: none; }
.day-shift .ts-shift { min-width: 70px; justify-content: center; }
.day-shift-text { flex: 1 1 auto; min-width: 0; color: var(--ink-2); }
.day-shift > .icon { flex: none; color: var(--ink-3); }
.adv-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.adv-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-md); }
.adv-item:last-child { border-bottom: 0; }
.adv-item .strong { font-weight: 620; color: var(--ink); }
.adv-item .cell-sub { display: block; }
.adv-item .btn, .adv-item .chip { flex: none; }
a.col { color: inherit; }
a.col:hover { text-decoration: none; }
.col.is-peak .col-value { color: var(--ink-2); }

/* ---------- Карточка исполнителя: формы и окна ---------- */

.form-page { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.form-section { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.form-section-head { display: grid; gap: 4px; }
.form-section-head p { color: var(--ink-2); font-size: var(--fs-md); max-width: 70ch; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
#duplicates:not(:has(*)) { display: none; }
.optional { margin-left: 8px; font-weight: 400; font-size: var(--fs-sm); color: var(--ink-3); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea, .pay-row.has-error .input { border-color: var(--red); }
.checks-stack { display: grid; gap: 12px; }
.checks-stack legend { margin-bottom: 10px; }
.check-field { display: grid; gap: 2px; }
.check-field .hint { padding-left: 28px; font-size: var(--fs-sm); color: var(--ink-2); }
.check-field .errorlist { padding-left: 28px; }
.confirm-check { padding: 10px 14px; border: 1px solid var(--amber-line); border-radius: var(--r-control); background: var(--surface); font-weight: 550; }
.form-bar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px;
  padding: 14px 0 max(14px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--canvas) 72%, transparent);
}
.disclosure summary { cursor: pointer; color: var(--brand); font-weight: 550; font-size: var(--fs-md); width: fit-content; }
.disclosure summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.disclosure[open] summary { margin-bottom: 12px; }

.pay-grid { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.pay-grid legend { margin-bottom: 8px; padding: 0; }
.pay-head, .pay-row { display: grid; grid-template-columns: 112px minmax(0, 190px) minmax(0, 150px) minmax(0, 1fr); gap: 6px 12px; align-items: center; }
.pay-head { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 550; }
.pay-label { display: flex; align-items: center; gap: 8px; font-weight: 550; font-size: var(--fs-md); }
.pay-label .icon { color: var(--ink-3); }
.pay-field { display: grid; gap: 4px; min-width: 0; }
.pay-cap { display: none; font-size: var(--fs-sm); color: var(--ink-2); }
.pay-hint { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.pay-row .errorlist { grid-column: 2 / -1; }
.pay-grid .hint { font-size: var(--fs-sm); color: var(--ink-2); }

.panel-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.term { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); white-space: nowrap; }
.term + .term { margin-top: 2px; }
.term .icon { color: var(--ink-3); }
.term span:first-of-type { color: var(--ink-2); min-width: 46px; }
.cell-actions { text-align: right; white-space: nowrap; }
.data tr.is-muted td { color: var(--ink-2); }
.data tr.is-muted .cell-title { color: var(--ink-2); font-weight: 500; }

dialog.modal { overflow-y: auto; }
dialog.modal.modal-wide { width: min(720px, calc(100vw - 32px)); }
.modal-sub { margin-top: 4px; font-size: var(--fs-md); color: var(--ink-2); }
.modal-foot { position: sticky; bottom: 0; }
.dialog-loading { display: grid; place-items: center; min-height: 220px; color: var(--ink-2); }

@media (max-width: 720px) {
  .pay-head { display: none; }
  .pay-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 0; border-top: 1px solid var(--line); }
  .pay-label { grid-column: 1 / -1; }
  .pay-cap { display: block; }
  .pay-hint { grid-column: 1 / -1; text-align: left; }
  .pay-row .errorlist { grid-column: 1 / -1; }
  .form-bar .btn { flex: 1 1 auto; }
  .cell-actions { text-align: left; }
  .term { white-space: normal; }
}

/* ---------- Табель ---------- */

.page-wide { max-width: 1680px; }
.ts-toolbar { align-items: center; }
.ts-customer { width: auto; min-width: 220px; max-width: 100%; }
.week-switch { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.week-switch .btn { border: 0; }
.week-switch-label { min-width: 196px; text-align: center; font-weight: 600; font-size: var(--fs-md); white-space: nowrap; }
.ts-search { min-width: 240px; }
.ts-help { margin-bottom: -16px; }
.ts-message {
  position: fixed; z-index: 50; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px;
  background: var(--red-soft); color: var(--ink); border: 1px solid var(--red-line); box-shadow: var(--shadow-pop);
  font-size: var(--fs-md); font-weight: 500;
}
.ts-message:not([hidden]) { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ts-message.is-warn { background: var(--amber-soft); border-color: var(--amber-line); }
.ts-message-close { flex: none; border: 0; background: none; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; opacity: 0.7; padding: 0 2px; }
.ts-message-close:hover { opacity: 1; }

.ts-wrap {
  overflow: auto; max-height: calc(100dvh - 150px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  overscroll-behavior: contain;
}
table.ts { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-md); font-variant-numeric: tabular-nums lining-nums; }
.ts th, .ts td { border-bottom: 1px solid var(--line); padding: 0; }
.ts thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600;
  padding: 8px 6px; text-align: center; white-space: nowrap;
}
.ts thead th.ts-name { text-align: left; padding-left: 16px; z-index: 4; left: 0; }
.ts-day span { display: block; font-size: var(--fs-xs); font-weight: 500; }
.ts-day b { display: block; font-size: var(--fs-base); color: var(--ink); font-weight: 650; }
.ts-day.is-weekend { background: var(--weekend); }
.ts-day.is-today { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 -2px 0 var(--brand); }
.ts-day.is-today b { color: var(--brand-ink); }
.ts .ts-name {
  position: sticky; left: 0; z-index: 2;
  width: 290px; min-width: 250px; max-width: 320px; padding: 8px 12px 8px 16px;
  background: var(--surface); text-align: left; font-weight: 400; border-right: 1px solid var(--line);
}
.ts-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ts-person a, .ts-person > span:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-person a:hover { color: var(--brand); }
.ts-shift { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; }
.ts-shift.is-night { background: #e6e9f6; color: #2f3a78; }
.ts-shift.is-sutki { background: var(--amber-soft); color: var(--amber); }
.ts-sub { margin-top: 2px; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-warn { margin-top: 2px; font-size: var(--fs-sm); color: var(--red); }
.ts-group th {
  position: sticky; left: 0; padding: 14px 16px 6px; text-align: left;
  background: var(--canvas); font-size: var(--fs-sm); font-weight: 650; color: var(--ink);
}
.ts-group .icon { margin-right: 6px; color: var(--ink-3); }

.ts-cell { min-width: 64px; height: 52px; text-align: center; background: var(--surface); position: relative; }
.ts-cell.is-weekend { background: var(--weekend); }
.ts-cell + .ts-cell { border-left: 1px solid var(--line); }
.ts-input {
  display: block; width: 100%; height: 100%; min-height: 51px; padding: 0 4px; margin: 0;
  border: 0; border-radius: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-base); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
}
.ts-input:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.ts-input:focus { outline: 2px solid var(--brand); outline-offset: -2px; background: transparent; position: relative; z-index: 1; }
.ts-value { display: grid; place-items: center; height: 100%; min-height: 51px; font-weight: 600; color: var(--ink); }
.ts-cell.is-zero .ts-input, .ts-cell.is-zero .ts-value { color: var(--red); font-weight: 500; }
.ts-cell.is-long { background: var(--amber-soft); }
.ts-cell.is-long .ts-input, .ts-cell.is-long .ts-value { color: var(--amber); }
.ts-cell.is-warn .ts-input { box-shadow: inset 0 -3px 0 var(--amber); }
.ts-cell.is-imported .ts-value, .ts-cell.is-before .ts-value { color: var(--ink-2); font-weight: 500; }
.ts-cell.is-locked .ts-value { color: var(--ink); }
.ts-cell.is-off, .ts-cell.is-norate {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px);
}
.ts-cell.is-saving .ts-input { opacity: 0.55; }
.ts-cell.has-plan::before {
  content: ""; position: absolute; top: 6px; right: 6px; z-index: 2; pointer-events: none;
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand-line);
}
.ts-cell.plan-confirmed::before { background: var(--brand-fill); }
.ts-cell.plan-declined::before { background: var(--red); }
.ts-cell.plan-no_answer::before { background: var(--amber); }
.ts-cell.is-saved { animation: ts-saved 0.9s ease-out; }
@keyframes ts-saved { from { background: var(--brand-soft); } to { background: transparent; } }
.ts-cell.is-error { background: var(--red-soft); }
.ts-cell.is-error .ts-input, .ts-cell.is-error .ts-value { box-shadow: inset 0 0 0 2px var(--red); }
.ts-cell.is-error .ts-input:focus { outline-color: var(--red); }
.ts-total { width: 80px; padding: 0 12px !important; text-align: right; white-space: nowrap; font-weight: 600; background: var(--surface); }
.ts thead th.ts-total { text-align: right; padding-right: 12px; }
.ts .ts-amount { width: 112px; color: var(--ink-2); font-weight: 500; }
.ts tfoot th, .ts tfoot td {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--surface-2); border-top: 1px solid var(--line-2); border-bottom: 0;
}
.ts tfoot th.ts-name { z-index: 3; font-weight: 650; font-size: var(--fs-sm); color: var(--ink-2); }
.ts-daytotal { text-align: center; padding: 6px 2px !important; }
.ts-daytotal b { display: block; font-size: var(--fs-base); }
.ts-daytotal span { display: block; font-size: var(--fs-xs); color: var(--ink-2); }
.ts tfoot .ts-total { font-size: var(--fs-base); }
.ts tbody tr.ts-row:hover .ts-name { background: var(--surface-2); }
.ts-row[hidden], .ts-group[hidden] { display: none; }
.ts-days { display: none; }

@media (max-width: 720px) {
  .week-switch-label { min-width: 0; }
  .ts-search { min-width: 0; }
  .ts-wrap { max-height: none; overflow: visible; }
  .ts-days {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
    position: sticky; top: 56px; z-index: 5; padding: 6px 0; background: var(--canvas);
  }
  .ts-daytab {
    display: grid; gap: 0; justify-items: center; padding: 6px 0; border: 1px solid var(--line);
    border-radius: var(--r-control); background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--fs-xs); cursor: pointer;
  }
  .ts-daytab b { font-size: var(--fs-base); color: var(--ink); }
  .ts-daytab.is-weekend { background: var(--weekend); }
  .ts-daytab[aria-selected="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
  .ts .ts-name { min-width: 0; max-width: none; width: 100%; position: static; }
  .ts thead { display: none; }
  .ts .ts-amount { display: none; }
  .ts-cell { width: 84px; }
  .ts tfoot th, .ts tfoot td { position: static; }
  .ts-wrap[data-day="0"] [data-i]:not([data-i="0"]),
  .ts-wrap[data-day="1"] [data-i]:not([data-i="1"]),
  .ts-wrap[data-day="2"] [data-i]:not([data-i="2"]),
  .ts-wrap[data-day="3"] [data-i]:not([data-i="3"]),
  .ts-wrap[data-day="4"] [data-i]:not([data-i="4"]),
  .ts-wrap[data-day="5"] [data-i]:not([data-i="5"]),
  .ts-wrap[data-day="6"] [data-i]:not([data-i="6"]) { display: none; }
  .ts-help { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ts-shift.is-night { background: #232a4d; color: #b9c2f2; }
}
:root[data-theme="dark"] .ts-shift.is-night { background: #232a4d; color: #b9c2f2; }

/* ---------- График выходов и обзвон ---------- */

.workplace-tabs { margin-top: 12px; width: fit-content; }
.workplace-tabs .tab .icon { color: var(--ink-3); }
.workplace-tabs .tab[aria-current="true"] .icon { color: var(--brand); }

table.sc { table-layout: fixed; }
.sc .ts-name { width: 290px; }
.sc-count { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.sc-count.is-short { color: var(--amber); }
.sc-count.is-ok { color: var(--brand-ink); }
/* Строка объекта с потребностью: сколько закрыто по дням */
.ts .ts-group.has-need th.ts-name { background: var(--canvas); border-right-color: transparent; }
.ts-group.has-need td { background: var(--canvas); text-align: center; vertical-align: bottom; padding: 12px 2px 6px; }
.sc-need-badge {
  display: inline-block; min-width: 44px; padding: 1px 8px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink-3);
}
.sc-need.is-short .sc-need-badge { background: var(--amber-soft); color: var(--amber); }
.sc-need.is-ok .sc-need-badge { background: var(--brand-soft); color: var(--brand-ink); }
.sc-toggle {
  display: grid; place-items: center; width: 100%; height: 100%; min-height: 51px; padding: 0 4px;
  border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer;
}
span.sc-toggle { cursor: default; }
button.sc-toggle:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
button.sc-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 0; }
button.sc-toggle[aria-pressed="false"]:hover::after { content: "+"; color: var(--ink-3); font-size: 18px; font-weight: 500; }
.sc-mark { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.sc-cell.is-planned { background: var(--brand-soft); }
.sc-cell.is-planned .sc-mark { color: var(--brand-ink); }
.sc-cell.is-pending .sc-mark { font-weight: 500; }
.sc-cell.is-declined { background: var(--red-soft); }
.sc-cell.is-declined .sc-mark { color: var(--red); }
.sc-cell.is-no_answer { background: var(--amber-soft); }
.sc-cell.is-no_answer .sc-mark { color: var(--amber); }
.sc-cell.has-hours { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand-fill); }
.sc-cell.has-hours .sc-mark { color: var(--brand-ink); }
.sc-cell.has-zero { background: var(--red-soft); }
.sc-cell.has-zero .sc-mark { color: var(--red); }
.sc-cell.is-static:not(.is-planned):not(.has-hours):not(.has-zero) {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px);
}
.sc-cell.is-saving .sc-toggle { opacity: 0.5; }

.call-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.call-total { font-size: var(--fs-lg); margin-right: 6px; }
.call-total b { font-weight: 650; }
.call-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.call-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px 24px; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.call-row:last-child { border-bottom: 0; }
.call-name { font-weight: 620; color: var(--ink); }
.call-sub { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }
.call-contacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.call-result { display: grid; gap: 8px; justify-items: start; }
.call-form { display: grid; gap: 8px; width: 100%; margin: 0; }
.call-status { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.call-option {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface);
  font-size: var(--fs-md); font-weight: 550; color: var(--ink-2); cursor: pointer;
}
.call-option:hover { border-color: var(--control-line); color: var(--ink); }
.call-option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.call-option.is-confirmed:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.call-option.is-declined:has(input:checked) { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.call-option.is-no_answer:has(input:checked) { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.call-note { min-height: 36px; height: 36px; }
.call-row.is-confirmed { box-shadow: inset 3px 0 0 var(--brand-fill); }
.call-row.is-declined { box-shadow: inset 3px 0 0 var(--red); }
.call-row.is-no_answer { box-shadow: inset 3px 0 0 var(--amber); }

@media (max-width: 720px) {
  .call-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .workplace-tabs { width: 100%; }
  .workplace-tabs .tab { flex: 1 1 auto; justify-content: center; padding: 0 8px; }
  .workplace-tabs .tab .icon { display: none; }
}

/* Продажи: заказчик и его строки «объект × должность × смена» */
.sales tr.sales-customer > * { background: var(--surface-2); }
.sales tr.sales-customer th { text-align: left; font-weight: 400; }
.sales tr.sales-line td:first-child { padding-left: 32px; color: var(--ink-2); }
.btn.is-disabled { opacity: 0.4; pointer-events: none; }
@media (max-width: 720px) {
  .sales.responsive tbody tr.sales-customer { background: var(--surface-2); }
  .sales.responsive tr.sales-customer > * { background: transparent; }
  .sales.responsive tr.sales-customer th { display: block; grid-column: 1 / -1; padding: 0; border: 0; }
  .sales.responsive tr.sales-line td:first-child { padding-left: 0; }
}

/* Заказчики: выбор рекрутеров */
.pick-checks { display: grid; gap: 12px; }

/* Переход заказчика на ERP: что изменится */
.cutover-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cutover-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.cutover-list b { font-size: var(--fs-lg); font-weight: 650; text-align: right; }
.cutover-names { margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-sm); max-height: 160px; overflow: auto; }

/* ---------- Потребность ---------- */

.fact-link { color: var(--brand); font-weight: 600; text-decoration: none; }
.fact-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.demand-group { display: grid; gap: 8px; }
.demand-site { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: var(--fs-base); font-weight: 650; }
.demand-site .icon { color: var(--ink-3); }
.demand-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.demand-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 150px auto; gap: 12px 20px; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.demand-row:last-child { border-bottom: 0; }
.demand-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.demand-title .strong { font-weight: 620; }
.demand-sub { margin-top: 3px; font-size: var(--fs-sm); color: var(--ink-2); }
.demand-note { margin-top: 3px; font-size: var(--fs-sm); color: var(--ink-3); }
.demand-num { display: grid; gap: 0; }
.demand-num b { font-size: var(--fs-lg); font-weight: 650; }
.demand-num span { font-size: var(--fs-xs); color: var(--ink-2); }
.demand-num.is-short b, .demand-num.is-short span { color: var(--amber); }
.demand-actions { display: flex; gap: 6px; justify-content: flex-end; }
.day-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.day-pill {
  position: relative; display: inline-grid; place-items: center; min-width: 44px; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--surface);
  font-size: var(--fs-md); font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.day-pill input { position: absolute; opacity: 0; pointer-events: none; }
.day-pill:hover { border-color: var(--control-line); color: var(--ink); }
.day-pill:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand); }
.day-pill:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 720px) {
  .demand-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 14px 16px; }
  .demand-what, .demand-actions { grid-column: 1 / -1; }
  .demand-actions { justify-content: flex-start; }
}

/* ---------- Авансы ---------- */

.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; min-height: 120px; align-content: start; }
.pick-item {
  display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 12px; border: 1px solid transparent; border-radius: var(--r-control);
  background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.pick-item:hover, .pick-item:focus-visible { background: var(--surface-2); border-color: var(--line); }
.pick-item .strong { font-weight: 600; }

/* Колонки сеток не растягиваются под содержимое: длинное уходит в свою прокрутку. */
.page, .section, .stack, .drawer-body, .drawer-section, .form-grid, .modal-body, .issues, .ledger, .auth-card, .form-page, .form-section {
  grid-template-columns: minmax(0, 1fr);
}
fieldset { min-width: 0; min-inline-size: 0; }
