/* Дизайн-система сайта автосервиса.
   Один файл на три страницы: клиент, мастер, администратор — чтобы кнопка
   и карточка выглядели одинаково везде и правились в одном месте.
   Никаких фреймворков: только переменные, flex и grid. */

/* ------------------------------------------------------------- палитра */
:root {
  color-scheme: light;

  --bg: #f4f5f7;
  --bg-soft: #eceef1;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e0e3e8;
  --border-strong: #c9cdd4;

  --text: #171a1f;
  --text-soft: #5b6270;
  --text-faint: #878e9b;

  /* Акцент — синий из фирменного знака. На белом берём затемнённый
     оттенок: чистый неон #2ea6ff на светлом фоне не набирает контраста
     для текста и мелких значков. */
  --accent: #0a6fd8;
  --accent-hover: #0857ad;
  --accent-soft: #e9f2fe;
  --accent-text: #ffffff;

  --ok: #1a7f4b;
  --ok-soft: #e6f4ec;
  --warn: #a5720b;
  --warn-soft: #fdf4e1;
  --danger: #c0392b;
  --danger-soft: #fbecea;
  /* Второй цвет графиков разведён с акцентом в фиолетовый: раньше он был
     синим при оранжевом акценте, теперь синий занят. */
  --info: #6d3ee0;
  --info-soft: #f0eafd;

  --shadow: 0 1px 2px rgba(16, 20, 28, .06), 0 4px 16px rgba(16, 20, 28, .05);
  --shadow-lg: 0 8px 32px rgba(16, 20, 28, .12);
  --ring: 0 0 0 3px rgba(10, 111, 216, .25);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --header-h: 62px;

  /* ---- шкалы. Значения вне них в CSS не пишутся: одиннадцатый размер
     шрифта или пятое скругление — это не решение дизайна, а шум, который
     через полгода никто не сможет объяснить. Исключения помечены на месте. */

  /* Текст: подписи и метки → вторичный → интерфейс → основной → лид →
     заголовки. Заголовки витрины тянутся от ширины экрана. */
  --fs-caption: 12px;
  --fs-small: 13px;
  --fs-ui: 14px;
  --fs-body: 15px;
  --fs-lead: 17px;
  --fs-h3: 20px;
  --fs-h3-lg: 24px;
  --fs-title: 28px;
  --fs-h2: clamp(28px, 3.4vw, 42px);
  --fs-display: clamp(32px, 4.6vw, 56px);

  /* Насыщенность. Системные шрифты Windows знают 400/600/700/800 — всё
     промежуточное браузер всё равно округлял, но по-разному на Mac. */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-heavy: 800;

  /* Скругления: поля и кнопки → карточки → крупные карточки → панели. */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Отступы, шаг 4 px. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;
  --space-9: 64px;

  /* Движение: быстрый отклик на наведение и обычный переход. */
  --dur-fast: .14s;
  --dur: .25s;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14161a;
  --bg-soft: #1a1d22;
  --surface: #1e2126;
  --surface-2: #24282e;
  --border: #31363e;
  --border-strong: #454b55;

  --text: #eef0f3;
  --text-soft: #a8afba;
  --text-faint: #7b838f;

  --accent: #2ea6ff;
  --accent-hover: #63c0ff;
  --accent-soft: #10263d99;
  --accent-text: #03121f;

  --ok: #4ade80;
  --ok-soft: #14321f;
  --warn: #fbbf24;
  --warn-soft: #332714;
  --danger: #f87171;
  --danger-soft: #351b1b;
  --info: #a78bfa;
  --info-soft: #241a3d;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(46, 166, 255, .3);
}

/* --------------------------------------------------------------- базовое */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-body)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: var(--fw-semibold); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--fs-title); }
h2 { font-size: var(--fs-h3); }
h3 { font-size: var(--fs-lead); }
h4 { font-size: var(--fs-body); }
p { margin: 0; }

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

/* Фокус с клавиатуры виден на всём, что кликается. Раньше кольцо было
   только у кнопок: ссылки, иконки и вопросы FAQ полагались на системную
   обводку, которую тёмная витрина почти не показывает. `:focus-visible` —
   чтобы мышью кольцо не мигало. */
