/* ============================================================
   Админка студии. Mobile-first; палитра приходит из /theme.css.
   Брейкпоинты: базовый — телефон (390px), с 900px — десктоп.
   ============================================================ */

/* Палитра и шрифты приходят отдельным ответом /theme.css — он собирается
   из [theme] в tenants/<slug>.toml (admin/routes/theme.py). Здесь остаётся
   только то, что от вертикали не зависит: ритм, радиусы, тайминги.
   Полупрозрачные слои строятся на автоматических --<токен>-rgb
   (см. admin/routes/theme.py): альфа-слоёв в интерфейсе больше двух десятков,
   перечислять их в конфиге по одному значило бы держать палитру в двух местах.
   Тени берут --shadow-rgb, а не --ink-rgb: в тёмной теме текст светлый,
   и тень на нём превратилась бы в свечение. */
:root {
  /* Отступы: шаг 4/8 */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 20px;
  /* Поверхности: карточка светлее фона — так появляется глубина,
     а тёмный текст остаётся контрастным. */
  --surface-glass: rgba(var(--surface-rgb), .78);  /* шапка и липкие панели */
  /* Тень как у карточки логина: мягкая и глубокая, а не тонкая линия.
     Цвет теней — отдельный токен --shadow, а не текстовый --ink: в тёмной
     теме текст светлый, и тень на нём превратилась бы в свечение. */
  --shadow: 0 2px 4px rgba(var(--shadow-rgb), .05), 0 8px 24px rgba(var(--shadow-rgb), .09);
  --shadow-lift: 0 4px 10px rgba(var(--shadow-rgb), .09), 0 16px 40px rgba(var(--shadow-rgb), .16);
  --tap: 44px;               /* минимальная тап-зона */
  --bar-h: 68px;             /* высота нижнего таб-бара */
  --ease: 220ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

/* Атрибут hidden — это UA-стиль display:none, и любой авторский display его
   перебивает. Дважды из-за этого элемент оставался видимым (модалка продажи,
   меню «Позже»). Universal-правило закрывает класс проблемы: новый скрытый
   элемент прячется по построению, помнить про [hidden] больше не нужно.
   !important здесь оправдан — это не стилизация, а базовая семантика. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;                 /* 16px — iOS не зумит поля ввода */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;  /* без случайного pull-to-refresh */
}

/* Фон-подложка на всех рабочих страницах: тот же язык, что на логине,
   но тише. Отдельный фиксированный слой, а не background-attachment:
   на iOS fixed-фон подтормаживает при скролле, а слой ведёт себя ровно. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: url('/theme/app-bg.svg') center / cover no-repeat, var(--page);
  pointer-events: none;
}
/* У логина собственный, более насыщенный фон — общий слой ему не нужен */
body.login-page::before { content: none; }

h1, h2, h3, .h {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: .02em;
  margin: 0;
  line-height: 1.25;
}

h1 { font-size: 22px; text-transform: uppercase; letter-spacing: .06em; }
h2 { font-size: 17px; text-transform: uppercase; letter-spacing: .05em; }
h3 { font-size: 15px; }

.accent {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  color: var(--ink-soft);
}

a { color: var(--ink); }

/* ------------------------------------------------ логотип */
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 15px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  line-height: .92;
  letter-spacing: .08em;
  text-align: center;
  flex-shrink: 0;
}
.logo span { display: block; }

/* ------------------------------------------------ шапка */
.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  padding-top: calc(var(--s3) + env(safe-area-inset-top));
  /* та же тёплая полупрозрачная подложка, что у карточки логина */
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(1.06);
  -webkit-backdrop-filter: blur(14px) saturate(1.06);
  border-bottom: 1px solid rgba(var(--line-rgb), .7);
  box-shadow: 0 2px 14px rgba(var(--shadow-rgb), .05);
}
.top .title { flex: 1; min-width: 0; }
.top .title .sub {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
}
.top .exit {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
}
.top .exit:hover { background: var(--tint); }

/* десктопная навигация в шапке — на мобиле скрыта */
.nav-desktop { display: none; }

/* ------------------------------------------------ контент */
.wrap {
  padding: var(--s4);
  padding-bottom: calc(var(--bar-h) + var(--s6) + env(safe-area-inset-bottom));
  max-width: 1180px;
  margin: 0 auto;
}

.section { margin-bottom: var(--s5); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s3); margin-bottom: var(--s3);
}
.muted { color: var(--ink-soft); font-size: 14px; }
.empty {
  padding: var(--s5); text-align: center; color: var(--ink-soft);
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ------------------------------------------------ карточки */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s4);
  margin-bottom: var(--s3);
}
.card.cream { background: var(--surface-accent); border-color: var(--accent); }

.card-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s3);
}

.slot-time {
  font-family: var(--font-head);
  font-weight: 700; font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.slot-master {
  font-family: var(--font-accent);
  font-style: italic; font-size: 16px; color: var(--ink-soft);
}

/* ------------------------------------------------ бейджи */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-sub  { background: var(--tint); border-color: var(--accent); color: var(--ink); }
.badge-ok   { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.badge-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge-wait { background: var(--paper); border-color: var(--line); color: var(--ink-soft); }
.badge-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }

/* ------------------------------------------------ кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 10px var(--s4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-head);
  font-size: 14px; font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--ease), background var(--ease), opacity var(--ease);
}
.btn:hover { background: var(--ink-deep); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--accent);
}
.btn-ghost:hover { background: var(--tint); }

.btn-quiet {
  background: var(--tint); color: var(--ink); border-color: var(--accent);
}
.btn-quiet:hover { background: var(--tint-deep); }

/* Ключевые демо-действия — крупные и заметные */
.btn-hero {
  width: 100%;
  min-height: 52px;
  font-size: 15px;
  box-shadow: var(--shadow-lift);
}

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.btn-row .btn { flex: 1 1 auto; }

/* ------------------------------------------------ формы */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px var(--s3);
  font-size: 16px;                  /* без автозума на iOS */
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field { margin-bottom: var(--s3); }

/* видимый фокус для клавиатуры */
a:focus-visible, button:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------ нижняя навигация (мобильная) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex;
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.06);
  -webkit-backdrop-filter: blur(16px) saturate(1.06);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 14px rgba(var(--shadow-rgb), .06);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  min-height: var(--bar-h);
  padding: var(--s2) 2px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 11px; font-weight: 600;
  letter-spacing: .01em;
  transition: color var(--ease), background var(--ease);
}
.tab svg { width: 22px; height: 22px; stroke-width: 1.6; }
.tab.active { color: var(--ink); background: var(--tint); }
.tab.active svg { stroke-width: 2.1; }

/* ------------------------------------------------ календарь записей */
.day-block { margin-bottom: var(--s5); }
.day-head {
  position: sticky; top: 62px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s3);
  background: var(--tint);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .05em;
}
.day-head.is-today { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.day-head .count { font-weight: 600; font-size: 12px; opacity: .8; letter-spacing: 0; }

.master-group { margin-bottom: var(--s4); }
.master-name {
  font-family: var(--font-accent);
  font-style: italic; font-size: 18px;
  margin-bottom: var(--s2);
  padding-left: 2px;
}

/* десктопная таблица-сетка — на мобиле скрыта */
.grid-desktop { display: none; }

/* ------------------------------------------------ таймлайн касаний */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 var(--s4) var(--s5);
  border-left: 2px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute; left: -7px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.next::before { background: var(--ink); border-color: var(--ink); }
.timeline .t-title { font-weight: 600; font-size: 15px; }
.timeline .t-meta { font-size: 13px; color: var(--ink-soft); }

/* ------------------------------------------------ задачи: аккордеон */
.acc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
       margin-bottom: var(--s3); overflow: hidden; box-shadow: var(--shadow); }
.acc summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  min-height: 52px;
  padding: var(--s3) var(--s4);
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .05em;
  list-style: none;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: '';
  width: 9px; height: 9px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform var(--ease);
  flex-shrink: 0;
}
.acc[open] summary::after { transform: rotate(-135deg); }
.acc summary .n {
  margin-left: auto; margin-right: var(--s2);
  font-size: 12px; font-weight: 600; letter-spacing: 0;
  color: var(--ink-soft);
}
.acc-body { padding: 0 var(--s4) var(--s3); }
.acc.overdue summary { background: var(--danger-bg); color: var(--danger); }
.acc.today summary { background: var(--tint); }

.task {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
}
.task:first-child { border-top: none; }
.task input[type=checkbox] {
  width: 24px; height: 24px; min-height: 24px;
  margin: 2px 0 0; flex-shrink: 0; accent-color: var(--ink);
  cursor: pointer;
}
.task.is-done .task-title { text-decoration: line-through; opacity: .5; }
.task-title { font-weight: 600; font-size: 15px; }
.task-meta { font-size: 13px; color: var(--ink-soft); }

/* ------------------------------------------------ список клиентов */
.client-line {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 56px;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: var(--s2);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
}
.client-line:active { transform: scale(.995); }
.client-line .who { flex: 1; min-width: 0; }
.client-line .nm { font-weight: 600; }
.client-line .chev { color: var(--ink-soft); opacity: .65; flex-shrink: 0; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--tint); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}

/* ------------------------------------------------ уведомление */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + 16px);
  transform: translate(-50%, 20px);
  z-index: 100;
  max-width: min(92vw, 420px);
  padding: var(--s3) var(--s4);
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ------------------------------------------------ страница входа */
.login-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s4);
  background: linear-gradient(160deg, var(--tint) 0%, var(--paper) 55%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lift);
  padding: var(--s6) var(--s5);
  text-align: center;
}
.login-card .logo { width: 68px; height: 68px; border-radius: 22px; font-size: 20px;
                    margin: 0 auto var(--s4); }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card .accent { display: block; margin-bottom: var(--s5); font-size: 17px; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; margin-top: var(--s2); }
.login-error {
  margin-bottom: var(--s3); padding: var(--s3);
  background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger);
  border-radius: var(--radius-sm); font-size: 14px; text-align: left;
}

/* ============================================================
   Десктоп
   ============================================================ */
@media (min-width: 900px) {
  .tabbar { display: none; }

  .nav-desktop { display: flex; gap: var(--s1); }
  .nav-desktop a {
    display: inline-flex; align-items: center; gap: var(--s2);
    min-height: var(--tap);
    padding: 0 var(--s4);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--ink-soft);
    font-family: var(--font-head);
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    transition: background var(--ease), color var(--ease);
  }
  .nav-desktop a svg { width: 18px; height: 18px; }
  .nav-desktop a:hover { background: var(--tint); color: var(--ink); }
  .nav-desktop a.active { background: var(--ink); color: var(--paper); }

  .wrap { padding: var(--s5); padding-bottom: var(--s7); }
  h1 { font-size: 26px; }

  .toast { bottom: 28px; }

  /* записи: настоящая таблица-сетка мастера × дни */
  .cards-mobile { display: none; }
  .grid-desktop { display: block; }

  .grid-scroll { overflow-x: auto; padding-bottom: var(--s2); }
  table.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 900px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
  }
  table.grid th, table.grid td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: var(--s2);
    vertical-align: top;
    text-align: left;
  }
  table.grid th {
    background: var(--tint);
    font-family: var(--font-head);
    font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    position: sticky; top: 0; z-index: 5;
  }
  table.grid th.is-today { background: var(--ink); color: var(--paper); }
  table.grid th:first-child, table.grid td:first-child {
    width: 140px; background: var(--surface-sunken); font-weight: 600;
    position: sticky; left: 0; z-index: 4;
  }
  table.grid th:first-child { z-index: 6; }
  table.grid tr:last-child td { border-bottom: none; }
  table.grid td:last-child, table.grid th:last-child { border-right: none; }

  .cell-empty { color: var(--ink-soft); opacity: .55; font-size: 13px; }
  .mini {
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: var(--s2);
    margin-bottom: var(--s2);
    font-size: 13px;
  }
  .mini:last-child { margin-bottom: 0; }
  .mini.came { border-left-color: var(--ok); }
  .mini.no_show { border-left-color: var(--danger); }
  .mini .t { font-weight: 700; font-variant-numeric: tabular-nums; }
  .mini .btn { min-height: 34px; padding: 4px 10px; font-size: 12px; width: 100%; }

  .two-col { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--s5); align-items: start; }
  .client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s2); }
}

