/*
 * CRM «Мастер Услуги» — стили.
 *
 * Дизайн-система — design/canvas/Tokens.dc.html: цвета ниже названы так же,
 * как там (--bg, --surface, --accent, --st-new …). Меняя цвет здесь, меняйте и там.
 *
 * Правила (из той же системы):
 *  • одна оранжевая кнопка на экран — главное действие;
 *  • цвет статуса всегда рядом со словом;
 *  • всё, куда попадают пальцем, — не ниже 44 px;
 *  • суммы — цифрами одной ширины, «₽» через пробел и без переноса.
 */

/* ── Шрифт ───────────────────────────────────────────────────────────── */
/* Golos Text грузится без блокировки (см. index.html). Пока его нет или он
   недоступен (мобильный интернет в режиме «белых списков»), работает системный. */

:root {
  --bg: #0F172A;
  --surface: #1E293B;
  --raised: #273449;
  --line: #334155;
  --line-strong: #475569;

  --text: #F8FAFC;
  --text-2: #E2E8F0;
  --text-3: #CBD5E1;
  --muted: #94A3B8;

  --accent: #F97316;
  --accent-hover: #FB923C;
  --on-accent: #0F172A;
  --selected: #2563EB;
  --info: #38BDF8;
  --danger: #F87171;
  --danger-soft: #FCA5A5;
  --ok: #4ADE80;

  --st-new: #F87171;
  --st-called: #FBBF24;
  --st-work: #60A5FA;
  --st-done: #4ADE80;
  --st-cancel: #94A3B8;

  --t-orange: rgba(249, 115, 22, 0.16);
  --t-green: rgba(74, 222, 128, 0.15);
  --t-blue: rgba(96, 165, 250, 0.15);
  --t-sky: rgba(56, 189, 248, 0.15);
  --t-amber: rgba(251, 191, 36, 0.15);
  --t-red: rgba(248, 113, 113, 0.15);
  --t-grey: rgba(148, 163, 184, 0.18);
  --t-violet: rgba(167, 139, 250, 0.16);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 74px;
  --rail: 232px;

  color-scheme: dark;
}

/* ── Основа ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--muted); }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--text-3); }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Каркас ──────────────────────────────────────────────────────────── */
.app { min-height: 100vh; min-height: 100dvh; }
.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: clip;   /* ленты фильтров во всю ширину не раздвигают экран вбок; липкая шапка работает */
}
.view.no-nav { padding-bottom: calc(24px + var(--safe-b)); }
.view.full { padding: 0; gap: 0; max-width: 640px; min-height: 100vh; min-height: 100dvh; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 8px 6px calc(10px + var(--safe-b));
  background: rgba(15, 23, 42, 0.96);
  border-top: 1px solid var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav[hidden] { display: none; }
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 52px; color: var(--muted); font-size: 12px; font-weight: 500;
  position: relative;
}
.nav a .ic { width: 48px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.nav a.on { color: var(--accent); font-weight: 600; }
.nav a.on .ic { background: var(--t-orange); }
.nav a .dot {
  position: absolute; top: 0; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}

/* Широкий экран: меню слева, контент по центру. */
@media (min-width: 960px) {
  .nav {
    top: 0; right: auto; width: var(--rail);
    grid-auto-flow: row; grid-auto-rows: max-content; align-content: start; gap: 4px;
    padding: 20px 12px; border-top: 0; border-right: 1px solid var(--surface);
  }
  .nav::before {
    content: 'Мастер Услуги'; display: block; padding: 4px 12px 18px;
    font-size: 18px; font-weight: 800; color: var(--text);
  }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: 12px; font-size: 15px; }
  .nav a .ic { width: 30px; height: 30px; }
  .nav a.on { background: var(--t-orange); }
  .nav a.on .ic { background: transparent; }
  .nav a .dot { position: static; margin-left: auto; }
  .app.has-nav .view { margin-left: calc(var(--rail) + max(0px, (100vw - var(--rail) - 640px) / 2)); padding-bottom: 40px; }
}