a:focus-visible,
summary:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Первая клавиша Tab — сразу к содержанию, мимо шапки и меню. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}
.skip-link:focus { top: 12px; text-decoration: none; }
/* Сама область получает фокус от ссылки выше; обводить весь экран незачем. */
main:focus { outline: none; }

::selection { background: var(--accent); color: var(--accent-text); }

[hidden] { display: none !important; }

/* --------------------------------------------------------------- макет */
.wrap {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
}

.page { padding: 28px 0 72px; }

.section { margin-top: 34px; }
.section:first-child { margin-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-head p { color: var(--text-soft); font-size: var(--fs-ui); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

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

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 7px; }

/* --------------------------------------------------------------- шапка */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header .wrap { display: flex; align-items: center; gap: 18px; flex-wrap: nowrap; }

.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: var(--fw-bold);
  font-size: var(--fs-body);
  color: var(--text);
  letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  flex: none;
}
.brand-mark svg { width: 18px; height: 18px; }

.brand-sub {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: 7px 11px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: var(--fs-ui);
  font-weight: var(--fw-medium);
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------------- кнопки */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-ui);
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform .08s, opacity var(--dur-fast);
}

.btn:hover { background: var(--bg-soft); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-text);
  --btn-bd: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { --btn-bd: transparent; --btn-bg: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn-danger { --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-ok { --btn-fg: var(--ok); --btn-bd: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.btn-ok:hover { background: var(--ok-soft); }

.btn-sm { padding: 6px 10px; font-size: var(--fs-small); }
.btn-lg { padding: 12px 22px; font-size: var(--fs-body); }
.btn-block { width: 100%; }

.icon-btn {
  width: 34px; height: 34px;
  padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------- поля */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field > label,
.label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-ui);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input[type="date"] { min-height: 38px; }

.hint { font-size: var(--fs-small); color: var(--text-soft); }
.hint-error { color: var(--danger); }

.code-input {
  font: var(--fw-semibold) var(--fs-h3-lg)/1 var(--mono);
  letter-spacing: .5em;
  text-align: center;
  padding: 12px;
}

/* --------------------------------------------------------------- карточки */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-flat { box-shadow: none; }
.card-pad-lg { padding: 24px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title { font-size: var(--fs-body); font-weight: var(--fw-semibold); }
.card-sub { font-size: var(--fs-small); color: var(--text-soft); margin-top: 2px; }


/* --------------------------------------------------------------- значки */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  background: var(--bg-soft);
  color: var(--text-soft);
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* --------------------------------------------------------------- метрики */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-value {
  margin-top: 6px;
  font-size: var(--fs-title);
  font-weight: var(--fw-bold);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.stat-hint { margin-top: 3px; font-size: var(--fs-small); color: var(--text-soft); }
.stat-accent .stat-value { color: var(--accent); }

/* --------------------------------------------------------------- таблица */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }

thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  text-align: left;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-soft);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }

.mono { font-family: var(--mono); font-size: var(--fs-small); }

.cell-main { font-weight: var(--fw-semibold); }
.cell-sub { font-size: var(--fs-caption); color: var(--text-soft); }

/* --------------------------------------------------------------- графики */
.chart { width: 100%; display: block; overflow: visible; }

.chart-bar { fill: var(--accent); transition: opacity .12s; }
.chart-bar:hover { opacity: .75; }
.chart-bar-soft { fill: color-mix(in srgb, var(--accent) 28%, transparent); }
.chart-line { fill: none; stroke: var(--info); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: color-mix(in srgb, var(--info) 12%, transparent); }
.chart-grid { stroke: var(--border); stroke-width: 1; }
/* Исключение из шкалы: единицы SVG, график сам масштабируется под ширину. */
.chart-axis { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-small); color: var(--text-soft); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
/* Исключение: квадратик 11 px со скруглением 8 превратился бы в кружок. */
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* воронка */
.funnel { display: flex; flex-direction: column; gap: 9px; }

.funnel-row { display: grid; grid-template-columns: 145px 1fr auto; gap: 12px; align-items: center; }
.funnel-label { font-size: var(--fs-ui); color: var(--text-soft); }

.funnel-track {
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--info)));
  min-width: 2px;
  transition: width .5s ease;
}