/* уважаем системную настройку «меньше движения» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   ПОЛИРОВКА: фоны, микроанимации, состояния
   Всё на CSS/SVG — без внешних библиотек и рантайм-загрузок.
   ============================================================ */

/* ------------------------------------------------ мягкий фон страницы входа */
.login-page {
  background:
    url('/theme/login-bg.svg') center / cover no-repeat,
    linear-gradient(160deg, var(--tint) 0%, var(--paper) 55%);
  position: relative;
}
.login-card {
  background: rgba(var(--surface-rgb), .82);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: 0 18px 48px rgba(var(--shadow-rgb), .16);
  animation: card-in 520ms cubic-bezier(.2, .7, .3, 1) both;
}
.login-card .logo {
  box-shadow: 0 10px 26px rgba(var(--shadow-rgb), .28);
  animation: logo-in 700ms cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes logo-in {
  from { opacity: 0; transform: translateY(-8px) scale(.9); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------ волна-разделитель под шапкой */
.top { border-bottom: none; position: relative; }
.top::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 14px;
  background: url('/static/img/wave.svg') center bottom / 100% 100% no-repeat;
  pointer-events: none;
}
.wrap { padding-top: calc(var(--s4) + 6px); }

/* ------------------------------------------------ появление карточек: fade+slide со stagger */
.card, .client-line, .acc, .day-block {
  animation: rise 320ms cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
/* лесенка: первые элементы появляются заметно, дальше задержку не копим */
.card:nth-child(1),   .client-line:nth-child(1)  { animation-delay: 20ms; }
.card:nth-child(2),   .client-line:nth-child(2)  { animation-delay: 60ms; }
.card:nth-child(3),   .client-line:nth-child(3)  { animation-delay: 100ms; }
.card:nth-child(4),   .client-line:nth-child(4)  { animation-delay: 140ms; }
.card:nth-child(5),   .client-line:nth-child(5)  { animation-delay: 180ms; }
.card:nth-child(n+6), .client-line:nth-child(n+6){ animation-delay: 210ms; }

/* ------------------------------------------------ кнопки: мягкий подъём */
.btn {
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .08);
  transition: transform var(--ease), background var(--ease),
              box-shadow var(--ease), opacity var(--ease);
}
.btn-hero {
  background: linear-gradient(140deg, var(--ink-deep) 0%, var(--ink) 60%);
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(var(--shadow-rgb), .18); }
  .btn-hero:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(var(--shadow-rgb), .24); }
  .client-line:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
}
.btn:active { transform: translateY(0) scale(.985); box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .1); }

/* ------------------------------------------------ прогресс-полоска абонемента */
.sub-progress {
  height: 6px;
  margin-top: 10px;
  background: rgba(var(--shadow-rgb), .13);
  border-radius: 999px;
  overflow: hidden;
}
.sub-progress i {
  display: block; height: 100%;
  width: var(--fill, 100%);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--ink));
  transition: width 700ms cubic-bezier(.2, .7, .3, 1);
}

/* число остатка: короткая подсветка при изменении */
.num-flash { animation: num-flash 700ms ease-out; }
@keyframes num-flash {
  0%   { transform: scale(1);    color: var(--ink); }
  35%  { transform: scale(1.14); color: var(--ok); }
  100% { transform: scale(1);    color: var(--ink); }
}

/* ------------------------------------------------ галочка успеха (stroke-dashoffset) */
.success-pop {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  pointer-events: none;
  background: rgba(var(--shadow-rgb), .10);
  opacity: 0;
  animation: pop-fade 1500ms ease forwards;
}
.success-pop .ring {
  width: 108px; height: 108px;
  background: rgba(var(--surface-rgb), .96);
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 14px 40px rgba(var(--shadow-rgb), .22);
  transform: scale(.86);
  animation: ring-in 420ms cubic-bezier(.2, .8, .3, 1) forwards;
}
.success-pop svg { width: 56px; height: 56px; }
.success-pop .circle {
  fill: none; stroke: var(--accent); stroke-width: 2.4;
  stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: draw 520ms cubic-bezier(.4, 0, .2, 1) 80ms forwards;
}
.success-pop .tick {
  fill: none; stroke: var(--ink); stroke-width: 3.6;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 36; stroke-dashoffset: 36;
  animation: draw 360ms cubic-bezier(.4, 0, .2, 1) 380ms forwards;
}
@keyframes draw    { to { stroke-dashoffset: 0; } }
@keyframes ring-in { to { transform: scale(1); } }
@keyframes pop-fade {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ------------------------------------------------ деликатный лоадер автообновления */
.sync {
  position: fixed;
  right: 14px;
  bottom: calc(var(--bar-h) + 16px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--ease), transform var(--ease);
  pointer-events: none;
}
.sync.show { opacity: 1; transform: none; }
.sync i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: dot 1200ms ease-in-out infinite;
}
.sync i:nth-child(2) { animation-delay: 160ms; }
.sync i:nth-child(3) { animation-delay: 320ms; }
@keyframes dot {
  0%, 100% { opacity: .35; transform: translateY(0) scale(.9); }
  40%      { opacity: 1;   transform: translateY(-3px) scale(1); background: var(--ink); }
}

/* ------------------------------------------------ пустые состояния */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: var(--s6) var(--s4);
  background: var(--surface);
  border: 1px dashed var(--line);
}
.empty svg { width: 74px; height: 74px; animation: float 5s ease-in-out infinite; }
.empty .say {
  font-family: var(--font-accent);
  font-style: italic; font-size: 17px; color: var(--ink-soft);
  max-width: 34ch; line-height: 1.45;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ------------------------------------------------ таймлайн: плавное заполнение линии */
.timeline li { --line-fill: 0%; }
.timeline li::after {
  content: '';
  position: absolute; left: -2px; top: 0;
  width: 2px; height: var(--line-fill);
  background: var(--ink);
  transition: height 900ms cubic-bezier(.2, .7, .3, 1) 200ms;
}
.timeline li.done { --line-fill: 100%; }
.timeline li.next { --line-fill: 45%; }
.timeline li::before {
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.timeline li.next::before {
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--shadow-rgb), .26); }
  50%      { box-shadow: 0 0 0 7px rgba(var(--shadow-rgb), 0); }
}

/* ------------------------------------------------ тост: чуть заметнее и в тоне бренда */
.toast {
  border: 1px solid rgba(var(--accent-rgb), .35);
  box-shadow: 0 14px 34px rgba(var(--shadow-rgb), .28);
  display: flex; align-items: center; gap: 10px;
}
.toast::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.toast.error::before { background: var(--danger-soft); }

/* ------------------------------------------------ мобильные уточнения (390px) */
@media (max-width: 899px) {
  /* тост и лоадер не должны накрывать нижние кнопки и таб-бар */
  .toast { bottom: calc(var(--bar-h) + 14px + env(safe-area-inset-bottom)); }
  .success-pop .ring { width: 96px; height: 96px; }
  .success-pop svg { width: 50px; height: 50px; }
}

@media (min-width: 900px) {
  .sync { bottom: 24px; right: 24px; }
}

/* «меньше движения» — гасим всё, включая новые эффекты */
@media (prefers-reduced-motion: reduce) {
  .card, .client-line, .acc, .day-block,
  .login-card, .login-card .logo,
  .empty svg, .timeline li.next::before { animation: none !important; }
  .sub-progress i, .timeline li::after { transition: none !important; }
  .success-pop { animation: pop-fade-static 1200ms ease forwards; }
  @keyframes pop-fade-static { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
  .success-pop .circle, .success-pop .tick { stroke-dashoffset: 0; animation: none; }
  .success-pop .ring { transform: scale(1); animation: none; }
}

/* ------------------------------------------------ метка сборки (пруф свежести страницы) */
.build-mark {
  margin-top: var(--s5);
  text-align: center;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-soft);    /* метку сборки читают с телефона — латте не годится */
  user-select: all;            /* удобно продиктовать или скопировать */
}
.build-mark.login {
  position: fixed; left: 0; right: 0;
  bottom: calc(12px + env(safe-area-inset-bottom));
  margin: 0;
  color: var(--ink-soft);
  opacity: .6;
}

/* ============================================================
   ДИАЛОГИ, АВТООТВЕТЧИК, ВИТРИНЫ, НАВИГАЦИЯ «ЕЩЁ»
   ============================================================ */

/* ------------------------------------------------ бейдж непрочитанного */
.dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tab .dot, .nav-desktop a .dot {
  position: absolute; top: 6px; left: 50%; margin-left: 6px;
}
.tab, .nav-desktop a { position: relative; }
.nav-desktop a .dot { position: static; margin: 0 0 0 6px; }
.nav-desktop a.active .dot { background: var(--paper); color: var(--ink); }
.tab.active .dot { background: var(--ink); color: var(--paper); }

/* ------------------------------------------------ панель «Ещё» */
.more-scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(var(--shadow-rgb), .38);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease);
}
.more-sheet {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
  z-index: 56;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(var(--shadow-rgb), .18);
  padding: var(--s2) var(--s3) var(--s3);
  transform: translateY(110%);
  transition: transform var(--ease);
}
.more-toggle:checked ~ .more-scrim { opacity: 1; pointer-events: auto; }
.more-toggle:checked ~ .more-sheet { transform: translateY(0); }

.more-item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 52px;
  padding: 0 var(--s3);
  border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
  font-weight: 600;
}
.more-item svg { width: 21px; height: 21px; stroke-width: 1.7; color: var(--ink-soft); }
.more-item.active { background: var(--tint); }
.more-item.active svg { color: var(--ink); }
.more-tab { cursor: pointer; }

/* ------------------------------------------------ диалоги: раскладка */
.wrap-dialogs { padding-bottom: var(--s4); }
.dialogs { display: block; }

/* мобильный режим: либо список, либо лента на весь экран */
@media (max-width: 899px) {
  .wrap-dialogs .build-mark { display: none; }
  .dlg-thread { display: none; }
  .wrap-dialogs.thread-open .dlg-list { display: none; }
  .wrap-dialogs.thread-open .dlg-thread { display: flex; flex-direction: column; }
  .thread-blank { display: none; }
}

/* ------------------------------------------------ список диалогов */
.dlg-item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 64px;
  padding: var(--s3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: var(--s2);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease);
}
.dlg-item.active { background: var(--tint); border-color: var(--accent); }
.dlg-body { flex: 1; min-width: 0; }
.dlg-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.dlg-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.dlg-time { font-size: 12px; color: var(--ink-soft); flex-shrink: 0;
            font-variant-numeric: tabular-nums; }
.dlg-last {
  display: block; margin-top: 2px;
  font-size: 14px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch { width: 15px; height: 15px; flex-shrink: 0; }
.ch-tg { color: var(--channel-tg); }
.ch-wa { color: var(--channel-wa); }

/* ------------------------------------------------ лента */
.dlg-thread { min-height: 60vh; }

.thread-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s3);
}
.thread-back {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  border-radius: var(--radius-sm);
  color: var(--ink); flex-shrink: 0;
}
.thread-back:hover { background: var(--tint); }
.thread-who { flex: 1; min-width: 0; }
.thread-who .nm { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.thread-card { flex-shrink: 0; }

.stage-note {
  padding: 9px var(--s3);
  margin-bottom: var(--s3);
  background: var(--tint);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-soft);
  text-align: center;
}
.stage-note-block { margin: var(--s5) 0 var(--s4); }

.thread {
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s2) 0 var(--s4);
  flex: 1;
  overflow-y: auto;
}
.msg { max-width: 78%; padding: 10px 13px; border-radius: 16px; font-size: 15px;
       animation: rise 260ms cubic-bezier(.2,.7,.3,1) both; }
.msg.in  { align-self: flex-start; background: var(--surface); border: 1px solid var(--line);
           border-bottom-left-radius: 5px; }
.msg.out { align-self: flex-end; background: var(--surface-accent); border: 1px solid var(--accent);
           border-bottom-right-radius: 5px; }