/* ── Шапки ───────────────────────────────────────────────────────────── */
.hdr { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.hdr h1 { font-size: 24px; font-weight: 700; line-height: 1.15; }
.hdr .sub { font-size: 13px; color: var(--muted); }
.hdr-back {
  position: sticky; top: 0; z-index: 20;
  margin: -14px -16px 0; padding: 10px 12px;
  background: rgba(15, 23, 42, 0.96); border-bottom: 1px solid var(--surface);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hdr-back .t { font-size: 18px; font-weight: 700; line-height: 1.2; }
.hdr-back .tt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pill {
  font-size: 13px; font-weight: 700; color: var(--accent); background: rgba(249, 115, 22, 0.15);
  border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.greet { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.greet .hi { font-size: 13px; color: var(--muted); }
.greet .nm { font-size: 18px; font-weight: 700; }
/* Город в шапке (3.7.0): «Все города ▾» / «Тула ▾»; у администратора одного города — подпись без выбора */
.city-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; flex: none; max-width: 46vw;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.city-chip .ellipsis { max-width: 32vw; }
.city-chip.on { border-color: var(--accent); color: var(--accent); background: rgba(249, 115, 22, 0.12); }
.city-chip.static { cursor: default; }
.city-row { display: flex; margin: -4px 0 2px; }
.tag.city { color: var(--info); }

/* ── Карточки и секции ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.shift-card { width: 100%; min-width: 0; align-self: stretch; }
.shift-card > .col { width: 100%; }
.card.tight { padding: 4px 14px; gap: 0; }
.view > *, .card > *, .row > *, .li > *, .kv > *, .note > * { min-width: 0; }
.card, .stack, .col { overflow-wrap: anywhere; }
.row > svg, .btn > svg, .li > svg, .note > svg { flex-shrink: 0; }
input, select, textarea, audio { min-width: 0; max-width: 100%; }
.card.flat { background: var(--bg); }
.card.warn { border-color: rgba(251, 191, 36, 0.45); }
.lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.s8 { gap: 8px; }
/* Сетки сами уменьшают число колонок, когда текст не помещается: узкий экран, крупный шрифт
   в настройках телефона. Ширина колонки задана в em и растёт вместе со шрифтом. */
.client-name-row { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.client-name-row .mid { min-width:0; overflow-wrap:anywhere; }
.order-view-badge { display:inline-flex; flex:none; align-items:center; justify-content:center; gap:4px; min-height:24px; padding:3px 7px; border:1px solid #dc2626; border-radius:6px; background:#fff; color:#000; font-family:inherit; font-size:10px; font-weight:600; line-height:1.3; cursor:pointer; white-space:nowrap; }
.order-view-badge span { font-size:10px; font-weight:600; }
.order-view-badge.seen { border-color:#16a34a; }
.order-view-badge:focus-visible { outline:2px solid var(--info); outline-offset:3px; }
.call-city { display:inline-block; color:var(--text); font-size:12px; font-weight:600; }
.cash-plan-left { font-size:clamp(22px,8cqi,30px); font-variant-numeric:tabular-nums; white-space:nowrap; }
.cash-plan-amount { font-size:clamp(12px,4.5cqi,18px); font-variant-numeric:tabular-nums; white-space:nowrap; }
.cash-plan-progress { width:100%; height:8px; border:0; border-radius:8px; overflow:hidden; accent-color:var(--ok); background:var(--raised); }
.cash-plan-progress::-webkit-progress-bar { background:var(--raised); }
.cash-plan-progress::-webkit-progress-value { background:var(--ok); }
.cash-plan-progress::-moz-progress-bar { background:var(--ok); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.4em), 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.8em), 1fr)); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 4.4em), 1fr)); gap: 6px; }
.grid2 > .btn { padding: 0 10px; }
.grid3 > .btn { padding: 0 6px; gap: 6px; }
.grid2 > *, .grid3 > *, .grid4 > * { min-width: 0; }
.divide > * + * { border-top: 1px solid var(--raised); }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; color: var(--muted); }
.note svg { flex: none; margin-top: 1px; }
.big { font-size: 32px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.15; }
.mid { font-size: 18px; font-weight: 700; }

/* Строка списка: иконка/аватар + текст + справа значение. */
.li {
  display: flex; align-items: center; gap: 12px; min-height: 56px; width: 100%;
  background: transparent; border: 0; padding: 0; color: var(--text); text-align: left;
}
a.li, button.li { cursor: pointer; }
a.li, a.card, a.stat { color: var(--text); }
a.li:hover, a.card:hover { color: var(--text); background: rgba(255, 255, 255, 0.02); }
.li .t { font-size: 15px; font-weight: 600; }
.li .s { font-size: 13px; color: var(--muted); }
.li .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { flex: none; color: var(--muted); }

/* ── Кнопки ──────────────────────────────────────────────────────────── */
.btn {
  min-height: 48px; padding: 0 16px; border-radius: var(--r); border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  background: var(--raised); color: var(--text-2); transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { filter: brightness(0.95); }
.btn[disabled], .btn.busy { opacity: 0.55; pointer-events: none; }
.btn.lg { min-height: 52px; font-size: 16px; font-weight: 700; }
.btn.full { width: 100%; }
.btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn.outline-accent { background: transparent; border-color: rgba(249, 115, 22, 0.6); color: var(--accent); font-weight: 700; }
.btn.outline-danger { background: transparent; border-color: rgba(248, 113, 113, 0.6); color: var(--danger); font-weight: 700; }
.btn.green { background: var(--t-green); color: var(--ok); font-weight: 700; }
.btn.blue { background: var(--t-sky); color: var(--info); font-weight: 700; }
.btn.amber { background: var(--t-amber); color: var(--st-called); font-weight: 700; }
.btn.red { background: var(--t-red); color: var(--danger); font-weight: 700; }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 6px; min-height: 44px; }
.btn.ghost.danger { color: var(--danger); }
.btn.sel { background: var(--selected); border-color: var(--selected); color: #fff; font-weight: 700; }
.btn.icon { width: 44px; min-height: 44px; height: 44px; padding: 0; flex: none; background: var(--surface); border-color: var(--line); color: var(--text); }
.btn.icon.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.icon.round { border-radius: 999px; }
.btn.tile {
  flex-direction: column; gap: 6px; min-height: 76px; padding: 8px 6px; border-radius: 14px;
  background: var(--surface); border-color: var(--line); color: var(--text); font-size: 13px; font-weight: 600;
  overflow-wrap: anywhere; hyphens: auto;
}
.btn.tile .ic { width: 32px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.fab {
  position: fixed; right: max(16px, calc(50vw - 304px)); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.35);
}
@media (min-width: 960px) { .fab { bottom: 28px; right: 32px; } }

/* ── Чипы и сегменты ─────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
/* Немного фильтров (у мастера четыре) — видны целиком: делят ширину, при крупном шрифте переносятся. */
.chips.fit { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chips.fit .chip { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
.chip {
  height: 40px; padding: 0 14px; border-radius: 999px; flex: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.chip.soft.on { background: var(--t-orange); color: var(--accent); }
.chip .dt { width: 8px; height: 8px; border-radius: 999px; }
.chip b { font-weight: 800; }
/* Сегменты делят ширину поровну, но не уже своей подписи: не помещаются — переносятся
   на вторую строку, а не вылезают за край. */
.seg {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; flex: none;
}
.seg.on-bg { background: var(--bg); }
.seg button {
  flex: 1 1 0; min-width: max-content;
  min-height: 40px; border-radius: 9px; border: 0; background: transparent; color: var(--text-3);
  font-size: 14px; font-weight: 700; padding: 0 8px; display: flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.seg button.on { background: var(--line); color: #fff; }
.seg.small button { min-height: 36px; font-size: 13px; }
/* Четыре варианта в ряд, на узком экране — два на два (экран «Пуши»: кому) */
.seg.quad { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg.quad button { min-width: 0; }
@media (max-width: 459px) { .seg.quad { grid-template-columns: repeat(2, 1fr); } }
/* Коэффициент сложности в калькуляторе: ползунок на 8 шагов и подписи под ним.
   Ползунок шире строки подписей на размер бегунка (24 px) и сдвинут на половину
   столбца, чтобы центр бегунка стоял ровно над своей подписью. */
.kbox { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 12px; }
.krange {
  -webkit-appearance: none; appearance: none; display: block; background: transparent; cursor: pointer;
  width: calc(87.5% + 24px); margin: 8px 0 0 calc(6.25% - 12px); height: 32px; padding: 0;
}
.krange:focus { outline: none; }
.krange::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--ok), var(--line-strong) 43%, var(--st-called) 72%, var(--danger));
}
.krange::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%; margin-top: -9px;
  background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent);
}
.krange::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--ok), var(--line-strong) 43%, var(--st-called) 72%, var(--danger));
}
.krange::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.krange:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.45); }
.kticks { display: grid; grid-template-columns: repeat(8, 1fr); }
.kticks button {
  background: none; border: 0; padding: 0; min-height: 34px; color: var(--muted);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.kticks button.on { color: var(--accent); font-weight: 800; font-size: 13px; }
/* Плашка калькулятора: итог и «Показать клиенту», пока сама смета ушла с экрана */
.calc-bar {
  position: fixed; z-index: 26; left: 50%; transform: translateX(-50%); width: min(616px, calc(100% - 24px));
  bottom: calc(var(--nav-h) + var(--safe-b) + 10px);
  display: none; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.55); animation: up .2s ease-out;
}
.calc-bar.show { display: flex; }
.calc-bar b { font-size: 17px; font-weight: 800; color: var(--accent); }
.calc-bar .btn { flex: none; padding: 0 14px; }
.calc-gap { height: 64px; flex: none; }
@media (min-width: 960px) {
  .calc-bar { bottom: 20px; transform: none; width: 616px; left: calc(var(--rail) + max(0px, (100vw - var(--rail) - 640px) / 2) + 12px); }
}

