:root {
  --bg: #efe9dc;
  --surface: #fffdf8;
  --surface-2: #f7f2e7;
  --glass: rgb(255 253 248 / .72);
  --ink: #1f1c17;
  --muted: #6b6457;
  --line: #e6dfcf;
  --accent: #211e19;
  --on-accent: #fffdf8;
  --sun: #f6c744;
  --sun-soft: #fdf0c4;
  --bar: #a97b06;
  --chart-1: #a97b06;
  --chart-2: #2563a8;
  --chart-3: #b4436c;
  --glow-a: #fbe6a2;
  --glow-b: #f8d9a8;
  --good: #1a7350;
  --good-bg: #e2f3e9;
  --warn: #855600;
  --warn-bg: #fcefc9;
  --bad: #ad2a1f;
  --bad-bg: #fbe6e1;
  --shadow: 0 1px 2px rgb(60 48 20 / .05), 0 8px 24px rgb(60 48 20 / .06);
  --radius: 18px;
  --ease: cubic-bezier(.22, .9, .3, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --surface: #211e18;
    --surface-2: #2b271f;
    --glass: rgb(33 30 24 / .72);
    --ink: #f3eee3;
    --muted: #a89f8e;
    --line: #38332a;
    --accent: #f6c744;
    --on-accent: #211e18;
    --sun-soft: #3a3118;
    --bar: #b98a14;
    --chart-1: #b98a14;
    --chart-2: #4f93d6;
    --chart-3: #d0668c;
    --glow-a: #3a3016;
    --glow-b: #33261a;
    --good: #6fd3a6;
    --good-bg: #16322a;
    --warn: #eabd60;
    --warn-bg: #362a12;
    --bad: #f3a096;
    --bad-bg: #3b1d19;
    --shadow: 0 1px 2px rgb(0 0 0 / .25), 0 8px 24px rgb(0 0 0 / .2);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
/* Мягкие тёплые пятна на фоне медленно смещаются */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: -25%;
  pointer-events: none;
  background:
    radial-gradient(38% 34% at 72% 18%, var(--glow-a), transparent 70%),
    radial-gradient(34% 36% at 18% 78%, var(--glow-b), transparent 70%);
  animation: drift 26s ease-in-out infinite alternate;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 620; letter-spacing: -.02em; overflow-wrap: break-word; }
h2 { font-size: 15px; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Каркас */
.shell { min-height: 100dvh; }
.nav {
  position: fixed;
  z-index: 10;
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow);
}
.nav-brand, .nav-user { display: none; }
.nav-links { position: relative; display: flex; flex: 1; min-width: 0; }
.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--w, 0);
  height: var(--h, 0);
  border-radius: 18px;
  background: var(--accent);
  transform: translate(var(--x, 0), var(--y, 0));
  transition: transform .42s var(--spring), width .3s var(--ease), height .3s var(--ease);
}
.nav-pill.instant { transition: none; }
.nav-link {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px;
  border-radius: 18px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  transition: color .25s ease;
}
.nav-link:active .icon { transform: scale(.86); }
.nav-link.on { color: var(--on-accent); font-weight: 600; }
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .25s var(--spring);
}
.main {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.main { overflow-x: clip; }
.page { display: grid; gap: 16px; min-width: 0; align-content: start; }
.page > * { min-width: 0; }
@media (min-width: 800px) {
  h1 { font-size: 32px; }
  .shell { display: flex; align-items: flex-start; gap: 8px; padding: 16px; }
  .nav {
    position: sticky;
    top: 16px;
    left: auto;
    right: auto;
    bottom: auto;
    width: 224px;
    height: calc(100dvh - 32px);
    flex: none;
    flex-direction: column;
    padding: 20px 12px 12px;
    border-radius: 26px;
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; padding: 0 10px 20px; }
  .brand-mark { flex: none; width: 30px; height: 30px; }
  .nav-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
  .nav-user strong { display: block; color: var(--ink); font-weight: 600; }
  .nav-links { flex-direction: column; flex: 1; gap: 4px; }
  .nav-pill { border-radius: 14px; }
  .nav-link { flex: none; flex-direction: row; gap: 10px; min-height: 44px; justify-content: flex-start; padding: 0 12px; border-radius: 14px; font-size: 15px; }
  .nav-link:not(.on):hover { color: var(--ink); }
  .nav-link:not(.on):hover .icon { transform: translateX(2px) scale(1.06); }
  .main { padding: 16px 24px 40px; min-width: 0; flex: 1; }
}

/* Заголовок экрана */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top > div:first-child { min-width: 0; flex: 1 1 200px; }
.sub { color: var(--muted); font-size: 14px; overflow-wrap: break-word; }
.back { color: var(--muted); font-size: 14px; display: inline-flex; min-height: 32px; align-items: center; justify-self: start; transition: transform .2s var(--ease), color .2s; }
.back:hover { color: var(--ink); transform: translateX(-3px); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Кнопки и поля */
.btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  transition: transform .18s var(--spring), border-color .2s, background-color .2s, box-shadow .2s;
}
.btn:hover:not(:disabled) { border-color: var(--muted); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); min-width: 0; }
.field[hidden] { display: none; }
.field.reveal { animation: rise .3s var(--ease); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--sun-soft); }
textarea.input { min-height: 80px; resize: vertical; }
.search { max-width: 420px; }
.error { color: var(--bad); font-size: 14px; }
.error:empty { display: none; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }

/* Аватарки */
.avatar { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--sun); color: #211e19; font-weight: 650; object-fit: cover; }
.avatar.large { width: 52px; height: 52px; font-size: 21px; }
.photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.photo-row .btn { display: inline-flex; align-items: center; gap: 6px; }
.photo-row .btn .icon { width: 16px; height: 16px; }
.staff-row { display: flex; align-items: center; padding-left: 12px; border-top: 1px solid var(--line); }
.staff-row:first-child { border-top: 0; }
.staff-row .row { flex: 1; min-width: 0; border-top: 0; }
.staff-photo { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; transition: transform .18s var(--spring); }
.staff-photo:active { transform: scale(.92); }
.staff-camera { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.staff-camera .icon { width: 12px; height: 12px; }

/* Экран «Сегодня» */
.today-top > div:first-child { flex: 1 1 0; }
.today-link { display: block; }
.today-link .stat { width: 100%; }
.today-link .stat-value { font-size: 36px; }
.today-row { min-height: 56px; flex-wrap: nowrap; }
.today-row .row-main { flex: 1 1 0; }
.today-row .badge .icon { display: block; width: 14px; height: 14px; }
.tile-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-2); }
.today-action { display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Главная цифра и строки под ней */
.hero-block { display: grid; gap: 8px; }
.stat.hero .stat-value { font-size: 36px; }
.hero-row { min-height: 48px; flex-wrap: nowrap; }
.hero-row .row-main { flex: 1 1 0; }
.hero-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Карточки и списки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 16px; display: grid; gap: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding-bottom: 4px; }
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
  transition: background-color .3s ease;
}
.row:first-child { border-top: 0; }
a.row, button.row { cursor: pointer; }
a.row:hover, button.row:hover { background: var(--surface-2); }
a.row:active, button.row:active { background: var(--sun-soft); }
.row[data-state="present"] { background: var(--good-bg); }
.row[data-state="absent"] { background: var(--bad-bg); }
.row-main { min-width: 0; flex: 1 1 150px; overflow-wrap: break-word; }
.row-title { font-weight: 500; }
.row-side { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.row-side.wrap { flex: 0 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; align-items: center; }
.row > .time + .row-main { flex-basis: 0; }
.voided { text-decoration: line-through; color: var(--muted); }
.time { flex: none; width: 52px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 359px) {
  .row { padding-inline: 12px; }
  .stat { padding: 12px; }
  .row > .time + .row-main { font-size: 15px; }
}
.slot-side { flex: none; width: 56px; display: grid; gap: 2px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot-side > span { font-size: 11px; }
.meter { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--bar); transform: scaleX(var(--v, 0)); transform-origin: left; transition: transform .5s var(--ease); }
.meter.over i { background: var(--bad); }

/* Отчёт за месяц и график */
.stats.money { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.stats.money .stat-value { font-size: 21px; }
.month-title { flex: 1; min-width: 0; min-height: 44px; display: grid; place-items: center; font-weight: 600; text-transform: capitalize; }
.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-zero { stroke: var(--muted); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }
.page.enter .chart-line { animation: draw .9s var(--ease) backwards .15s; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.page.enter .chart-dot { animation: fade-in .3s ease backwards .9s; }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit:focus { outline: none; }
.chart-tip { position: absolute; z-index: 2; top: 0; left: 0; min-width: 190px; display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; pointer-events: none; transform: translateX(var(--tip-x, 0)); }
.chart-tip[hidden] { display: none; }
.chart-tip strong { text-transform: capitalize; }
.chart-tip .pair { font-variant-numeric: tabular-nums; }
.chart-tip i, .chart-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; background: var(--swatch); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.chart-table summary { cursor: pointer; font-size: 14px; color: var(--muted); min-height: 28px; }
.table-total th, .table-total td { font-weight: 600; background: var(--surface-2); }
.table-note { padding: 6px 2px 0; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* Статистика */
.nav-wide-only { }
.phone-only { display: none; }
@media (max-width: 799px) {
  .nav-wide-only { display: none; }
  .phone-only { display: block; }
}
.segmented.wrap { flex: 0 1 auto; flex-wrap: wrap; }
.segmented.wrap .seg { flex: 1 0 auto; padding: 0 10px; }
.chart-bar { fill: var(--chart-1); }
.page.enter .chart-bar { transform-box: fill-box; transform-origin: bottom; animation: grow-up .6s var(--ease) backwards .1s; }
.chart-value { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-hit:focus-visible { outline: 2px solid var(--accent); }
.heat { min-width: 420px; }
.heat th, .heat td { text-align: center; padding: 9px 6px; }
.heat tbody td { background: color-mix(in srgb, var(--bar) var(--heat, 0%), var(--surface)); }
.section-note { padding: 0 2px 6px; }
.reason-tags { padding-top: 4px; }
.sort-btn { padding: 0; border: 0; background: none; color: inherit; font-weight: inherit; cursor: pointer; }
.sort-btn:hover { color: var(--ink); }
th[aria-sort="ascending"] .sort-btn::after { content: " ↑"; }
th[aria-sort="descending"] .sort-btn::after { content: " ↓"; }
.table th a:hover { text-decoration: underline; }
@keyframes grow-up { from { transform: scaleY(0); } }

.person-title { font-size: 20px; font-weight: 620; letter-spacing: -.01em; }
.person-gym { display: grid; gap: 4px; padding-bottom: 8px; }
.month-name { text-transform: capitalize; }

/* Подсказки */
.hint-row { flex-wrap: nowrap; align-items: flex-start; padding-block: 14px; }
.hint-title { padding-top: 6px; }
.summary-box { margin-top: 6px; min-height: 260px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Период */
.period-bar { display: grid; gap: 8px; }
.period-menu { display: grid; gap: 8px; justify-items: start; }
.period-menu > .period-bar { width: 100%; animation: rise .3s var(--ease); }
.period-button { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; list-style: none; }
.period-button::-webkit-details-marker { display: none; }
.period-button .icon { width: 16px; height: 16px; transition: transform .25s var(--spring); }
.period-menu[open] > .period-button .icon { transform: rotate(180deg); }
.period-selects { display: flex; flex-wrap: wrap; gap: 8px; }
.period-selects .input { flex: 1 1 130px; width: auto; max-width: 260px; }
@media (max-width: 359px) { .period-selects .input { flex-basis: 100%; max-width: none; } }
.period-dates summary { cursor: pointer; min-height: 28px; font-size: 14px; color: var(--muted); }
.period-dates .stats { padding-top: 4px; }
.btn.is-on { background: var(--sun-soft); border-color: var(--sun); font-weight: 600; }

/* Тарифы и продажа */
.tariff-side { flex: none; display: grid; gap: 2px; justify-items: end; text-align: right; font-variant-numeric: tabular-nums; }
.sale-summary[hidden] { display: none; }
.trial-payments { margin-top: 8px; }
.sale-summary { display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.sale-summary .pair:nth-last-child(2) { font-weight: 650; font-size: 16px; }
.sale-summary .pair:nth-last-child(2) > :first-child { color: var(--ink); }

/* Фильтры и залы */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters .input { flex: 1 1 140px; width: auto; max-width: 260px; }
.filter-reset { flex: none; animation: pop .3s var(--spring); }
@media (max-width: 359px) { .filters .input { flex-basis: 100%; max-width: none; } }
.gym-section { display: grid; gap: 8px; min-width: 0; }
.gym-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 6px 2px 0; }
.gym-head h2 { font-size: 18px; font-weight: 620; letter-spacing: -.01em; }
.gym-fill { display: grid; gap: 4px; flex: 0 1 200px; min-width: 150px; }
.day-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; padding: 0 2px; font-size: 14px; font-weight: 600; }
.group-side { flex: 0 1 170px; min-width: 130px; display: grid; gap: 4px; justify-items: end; text-align: right; }
.group-side .meter { width: 100%; }
.group-fill { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.top .meter { margin-top: 6px; max-width: 280px; }
.stat .meter { margin-top: 6px; }
.stat .sub { font-size: 13px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 13px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.stats.fields { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { padding: 14px 16px; display: grid; gap: 2px; align-content: start; transition: transform .25s var(--ease); }
.stat:hover { transform: translateY(-2px); }
.stat.sun { background: linear-gradient(135deg, var(--sun-soft), var(--surface) 90%); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 24px; line-height: 1.2; font-weight: 620; letter-spacing: -.02em; overflow-wrap: break-word; }
.pair { display: flex; justify-content: space-between; gap: 12px; }
.pair > :first-child { color: var(--muted); }
.pair > :last-child { text-align: right; overflow-wrap: anywhere; min-width: 0; }

/* Выбор даты */
.date-bar { display: flex; align-items: center; gap: 8px; }
.date-bar .input { flex: 1; min-width: 0; }
.date-bar .btn { flex: none; width: 44px; padding: 0; }

.date-bar .btn.wide { flex: 1; width: auto; min-width: 0; padding: 0 12px; }

/* Переключатель день и неделя */
.segmented { display: flex; flex: none; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.seg { min-width: 58px; min-height: 38px; display: grid; place-items: center; padding: 0 12px; border-radius: 11px; font-size: 14px; color: var(--muted); transition: background-color .25s ease, color .25s ease, transform .18s var(--spring); }
.seg:active { transform: scale(.96); }
.seg:not(.on):hover { color: var(--ink); }
.seg.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }

@media (max-width: 399px) {
  .segmented { flex: 1 1 100%; min-width: 0; }
  .seg { flex: 1 1 0; min-width: 0; padding: 0 4px; font-size: 13px; }
}

/* Неделя и неотмеченные занятия */
.day-section { display: grid; gap: 4px; min-width: 0; }
.day-section.is-today .card { border-color: var(--sun); box-shadow: 0 0 0 2px var(--sun-soft), var(--shadow); }
.day-empty { padding: 0 2px 4px; }
.badge.sun { background: var(--sun); color: #211e19; font-weight: 600; }
.row-flag { margin-top: 4px; }
.warn-card { border-color: var(--warn); }
.warn-head { padding: 14px 16px 10px; background: var(--warn-bg); display: grid; gap: 2px; }
.warn-head h2 { color: var(--warn); }
.warn-head .sub { color: var(--ink); }
.warn-more { padding: 10px 16px; border-top: 1px solid var(--line); }

/* Доска заявок */
.label-short { display: none; }
/* Семь пунктов меню должны помещаться на узком телефоне */
@media (max-width: 399px) {
  .nav-link { font-size: 10px; padding: 2px 0; }
}
@media (max-width: 349px) {
  .nav-link { font-size: 9.5px; }
}
@media (max-width: 799px) {
  .label-long { display: none; }
  .label-short { display: inline; }
}
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 799px) { .board { grid-auto-columns: 82%; } }
.board-column {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  scroll-snap-align: start;
  transition: border-color .2s, background-color .2s, transform .2s var(--ease);
}
.board-column.drop-target { border-color: var(--accent); background: var(--sun-soft); transform: scale(1.01); }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; padding: 0 4px; }
.board-cards { display: grid; gap: 8px; }
.board-empty { padding: 10px 4px; }
.lead-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .22s var(--ease), box-shadow .22s, opacity .2s;
}
.lead-card[draggable="true"] { cursor: grab; }
.lead-card:hover { transform: translateY(-2px); }
.lead-card.dragging { opacity: .45; transform: scale(.97) rotate(-1deg); }
.lead-card.arrive { animation: arrive .55s var(--spring); }
.lead-name { overflow-wrap: break-word; }
.lead-name:hover { text-decoration: underline; }
.lead-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.lead-tags:empty { display: none; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
.link-btn { display: inline-flex; align-items: center; }
.wrap-badge { white-space: normal; border-radius: 10px; }

/* Этапы заявки */
.timeline { list-style: none; margin: 0; padding: 16px; display: grid; gap: 0; }
.step { position: relative; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 4px 12px; padding: 0 0 18px 26px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step.done:has(+ .step.done)::before { background: var(--sun); }
.step-dot { position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); transition: transform .3s var(--spring); }
.step.done .step-dot { border-color: var(--sun); background: var(--sun); }
.step.current .step-dot { box-shadow: 0 0 0 4px var(--sun-soft); }
.step.lost .step-dot { border-color: var(--bad); background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
.step:not(.done) .row-title { color: var(--muted); font-weight: 400; }
.page.enter .step-dot { animation: pop .4s var(--spring) backwards; animation-delay: .2s; }

/* Отчёт по заявкам */
.funnel { gap: 16px; }
.funnel-row { display: grid; gap: 5px; }
.funnel-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.funnel-row .pair > :first-child { color: var(--ink); }
.funnel-track { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.funnel-track i { display: block; height: 100%; border-radius: 4px; background: var(--bar); transform: scaleX(var(--v, 0)); transform-origin: left; }
.page.enter .funnel-track i { animation: grow .8s var(--ease) backwards .25s; }
.row-total { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; min-width: 460px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 11px 12px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.table thead th { border-top: 0; font-weight: 500; color: var(--muted); font-size: 13px; }
.table th:first-child { text-align: left; font-weight: 500; }

/* Отметка посещения */
.toggle { display: flex; flex: none; gap: 6px; }
.toggle button {
  min-width: 48px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  transition: background-color .2s, border-color .2s, color .2s, transform .15s var(--spring);
}
.toggle button:active:not(:disabled) { transform: scale(.92); }
.toggle button[aria-pressed="true"] { animation: pop .34s var(--spring); }
.toggle button[aria-pressed="true"].yes { background: var(--good); border-color: var(--good); color: var(--surface); font-weight: 600; }
.toggle button[aria-pressed="true"].no { background: var(--bad); border-color: var(--bad); color: var(--surface); font-weight: 600; }

/* Окно с формой */
dialog {
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgb(40 30 10 / .25);
}
dialog[open] { animation: dialog-in .32s var(--spring); }
dialog::backdrop { background: rgb(35 28 12 / .38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade-in .25s ease; }
dialog.closing { animation: dialog-out .17s ease forwards; }
dialog.closing::backdrop { animation: fade-out .17s ease forwards; }
.form { display: grid; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.slot-row { display: grid; grid-template-columns: 1fr 96px 72px 44px; gap: 6px; align-items: center; }
.slot-row .input { padding: 8px 6px; min-width: 0; }
.slot-row .btn { padding: 0; }

/* Вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-logo { width: 64px; height: 64px; }
.login-card { width: min(380px, 100%); padding: 24px; display: grid; gap: 16px; background: var(--glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-radius: 26px; animation: dialog-in .55s var(--spring); }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast-in .36s var(--spring);
}
.toast.leaving { animation: toast-out .2s ease forwards; }
@media (min-width: 800px) { .toast { bottom: 24px; } }

/* Появление экрана: вглубь, назад и между разделами экран едет по-разному */
.placeholder-line, .placeholder-block { display: block; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); animation: placeholder-breath 1.2s ease-in-out infinite alternate; }
.placeholder-line.wide { width: 45%; height: 34px; }
.placeholder-block { height: 76px; }
.placeholder-block.tall { height: 128px; }
@keyframes placeholder-breath { from { opacity: .45; } to { opacity: .95; } }
.page.enter > * { animation: rise .38s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.page.enter.go-forward > * { animation-name: from-right; }
.page.enter.go-back > * { animation-name: from-left; }
.page.enter .row { animation: row-in .32s var(--ease) backwards; animation-delay: calc(60ms + var(--r, 0) * 22ms); }
.page.enter .meter i { animation: grow .7s var(--ease) backwards .2s; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes from-right { from { opacity: 0; transform: translateX(22px); } }
@keyframes from-left { from { opacity: 0; transform: translateX(-22px); } }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes arrive { 0% { transform: scale(.9); box-shadow: 0 0 0 0 var(--sun); } 55% { transform: scale(1.03); box-shadow: 0 0 0 5px var(--sun); } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(.86); } 60% { transform: scale(1.07); } 100% { transform: scale(1); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes drift { to { transform: translate(5%, -4%) scale(1.06); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, dialog::backdrop {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  body::before { animation: none; }
}