.msg.out.by-admin { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-meta { margin-top: 4px; font-size: 11px; opacity: .65; }

/* ------------------------------------------------ поле ответа */
.composer {
  position: sticky; bottom: 0;
  display: flex; align-items: flex-end; gap: var(--s2);
  padding: var(--s2) 0 calc(var(--bar-h) + var(--s3) + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(var(--page-rgb),0), var(--page) 22%);
}
.composer textarea {
  flex: 1; resize: none; max-height: 130px;
  border-radius: 20px; padding: 11px var(--s4);
  line-height: 1.4;
}
.composer .btn { min-width: 52px; border-radius: 50%; padding: 0; min-height: 48px; }
.composer.disabled { display: block; }
.composer-note {
  padding: var(--s3);
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 14px; color: var(--ink-soft); text-align: center;
}

/* ------------------------------------------------ тумблер */
.switch {
  width: 58px; height: 32px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--surface-sunken);
  padding: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ease), border-color var(--ease);
}
.switch .knob {
  display: block; width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform var(--ease), background var(--ease);
}
.switch.on { background: var(--ink); border-color: var(--ink); }
.switch.on .knob { transform: translateX(26px); background: var(--paper); }

.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 22px; accent-color: var(--ink); }

/* ------------------------------------------------ витрина интеграций */
.cards-grid { display: grid; gap: var(--s3); }
.integration.stage2 { opacity: .92; border-style: dashed; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  animation: live 2.4s ease-in-out infinite;
}
@keyframes live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--ok-rgb), .5); }
  50%      { box-shadow: 0 0 0 6px rgba(var(--ok-rgb), 0); }
}

/* ------------------------------------------------ десктоп */
@media (min-width: 900px) {
  .more-sheet, .more-scrim, .more-tab { display: none; }

  .nav-desktop { flex-wrap: wrap; justify-content: flex-end; max-width: 720px; }
  .nav-desktop a { padding: 0 var(--s3); font-size: 12px; }

  .dialogs {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: var(--s4);
    align-items: start;
  }
  .dlg-list { max-height: calc(100vh - 190px); overflow-y: auto; padding-right: 4px; }
  .dlg-thread {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0 var(--s4);
    max-height: calc(100vh - 190px);
  }
  .thread-back { display: none; }
  .thread { max-height: none; }
  .composer { padding-bottom: var(--s3); background: var(--surface); }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .msg, .more-sheet, .more-scrim, .switch .knob, .live-dot { animation: none !important; }
  .more-sheet { transition: none !important; }
}

/* ============================================================
   ВЛАДЕНИЕ ДИАЛОГОМ, НАСТРОЙКИ, МОДАЛКА ПРОДАЖИ, ЛОГОТИП
   ============================================================ */

/* ------------------------------------------------ логотип-картинка */
.logo {
  display: block;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: none;
  object-fit: cover;
  flex-shrink: 0;
  /* крем на кремовом фоне сливался бы — держим тонкий контур */
  box-shadow: 0 0 0 1px rgba(var(--shadow-rgb), .18), 0 2px 8px rgba(var(--shadow-rgb), .10);
}
.login-card .logo {
  width: 88px; height: 88px;
  margin: 0 auto var(--s4);
  box-shadow: 0 0 0 1.5px rgba(var(--shadow-rgb), .22), 0 10px 26px rgba(var(--shadow-rgb), .18);
}

/* ------------------------------------------------ два ряда навигации на десктопе */
.nav-row { display: flex; gap: var(--s1); }

/* ------------------------------------------------ статусы диалога */
.dlg-filter { margin-bottom: var(--s3); }
.filter-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 var(--s3);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
}
.filter-chip .chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.filter-chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter-chip.on .chip-dot { background: var(--accent-soft); }

.dlg-status {
  display: inline-block; margin-top: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  border: 1px solid transparent;
}
.st-bot     { background: var(--paper); border-color: var(--line); color: var(--ink-soft); }
.st-admin   { background: var(--tint); border-color: var(--accent); color: var(--ink); }
.st-waiting { background: var(--wait-bg); border-color: var(--wait-line); color: var(--wait); }

.thread-actions { display: flex; gap: var(--s2); flex-shrink: 0; }
.own-btn { white-space: nowrap; }

.owner-note {
  padding: 9px var(--s3);
  margin-bottom: var(--s3);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft);
}
.owner-note.is-admin { background: var(--tint); border-color: var(--accent); color: var(--ink); }