/* Мастер просит номер клиента — сотруднику, пока запрос не решён (shell.js) */
.phone-ask {
  position: fixed; z-index: 27; left: 12px; right: 12px; margin: 0 auto; max-width: 616px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 10px);
  display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 10px;
  background: var(--raised); border: 1px solid rgba(251, 191, 36, 0.55); border-radius: var(--r-lg);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.55); animation: up .2s ease-out;
}
.phone-ask .pa-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px;
  background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.phone-ask .col { gap: 2px; }
.phone-ask .t { font-size: 14px; font-weight: 700; line-height: 1.3; }
.phone-ask .s { font-size: 12px; color: var(--muted); }
.phone-ask .btn.icon { flex: none; border: 0; background: transparent; color: var(--muted); }
/* Просьба выйти на смену: текст сверху, «Разрешить / Отказать» под ним */
.phone-ask.two { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
.phone-ask .pa-row { display: flex; align-items: center; gap: 10px; }
.phone-ask .grid2 .btn { min-height: 40px; }
/* Пуш в открытой CRM (3.12.0, shell.js → pollPush): сверху, пока не откроют или не закроют */
.push-in {
  position: fixed; z-index: 70; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 10px); margin: 0 auto; max-width: 616px;
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px 10px 12px;
  background: var(--raised); border: 1px solid rgba(249, 115, 22, 0.6); border-radius: var(--r-lg);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.55); animation: pushdown .2s ease-out;
}
.push-in .col { gap: 2px; min-width: 0; }
.push-in .t { font-size: 15px; font-weight: 700; line-height: 1.3; }
.push-in .s { font-size: 13px; line-height: 1.4; color: var(--text-2); white-space: pre-line; max-height: 9.8em; overflow: auto; }
.push-in .pi-more { font-size: 12px; color: var(--muted); }
.push-in .pi-acts { display: flex; align-items: center; gap: 2px; flex: none; }
.push-in .btn.primary { min-height: 36px; padding: 0 12px; }
.push-in .btn.icon { border: 0; background: transparent; color: var(--muted); }
@keyframes pushdown { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
/* Как пуш выглядит у получателя — экран «Пуши» */
.push-preview { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); }
.push-preview b { font-size: 14px; }
.push-preview span { font-size: 13px; line-height: 1.4; color: var(--text-2); white-space: pre-line; }
/* Комментарии заказа: заголовок — кнопка «Показать все / Свернуть» */
.cmt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }
.cmt-more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--accent); }
.cmt-head[aria-expanded="true"] .cmt-more svg { transform: rotate(180deg); }
/* Колокольчик оповещений на главной: число — сколько заказов требуют внимания */
.btn.icon.bell { position: relative; }
.btn.icon.bell .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
.btn.icon.bell .dot[hidden] { display: none; }
@media (min-width: 960px) { .phone-ask { bottom: 20px; left: calc(var(--rail) + 12px); } }
body.has-phone-ask .fab { bottom: calc(var(--nav-h) + var(--safe-b) + 84px); }   /* кнопка «+» — над плашкой */
@media (min-width: 960px) { body.has-phone-ask .fab { bottom: 100px; } }