.funnel-value { font-size: var(--fs-ui); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* горизонтальный рейтинг — топ масел, точки */
.rank { display: flex; flex-direction: column; gap: 11px; }
.rank-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.rank-name { font-size: var(--fs-ui); font-weight: var(--fw-semibold); }
.rank-value { font-size: var(--fs-ui); font-variant-numeric: tabular-nums; color: var(--text-soft); }
.rank-track { grid-column: 1 / -1; height: 6px; border-radius: var(--radius-pill); background: var(--bg-soft); overflow: hidden; }
.rank-fill { height: 100%; border-radius: var(--radius-pill); background: var(--accent); }

/* --------------------------------------------------------------- вкладки */
.tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.tab {
  padding: 8px 15px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: var(--fs-ui);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: var(--bg-soft); color: var(--text); }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }

/* --------------------------------------------------------------- прочее */
.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-ui);
}

.empty svg { width: 30px; height: 30px; opacity: .45; margin-bottom: 9px; }

.divider { height: 1px; background: var(--border); margin: 18px 0; }

.note {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--info-soft);
  color: var(--text);
  font-size: var(--fs-ui);
  border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
}
.note svg { width: 17px; height: 17px; flex: none; color: var(--info); margin-top: 1px; }
.note-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note-warn svg { color: var(--warn); }

/* --------------------------------------------------------------- уведомления */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-ui);
  animation: toast-in .22s ease;
}

.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }

.toast-title { font-weight: var(--fw-semibold); margin-bottom: 2px; }
.toast-text { color: var(--text-soft); font-size: var(--fs-ui); }
.toast-close { margin-left: auto; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- модалка */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 12, 16, .55);
  backdrop-filter: blur(3px);
  animation: fade-in .15s ease;
}

.modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: modal-in .2s ease;
  /* Длинная форма («Записать клиента») на телефоне выше экрана: прокручивается
     само окно, кнопки не уезжают за край. */
  max-height: calc(100dvh - 2 * var(--space-5));
  overflow-y: auto;
}

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.modal-title { font-size: var(--fs-h3); font-weight: var(--fw-semibold); }
.modal-sub { font-size: var(--fs-ui); color: var(--text-soft); margin-top: 4px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ------------------------------------------------------ рабочее место */
/* Экран мастера собран так, чтобы вся смена была видна без прокрутки к
   фильтрам: вкладки → одна строка инструментов → полоса сводки → таблица
   и колонка «записываются сейчас». */
.ws-tabs { margin-bottom: var(--space-4); }

/* Рабочее место шире витринного контейнера: таблица смены — главное на
   экране, и на ноутбуке 1280 px ей нужны все колонки без прокрутки. */
.staff .wrap { width: min(1400px, 100% - 32px); }
.staff .page { padding-top: var(--space-5); }
.cell-oil { min-width: 170px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.toolbar select, .toolbar input { width: auto; min-height: 36px; }
.toolbar .toolbar-grow { flex: 1 1 220px; }
.toolbar-date { display: flex; align-items: center; gap: var(--space-1); }
.toolbar-date input { width: 150px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.kpi { padding: var(--space-2) var(--space-4); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { font-size: var(--fs-caption); color: var(--text-soft); white-space: nowrap; }
.kpi-value { font-size: var(--fs-h3); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.kpi-accent .kpi-value { color: var(--accent); }

.shift-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-3);
  align-items: start;
}
.side-card { padding: var(--space-4); position: sticky; top: calc(var(--header-h) + var(--space-3)); }
.side-card .card-head { margin-bottom: var(--space-2); }

.live-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.live-row:first-child { border-top: none; padding-top: 0; }

.row-actions { display: inline-flex; gap: var(--space-1); justify-content: flex-end; flex-wrap: nowrap; }

/* Закрытые записи отходят на второй план: глаз должен цепляться за
   ожидающих и тех, кто в работе. */
tr.status-completed td, tr.status-cancelled_by_client td,
tr.status-cancelled_by_master td, tr.status-no_show td, tr.is-muted td { color: var(--text-soft); }
tr.status-in_progress td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

.panel-hint { margin: 0 0 var(--space-3); }

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-ui);
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
}
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.qty-input { width: 84px; min-height: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.qty-input.is-low { border-color: var(--danger); color: var(--danger); }

/* Окно расчёта */
.modal-wide { width: min(640px, 100%); }
.checkout-lines { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-4); }
.checkout-line { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-1) 0; font-size: var(--fs-ui); }
.checkout-line .num { white-space: nowrap; }
.checkout-sum { border-top: 1px solid var(--border); margin-top: var(--space-1); padding-top: var(--space-2); font-weight: var(--fw-semibold); }
.checkout-points { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius); background: var(--accent-soft); }
.checkout-points .row { align-items: flex-end; flex-wrap: nowrap; }
.checkout-points-head { display: flex; flex-direction: column; gap: 2px; }
.checkout-pay { font-size: var(--fs-lead); font-weight: var(--fw-semibold); }
.checkout-total { font-size: var(--fs-h3-lg); font-weight: var(--fw-bold); color: var(--accent); font-variant-numeric: tabular-nums; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.field-wide { grid-column: 1 / -1; }

/* Окно «Записать клиента»: время — сеткой кнопок, выбранная — как основная. */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--space-9), 1fr)); gap: var(--space-2); }
.slot-grid .btn { width: 100%; justify-content: center; font-variant-numeric: tabular-nums; }
.slot-grid .btn[aria-pressed="true"] { --btn-bg: var(--accent); --btn-fg: var(--accent-text); --btn-bd: var(--accent); }
.slot-grid .btn[aria-pressed="true"]:hover { background: var(--accent-hover); }
.slot-grid .hint { grid-column: 1 / -1; }