.msg-system {
  align-self: center;
  max-width: 90%;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(var(--shadow-rgb), .06);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

/* ------------------------------------------------ поля в две колонки */
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.pair-no {
  display: inline-block; min-width: 22px;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------ модалка */
body.modal-open { overflow: hidden; }
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: var(--s4);
}

.modal-scrim {
  position: absolute; inset: 0;
  background: rgba(var(--shadow-rgb), .45);
  animation: fade-in 200ms ease both;
}
.modal-card {
  position: relative;
  width: 100%; max-width: 420px;
  max-height: 86vh; overflow-y: auto;
  padding: var(--s5);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(var(--shadow-rgb), .3);
  animation: modal-in 260ms cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.summary { display: grid; grid-template-columns: auto 1fr; gap: 8px var(--s3); margin: var(--s4) 0 0; }
.summary dt { color: var(--ink-soft); font-size: 14px; }
.summary dd { margin: 0; font-weight: 600; text-align: right; }

.just-sold { animation: just-sold 1600ms ease both; }
@keyframes just-sold {
  0%   { transform: scale(.98); box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .8); }
  35%  { transform: scale(1);   box-shadow: 0 0 0 12px rgba(var(--accent-rgb), 0); }
  100% { transform: none;       box-shadow: var(--shadow); }
}

@media (max-width: 899px) {
  .two-fields { grid-template-columns: 1fr; }
  .thread-actions .thread-card { display: none; }   /* карточка клиента — из списка */
  .modal-card { padding: var(--s4); }
  .modal .btn { min-height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-card, .modal-scrim, .just-sold { animation: none !important; }
}

/* ------------------------------------------------ доступы */
.user-card.is-off { opacity: .6; border-style: dashed; }
.role-select {
  width: auto; min-width: 150px;
  min-height: 40px; padding: 6px var(--s3);
  font-size: 14px;
  flex-shrink: 0;
}
.session-card.is-revoked { opacity: .62; }
.session-card .badge { white-space: nowrap; }

.pass-box {
  margin-top: var(--s4);
  padding: var(--s4);
  background: var(--tint);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: 'Montserrat', monospace;
  font-size: 20px; font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  word-break: break-all;
  user-select: all;
}

@media (max-width: 899px) {
  /* на телефоне селект роли уезжает под имя, иначе строка ломается */
  .user-card .card-row { flex-direction: column; align-items: stretch; gap: var(--s2); }
  .role-select { width: 100%; min-height: var(--tap); }
  .pass-box { font-size: 18px; }
  #pass-copy { min-height: 52px; }
}

/* ============================================================
   ЗАДАЧИ ↔ ДИАЛОГИ, ВОЗМОЖНОСТИ И ЦЕНЫ, СТАТИСТИКА
   ============================================================ */

/* ------------------------------------------------ действие в задаче */
.task-action { margin-top: 10px; }
.task-action .btn { width: 100%; justify-content: flex-start; gap: 10px; }
.mini-link { font-size: 13px; }

.task-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px var(--s3);
  margin-bottom: var(--s3);
  background: var(--wait-bg);
  border: 1px solid var(--wait-line);
  border-radius: var(--radius-sm);
  color: var(--wait);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
}
.task-strip-go { margin-left: auto; opacity: .75; font-weight: 500; }

/* ------------------------------------------------ возможности и цены */
.lead {
  font-family: var(--font-accent);
  font-style: italic; font-size: 18px; line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 var(--s5);
  max-width: 60ch;
}

.feat-grid { display: grid; gap: var(--s3); }
.feat { display: flex; flex-direction: column; gap: 8px; }
.feat.stage2 { border-style: dashed; opacity: .93; }
.feat-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.feat-head h2 { font-size: 15px; text-transform: none; letter-spacing: .01em; }
.feat-price {
  font-family: var(--font-head);
  font-weight: 700; font-size: 19px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.feat-note { margin: 0; font-size: 14px; }
.feat .badge { align-self: flex-start; }

.total-line {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s5);
}
.total-label {
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; font-size: 13px;
}
.total-sum {
  font-family: var(--font-head); font-weight: 700; font-size: 26px;
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.plans { display: grid; gap: var(--s3); }
.plan { display: flex; flex-direction: column; }
.plan.accent {
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-lift);
  background: var(--tint);
}
.plan-head { display: flex; align-items: center; gap: var(--s2); }
.plan-head h2 { font-size: 16px; }
.plan-badge {
  padding: 3px 10px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.plan-price {
  font-family: var(--font-head);
  font-weight: 700; font-size: 34px;
  margin-top: var(--s3);
  line-height: 1;
}
.plan-price-note { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.plan-recurring {
  font-family: var(--font-accent);
  font-style: italic; font-size: 19px; color: var(--ink-soft);
  margin-top: 4px;
}
.plan-points { margin: var(--s4) 0 0; padding: 0; list-style: none; }
.plan-points li {
  position: relative; padding-left: 22px; margin-bottom: 8px; font-size: 14px;
}
.plan-points li::before {
  content: ''; position: absolute; left: 2px; top: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}
.plan.accent .plan-points li::before { background: var(--ink); }

.fineprint {
  margin: var(--s5) 0 0;
  font-size: 12px; color: var(--ink-soft); text-align: center;
}

/* ------------------------------------------------ статистика */
.bar-row { margin-bottom: var(--s3); }
.bar-row:last-child { margin-bottom: 0; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.bar-name { font-weight: 600; font-size: 14px; }
.bar-num { font-variant-numeric: tabular-nums; font-size: 14px; }
.bar {
  height: 10px; margin-top: 6px;
  background: rgba(var(--shadow-rgb), .12);
  border-radius: 999px; overflow: hidden;
}
.bar i {
  display: block; height: 100%; width: var(--fill, 0%);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--ink));
  transition: width 800ms cubic-bezier(.2, .7, .3, 1);
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.stat { text-align: center; }
.stat-num {
  font-family: var(--font-head); font-weight: 700; font-size: 30px;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.stat-label { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.stat-week {
  font-family: var(--font-accent); font-style: italic;
  font-size: 15px; color: var(--ink-soft); margin-top: 4px;
}

.link-box {
  display: flex; align-items: center; gap: var(--s2);
  flex-wrap: wrap;
  margin-top: var(--s3); padding: var(--s3);
  background: var(--tint); border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
}
.link-box code { flex: 1; min-width: 0; font-size: 13px; word-break: break-all; }
.link-preset { display: flex; align-items: center; gap: var(--s3); }
.preset-url {
  display: block; font-size: 12px; color: var(--ink-soft);
  word-break: break-all; margin-top: 2px;
}

@media (min-width: 900px) {
  .feat-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  /* три тарифа подписки в ряд; разовая живёт отдельной карточкой ниже */
  .plans { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 899px) {
  .task-action .btn { min-height: 48px; }
  .link-preset { flex-direction: column; align-items: stretch; }
  .link-preset .btn { width: 100%; }
  .plan-price { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar i { transition: none !important; }
}

/* ------------------------------------------------ конфигуратор на /pricing */
.feat-benefit {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 17px;
  line-height: 1.4;
  /* латте здесь дал бы контраст 1.93 — берём приглушённый шоколад:
     тише основного текста, но читается (6.7) */
  color: var(--ink-soft);
  margin: 0;
}

.feat-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2);
  margin-top: auto;
  padding-top: var(--s2);
}

.pick {
  min-height: 40px;
  padding: 0 var(--s3);
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-head);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.pick:active { transform: scale(.96); }
.pick .pick-off { display: none; }
.pick:not(.on) {
  background: transparent;
  color: var(--ink);
  border-color: var(--accent);
}
.pick:not(.on) .pick-on { display: none; }
.pick:not(.on) .pick-off { display: inline; }

/* Исключённая карточка гаснет, но остаётся читаемой */
.feat.is-off { opacity: .45; }
.feat.is-off .feat-price { text-decoration: line-through; }

.total-hint {
  margin: -12px 0 var(--s5);
  font-size: 13px; color: var(--ink-soft); text-align: center;
}
.total-line { transition: border-color var(--ease); }
.total-sum #total-sum { font-variant-numeric: tabular-nums; }

/* «в подписке просто всё» — подпись, ради которой затевался контраст */
.plan-allin {
  margin-top: 8px;
  font-family: var(--font-accent);
  font-style: italic; font-size: 17px;
  color: var(--ink-soft);
}
.plan.accent .plan-allin { color: var(--ink); }

@media (max-width: 899px) {
  .pick { min-height: var(--tap); font-size: 13px; padding: 0 var(--s4); }
  .feat-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .feat-foot .badge { align-self: flex-start; }
  .pick { width: 100%; }

  /* Итог виден всегда: на телефоне карточек одиннадцать, и без липкой
     строки после третьего клика непонятно, что вообще пересчиталось. */
  .total-line {
    position: sticky;
    bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
    z-index: 30;
    background: var(--surface-glass);
    backdrop-filter: blur(14px) saturate(1.06);
    -webkit-backdrop-filter: blur(14px) saturate(1.06);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: var(--s3) var(--s4);
  }
}

/* ============================================================
   МОБИЛЬНАЯ ПЛОТНОСТЬ И КОМПАКТНЫЙ ТАБ-БАР
   Всё внутри @media (max-width: 899px) — десктоп не трогаем.
   ============================================================ */

.only-mobile { display: none; }

@media (max-width: 899px) {
  .only-desktop { display: none !important; }
  .only-mobile  { display: inline; }

  /* ---------- таб-бар: пять икон без подписей ----------
     Подписи убраны сознательно: пять ячеек с текстом на 390px дают
     шрифт 10px и обрезку. Доступность добираем aria-label + title,
     активная вкладка залита шоколадом — состояние видно без слов. */
  :root { --bar-h: 54px; }

  .tabbar {
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(var(--line-rgb), .8);
  }
  .tab {
    min-height: var(--bar-h);
    gap: 0;
    padding: 6px 2px;
    font-size: 0;                 /* подписи не рендерим */
    touch-action: manipulation;   /* без 300 мс задержки */
  }
  .tab svg { width: 23px; height: 23px; stroke-width: 1.7; }

  /* активная — шоколадная пилюля вокруг иконки, а не заливка всей ячейки */
  .tab.active { background: none; }
  .tab.active svg { stroke-width: 2; }
  .tab.active::before {
    content: '';
    position: absolute;
    width: 46px; height: 32px;
    border-radius: 999px;
    background: var(--ink);
    z-index: -1;
  }
  .tab.active { color: var(--paper); position: relative; }
  .tab.active svg { position: relative; z-index: 1; }

  .tab .dot {
    position: absolute; top: 5px; left: 50%; margin-left: 5px;
    min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px;
  }

  /* панель «Ещё» отсчитывается от нового бара автоматически: она
     привязана к var(--bar-h) */

  /* ---------- карточка задачи ---------- */
  .task { padding: 10px 0; gap: 10px; }
  .task input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; }
  .task-title { font-size: 14px; line-height: 1.35; }

  /* описание — одна строка, раскрывается тапом по карточке */
  .task-body {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    margin-top: 2px;
    cursor: pointer;
  }
  .task.is-open .task-body { -webkit-line-clamp: unset; }

  /* метаданные и кнопка — одной строкой */
  .task-line {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
  }
  .task-line .badge { font-size: 10px; padding: 2px 7px; }
  .task-due { font-variant-numeric: tabular-nums; }
  .mini-link { font-size: 12px; }

  /* кнопка действия компактная, но тап-зона остаётся 44px */
  .task-go {
    margin-left: auto;
    min-height: 34px;             /* визуальная высота; десктопные 29px сюда не доходят */
    background: var(--tint);     /* на телефоне контур читается хуже — оставляем заливку */
    border-color: var(--accent);
    padding: 0 12px;
    font-size: 12px;
    gap: 6px;
    border-radius: 999px;
    position: relative;
  }
  .task-go::after {               /* расширяем тап-зону до 44px, не раздувая вид */
    content: '';
    position: absolute; left: 0; right: 0;
    top: -5px; bottom: -5px;
  }
  .task-go svg { width: 15px; height: 15px; }

  .acc-body { padding: 0 var(--s3) var(--s2); }
  .acc summary { min-height: 46px; padding: var(--s2) var(--s3); font-size: 12px; }

  /* ---------- клиенты ---------- */
  .client-line { min-height: 52px; padding: 10px var(--s3); gap: 10px; }
  .client-line .avatar { width: 34px; height: 34px; font-size: 13px; }
  .client-line .nm { font-size: 14px; }
  .client-line .muted { font-size: 12px; }
  .client-grid { gap: 6px; }

  /* ---------- записи ---------- */
  .card { padding: var(--s3); }
  .day-head { padding: 7px var(--s3); font-size: 12px; margin-bottom: 10px; }
  .slot-time { font-size: 17px; }
  .slot-master { font-size: 14px; }
  .master-name { font-size: 16px; margin-bottom: 6px; }
  .master-group { margin-bottom: var(--s3); }

  /* ---------- абонементы ---------- */
  .card .muted { font-size: 12.5px; }

  /* ---------- диалоги: список ---------- */
  .dlg-item { min-height: 58px; padding: 10px var(--s3); gap: 10px; }
  .dlg-item .avatar { width: 34px; height: 34px; font-size: 13px; }
  .dlg-name { font-size: 14px; }
  .dlg-last { font-size: 12.5px; margin-top: 1px; }
  .dlg-time { font-size: 11px; }
  .dlg-status { font-size: 9px; padding: 1px 6px; margin-top: 3px; }

  /* ---------- общее: вторичный текст мельче ---------- */
  .muted { font-size: 13px; }
  .section { margin-bottom: var(--s4); }
  h1 { font-size: 19px; }
  h2 { font-size: 15px; }
}

/* ============================================================
   ЗАДАЧИ: кромка по типу, три действия, панель фильтров
   ============================================================ */

/* Кромки в одной тёплой гамме: различимы, но список не превращается
   в светофор — насыщенный только «вопрос из бота», он же самый срочный. */
/* Сами цвета живут в [theme] (--k-call, --k-question и т.д.): в другой
   вертикали гамма другая. Здесь только раскладка по типам задач.
   Для мелкого ТЕКСТА заведён отдельный --terra-text: светлая терракота
   даёт на плашке 3.87:1, ниже AA. Заливки и рамки живут на --k-call. */

.task {
  border-left: 4px solid var(--line);
  padding-left: var(--s3);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.task.k-reactivation { border-left-color: var(--k-reactivation); }
.task.k-call         { border-left-color: var(--k-call); }
.task.k-question     { border-left-color: var(--k-question); }
.task.k-reschedule   { border-left-color: var(--k-reschedule); }
.task.is-done { border-left-color: var(--line); }

.task-main { flex: 1; min-width: 0; }

/* Только десктоп: мобильный вариант кнопки уже настроен выше, и правило
   без медиа-запроса перебило бы его — тап-зона упала бы с 34 до 29px. */
@media (min-width: 900px) {
  /* строка метаданных: слева бейдж, срок и имя, кнопка прижата вправо */
  .task-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .task-line > .task-go { margin-left: auto; }

  /* контурная кнопка в одну высоту с бейджами: тёмная заливка спорила
     с бейджами и притягивала взгляд сильнее самой задачи */
  .task-go {
    min-height: 29px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--ink);
    font-family: var(--font-head);
    font-size: 12px; font-weight: 600;
    letter-spacing: .01em;
    gap: 6px;
    box-shadow: none;
    transition: background var(--ease), border-color var(--ease);
  }
  .task-go:hover { background: var(--tint); border-color: var(--ink); transform: none; }
  .task-go svg { width: 14px; height: 14px; }
}
.attempts {
  color: var(--k-call);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- три действия ---------- */
.task-acts {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.act {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-head);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.act:hover { background: var(--tint); color: var(--ink); }
.act:active { transform: scale(.96); }
.act[disabled] { opacity: .5; }
.act-done { border-color: var(--accent); color: var(--ink); }
.act-done:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* меню «Позже» */
.act-later { position: relative; }
.later-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px);
  z-index: 60;
  display: flex; flex-direction: column;
  min-width: 168px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: rise 180ms cubic-bezier(.2,.7,.3,1) both;
}
.later-menu button {
  min-height: 44px;
  padding: 0 var(--s3);
  border: none; background: none;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.later-menu button:hover { background: var(--tint); }

/* ---------- панель фильтров ---------- */
.task-panel {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-n {
  margin-left: 7px; padding: 1px 6px;
  border-radius: 999px;
  background: rgba(var(--shadow-rgb), .1);
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.filter-chip.on .chip-n { background: rgba(var(--surface-rgb), .22); }

.sort-wrap { display: flex; align-items: center; gap: 8px; margin: 0; }
.sort-select { width: auto; min-width: 190px; min-height: 40px; font-size: 13px; }

@media (max-width: 899px) {
  .task { padding-left: 10px; border-left-width: 3px; }
  .task-acts { gap: 4px; }
  .act {
    min-height: 44px;          /* тап-зона по норме */
    padding: 0 10px;
    font-size: 11px;
    gap: 4px;
  }
  .act span { display: none; }  /* на телефоне только иконки */
  .act svg { width: 19px; height: 19px; }
  .act-done { background: var(--tint); }

  .task-panel { gap: var(--s2); margin-bottom: var(--s3); }
  .chips { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .filter-chip { flex-shrink: 0; min-height: 36px; font-size: 12px; }
  .sort-wrap { width: 100%; }
  .sort-select { width: 100%; min-width: 0; }

  .later-menu { right: -4px; min-width: 156px; }
}

@media (prefers-reduced-motion: reduce) {
  .later-menu { animation: none !important; }
}

/* ------------------------------------------------ шапка: только бренд */
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .14em;
  line-height: 1.1;
  color: var(--ink);
}
.top .title .sub { margin-top: 1px; }

/* Контекстная строка на страницах без собственного заголовка:
   несёт данные, а не повторяет название вкладки. */
.page-note {
  margin: 0 0 var(--s3);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
}

@media (max-width: 899px) {
  .brand { font-size: 17px; letter-spacing: .12em; }
  .top .title .sub { font-size: 13px; }
  .page-note { font-size: 14px; margin-bottom: var(--s2); }
}

/* ------------------------------------------------ две колонки на широких страницах */
.cols { display: block; }

@media (min-width: 900px) {
  /* Левая чуть уже правой: слева формы, справа списки — им нужнее ширина.
     align-items: start, иначе короткая колонка растянется под длинную. */
  .cols {
    display: grid;
    grid-template-columns: 48fr 52fr;
    gap: var(--s5);
    align-items: start;
  }
  .col { min-width: 0; }
  .col .section:last-child { margin-bottom: 0; }
}

/* ------------------------------------------------ воронка по источникам */
.fn-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fn-row:last-of-type { border-bottom: none; }
.fn-organic { opacity: .82; }

.fn-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
}
.fn-name { font-weight: 600; font-size: 14px; }
.fn-nums { font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.fn-arrow { color: var(--accent); margin: 0 2px; }
.fn-pct { color: var(--ink-soft); font-size: 13px; }

/* Три полосы одна под другой: видно, как воронка сужается */
.fn-bars { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.fn-bars i {
  display: block; height: 6px; border-radius: 999px;
  transition: width 700ms cubic-bezier(.2,.7,.3,1);
}
.fn-came    { width: 100%; background: rgba(var(--shadow-rgb), .14); }
.fn-booked  { width: var(--fill, 0%); background: var(--accent); }
.fn-reached { width: var(--fill, 0%); background: var(--ink); }

.fn-total {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
  margin-top: var(--s3); padding-top: var(--s3);
  border-top: 2px solid var(--line);
  font-family: var(--font-head);
  font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .05em;
}
.fn-total .fn-nums { text-transform: none; letter-spacing: 0; font-size: 14px; }

@media (max-width: 899px) {
  .fn-name { font-size: 13px; }
  .fn-nums { font-size: 13px; }
  .fn-pct  { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .fn-bars i { transition: none !important; }
}

/* ------------------------------------------------ компактные действия в строке карточки */
.row-acts {
  display: flex; justify-content: flex-end; gap: var(--s2);
  margin-top: var(--s3); flex-wrap: wrap;
}
.row-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  box-shadow: none;
}
.row-btn:hover { background: var(--tint); border-color: var(--ink); transform: none; }
.row-btn[disabled] { opacity: .45; }

@media (max-width: 899px) {
  /* на телефоне кнопка во всю ширину удобнее пальцу */
  .row-acts { flex-direction: column; }
  .row-acts form { width: 100%; }
  .row-btn { width: 100%; min-height: var(--tap); font-size: 13px; }
}

/* ------------------------------------------------ подписка студии */
.bill-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bill-old { color: var(--muted); font-size: 20px; text-decoration-thickness: 2px; }
.bill-now { font-size: 34px; line-height: 1; letter-spacing: -.02em; }
.bill-note {
  margin: 8px 0 0; font-family: var(--font-accent);
  font-style: italic; color: var(--accent); font-size: 15px;
}
.bill-list {
  margin: var(--s3) 0 0; padding-left: 18px;
  display: grid; gap: 6px; font-size: 14px;
}
.bill-list li { color: var(--ink); }

/* ------------------------------------------------ галочки доступов */
.perm-grid {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}
.perm-grid.is-hidden { display: none; }
.perm-head {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--s2);
}
.perm-item {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--tap);            /* палец, а не курсор: смена работает с телефона */
  padding: 0 4px; cursor: pointer; font-size: 14px;
}
.perm-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.perm-foot {
  display: flex; align-items: center; gap: var(--s2);
  flex-wrap: wrap; margin-top: var(--s2);
}
@media (min-width: 700px) {
  .perm-grid { grid-template-columns: 1fr 1fr; }
  .perm-head, .perm-foot { grid-column: 1 / -1; }
}

/* ------------------------------------------------ тарифы подписки и лимит устройств
   Базовые правила безусловные (мобильный порядок), десктопные — строго
   внутри медиа-запроса от 900px: блок стоит ниже мобильных в файле
   и без медиа перебил бы их. */

.plan-devices {
  display: flex; align-items: center; gap: var(--s2);
  margin-top: var(--s3); padding-top: var(--s3);
  border-top: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
}
.plan.accent .plan-devices { border-top-color: var(--accent); }

.ico-dev { width: 20px; height: 20px; flex-shrink: 0; color: var(--ink-soft); }
.plan.accent .ico-dev { color: var(--ink); }

/* «всё из Базового, плюс:» — связка между соседними тарифами */
.plan-includes {
  margin-top: var(--s4);
  font-family: var(--font-accent);
  font-style: italic; font-size: 17px; color: var(--ink-soft);
}
.plan-includes + .plan-points { margin-top: var(--s2); }

/* разовая покупка: карточка во всю ширину под тремя тарифами.
   display:block вместо унаследованного от .plan флекса — обычный поток
   гарантированно обнимает содержимое; блок инфраструктуры выпадал наружу. */
.plan-single { display: block; margin-top: var(--s4); }
.plan-single-cols {
  display: grid; gap: var(--s4); margin-top: var(--s4);
  align-items: start;   /* колонки по своей высоте, ряд — по самой высокой */
}
.plan-single .plan-points { margin: 0; }
.plan-single .infra { align-self: start; }

/* инфраструктура при разовой — не мелкий шрифт-ловушка, а честный блок */
.infra {
  padding: var(--s3) var(--s4);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.infra-title {
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: var(--s2);
}
.infra-list { margin: 0; padding: 0; list-style: none; }
.infra-list li {
  position: relative; padding-left: 16px; margin-bottom: 6px;
  font-size: 13px; line-height: 1.5;
}
.infra-list li:last-child { margin-bottom: 0; }
.infra-list li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 6px; height: 1.5px; background: var(--accent);
}

.plan-notes { margin-top: var(--s4); }
.plan-note {
  margin: 0 0 var(--s2);
  font-size: 13px; line-height: 1.5; color: var(--ink-soft);
  max-width: 78ch;
}
.plan-note:last-child { margin-bottom: 0; }

/* --- счётчик устройств в «Доступах» --- */
.devices-line {
  display: flex; align-items: flex-start; gap: var(--s3);
  margin-bottom: var(--s4); padding: var(--s3) var(--s4);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.devices-body { min-width: 0; }
.devices-count { font-size: 14px; }
.devices-count b { font-variant-numeric: tabular-nums; }
.devices-sub { margin-top: 3px; font-size: 12px; color: var(--ink-soft); }

/* превышение лимита: терракота, но блокировки нет — это витрина */
.devices-line.is-over {
  background: rgba(var(--terra-rgb), .10);
  border-color: var(--k-call);
}
.devices-line.is-over .ico-dev,
.devices-line.is-over .devices-count b { color: var(--terra-text); }
.devices-warn {
  margin-top: 3px; font-size: 12px; line-height: 1.5;
  color: var(--terra-text); font-weight: 600;
}

/* Две колонки только с 1100px: на 900–1099 пунктам и инфраструктуре тесно,
   там инфраструктура встаёт под списком на всю ширину карточки. */
@media (min-width: 1100px) {
  .plan-single-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 899px) {
  /* тарифы в столбик — .plans и так одна колонка, здесь только плотность */
  .plan-includes { font-size: 16px; }
  .plan-note { font-size: 12px; }
  .devices-line { padding: var(--s3); }
}

/* ------------------------------------------------ карточка в узкой колонке
   Список абонементов живёт в правой колонке и стал уже: бейдж не должен
   сжиматься, а мета-строка обязана переноситься по разделителям. */
.card-side { flex-shrink: 0; text-align: right; }

.sub-meta {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 4px 0;
  margin-top: 10px;
}
.sub-meta span { white-space: nowrap; }
.sub-meta span + span::before {
  content: '·';
  margin: 0 7px;
  color: var(--accent);
}

/* ------------------------------------------------ сообщество и код продажи */

/* Сообщество — спокойная поверхность без акцентной рамки:
   акцент на странице один, у тарифа «Стандарт». */
.community { margin-top: var(--s4); }
.community h2 { font-size: 18px; margin-bottom: var(--s3); }
.community-line { margin: 0 0 var(--s2); font-size: 14px; line-height: 1.6; max-width: 78ch; }
.community-line:last-of-type { margin-bottom: var(--s4); }
.community-btn { display: inline-flex; text-decoration: none; }

/* Код проданного абонемента: его диктуют вслух с экрана,
   поэтому крупно, моноширинно и с разрядкой. */
.code-big {
  margin: var(--s4) 0;
  padding: var(--s3) var(--s4);
  background: var(--surface-sunken);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-weight: 700; font-size: 34px;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  word-break: break-all;
}

@media (max-width: 899px) {
  .code-big { font-size: 28px; }
  .community-btn { width: 100%; }
}

/* ============================================================
   ВКЛАДКА «МАСТЕРА»: сетка графиков, боковая панель, карточки.
   Мобильный вид — базовый: сетка разворачивается в список
   «мастер → его неделя строками», панель занимает весь экран.
   ============================================================ */

/* --- навигация по периоду над сеткой --- */
.sched-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4);
  margin-bottom: var(--s3);
}
.sched-nav-group { display: flex; align-items: center; gap: var(--s2); }
.sched-step {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 20px; line-height: 1; cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.sched-step:hover { background: var(--tint); border-color: var(--accent); }
.sched-period {
  font-weight: 600; min-width: 9.5em; text-align: center;
  font-variant-numeric: tabular-nums;
}
.sched-month { color: var(--ink-soft); min-width: 8.5em; text-align: center; }
/* «Сегодня» гаснет, когда сегодняшний день и так в окне: нажимать её незачем */
.sched-today.is-on { opacity: .5; }

/* Пока едет запрос следующей недели, сетка гаснет — но не исчезает:
   мигание пустотой читается как сбой. */
[data-sched-box].is-loading { opacity: .55; transition: opacity var(--ease); }

/* --- сетка мастера × дни --- */
.sched-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  /* Системную полосу прячем: под сеткой лежит своя, всегда видимая
     и в палитре вертикали. Две полосы разом читались бы как сбой. */
  scrollbar-width: none;
}
.sched-scroll::-webkit-scrollbar { height: 0; }

/* Свой ползунок под сеткой */
.sched-bar {
  height: 10px; margin-top: var(--s2);
  background: var(--surface-sunken);
  border: 1px solid var(--line); border-radius: 999px;
  position: relative; touch-action: none;
}
.sched-bar-thumb {
  position: absolute; top: -1px; bottom: -1px; left: 0;
  min-width: 40px; border-radius: 999px;
  background: var(--accent); border: 1px solid var(--accent);
  cursor: grab;
}
.sched-bar-thumb:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.sched-bar-thumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sched-bar.is-drag .sched-bar-thumb { cursor: grabbing; background: var(--ink-soft); }

.sched { border-collapse: separate; border-spacing: 0; width: 100%; }

/* Прошлые дни видно, но они приглушены: посмотреть, кто работал на той
   неделе, нужно регулярно, а править задним числом — почти никогда. */
.sched-day.is-past { opacity: .55; }
.sched-cell.is-past .cell { opacity: .5; }
.sched-cell.is-past .cell:hover { opacity: .8; }

/* На телефоне таблица перестаёт быть таблицей: заголовок-строка уезжает,
   каждая строка мастера становится карточкой, а ячейки — строками «день → время».
   Подпись дня берётся из data-day: шапка сюда уже не дотягивается. */
.sched thead { display: none; }
.sched, .sched tbody, .sched tr, .sched th, .sched td { display: block; }

.sched tr {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--s4);
  overflow: hidden;
}
.sched tr.is-off-duty { opacity: .62; }

.sched-master {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--surface-accent);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.sched-name {
  font-family: var(--font-head); font-weight: 700;
  font-size: 15px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink); background: none; border: 0; padding: 0;
  cursor: pointer; min-height: var(--tap);
}
.sched-badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--warn); border: 1px solid currentColor;
  border-radius: 999px; padding: 1px 8px;
}

.sched-cell {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s4);
  border-top: 1px solid var(--line);
}
.sched-cell:first-of-type { border-top: 0; }
.sched-cell::before {
  content: attr(data-day);
  flex: 0 0 74px;
  font-size: 13px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .04em;
}
.sched-cell.is-today::before { color: var(--ink); font-weight: 700; }