/* «Показать клиенту»: лист сметы или акта на весь экран, светлый, как бумага (сам лист — core/estimate-doc.js) */
.edoc-veil { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: #F1F5F9; color: #1F2937; color-scheme: light; animation: fade .15s ease-out; }
.edoc-top, .edoc-bottom { flex: none; display: flex; align-items: center; gap: 10px; background: #fff; padding: 8px 12px; }
.edoc-top { border-bottom: 1px solid #E5E7EB; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.edoc-bottom { border-top: 1px solid #E5E7EB; padding-bottom: calc(10px + var(--safe-b)); }
.edoc-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px; }
.edoc-btn {
  min-height: 50px; border-radius: 14px; border: 1px solid #E5E7EB; background: #fff; color: #1F2937;
  font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px;
}
.edoc-btn.icon { width: 50px; padding: 0; flex: none; }
.edoc-btn.primary { flex: 1; background: var(--accent); border-color: var(--accent); color: #fff; }
.edoc-btn.busy { opacity: 0.6; pointer-events: none; }
.edoc-seg { margin-left: auto; display: flex; gap: 4px; padding: 4px; background: #F1F5F9; border-radius: 12px; }
.edoc-seg button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: #6B7280; font-size: 15px; font-weight: 700; }
.edoc-seg button.on { background: #fff; color: #1F2937; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14); }
@media (max-width: 360px) {
  .seg button { font-size: 12px; padding: 0 2px; }
  .view { padding-left: 12px; padding-right: 12px; }
  .hdr-back { margin-left: -12px; margin-right: -12px; }
  .chips { margin: 0 -12px; padding: 0 12px; }
}
@media (max-width: 320px) {
  .phone { font-size: 17px; }
  .hdr h1 { font-size: 21px; }
}

/* ── Выбор дня и времени визита (core/visit.js) ──────────────────────── */
.visit-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 12px 0 14px;
  border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer;
}
.visit-btn > svg:first-child { color: var(--accent); flex: none; }
.visit-btn .ph { color: var(--muted); font-weight: 500; }
.visit-btn .chev { margin-left: auto; }
.visit-sum {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: var(--r);
  background: var(--t-orange); color: var(--text); font-size: 16px; font-weight: 700;
}
.visit-sum > svg { color: var(--accent); flex: none; }
.cal-head { display: flex; align-items: center; gap: 8px; }
.cal-head b { flex: 1; text-align: center; font-size: 17px; font-weight: 700; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.cal button {
  min-height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal button:hover:not(:disabled):not(.on) { background: var(--raised); }
.cal button:disabled { color: var(--line-strong); cursor: default; }
.cal button.today { box-shadow: inset 0 0 0 2px var(--line-strong); }
.cal button.on { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6em, 1fr)); gap: 6px; }
.slots button {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
}
.slots button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.slots button:disabled { opacity: 0.35; cursor: default; }

/* ── Плашки статуса, теги, аватары ───────────────────────────────────── */
.badge {
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px; line-height: 1.25;
}
.badge.new { color: var(--st-new); background: var(--t-red); }
.badge.called { color: var(--st-called); background: var(--t-amber); }
.badge.in_progress { color: var(--st-work); background: var(--t-blue); }
.badge.done { color: var(--st-done); background: var(--t-green); }
.badge.canceled, .badge.refused { color: var(--text-3); background: var(--t-grey); }
.badge.orange { color: var(--accent); background: var(--t-orange); }
.badge.green { color: var(--ok); background: var(--t-green); }
.badge.blue { color: var(--st-work); background: var(--t-blue); }
.badge.amber { color: var(--st-called); background: var(--t-amber); }
.badge.grey { color: var(--text-3); background: var(--t-grey); }
.badge.red { color: var(--danger); background: var(--t-red); }
.tag { font-size: 13px; font-weight: 600; color: var(--text-3); background: var(--raised); border-radius: var(--r-sm); padding: 5px 9px; white-space: nowrap; }
.when { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; border-radius: var(--r-sm); padding: 4px 8px; white-space: nowrap; background: var(--raised); color: var(--text-2); }
.when.soon { color: var(--st-called); background: var(--t-amber); }
.when.late { color: var(--danger); background: var(--t-red); }
.av {
  width: 44px; height: 44px; border-radius: 999px; flex: none; color: #fff; background: var(--selected);
  font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; position: relative;
}
.av.sm { width: 36px; height: 36px; font-size: 15px; }
.av.xs { width: 24px; height: 24px; font-size: 11px; }
.av.lg { width: 80px; height: 80px; font-size: 34px; font-weight: 800; }
.av.me { background: var(--accent); color: var(--on-accent); }
.av .st { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 999px; border: 2px solid var(--surface); }
.ic-tile { width: 36px; height: 36px; border-radius: 999px; flex: none; display: flex; align-items: center; justify-content: center; }
.ic-sq { width: 32px; height: 32px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; }
.c-orange { color: var(--accent); background: var(--t-orange); }
.c-green { color: var(--ok); background: var(--t-green); }
.c-blue { color: var(--st-work); background: var(--t-blue); }
.c-sky { color: var(--info); background: var(--t-sky); }
.c-amber { color: var(--st-called); background: var(--t-amber); }
.c-red { color: var(--danger); background: var(--t-red); }
.c-violet { color: #A78BFA; background: var(--t-violet); }
.c-grey { color: var(--text-3); background: var(--raised); }

/* ── Поля ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--text-3); }
.field .hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.inp, select.inp, textarea.inp {
  width: 100%; min-height: 48px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 16px; padding: 0 14px; outline: none; -webkit-appearance: none; appearance: none;
}
textarea.inp { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.45; }
select.inp { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.inp:focus { border-color: var(--info); }
.inp.money { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 52px; }
.search {
  height: 48px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; flex: none;
}
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font-size: 16px; }
.err { font-size: 14px; font-weight: 600; color: var(--danger-soft); }
.alert {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r);
  background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); color: var(--danger-soft);
  font-size: 14px; font-weight: 600;
}
.ok-box, .warn-box, .info-box {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); font-size: 14px; line-height: 1.4;
}
.ok-box { background: rgba(74, 222, 128, 0.12); border: 1px solid rgba(74, 222, 128, 0.4); color: var(--text-2); }
.warn-box { background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.4); color: #FDE68A; }
.info-box { background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.35); color: var(--text-2); }
.switch { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 999px; background: var(--text); transition: left .15s; }
.switch.on { background: var(--ok); }
.switch.on::after { left: 22px; }

/* ── Статистика ──────────────────────────────────────────────────────── */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; color: var(--text); text-align: left;
}
.stat .k { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text-3); }
.stat .k i { width: 8px; height: 8px; border-radius: 999px; }
.stat .n { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mini { background: var(--bg); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mini b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini span { font-size: 12px; color: var(--muted); }
.mini.c { align-items: center; text-align: center; padding: 7px 4px; }
.mini.c span { font-size: 11px; overflow-wrap: anywhere; hyphens: auto; }
.strip { display: flex; flex-wrap: wrap; row-gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 0; }
.strip > div { flex: 1 1 0; min-width: max-content; padding: 0 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.strip > div + div { border-left: 1px solid var(--line); }
.strip b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip span { font-size: 12px; color: var(--muted); }
.bar { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; font-size: 13px; min-height: 26px; }
.bar u { display: block; height: 10px; border-radius: 999px; background: var(--accent); text-decoration: none; min-width: 3px; }
.bar i { font-style: normal; color: var(--muted); }
.bar b { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ── Карточка заказа в списке ────────────────────────────────────────── */
.ocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.ocard > a { display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px; color: var(--text); }
.ocard .top { flex-wrap: wrap; row-gap: 6px; }
.ocard .no { font-size: 14px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ocard .cl { font-size: 17px; font-weight: 700; line-height: 1.25; }
.ocard .ad { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-3); }
.ocard .ms { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.ocard .ft { display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px 14px; border-top: 1px solid var(--line); }
.ocard .acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px 12px; }
.ocard .sum { font-size: 15px; font-weight: 700; color: var(--ok); font-variant-numeric: tabular-nums; white-space: nowrap; }
.onsite { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ok); }
.onsite::before { content: ''; width: 8px; height: 8px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25); }

/* ── Детали ──────────────────────────────────────────────────────────── */
.kv { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.kv > svg { flex: none; color: var(--muted); }
.kv .k { width: 84px; flex: none; font-size: 14px; color: var(--muted); }
.kv .v { font-size: 15px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.phone { font-size: 19px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card { container-type: inline-size; }
.phone { font-size: clamp(15px, 6.2cqi, 19px); }
a.big[href^="tel:"] { font-size: clamp(18px, 7.8cqi, 32px); }
.big { font-size: clamp(22px, 9cqi, 32px); }
.stat .n { font-size: clamp(20px, 7cqi, 28px); }
@media (max-width: 420px) {
  .view { padding-left: 10px; padding-right: 10px; gap: 10px; }
  .card { padding: 12px; border-radius: 14px; gap: 8px; }
  .card.tight { padding-left: 12px; padding-right: 12px; }
  .hdr-back { margin-left: -10px; margin-right: -10px; }
  .row, .li { gap: 8px; }
  .btn { padding: 6px 10px; font-size: 14px; gap: 6px; }
  .btn.lg { font-size: 15px; }
  .grid2 > .btn { padding-left: 6px; padding-right: 6px; }
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btn > svg { max-width: 18px; }
  .nav a { font-size: clamp(10px, 2.8vw, 12px); }
  .kv .k { width: 70px; font-size: 13px; }
  .li .v { font-size: 13px; }
  .msg .offer, .vc { min-width: 0; max-width: 100%; }
}
a[href^="tel:"] .num { white-space: nowrap; }
.cmt { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.cmt .h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.cmt .h b { font-weight: 700; color: var(--info); }
.cmt .h b.sys { color: var(--accent); }
.cmt .h span { color: var(--muted); }
.cmt .b { font-size: 14px; line-height: 1.45; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.ph {
  width: 80px; height: 80px; border-radius: var(--r); overflow: hidden; position: relative; flex: none;
  background: var(--raised); border: 1px solid var(--line-strong);
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 999px; border: 0; background: rgba(15, 23, 42, 0.8); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; }
.ph-add {
  width: 80px; height: 80px; border-radius: var(--r); background: var(--bg); border: 1px dashed var(--line-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600; position: relative; overflow: hidden;
}
.ph-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.stars { display: flex; gap: 4px; color: var(--st-called); }
.stars .off { color: var(--line-strong); }

/* ── Чат ─────────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat .msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat .compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(12px + var(--safe-b)); border-top: 1px solid var(--surface); background: var(--bg); }
.chat .compose textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 140px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 16px; padding: 12px 16px; outline: none; resize: none; line-height: 1.35; }
.msg { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.msg.me { align-items: flex-end; }
.msg .who { font-size: 12px; font-weight: 700; padding: 0 4px; color: var(--text-3); }
.msg .bub { max-width: 82%; padding: 9px 12px 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; display: flex; flex-direction: column; gap: 2px; }
.msg.me .bub { background: rgba(249, 115, 22, 0.16); border-color: rgba(249, 115, 22, 0.35); border-radius: 16px 16px 4px 16px; }
.msg .bub .tx { font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .bub .tm { align-self: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg.sys { align-items: center; }
.msg.sys .bub { background: transparent; border: 0; padding: 2px 8px; color: var(--muted); font-size: 13px; text-align: center; }
.msg .offer { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.msg .offer .ot { font-size: 15px; font-weight: 700; }
.day { align-self: center; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface); border-radius: 999px; padding: 4px 12px; }

/* Чат 3.8.0: «прочитано», фото на весь экран, голосовые, смайлы */
.msg .bub button.tm { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; padding: 2px 0 0 8px; margin: 0; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; min-height: 20px; }
.msg .tk { display: inline-flex; color: var(--muted); }
.msg .tk.on { color: var(--info); }
.rd { align-self: flex-end; margin-top: -6px; padding: 0 4px; font-size: 12px; color: var(--muted); }
.rd.on { color: var(--info); }
button.rd { border: 0; background: none; font: inherit; font-size: 12px; cursor: pointer; min-height: 28px; text-align: right; }
.msg .bub.emo-big { background: transparent; border-color: transparent; padding: 0 2px; }
.msg .bub.emo-big .tx { font-size: 40px; line-height: 1.15; }
.pv-thumb { display: block; padding: 0; border: 0; background: none; border-radius: 10px; overflow: hidden; cursor: zoom-in; max-width: 100%; }
.pv-thumb img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; }
.vc { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.vc-btn { flex: none; width: 42px; height: 42px; border-radius: 999px; border: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.vc-bar { flex: 1; height: 24px; display: flex; align-items: center; position: relative; cursor: pointer; }
.vc-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--line-strong); }
.vc-fill { position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; width: 0; border-radius: 2px; background: var(--accent); }
.vc-t { flex: none; min-width: 34px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chat .compose .snd, .chat .compose .snd-mic { flex: none; width: 48px; height: 48px; }
.chat .compose.with-mic:not(.has-text) > .snd, .chat .compose.has-text > .snd-mic { display: none; }
.chat .compose .rec { display: none; }
.chat .compose.recording > :not(.rec) { display: none; }
.chat .compose.recording .rec { display: flex; flex: 1; align-items: center; gap: 10px; min-height: 48px; }
.rec-dot { flex: none; width: 12px; height: 12px; border-radius: 999px; background: var(--danger); transition: transform .08s linear; }
.rec-t { font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-hint { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emo { flex: none; height: min(280px, 42vh); display: flex; flex-direction: column; border-top: 1px solid var(--surface); background: var(--bg); padding-bottom: var(--safe-b); }
.emo[hidden] { display: none; }
.emo-tabs { flex: none; display: flex; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--surface); }
.emo-tabs button { flex: 1; height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 20px; cursor: pointer; padding: 0; }
.emo-tabs button:hover { background: var(--surface); }
.emo-grid { flex: 1; min-height: 0; overflow-y: auto; position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); align-content: start; padding: 4px 8px 8px; }
.emo-sec { grid-column: 1 / -1; padding: 8px 4px 4px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.emo-grid button { height: 46px; border: 0; border-radius: 10px; background: transparent; font-size: 28px; line-height: 1; padding: 0; cursor: pointer; }
.emo-grid button:hover, .emo-grid button:active { background: var(--surface); }

/* Значок «есть машина» у мастера (3.9.0, parts.js carMark) */
.carm { display: inline-flex; align-items: center; flex: none; color: var(--info); }

/* Фото на весь экран (core/viewer.js): над листами, под всплывашками */
.pv { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, var(--pv-fade, 1)); color: #fff; user-select: none; -webkit-user-select: none; animation: fade .15s ease-out; }
.pv-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: 50% 50%; will-change: transform; -webkit-user-drag: none; }
.pv-stage.loading::after { content: ''; position: absolute; width: 36px; height: 36px; border-radius: 999px; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: rot .8s linear infinite; }
.pv-msg { position: absolute; color: #CBD5E1; font-size: 15px; }
.pv-msg[hidden] { display: none; }
.pv-bar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 18px 18px; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.pv-bar .pv-btn { pointer-events: auto; background: rgba(15, 23, 42, 0.6); border-color: transparent; color: #fff; border-radius: 999px; }
.pv-nav { position: absolute; top: 50%; width: 52px; height: 72px; margin-top: -36px; border: 0; border-radius: 14px; background: rgba(15, 23, 42, 0.55); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.pv-nav.prev { left: 14px; }
.pv-nav.next { right: 14px; }
@media (hover: hover) and (pointer: fine) { .pv-nav { display: flex; } }

/* ── Слои: лист снизу, окно, уведомление ─────────────────────────────── */
.veil { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 23, 0.72); display: flex; flex-direction: column; justify-content: flex-end; animation: fade .15s ease-out; }
.sheet {
  position: relative; width: 100%; max-width: 640px; margin: 0 auto; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-top: 1px solid var(--line); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px;
  animation: up .2s ease-out;
}
.sheet .grab { align-self: center; width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); flex: none; }
.sheet .st { display: flex; align-items: center; gap: 8px; }
.sheet .st h2 { flex: 1; font-size: 20px; font-weight: 700; }
@media (min-width: 720px) {
  .veil { justify-content: center; padding: 24px; }
  .sheet { max-width: 520px; border-radius: var(--r-xl); border: 1px solid var(--line); }
  .sheet .grab { display: none; }
}
.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 560px; width: 100%; background: var(--text); color: var(--bg); border-radius: var(--r);
  padding: 12px 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.5); animation: up .2s ease-out; pointer-events: auto;
}
.toast.bad { background: #FEE2E2; color: #7F1D1D; }
.toast .ti { flex: none; }
@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Состояния ───────────────────────────────────────────────────────── */
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 40px 16px; color: var(--muted); }
.center .t { font-size: 16px; font-weight: 600; color: var(--text-2); }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--raised) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: var(--r-lg); }
@keyframes sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--st-called); color: var(--on-accent); font-size: 13px; font-weight: 700; text-align: center; padding: 6px 12px calc(6px); }

/* ── Вход ────────────────────────────────────────────────────────────── */
.login { width: 100%; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 24px 20px calc(24px + var(--safe-b)); max-width: 440px; margin: 0 auto; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--t-orange); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.login .brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login .brand h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.pw { position: relative; display: flex; }
.pw .inp { padding-right: 52px; }
.pw button { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }

/* ── Печать отчёта ───────────────────────────────────────────────────── */
@media print {
  .nav, .fab, .toasts, .hdr-back .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; background: #fff; }
}
/* Яндекс: посещаемость → аккаунт → подробный отчёт. */
.ad-screen { min-width: 0; --ad-blue:#83a8ff; }
.ad-screen .card { gap:16px; border-radius:20px; }
.ad-screen h2 { font-size:16px; letter-spacing:-.2px; margin:0; }
.ad-period { display:flex; flex-direction:column; gap:10px; padding:0 2px 4px; }
.ad-period-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--text-2); font-size:13px; }
.ad-period-heading .btn { min-height:30px; padding:6px 10px; }
.ad-presets,.ad-mode,.ad-tabs { display:flex; gap:5px; }
.ad-presets .btn,.ad-tabs .btn { flex:1; min-width:0; min-height:35px; padding:7px 5px; font-size:12px; }
.ad-selected { background:#334c7f; color:#eef3ff; border:1px solid #5475b4; box-shadow:0 2px 8px #0b142c26; }
.ad-mode { padding:4px; background:#0b1425; border:1px solid #2b3951; border-radius:15px; }
.ad-mode .btn { flex:1; min-height:38px; border-radius:11px; font-size:13px; padding:7px 9px; }
.ad-mode .outline { border-color:transparent; background:transparent; color:var(--text-2); }
.ad-overview { background:linear-gradient(120deg,#22324d,#1a2943); border-color:#3a4c6a; }
.ad-eyebrow { display:flex; flex-wrap:wrap; justify-content:space-between; gap:6px; color:#dce6f9; font-size:13px; font-weight:600; }
.ad-eyebrow > span { font-weight:400; color:#96a9ca; font-size:11px; }
.ad-hero-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding-top:6px; }
.ad-stat { display:flex; flex-direction:column; gap:6px; min-width:0; }
.ad-stat > span { color:#a8b7cd; font-size:12px; line-height:1.4; }
.ad-stat > b { font-size:clamp(17px,5.8cqi,27px); font-variant-numeric:tabular-nums; line-height:1.15; letter-spacing:-.5px; }
.ad-stat > small { color:#91a3bf; font-size:11px; }
.ad-hero-stats .ad-stat > b { font-size:clamp(19px,6.5cqi,30px); }
.ad-section-heading { display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap; }
.ad-account-heading { padding:12px 3px 0; }
.ad-account-heading > span { font-size:12px; color:var(--text-2); }
.ad-account-list { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
.ad-account { color:var(--text); text-decoration:none; transition:border-color .15s,transform .15s; }
.ad-account:hover { border-color:#5778b1; }
.ad-account:active { transform:scale(.995); }
.ad-account-title { display:flex; align-items:center; gap:11px; }
.ad-account-title > .grow { min-width:0; display:flex; flex-direction:column; gap:4px; }
.ad-account-title b { font-size:15px; }
.ad-account-title small { font-size:11px; color:var(--text-2); }
.ad-account-title > svg { color:#8d9eb9; flex-shrink:0; }
.ad-brand { display:grid; place-items:center; height:37px; width:37px; flex-shrink:0; border-radius:12px; background:linear-gradient(145deg,#463044,#342536); color:#ff7d87; font-size:24px; font-weight:700; }
.ad-account-data { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.35fr) minmax(0,.65fr); gap:12px; align-items:center; padding-top:2px; }
.ad-account-data > .ad-stat { align-items:flex-end; }
.ad-mini-chart { min-width:0; }
.ad-secondary { color:#879ab8; font-size:10px; display:block; margin-top:6px; }
.ad-account-bottom { display:flex; align-items:center; justify-content:space-between; gap:8px; border-top:1px solid #334159; padding-top:12px; font-size:10px; }
.ad-account-bottom > span:last-child { color:#a6bfff; flex-shrink:0; }
.ad-live { color:#70d7b5; }
.ad-warn { color:#f5bf68; font-size:12px; line-height:1.5; }
.ad-source { color:#a5b9da; background:#17243a; font-size:10px; padding:4px 8px; border-radius:7px; white-space:normal; }
.ad-chart { display:block; width:100%; height:auto; overflow:visible; }
.ad-spark { overflow:hidden; }
.ad-gridline { stroke:#3e506b; stroke-width:1; stroke-dasharray:3 5; opacity:.6; }
.ad-point { fill:#9ebcff; opacity:0; }
.ad-point:hover { opacity:1; }
.ad-chart-empty { padding:30px 5px; text-align:center; color:#8398b7; font-size:11px; }
.ad-mini-chart .ad-chart-empty { padding:4px; }
.ad-chart-switch { display:flex; gap:2px; flex-wrap:wrap; }
.ad-chart-switch button { background:transparent; border:0; color:#8fa5c6; font:inherit; font-size:11px; padding:7px 9px; border-radius:8px; cursor:pointer; }
.ad-chart-switch button.active { background:#344d7c; color:#e9f0ff; }
.ad-chart-caption { display:flex; justify-content:space-between; align-items:center; gap:8px; color:#8ba0bf; font-size:10px; }
.ad-chart-caption b { font-size:13px; color:#cfddf5; }
.ad-finance { background:radial-gradient(ellipse at top right,#344c7c88,transparent 70%),linear-gradient(125deg,#233959,#192b46); border-color:#4a628a; }
.ad-direct-summary { background:linear-gradient(125deg,#243b60,#1b2b47); border-color:#47618b; }
.ad-summary-balance { padding:2px 0 15px; border-bottom:1px solid #58749b66; }
.ad-summary-balance .ad-stat > b { font-size:clamp(24px,8.5cqi,36px); }
.ad-direct-summary .ad-stats-grid { gap:12px; }
.ad-finance-head { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:13px; color:#c3d2e9; }
.ad-balance { font-size:clamp(25px,9cqi,42px); line-height:1.15; letter-spacing:-1px; font-variant-numeric:tabular-nums; padding:0 0 4px; }
.ad-finance-bottom { display:flex; align-items:flex-end; justify-content:space-between; gap:15px; padding-top:14px; border-top:1px solid #58749b66; }
.ad-finance-bottom > div { display:flex; flex-direction:column; gap:6px; min-width:0; }
.ad-finance-bottom span { color:#aabfdd; font-size:11px; }
.ad-finance-bottom b { font-size:clamp(17px,6cqi,23px); font-variant-numeric:tabular-nums; }
.ad-finance-bottom > small { color:#91a8c9; font-size:10px; max-width:42%; text-align:right; }
.ad-stats-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:23px 16px; }
.ad-stats-grid .ad-stat > b { font-size:clamp(17px,6cqi,26px); }
.ad-footnote { color:#91a4c0; font-size:11px; line-height:1.6; margin:0; }
.ad-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:3px 2px 15px; }
.ad-toolbar .btn { min-height:36px; font-size:11px; padding:7px 12px; }
.ad-toolbar > span { text-align:right; font-size:10px; color:#8498b7; }
.ad-help summary { font-size:12px; color:#a8bbd7; cursor:pointer; }
.ad-help p { font-size:11px; line-height:1.6; color:#91a4c0; margin:12px 0 0; }
.ad-help[open] { display:block; }
.ad-empty { align-items:center; text-align:center; padding:30px 18px; font-size:12px; color:#9cafcc; }
.ad-segment { display:flex; flex-direction:column; gap:8px; }
.ad-segment > div:first-child { display:flex; justify-content:space-between; gap:10px; font-size:13px; }
.ad-segment small { color:#90a3c0; font-size:11px; }
.ad-progress { height:5px; background:#33435d; border-radius:5px; overflow:hidden; }
.ad-progress > span { display:block; height:100%; border-radius:5px; background:linear-gradient(90deg,#4879da,#8badff); }
.ad-campaign-filters { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1fr); gap:8px!important; }
.ad-campaign-filters .inp { min-width:0; font-size:12px; padding:10px; }
.ad-campaign-account-filter { grid-column:1/-1; grid-row:1; }
.ad-campaign-account { display:flex; flex-direction:column; gap:4px; color:#a5bfff; font-size:12px; text-decoration:none; }
.ad-campaign-account > span { font-size:10px; color:#8da1c0; }
.ad-campaign-heading { display:flex; flex-direction:column; align-items:flex-start; gap:8px; }
.ad-campaign-heading h3 { margin:0; font-size:14px; line-height:1.5; }
.ad-campaign-main { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.ad-campaign-details { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 16px; border-top:1px solid #334159; padding-top:14px; }
.ad-campaign-details > span { color:#90a3be; display:flex; flex-direction:column; gap:4px; font-size:11px; }
.ad-campaign-details b { color:#d5e0f3; font-weight:500; font-size:13px; }
.ad-table-wrap { max-width:100%; overflow-x:auto; }
.ad-table { width:100%; border-collapse:collapse; font-size:11px; font-variant-numeric:tabular-nums; }
.ad-table th,.ad-table td { padding:12px 9px; text-align:right; white-space:nowrap; border-bottom:1px solid #334159; }
.ad-table th { color:#91a6c5; font-weight:500; }
.ad-table th:first-child,.ad-table td:first-child { text-align:left; padding-left:0; }
.ad-history-nav { display:flex; gap:8px; }
.ad-history-nav .btn { flex:1; font-size:12px; min-height:36px; }
.ad-connection { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:13px 0; border-top:1px solid #334159; }
.ad-connection > .grow { min-width:0; }
.ad-connection a { color:#dce7f8; text-decoration:none; font-size:13px; }
.ad-connection small { display:block; margin-top:5px; font-size:11px; color:#8da1c0; }
.ad-connection-end { display:flex; flex-direction:column; align-items:flex-end; gap:9px; min-width:0; max-width:45%; }
.ad-connection-end > b { font-size:13px; }
.ad-connection-end .btn { min-height:32px; font-size:11px; padding:5px 9px; }
.ad-connections > h2 { font-size:14px; }
.ad-help .ad-connections { margin-top:12px; padding:0; border:0; }

/* Журнал звонков: единые колонки и типографика на всех размерах экрана. */
.calls-day { display:flex; flex-direction:column; gap:8px; min-width:0; }
.calls-day-title { font-size:13px; line-height:1.4; font-weight:600; color:var(--muted); padding:4px 4px 0; }
.card.calls-list { padding:0; gap:0; overflow:hidden; }
.calls-row + .calls-row { border-top:1px solid var(--line); }
.calls-main { display:grid; grid-template-columns:40px minmax(0,1fr) auto; gap:12px; padding:16px; color:var(--text); align-items:start; }
.calls-main:hover { color:var(--text); background:var(--t-grey); }
.calls-icon { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px; border-radius:12px; flex:none; }
.calls-neutral { color:var(--muted); background:var(--t-grey); }
.calls-copy { display:flex; flex-direction:column; gap:4px; min-width:0; }
.calls-name { font-size:15px; font-weight:600; line-height:1.4; overflow-wrap:anywhere; }
.calls-meta { font-size:13px; font-weight:400; line-height:1.4; color:var(--muted); overflow-wrap:anywhere; }
.calls-direction { color:var(--text-2); }
.calls-recording:empty { display:none; }
.calls-blocked { color:var(--danger); }
.calls-end { display:flex; flex-direction:column; align-items:flex-end; gap:12px; color:var(--muted); }
.calls-time { font-size:13px; line-height:21px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.calls-order { display:flex; align-items:center; gap:6px; width:fit-content; max-width:calc(100% - 84px); min-height:44px; margin:-6px 16px 6px 68px; font-size:13px; line-height:1.4; overflow-wrap:anywhere; }
.calls-order svg { flex:none; }
.calls-empty { align-items:center; text-align:center; padding:28px 16px; }
.calls-empty > svg { color:var(--muted); }
.calls-empty > span { font-size:13px; color:var(--muted); }
.calls-hero { gap:12px; }
.calls-hero-direction { font-size:13px; font-weight:500; color:var(--text-2); }
.calls-hero-name { font-size:18px; line-height:1.4; }
.calls-hero-phone { font-size:clamp(20px,6vw,28px); line-height:1.3; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.calls-facts { margin:0; padding-top:12px; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:8px; font-size:13px; line-height:1.4; }
.calls-facts > div { display:grid; grid-template-columns:64px minmax(0,1fr); gap:12px; }
.calls-facts dt { color:var(--muted); }
.calls-facts dd { margin:0; color:var(--text-2); overflow-wrap:anywhere; }
@media(max-width:380px) {
  .calls-main { gap:10px; padding:14px 12px; }
  .calls-order { margin-left:62px; margin-right:12px; max-width:calc(100% - 74px); }
}