/* --------------------------------------------------------------- адаптив */
/* Колонка «записываются сейчас» — только когда таблице хватает места. */
@media (max-width: 1360px) {
  .shift-grid { grid-template-columns: 1fr; }
  .side-card { position: static; }
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: none; }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--border); }
}

/* На телефоне таблица записей становится карточками: горизонтальная
   прокрутка таблицы в восемь колонок у подъёмника неудобна. */
@media (max-width: 760px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; }
  .table-cards tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .table-cards tr:hover { background: none; }
  .table-cards td { padding: 2px 0; border: none; text-align: left; }
  .table-cards td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-caption);
    color: var(--text-faint);
  }
  .table-cards .row-actions { margin-top: var(--space-2); flex-wrap: wrap; justify-content: flex-start; }
  .table-cards tr.row-empty td::before { display: none; }
  tr.status-in_progress td:first-child { box-shadow: none; }
  tr.status-in_progress { box-shadow: inset 3px 0 0 var(--warn); }
  .toolbar-date input { width: 140px; }
  .kpi-label { white-space: normal; }

  /* Карточка записи на телефоне — четыре строки без подписей: время и
     статус, клиент с машиной, масло и сумма, кнопки. Подписи к полям тут
     лишние — по содержимому и так понятно, что где. */
  .shift-table tr:not(.row-empty) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--space-3);
    align-items: baseline;
  }
  .table-cards.shift-table td[data-label]::before { display: none; }
  .shift-table td:has(.no-actions) { display: none; }
  .shift-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .shift-table td:nth-child(1) > div { display: inline; margin-right: var(--space-2); }
  .shift-table td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; }
  .shift-table td:nth-child(2) { grid-column: 1 / -1; }
  .shift-table td:nth-child(3) { grid-column: 1; }
  .shift-table td:nth-child(4) { grid-column: 2; text-align: right; }
  .shift-table td:nth-child(6) { grid-column: 1 / -1; }
  .toolbar select, .toolbar .toolbar-grow { flex: 1 1 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .checkout-points .row { flex-wrap: wrap; }
}

@media (max-width: 1000px) {
  #me-badge { display: none; }
}

@media (max-width: 860px) {
  .brand-sub { display: none; }
  .funnel-row { grid-template-columns: 108px 1fr auto; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 28px); }
  h1 { font-size: var(--fs-h3-lg); }
  .nav a { padding: 7px 8px; font-size: var(--fs-small); }
  .funnel-row { grid-template-columns: 1fr; gap: 4px; }
  .funnel-value { justify-self: start; }
}

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