.cell {
  flex: 1 1 auto; min-height: var(--tap);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: var(--s2) var(--s3);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-sunken); color: var(--ink);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.cell:hover { border-color: var(--accent); }
.cell-work   { background: var(--tint); }
.cell-custom { background: var(--tint); border-color: var(--accent); border-style: dashed; }
.cell-off    { color: var(--warn); text-decoration: line-through; }
.cell-empty  { color: var(--ink-soft); }
.cell-time   { font-weight: 600; letter-spacing: .01em; }
.cell-mark   { font-size: 11px; color: var(--ink-soft); }

.sched-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  font-size: 13px; color: var(--ink-soft); margin-top: var(--s3);
}
.lg { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.lg-work   { background: var(--tint); }
.lg-custom { background: var(--tint); border: 1px dashed var(--accent); }
.lg-off    { background: var(--surface-sunken); border: 1px solid var(--warn); }
.sched-legend .lg:not(:first-child) { margin-left: var(--s3); }

/* --- карточки мастеров --- */
.master-card.is-off-duty { opacity: .68; }
.master-head { display: flex; justify-content: space-between; gap: var(--s3); align-items: flex-start; }
.master-head h2 { margin: 0 0 2px; }
.master-who { display: flex; gap: var(--s3); align-items: center; }
/* Фото — круглое и одного размера у всех: снимки приходят разные, а список
   должен читаться как список, а не как коллаж. */
.master-ava {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  background: var(--tint); flex: none; display: block;
}
.master-ava-blank {
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; color: var(--ink-soft);
}
/* Загрузка фото в карточке */
.photo-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.photo-preview {
  width: 84px; height: 84px; border-radius: 14px; object-fit: cover;
  border: 1px solid var(--line);
}
.photo-blank {
  width: 84px; height: 84px; border-radius: 14px; display: grid; place-items: center;
  border: 1px dashed var(--line); color: var(--ink-soft); font-size: 12px;
  background: var(--surface-sunken);
}
.photo-row .btn-row { flex: 1 1 160px; }
.fld-check { display: flex; align-items: center; gap: var(--s2); font-size: 15px; }
/* Держатели абонемента: до трёх человек на код */
.holder-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; margin: 0 6px 6px 0; font-size: 14px;
}
.holder-chip button {
  border: 0; background: none; color: var(--ink-soft); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px;
}
.fld-check input { width: 18px; height: 18px; }
.master-sched {
  font-family: var(--font-accent); font-style: italic;
  font-size: 18px; color: var(--ink); margin: var(--s3) 0;
}
.master-tags { display: flex; flex-wrap: wrap; gap: var(--s2); }
.tag {
  font-size: 13px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-sunken); border: 1px solid var(--line);
}
.master-off { margin-top: var(--s4); }
.master-off-title {
  display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); margin-bottom: var(--s2);
}
.off-chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 13px; padding: 4px 6px 4px 10px; margin: 0 var(--s2) var(--s2) 0;
  border-radius: 999px; background: var(--surface-sunken); border: 1px solid var(--warn);
  color: var(--warn);
}
.off-chip button {
  background: none; border: 0; color: inherit; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 0 4px; min-height: 28px;
}
.master-foot { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.master-foot .btn { flex: 1 1 auto; }

/* --- боковая панель и модалка --- */
.panel-scrim {
  position: fixed; inset: 0; z-index: 55;   /* поверх нижнего бара, под панелью */
  background: rgba(var(--shadow-rgb), .38);
  backdrop-filter: blur(2px);
}
/* Выше нижнего бара (z-index 50): панель раскрывается во весь экран, и бар,
   нарисованный позже в разметке, накрывал её кнопки «Отмена» и «Сохранить». */
.panel, .master-modal {
  position: fixed; z-index: 60;
  background: var(--paper);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lift);
}
/* телефон: панель во весь экран — иначе форма не помещается */
.panel, .master-modal { inset: 0; border-radius: 0; }

.panel-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3);
  padding: var(--s4); border-bottom: 1px solid var(--line);
  background: var(--surface-accent);
}
.panel-head h2 { margin: 0; }
.panel-head .muted { margin: 2px 0 0; }
.panel-close {
  background: none; border: 0; font-size: 26px; line-height: 1;
  color: var(--ink); cursor: pointer; min-width: var(--tap); min-height: var(--tap);
}
.panel-body { flex: 1 1 auto; overflow-y: auto; padding: var(--s4); }
.panel-foot {
  display: flex; gap: var(--s2); padding: var(--s4);
  padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface-glass);
}
.panel-foot .btn { flex: 1 1 auto; }

.panel-block { margin-top: var(--s5); }
.panel-label {
  display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); margin-bottom: var(--s2);
}
.panel-hint { margin: var(--s2) 0 0; }
.panel-row { display: flex; gap: var(--s2); }
.panel-mode {
  display: flex; flex-direction: column; gap: var(--s2);
  margin-top: var(--s4); padding: var(--s3);
  background: var(--surface-sunken); border-radius: var(--radius-sm);
}
.panel-mode label { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); }
/* Глобальное правило для input тянет поля на всю ширину — радиокнопке это
   превращает кружок в полосу. Возвращаем ей собственный размер. */
.panel-mode input[type="radio"] {
  flex: 0 0 auto; width: 20px; height: 20px; min-height: 20px;
  accent-color: var(--ink);
}

.iv-row { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.iv-row input { flex: 1 1 auto; }
.iv-drop {
  background: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink-soft); cursor: pointer;
  min-width: var(--tap); min-height: var(--tap); font-size: 18px;
}
.iv-drop:hover { color: var(--danger); border-color: var(--danger); }

.panel input[type="time"], .panel input[type="date"], .panel input[type="text"],
.master-modal input {
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px var(--s3);
  min-height: var(--tap); width: 100%;
}
.fld { display: flex; align-items: center; gap: var(--s2); flex: 1 1 0; }
.fld > span { font-size: 13px; color: var(--ink-soft); }
.fld-col { display: block; margin-bottom: var(--s3); }
.fld-col > span {
  display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); margin-bottom: 4px;
}
.checks { display: flex; flex-direction: column; gap: var(--s1); }
.check { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); }
.check input { width: auto; min-height: auto; }

/* Шапка «Записей»: заголовок-подсказка и кнопка новой записи в одной строке */
.bookings-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
}
.bookings-head .page-note { margin: 0; }

/* Сетка времени в форме записи. Занятое не исчезает, а гаснет: администратор
   видит не только «куда можно», но и «почему нельзя». */
.nb-times { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s2); }
.nb-time {
  min-width: 64px; min-height: 38px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.nb-time.is-on { background: var(--tint); border-color: var(--accent); font-weight: 600; }
.nb-time.is-busy { opacity: .35; cursor: default; text-decoration: line-through; }

/* Кабинет в карточке записи: назначен автоматически, меняется одной кнопкой */
.room-line {
  display: flex; align-items: baseline; gap: var(--s2);
  margin-top: 6px; font-size: 13px; color: var(--ink-soft);
}
.room-move {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 12px; color: var(--ink-soft); text-decoration: underline dotted;
}
.room-move:hover { color: var(--ink); }

/* Услуги мастера с переопределениями. Поля цены и длительности приглушены,
   пока услуга не отмечена: сначала «делает или нет», потом «почём». */
.svc-rows { display: flex; flex-direction: column; gap: var(--s1); }
.svc-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); flex-wrap: wrap;
  padding: var(--s1) 0; border-bottom: 1px solid var(--line);
}
.svc-row:last-child { border-bottom: 0; }
.svc-over { display: flex; align-items: center; gap: 5px; opacity: .45; margin-left: auto; }
.svc-row.is-on .svc-over { opacity: 1; }
.svc-over input { width: 58px; min-height: 38px; text-align: right; padding: 4px 6px; }
.svc-unit { font-size: 12px; color: var(--ink-soft); }

/* Подключение уведомлений мастеру */
.notify-state {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s2);
}
.notify-link {
  margin-top: var(--s2); padding: var(--s3);
  background: var(--surface-sunken);
  border: 1px solid var(--line); border-radius: var(--radius);
}
/* Ссылку показываем текстом: в студии её чаще пересылают с телефона,
   где копирование из невидимого поля невозможно. Перенос по любому символу —
   иначе длинный токен растягивает панель по горизонтали. */
.notify-link code {
  display: block; margin-bottom: var(--s2);
  font-size: 13px; word-break: break-all; color: var(--ink);
}
.notify-manual { margin-top: var(--s2); }
.notify-manual summary {
  cursor: pointer; color: var(--ink-soft); font-size: 13px;
  min-height: var(--tap); display: flex; align-items: center;
}
.notify-manual summary:hover { color: var(--ink); }

/* Форма новой услуги внутри карточки мастера: утоплена, чтобы читалась
   как часть блока специализаций, а не как вторая карточка поверх первой. */
.svc-new {
  margin-top: var(--s3); padding: var(--s3);
  background: var(--surface-sunken);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.svc-new .fld-col { margin-bottom: var(--s2); }

/* Список услуг в карточке мастера: что делает и почём именно у него */
.master-svc { display: flex; flex-direction: column; gap: 2px; }
.master-svc-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s2); font-size: 14px;
}
.master-svc-name { min-width: 0; }
.master-svc-terms { color: var(--ink-soft); white-space: nowrap; font-size: 13px; }
.master-svc-terms i { font-style: italic; }
.master-svc-row.is-own .master-svc-terms { color: var(--ink); }

/* --- мини-календарь --- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.cal-head span { font-weight: 600; text-transform: capitalize; }
.cal-head button {
  background: none; border: 0; font-size: 20px; color: var(--ink);
  cursor: pointer; min-width: var(--tap); min-height: var(--tap);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { font-size: 11px; color: var(--ink-soft); text-align: center; padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1; min-height: 36px;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; color: var(--ink); cursor: pointer;
}
.cal-day:hover { background: var(--surface-sunken); }
.cal-day.is-today { border-color: var(--accent); }
.cal-day.is-sel { background: var(--ink); color: var(--paper); }

@media (min-width: 900px) {
  /* Десктоп: сетка снова становится таблицей — дни идут колонками,
     первый столбец липкий, чтобы имя мастера не уезжало при скролле. */
  .sched { display: table; width: 100%; }
  .sched thead { display: table-header-group; }
  .sched tbody { display: table-row-group; }
  .sched tr { display: table-row; background: none; border: 0; box-shadow: none; margin: 0; border-radius: 0; }
  .sched th, .sched td { display: table-cell; }

  .sched-day {
    padding: var(--s2); text-align: center; min-width: 96px;
    font-size: 12px; color: var(--ink-soft); font-weight: 600;
    border-bottom: 1px solid var(--line);
  }
  .sched-day.is-weekend { color: var(--warn); }
  .sched-day.is-today { color: var(--ink); background: var(--surface-accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .sched-wd { display: block; text-transform: uppercase; letter-spacing: .06em; }
  .sched-num { display: block; font-size: 16px; color: var(--ink); }

  /* Липкая колонка с именами. Собственный фон обязателен: под ней проезжают
     ячейки, и прозрачная колонка показывала бы их сквозь имя. Левый отступ
     не ноль — прижатый к самому краю контейнера текст режется его границей
     (ровно это давало «АЛОМЕ» вместо «САЛОМЕ» при прокрутке).
     Правая граница отделяет колонку от уезжающей сетки. */
  .sched-corner, .sched-master {
    position: sticky; left: 0; z-index: 3;
    background: var(--paper); text-align: left;
    padding: var(--s3); min-width: 168px; width: 168px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    display: table-cell; flex-direction: unset;
  }
  /* Тень вправо появляется только когда под колонку что-то заехало —
     иначе на непрокрученной сетке она выглядит случайной полосой. */
  .sched-scroll.is-scrolled .sched-corner::after,
  .sched-scroll.is-scrolled .sched-master::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 100%;
    width: 10px; pointer-events: none;
    background: linear-gradient(to right, rgba(var(--shadow-rgb), .10), transparent);
  }
  .sched-corner {
    font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-soft); font-weight: 600;
  }
  .sched-cell {
    display: table-cell; padding: 3px; vertical-align: top;
    border-top: 0; border-bottom: 1px solid var(--line);
  }
  .sched-cell::before { content: none; }
  .sched-cell.is-today { background: var(--surface-accent); }
  .cell { min-height: 56px; align-items: center; text-align: center; }

  /* Панель — ящик справа, как в референсе; модалка мастера — по центру. */
  .panel {
    inset: 0 0 0 auto; width: min(420px, 92vw);
    border-left: 1px solid var(--line);
  }
  .master-modal {
    inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(560px, 92vw); max-height: 86vh;
    border-radius: var(--radius-lg);
  }
  .checks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1) var(--s3); }
  .master-foot .btn { flex: 0 0 auto; }
}

/* Записи вне графика мастера и гашение закрытых дней.
   График могли поменять уже после записи — терять её нельзя, но и делать
   вид, что всё в порядке, тоже: плашка адресует администратора к клиенту. */
.astray {
  margin: var(--s2) 0 0; font-size: 12px; color: var(--warn);
  border-left: 2px solid var(--warn); padding-left: var(--s2);
}
.master-group.is-closed, td.is-closed { opacity: .55; }
td.is-closed { background: repeating-linear-gradient(135deg,
  transparent, transparent 6px, rgba(var(--accent-rgb), .22) 6px, rgba(var(--accent-rgb), .22) 12px); }
.off-mark {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--warn); border: 1px solid currentColor;
  border-radius: 999px; padding: 1px 8px; margin-left: var(--s2);
}

/* Пара селектов вместо <input type="time">: нативное поле показывает AM/PM
   при английском языке интерфейса браузера, а демо открывают с разных
   устройств. Шаг минут — 30, часы полные сутки. */
.tp {
  display: inline-flex; align-items: center; gap: 2px; flex: 1 1 auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 var(--s2);
}
.tp i { font-style: normal; color: var(--ink-soft); }
.tp select {
  border: 0; background: none; padding: 10px 2px; min-height: var(--tap);
  font: inherit; font-size: 16px; color: var(--ink);
  width: auto; -webkit-appearance: none; appearance: none; text-align: center;
}
.tp select:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Крупное уведомление о событии: по центру сверху, поверх всего.
   Отмена записи — единственное, из-за чего администратор бросает дела,
   поэтому карточка не гаснет сама и требует нажатия. */
.alert-card {
  position: fixed; z-index: 70;
  top: var(--s4); left: 50%; transform: translate(-50%, -12px);
  width: min(520px, calc(100vw - 2 * var(--s4)));
  background: var(--surface); border: 1px solid var(--warn);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lift);
  opacity: 0; transition: opacity var(--ease), transform var(--ease);
}
.alert-card.show { opacity: 1; transform: translate(-50%, 0); }
.alert-body { padding: var(--s4) var(--s4) var(--s3); }
.alert-kind {
  display: inline-block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--warn);
  border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px;
}
.alert-card h3 { margin: var(--s2) 0 var(--s1); font-size: 17px; }
.alert-card p { margin: 0; color: var(--ink-soft); white-space: pre-line; }
.alert-foot {
  display: flex; gap: var(--s2); padding: 0 var(--s4) var(--s4);
}
.alert-foot .btn { flex: 1 1 auto; }

/* Предварительная запись в «Записях» */
.pending-mark {
  display: inline-block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--warn);
  border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px;
  margin-bottom: var(--s2);
}
.master-tg { margin: calc(-1 * var(--s2)) 0 var(--s3); font-size: 13px; }


/* Монограмма вместо логотипа: у вертикали без своего файла (см. [studio].logo)
   шапка и вход не должны показывать битую картинку. */
.logo-mono {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-head); font-weight: 700; font-size: 20px;
  letter-spacing: .04em;
}
.logo-mono.lg { width: 88px; height: 88px; font-size: 38px; }


/* ============================================================
   КАРТОЧКА КЛИЕНТА: правка полей
   ============================================================ */

/* Форма правки живёт прямо в карточке — отдельная страница «редактировать»
   ради четырёх полей была бы лишним шагом. Поля тянутся на всю ширину:
   на телефоне это единственный работающий вариант. */
.client-form textarea {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px var(--s3);
  width: 100%; font: inherit; color: var(--ink); resize: vertical;
}
.client-form .btn { width: 100%; margin-top: var(--s1); }

/* Факты из истории — под формой и не полем ввода: их правка означала бы
   подделку истории (см. repo.update_client). */
.client-facts {
  margin-top: var(--s4); padding-top: var(--s3);
  border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 14px;
}
.client-facts strong { color: var(--ink); font-weight: 600; }

@media (min-width: 900px) {
  /* Десктоп: источник и язык встают в строку — оба поля короткие */
  .client-form .fld-row { display: flex; gap: var(--s3); }
  .client-form .fld-row > .fld-col { flex: 1 1 0; }
  .client-form .btn { width: auto; min-width: 180px; }
}


/* ============================================================
   КОНТАКТЫ КЛИЕНТА: строка каналов
   ============================================================ */

/* Одна строка на все каналы: админ должен увидеть их взглядом, а не читать
   таблицу с прочерками. Пустые каналы в разметку не попадают вовсе
   (см. contact_links в core/contacts.py), поэтому строка всегда плотная. */
.contact-row {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  margin: 0 0 var(--s3);
}
.contact-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px var(--s3); min-height: 34px;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; color: var(--ink); text-decoration: none;
  max-width: 100%;
}
.contact-chip svg { width: 15px; height: 15px; flex: none; opacity: .75; }
.contact-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-chip:not(.is-plain):hover { border-color: var(--accent); background: var(--tint); }
/* Справочные значения (дата рождения, email без ссылки) — тише кликабельных */
.contact-chip.is-plain { color: var(--ink-soft); }

/* Тап-зона: чип визуально ниже 44px, добираем псевдоэлементом — как везде */
.contact-chip { position: relative; }
.contact-chip::after { content: ''; position: absolute; inset: -5px 0; }

/* Заметка о клиенте в шапке диалога: тот же текст, что в карточке. */
.thread-note {
  margin: 0 0 var(--s2); padding: var(--s2) var(--s3);
  background: var(--tint); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink);
}


/* ============================================================
   ПРОФИЛЬ: кнопка в шапке и блоки на странице
   ============================================================ */

/* Кнопка профиля заняла место прежней строки расхода ИИ. Цифра висела
   на каждой странице и каждый раз спрашивала «это про меня?»; смотрят её
   раз в неделю — теперь она внутри профиля. */
.me {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 6px var(--s3); min-height: 34px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-sunken);
  font-size: 13px; color: var(--ink-soft); text-decoration: none;
  white-space: nowrap; max-width: 220px;
}
.me:hover { color: var(--ink); border-color: var(--accent); }
.me.active { background: var(--tint); border-color: var(--accent); color: var(--ink); }
.me svg { width: 18px; height: 18px; flex: none; }
.me-name { overflow: hidden; text-overflow: ellipsis; }

/* На телефоне в шапке места нет: остаётся значок, имя уходит — иначе
   элемент раздувает шапку и ломает подзаголовок студии на три строки. */
@media (max-width: 899px) {
  .me { padding: 4px; min-height: 32px; border-radius: 50%; }
  .me-name { display: none; }
}

/* Расход ИИ на странице профиля */
.ai-figures {
  display: flex; flex-wrap: wrap; gap: var(--s5);
  margin-bottom: var(--s3);
}
.ai-big { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--ink); }
.ai-rows { margin-top: var(--s3); }
.ai-row {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: 6px 0; border-top: 1px solid var(--line);
}
.ai-row span:first-child { flex: 1 1 auto; }
.ai-row b { font-variant-numeric: tabular-nums; }
.ai-tokens { margin: var(--s3) 0 0; font-size: 12px; }
.over-limit { color: var(--warn); }

/* ============================================================
   БЕЙДЖИ ВМЕСТО ГОЛЫХ ЧИСЕЛ И ПОМЕТКИ АРХИВА
   ============================================================ */

/* Бейдж остатка по абонементу: иконка + число + слово. Голая цифра рядом
   с именем читалась как что угодно — визиты, скидка, номер. */
.badge-ico { width: 14px; height: 14px; flex: none; }
.badge b { font-weight: 700; }
.badge-word { opacity: .8; }
/* Один сеанс или ноль — повод предложить продление, и это должно быть видно */
.badge-sub.is-low {
  background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn);
}

/* Архив: строка гаснет, но остаётся читаемой — её открывают, чтобы вернуть */
.client-line.is-archived { opacity: .6; }
.tag-archived {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
.archived-note {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4);
}
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
}
.list-head .page-note { margin: 0; }

/* Поиск по списку: поле с иконкой, во всю ширину строки заголовка */
.search {
  display: flex; align-items: center; gap: var(--s2);
  flex: 1 1 260px; min-width: 200px;
  padding: 0 var(--s3); min-height: var(--tap);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px;
}
.search svg { width: 16px; height: 16px; flex: none; color: var(--ink-soft); }
.search input {
  border: 0; background: none; padding: 0; min-height: auto;
  font: inherit; color: var(--ink); width: 100%;
}
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--accent); }
.search-empty { margin-top: var(--s4); }

/* Поиск внутри выпадающего списка — над самим списком */
.picker-search { margin-bottom: var(--s2); }
.head-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.btn-quiet.is-on { background: var(--tint); border-color: var(--accent); }

/* Опасная зона: удаление без возврата. Рамка предупреждает до нажатия. */
.danger-zone { border-color: var(--danger-line); }
.danger-zone h2 { color: var(--danger); }
.btn-danger {
  background: var(--danger); color: var(--paper); border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); opacity: .9; }
.footprint { margin: 0 0 var(--s3); padding-left: 1.1em; color: var(--ink-soft); }
.footprint b { color: var(--ink); }

/* Отменённая запись: видна, но не спорит за внимание с теми, кто придёт */
.card.is-cancelled, .mini.is-cancelled { opacity: .55; }
.card.is-cancelled .slot-time, .mini.is-cancelled .t { text-decoration: line-through; }

/* ============================================================
   ЗАПИСИ: компактная сетка в двух режимах
   Прежние карточки занимали по 140px на запись — на экран влезало
   полтора мастера. Здесь высота плашки равна длительности сеанса,
   а действия появляются по клику, а не занимают место всегда.
   ============================================================ */

.bk-nav {
  display: flex; align-items: center; gap: var(--s2) var(--s3);
  flex-wrap: wrap; margin-bottom: var(--s3);
}
.bk-nav-group { display: flex; align-items: center; gap: var(--s2); }
.bk-period { font-weight: 600; min-width: 11em; text-align: center; }
.bk-nav .spacer { flex: 1 1 auto; }

/* переключатель режима */
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: var(--surface);
}
.seg a {
  padding: 0 var(--s4); min-height: var(--tap);
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; cursor: pointer;
}
.seg a.on { background: var(--ink); color: var(--paper); }

/* Переключатель во всю ширину формы: «себе / в подарок» — первое решение
   продавца, и половинки должны быть равными, чтобы палец попадал не глядя. */
.seg-wide { display: flex; width: 100%; margin-bottom: var(--s3); }
.seg-wide a { flex: 1; justify-content: center; }

/* История абонемента: про людей, а не про деньги. Свёрнута по умолчанию —
   в обычный день администратору нужен остаток, а не биография кода. */
.sub-history { margin-top: var(--s2); }
.sub-history summary {
  cursor: pointer; font-size: 13px; min-height: var(--tap);
  display: flex; align-items: center;
}
.sub-event {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 13px; padding: 2px 0 2px var(--s3);
  border-left: 2px solid var(--line);
}

/* --- ДЕНЬ --- */
/* Минута шкалы в пикселях. Всё остальное считается из неё, поэтому
   масштаб меняется одной строкой и сервер об этом не знает. */
.dayview { --minpx: .9; --axis: 54px; --colw: 1fr; overflow-x: auto; }
/* Одна и та же раскладка у шапки и у тела: считают они её от `--cols`,
   а не от собственной ширины, иначе при прокрутке колонки разъезжаются. */
.dv-head, .dv-body {
  display: grid;
  grid-template-columns: var(--axis) repeat(var(--cols, 3), var(--colw));
  min-width: max-content;
}
.dv-head {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-accent); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.dv-corner, .dv-master {
  padding: var(--s2) var(--s3); font-size: 13px; font-weight: 600;
  border-left: 1px solid var(--line);
}
.dv-corner {
  border-left: 0; color: var(--ink-soft); font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em;
}
.dv-master.is-off { color: var(--ink-soft); }
.dv-master .off-mark {
  display: block; font-size: 11px; font-weight: 400; color: var(--warn);
}
.dv-body {
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface); overflow: hidden;
}
/* Полчаса сверху и снизу — чтобы первая и последняя метки времени
   не упирались в шапку и в край. */
.dv-axis, .dv-col {
  position: relative;
  height: calc(var(--rows) * var(--minpx) * 1px);
  margin: calc(var(--minpx) * 15px) 0;
}
.dv-col { border-left: 1px solid var(--line); }
.dv-hour {
  position: absolute; right: 6px; top: calc(var(--top) * var(--minpx) * 1px);
  transform: translateY(-50%);
  font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.dv-line {
  position: absolute; left: 0; right: 0; top: calc(var(--top) * var(--minpx) * 1px);
  border-top: 1px solid var(--line);
}
.dv-line.is-half { border-top-style: dotted; opacity: .55; }
/* Нерабочее время штрихуется, рабочее остаётся чистым. Штриховка заметнее
   заливки: «сюда записывать не следует» должно читаться боковым зрением,
   а не сравнением двух похожих оттенков. */
.dv-col { background: repeating-linear-gradient(135deg,
            transparent 0 7px, rgba(var(--ink-rgb), .045) 7px 14px); }
.dv-work {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top) * var(--minpx) * 1px);
  height: calc(var(--len) * var(--minpx) * 1px);
  background: var(--surface);
}

/* --- плашка записи --- */
.bk {
  position: relative; z-index: 1;
  background: var(--tint); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 3px 7px;
  font-size: 12.5px; cursor: pointer; overflow: hidden;
}
.dv-col .bk {
  position: absolute; left: 3px; right: 3px;
  top: calc(var(--top) * var(--minpx) * 1px);
  height: calc(var(--len) * var(--minpx) * 1px);
}
/* Выбранная плашка не растёт — действия уехали в панель под сеткой */
.bk.is-sel { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 4; }
.bk-head { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.bk-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.bk-who { overflow: hidden; text-overflow: ellipsis; }
.bk-ico { margin-left: auto; display: inline-flex; gap: 4px; flex: none; }
.bk-ico svg { width: 13px; height: 13px; }
.bk-ico .ok { color: var(--ok); }
.bk-ico .bad { color: var(--danger); }
.bk-ico .wait { color: var(--warn); }
.bk-svc {
  color: var(--ink-soft); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bk-mark { font-size: 11px; color: var(--warn); }
.bk.came { background: var(--ok-bg); border-color: var(--ok-line); }
/* «Подтвердил» — между «ожидается» и «пришёл», и цвет должен читаться так же:
   мягкий акцент студии вместо зелени факта. Вечером в сетке видно, кого уже
   обзвонили, не вглядываясь в подписи. */
.bk-new {
  font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 4px; border-radius: 4px;
  background: var(--accent); color: var(--paper);
}
.bk-ico .rem { width: 13px; height: 13px; opacity: .65; }

/* Ждёт предоплаты: место придержано, но денег ещё нет. Пунктир говорит
   «не окончательно» — так же, как у закрытого дня в календаре. */
.bk.prepay {
  background: var(--warn-bg); border-color: var(--warn-line);
  border-style: dashed;
}

.bk.confirmed {
  background: var(--surface-accent); border-color: var(--accent);
}
.bk.no_show { background: var(--danger-bg); border-color: var(--danger-line); }
.bk.pending { border-style: dashed; }
.bk.cancelled { opacity: .55; }
.bk.cancelled .bk-time { text-decoration: line-through; }
.bk.is-astray { border-color: var(--warn); }
/* Плашка, только что изменившаяся при автообновлении: короткая вспышка,
   чтобы администратор заметил чужое действие, а не искал разницу глазами. */
.bk.is-fresh { animation: bk-flash 1.2s ease-out; }
@keyframes bk-flash {
  0% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .55); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}
/* Панель действий выбранной записи: всегда на одном месте, ничего не
   перекрывает и одинаково работает на телефоне. */
.bk-panel {
  margin-top: var(--s3); padding: var(--s3);
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.bk-panel-head { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s2); }
.bk-panel-head .panel-close { margin-left: auto; }
.bk-act { display: flex; flex-wrap: wrap; gap: var(--s2); }
/* Кнопка, ставшая вопросом. Тихое подтверждение — только обводка; громкое
   (неявка, отмена) — цветом: последствия там серьёзнее и должны выглядеть
   иначе, чем обычное «пришёл». */
.btn.is-asking { border-color: var(--ink); font-weight: 700; }
.btn.is-asking.is-loud {
  background: var(--danger-bg); border-color: var(--danger); color: var(--danger);
}
.btn[disabled] { opacity: .45; cursor: default; }
.bk-act .btn { font-size: 13px; }

/* --- НЕДЕЛЯ --- */
.weekview { overflow-x: auto; }
/* Фиксированная раскладка: без неё длинное имя клиента забирает половину
   таблицы, а соседний день сжимается в три строки по букве. */
.wv {
  border-collapse: separate; border-spacing: 0;
  width: 100%; min-width: 900px; table-layout: fixed;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.wv th, .wv td { border-bottom: 1px solid var(--line); vertical-align: top; padding: 5px 6px; }
.wv thead th {
  background: var(--surface-accent); font-size: 12px; font-weight: 600;
  text-align: center; position: sticky; top: 0; z-index: 2;
}
.wv thead th.is-today { background: var(--tint); }
.wv-corner, .wv-master {
  position: sticky; left: 0; z-index: 3; background: var(--paper);
  text-align: left; width: 140px; border-right: 1px solid var(--line);
  font-family: var(--font-head); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.wv td.is-closed { background: var(--surface-sunken); }
.wv-empty { color: var(--ink-soft); font-size: 12px; }
/* В неделе запись — одна строка: время, имя, иконки. Услуга и длительность
   остаются в подсказке, иначе семь дней не помещаются на экран. */
.weekview .bk { margin-bottom: 3px; }
.weekview .bk-svc, .weekview .bk-mark { display: none; }
.weekview .bk-who { min-width: 0; }

.bk-legend {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4);
  font-size: 12px; color: var(--ink-soft); margin-top: var(--s3);
}
.bk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sw-expected { background: var(--tint); border: 1px solid var(--accent); }
.sw-came { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.sw-confirmed { background: var(--surface-accent); border: 1px solid var(--accent); }
.sw-no_show { background: var(--danger-bg); border: 1px solid var(--danger-line); }
.sw-pending { background: var(--tint); border: 1px dashed var(--accent); }
.sw-off { background: var(--surface); border: 1px solid var(--warn); }

/* Телефон: колонок мастеров в ширину не хватает — день прокручивается вбок,
   а неделя и так со своей прокруткой. */
@media (max-width: 899px) {
  /* На телефоне колонка фиксированной ширины: ужимать её до трети экрана
     значит превратить имя клиента в три буквы. День прокручивается вбок. */
  .dayview { --colw: 168px; }
  .bk-period { min-width: auto; }
  .bk-nav { gap: var(--s2); }
}

/* ============================================================
   ПРИЁМ ОПЛАТЫ: абонемент, доплата, деньги
   ============================================================ */
.pay-modal { max-width: 520px; }
.pay-sum {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: var(--s3); margin-bottom: var(--s3);
  background: var(--surface-sunken); border-radius: var(--radius);
}
.pay-sum b { font-family: var(--font-head); font-size: 22px; }
.pay-modes { display: flex; flex-direction: column; gap: var(--s2); }
/* Способ оплаты — выбор из трёх, а не галочки: платят чем-то одним. */
.pay-mode {
  display: flex; align-items: flex-start; gap: var(--s2);
  padding: var(--s3); min-height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer;
}
.pay-mode:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.pay-mode input { width: 20px; height: 20px; min-height: auto; accent-color: var(--ink); }
.pay-mode b { display: block; font-weight: 600; }
.pay-mode i { font-style: normal; font-size: 13px; }
.pay-money { margin-top: var(--s3); }

/* Комбинированная оплата в истории: две суммы рядом, чтобы не считать в уме */
.pay-line { display: inline-flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.pay-line .from-sub { color: var(--ink-soft); }
.pay-line .extra { color: var(--ink); font-weight: 600; }
/* Отменённое списание: видно, но не считается — строка гаснет, сумма зачёркнута */
.task.is-refunded { opacity: .6; }
.task.is-refunded .badge { text-decoration: line-through; }

/* Пометка внутри контактной плашки: «имя, не ник». Тише самого значения —
   это уточнение, а не второй контакт. */
.chip-note {
  font-style: normal; font-size: 11px; color: var(--ink-soft);
  opacity: .8; margin-left: 4px;
}

/* Занятый кабинет в дневной сетке. Цвет отличается от статусов записей:
   это занятость комнаты, а не человека, и путать их нельзя — «аренда» рядом
   с «пришёл» читалась бы как ещё один статус клиента. */
.dv-blocks {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s3);
}
.room-block {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 6px var(--s3); border-radius: var(--r2);
  background: var(--surface-sunken); border: 1px dashed var(--line);
  font-size: 13px;
}
.room-block b { font-weight: 700; }
.room-block .rb-money { font-variant-numeric: tabular-nums; font-weight: 600; }
.room-block .btn { min-height: 32px; padding: 0 var(--s3); font-size: 12px; }
.rb-аренда { border-color: var(--ok-line); background: var(--ok-bg); }
.rb-ремонт { border-color: var(--warn-line); background: var(--warn-bg); }

/* ============================================================ КАЛЕНДАРЬ МЕСЯЦА
   Кольцо показывает долю занятого времени от того, сколько студия может
   принять. Шкала ступенчатая, а не непрерывный градиент: четыре состояния
   различимы на глаз и не требуют вглядывания в оттенок, а между ними стоят
   границы, которые администратор может назвать словами. */
.month { margin-bottom: var(--s4); }

.month-head {
  display: flex; align-items: center; justify-content: center;
  gap: var(--s3); margin-bottom: var(--s3);
}
.month-title {
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; font-size: 15px; min-width: 9em; text-align: center;
}

.month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.month-wd {
  text-align: center; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); padding-bottom: 2px;
}

.month-cell {
  position: relative; aspect-ratio: 1; min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px;
  border: 0; background: transparent; cursor: pointer;
  border-radius: 50%; padding: 0;
  font-family: inherit; color: var(--ink);
}
.month-cell.is-empty { cursor: default; }
.month-cell:disabled { cursor: default; }

/* Кольцо рисуется поверх клетки, а число — внутри него. Обводка идёт
   против часовой от двенадцати, как на всех индикаторах прогресса. */
.month-ring {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transform: rotate(-90deg); pointer-events: none;
}
.month-ring circle {
  fill: none; stroke-width: 2.5; stroke-linecap: round;
}
.ring-bg { stroke: var(--line); }
/* 2πr при r=15 ≈ 94.25 — длина окружности, от неё считается заполнение */
.ring-fill {
  stroke: var(--accent);
  stroke-dasharray: calc(var(--p, 0) * 94.25) 94.25;
  transition: stroke-dasharray .3s ease-out;
}

.month-num { font-size: 14px; font-weight: 600; line-height: 1; }
.month-count {
  font-size: 10px; line-height: 1; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Ступени загрузки. Пустое кольцо не красим вовсе: свободный день —
   отсутствие сигнала, а не ещё один сигнал. */
.month-cell.is-free .ring-fill { stroke: var(--line); }
.month-cell.is-low  .ring-fill { stroke: var(--ok); }
.month-cell.is-mid  .ring-fill { stroke: var(--warn); }
.month-cell.is-high .ring-fill { stroke: var(--danger); }
/* Записи есть, а графика на день нет: кольцо целое и пунктирное — это не
   «занято», а «смена не выставлена». Пунктир повторяет отметку закрытого дня,
   цвет говорит, что это требует внимания. */
.month-cell.is-astray .ring-fill {
  stroke: var(--danger); stroke-dasharray: 4 4;
}

.month-cell.is-today .month-num { color: var(--accent-ink, var(--ink)); font-weight: 700; }
.month-cell.is-today::after {
  content: ''; position: absolute; bottom: 4px; width: 4px; height: 4px;
  border-radius: 50%; background: var(--ink);
}
.month-cell.is-selected { background: var(--tint); }
.month-cell.is-selected .month-num { font-weight: 700; }
/* Прошедшие дни приглушены так же, как в сетке графика: работа идёт
   вперёд, а прошлое остаётся читаемым, но не тянет взгляд. */
.month-cell.is-past { opacity: .45; }
.month-cell.is-closed .month-num { color: var(--ink-soft); }
.month-cell.is-closed .ring-bg { stroke-dasharray: 3 4; }

.month-cell:hover:not(.is-empty) { background: var(--surface-sunken); }
.month-cell:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}

.month-legend {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3);
  margin: var(--s3) 0 0; font-size: 12px; color: var(--ink-soft);
}
.month-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ld {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2.5px solid var(--line);
}
.ld-free { border-color: var(--line); }
.ld-low  { border-color: var(--ok); }
.ld-mid  { border-color: var(--warn); }
.ld-high { border-color: var(--danger); }
.ld-astray { border-color: var(--danger); border-style: dashed; }

[data-month-box].is-loading { opacity: .5; pointer-events: none; }

/* На десктопе календарь не должен растягиваться во всю ширину экрана:
   клетка в 120px — это мишень, а не календарь. */
@media (min-width: 900px) {
  .month, [data-month-box] { max-width: 420px; }
}
