/* ═══════════════════════════════════════════
   ECO Service — панель и вход (редизайн 30.10)
   Основа: язык дизайн-систем Atlassian / Carbon — светлый фон, белые
   панели с тонкой рамкой, один акцент (циан логотипа, затемнённый до
   AA), статусы плашками. Шрифт Manrope, цифры моноширинные (tnum).
   ═══════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f7f8f9;
  --surface: #ffffff;
  --surface-2: #f1f2f4;
  --border: #dfe1e6;
  --border-2: #ebecf0;
  --border-input: #8590a2;
  --ink: #172b4d;
  --ink-2: #44546f;
  --muted: #626f86;            /* 4.9:1 на белом */
  --accent: #00739f;           /* циан логотипа, затемнён: 5.3:1 с белым */
  --accent-hover: #005f84;
  --accent-soft: #e6f4f9;
  --focus: #388bff;
  --success: #216e4e; --success-bg: #dcfff1;
  --warning: #7f5f01; --warning-bg: #fff7d6;
  --danger: #ae2e24;  --danger-bg: #ffeceb; --danger-solid: #c9372c;
  --info: #0055cc;    --info-bg: #e9f2ff;
  --neutral: #44546f; --neutral-bg: #e9ebee;
  --r-panel: 8px;
  --r-ctl: 4px;
  --shadow-pop: 0 8px 24px rgba(9, 30, 66, 0.16), 0 0 1px rgba(9, 30, 66, 0.31);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* старые имена — для разметки, которую ещё рисует accounts.js */
  --text-dark: var(--ink);
  --text-muted: var(--muted);
  --white: #ffffff;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html.has-modal { overflow: hidden; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

::selection { background: #cce0ff; color: var(--ink); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { text-wrap: balance; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.muted { color: var(--muted); }
.num { text-align: right; }

/* ─── кнопки ─── */
.btn, .btn-primary, .btn-secondary, .btn-quiet, .btn-danger, .btn-danger-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r-ctl);
  font-weight: 600; font-size: 14px; line-height: 1.2; text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: #c1c7d0; }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger-solid); color: #fff; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-danger-quiet { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-quiet:hover { background: var(--danger-bg); }
.btn:disabled, .btn-primary:disabled, .btn-secondary:disabled { opacity: 0.55; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn i { font-size: 16px; line-height: 1; }
.is-busy { position: relative; color: transparent !important; }
.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.btn-secondary.is-busy::after { border-color: #c1c7d0; border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px; text-decoration-color: transparent;
}
.link-btn:hover { text-decoration-color: currentColor; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid #c1c7d0; border-radius: var(--r-ctl); background: var(--surface);
  color: var(--ink-2); text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn i { font-size: 18px; line-height: 1; }
.icon-btn.is-small { width: 32px; height: 32px; border-color: transparent; background: transparent; }
.icon-btn.is-small:hover { background: var(--surface-2); }

/* ─── поля ─── */
.input, .pool-one input, .pool-one select, .pool-bulk textarea {
  width: 100%; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--border-input); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink); font-size: 14px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.input:hover { border-color: var(--ink-2); }
.input:focus, .pool-one input:focus, .pool-one select:focus, .pool-bulk textarea:focus {
  border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); outline: none;
}
.input::placeholder, textarea::placeholder { color: var(--muted); }
select { background: var(--surface); color: var(--ink); }
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.field-err { color: var(--danger); font-size: 13px; margin-top: 4px; }
.field-err:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.search {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px;
  border: 1px solid var(--border-input); border-radius: var(--r-ctl); background: var(--surface);
  color: var(--muted);
}
.search:focus-within { border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }
.search input { border: 0; outline: 0; background: transparent; min-width: 0; width: 200px; color: var(--ink); }
.search input::placeholder { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px;
  border: 1px solid #c1c7d0; border-radius: 16px; background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.chip:hover { background: var(--surface-2); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.chip.is-bad b { color: var(--danger); }
.chip b { font-weight: 800; }

/* ─── плашки статусов ─── */
.lozenge {
  display: inline-block; padding: 2px 6px; border-radius: 3px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  line-height: 1.35; white-space: nowrap; vertical-align: middle;
}
.lozenge.is-success { background: var(--success-bg); color: var(--success); }
.lozenge.is-warning { background: var(--warning-bg); color: var(--warning); }
.lozenge.is-neutral { background: var(--neutral-bg); color: var(--neutral); }
.lozenge.is-info    { background: var(--info-bg);    color: var(--info); }
.lozenge.is-danger  { background: var(--danger-bg);  color: var(--danger); }

.svc-badge {
  display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px;
  border-radius: 4px; color: #fff; font-size: 11px; font-weight: 800;
}

/* ─── прогресс ─── */
.bar { position: relative; display: flex; height: 8px; border-radius: 4px; background: var(--border-2); overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-pend { height: 100%; background: #a3d2e4; }   /* запланировано: светлее размещённого */
.delta { margin-left: 6px; color: var(--success); font-size: 13px; font-weight: 700; }
.delta.is-neg { color: var(--danger); }

/* ─── Старт / Пауза / Стоп ─── */
.seg { display: inline-flex; border: 1px solid #c1c7d0; border-radius: var(--r-ctl); background: var(--surface); overflow: hidden; flex: none; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 10px;
  border: 0; border-right: 1px solid #c1c7d0; background: transparent; color: var(--ink);
  font-weight: 600; font-size: 13px;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn i { font-size: 15px; line-height: 1; }
.seg-btn:hover:not(:disabled):not(.is-on) { background: var(--surface-2); }
.seg-btn:disabled { color: #a5adba; }
.seg-btn.is-on { background: var(--accent-soft); color: var(--accent-hover); box-shadow: inset 0 0 0 1px var(--accent); cursor: default; }
.seg-btn.is-on[title] { cursor: pointer; }
.cab-soon { color: var(--ink-2); font-size: 13px; font-weight: 600; padding: 0 4px; }
.seg-btn:focus-visible { outline-offset: -3px; }

/* ═══════════════ ВХОД ═══════════════ */
.auth-page { background: var(--bg); }
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 420px);
  align-content: center; justify-content: center; padding: 40px 16px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel);
  padding: 32px; display: flex; flex-direction: column; gap: 20px;
}
.auth-card .logo img { height: 36px; width: auto; }
.auth-title { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.auth-sub { color: var(--ink-2); margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.auth-form .input { min-height: 40px; font-size: 16px; }
.field.is-invalid .input { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.control { position: relative; }
.control .input { padding-right: 44px; }
.control-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 36px; border: 0; background: transparent; color: var(--ink-2);
  border-radius: var(--r-ctl); display: grid; place-items: center;
}
.control-toggle:hover { background: var(--surface-2); }
.control-toggle i { font-size: 18px; }
.field-hint { color: var(--warning); font-size: 13px; margin-top: 4px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.forgot-hint { background: var(--info-bg); color: var(--ink); border-radius: var(--r-ctl); padding: 10px 12px; font-size: 13px; }
.alert {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px;
  border-radius: var(--r-ctl); background: var(--danger-bg); color: var(--danger); font-weight: 600;
}
.alert i { font-size: 18px; line-height: 1.2; }
#submit { min-height: 44px; font-size: 15px; }
#submit .btn-icon i { font-size: 18px; }
#submit.is-loading .btn-icon i { animation: spin 700ms linear infinite; display: inline-block; }
.auth-help { color: var(--ink-2); font-size: 13px; border-top: 1px solid var(--border-2); padding-top: 16px; }
.auth-help a { font-weight: 600; white-space: nowrap; }
/* «Поддержка в WhatsApp» — пока просто надпись: без номера и без ссылки.
   Цвет — акцентный, как у ссылки: когда появится номер, вид не изменится. */
.auth-help .support { font-weight: 600; white-space: nowrap; cursor: default; color: var(--accent); }
.forgot-hint .support { font-weight: 600; white-space: nowrap; cursor: default; color: var(--accent); }

.auth-foot { color: var(--muted); font-size: 12px; }

@media (max-width: 860px) {
  .auth { align-content: start; padding: 24px 16px 40px; }
  .auth-card { padding: 24px 20px; }
}

/* ═══════════════ ПАНЕЛЬ: шапка ═══════════════ */
.dash-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  min-height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.dash-top .logo img { height: 30px; width: auto; }
.dash-tabs { display: flex; align-self: stretch; gap: 4px; }
.dash-tab {
  display: inline-flex; align-items: center; padding: 0 12px; min-height: 56px;
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--ink-2); font-weight: 600;
}
.dash-tab:hover { color: var(--ink); background: var(--surface-2); }
.dash-tab.is-on { color: var(--accent); border-bottom-color: var(--accent); }
/* ссылка-вкладка («Журнал»): та же геометрия, что у кнопок */
.dash-tab-link { text-decoration: none; display: inline-flex; align-items: center; }
/* Счётчик на вкладке «Проверка» (11.11): сколько завершённых отзывов
   ещё не отмечено. При нуле прячется — js ставит hidden. */
.dash-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums;
  vertical-align: 1px;
}
.dash-tab-link:hover { color: var(--ink); }
.dash-tab:focus-visible { outline-offset: -2px; }
.dash-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.dash-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none;
}
.dash-user-text { display: flex; flex-direction: column; line-height: 1.2; }
.dash-user-name { font-weight: 700; }
.dash-user-role { color: var(--muted); font-size: 12px; }
.dash-diag, .dash-logout {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid #c1c7d0; border-radius: var(--r-ctl); background: var(--surface);
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.dash-diag:hover, .dash-logout:hover { background: var(--surface-2); color: var(--ink); }
.dash-diag[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
.dash-diag i, .dash-logout i { font-size: 16px; }
.dash-diag-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger-solid); color: #fff; font-size: 12px; font-weight: 800;
  display: inline-grid; place-items: center;
}

/* ── пауза автозапусков (09.11) ───────────────────────────────────────
   Кнопка живёт рядом с «Диагностикой», в выключенном виде нейтральная.
   Включённая пауза — красная и с точкой: конвейер стоит молча, это должно
   бросаться в глаза, а не находиться поиском в диагностике. */
.dash-hold {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid #c1c7d0; border-radius: var(--r-ctl); background: var(--surface);
  color: var(--ink); font-weight: 600; font-family: inherit; font-size: inherit; cursor: pointer;
}
.dash-hold:hover { background: var(--surface-2); }
.dash-hold i { font-size: 16px; }
.dash-hold.is-on { background: var(--danger-bg); border-color: var(--danger-solid); color: var(--danger); }
.dash-hold.is-on:hover { background: #ffdedb; }
.dash-hold.is-on::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--danger-solid);
  box-shadow: 0 0 0 3px rgba(201, 55, 44, 0.18);
}
.dash-hold[disabled] { opacity: 0.6; cursor: progress; }

/* Полоса под шапкой: пока идёт пауза — видно на каждом экране. */
.hold-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0; padding: 10px 24px; background: var(--danger-bg); color: var(--danger);
  border-bottom: 1px solid #ffc9c4; font-weight: 600;
}
.hold-bar[hidden] { display: none; }
.hold-bar i { font-size: 18px; flex: none; }
.hold-bar-text { flex: 1 1 320px; min-width: 0; }
.hold-bar-btn {
  min-height: 34px; padding: 0 14px; border-radius: var(--r-ctl); cursor: pointer;
  border: 1px solid var(--danger-solid); background: var(--danger-solid); color: #fff;
  font: inherit; font-weight: 700;
}
.hold-bar-btn:hover { background: #a92c22; border-color: #a92c22; }
.hold-bar-btn:focus-visible, .dash-hold:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (max-width: 640px) {
  .dash-hold-label { display: none; }
  .dash-hold { min-width: 44px; min-height: 44px; padding: 0 10px; justify-content: center; }
  .hold-bar { padding: 10px 16px; }
}

.dash-wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px 40px; }
.dash-hello { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.dash-sub { color: var(--ink-2); margin-top: 4px; }
.dash-meta {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}
.dash-meta a { font-weight: 600; }
.dash-meta .support { font-weight: 600; cursor: default; color: var(--accent); }

/* ── статистика: отзывы по дням (31.10) ───────────────────────────────
 * Столбики растягиваются по ширине, высота — от максимума за период.
 * Подписи по оси X идут не под каждым днём: на 375 px иначе не читается. */
.stats-panel { padding-bottom: 8px; }
.stats-chart {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-panel); padding: 16px 16px 8px;
}
.st-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 132px;
  border-bottom: 1px solid var(--border); padding-bottom: 2px;
}
.st-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.st-bar {
  position: relative; width: 100%; border-radius: 3px 3px 0 0;
  background: var(--border); transition: height .18s ease;
}
.st-bar.is-on { background: var(--accent); }
.st-bar.is-on:hover { background: var(--accent-hover); }
.st-val {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; color: var(--ink-2); white-space: nowrap;
}
.st-x {
  display: block; height: 16px; margin-top: 4px; font-size: 10px;
  color: var(--muted); text-align: center; white-space: nowrap;
}
.stats-sub { font-size: 15px; font-weight: 800; margin: 20px 0 8px; }
.stats-card-list { list-style: none; margin: 0; padding: 0; }
.stats-card-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel);
  margin-bottom: 6px;
}
.stats-card-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-card-count { flex: 0 0 auto; color: var(--ink); }
.stats-empty { color: var(--ink-2); padding: 4px 0; }
.stats-msg { color: var(--danger); font-weight: 600; margin-top: 12px; }
.ps-best { color: var(--ink-2); }
@media (max-width: 700px) {
  .stats-chart { padding: 12px 10px 6px; }
  .st-bars { height: 108px; gap: 2px; }
  .st-val { display: none; }
}

/* общий заголовок раздела */
.sec-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.sec-title { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.sec-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sec-sub { color: var(--ink-2); margin-bottom: 16px; max-width: 70ch; }
.cli-count, .cab-count {
  background: var(--neutral-bg); color: var(--neutral); border-radius: 10px;
  padding: 1px 8px; font-size: 12px; font-weight: 800;
}
.cli-count:empty, .cab-count:empty { display: none; }

/* ═══════════════ КАБИНЕТ ═══════════════ */
.cab-headrow { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.cab-hello { flex: 1 1 280px; min-width: 0; }
.cab-money {
  display: flex; align-items: stretch; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-panel); flex-wrap: wrap;
}
.cab-m { padding: 10px 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; }
.cab-l { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cab-v { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.cab-topup { margin: 10px 14px; align-self: center; }
.cab-money .cab-m:last-of-type:not(:has(+ .cab-topup)) { border-right: 0; }

.cab-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); }
.cab-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.cab-title { font-size: 16px; font-weight: 800; }
/* 08.11: поиск и «Добавить карточку» прижаты к заголовку слева, а справа —
 * «Изменить выбранные»: массовая правка должна быть на виду, а не в меню. */
.cab-bulk { margin-left: auto; }
.cab-bulk .count { font-weight: 700; }

/* Сортировка карточек (11.11): значок-кнопка в шапке, меню — <details>,
 * поэтому работает и без JS-роутера; открытие/закрытие — ванильно. */
.cab-sort { position: relative; flex: none; }
.cab-sort > summary { list-style: none; cursor: pointer; user-select: none; }
.cab-sort > summary::-webkit-details-marker { display: none; }
.cab-sort > summary::marker { content: ""; }
.cab-sort[open] > summary { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }
.cab-sort-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 212px; padding: 6px; display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface);
  box-shadow: 0 12px 28px rgba(16, 24, 40, .16);
}
.cab-sort-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.cab-sort-item:hover { background: var(--surface-2); }
.cab-sort-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cab-sort-item[aria-checked="true"] { font-weight: 700; }
.cab-sort-item[aria-checked="true"]::after { content: "✓"; margin-left: auto; font-weight: 700; }
/* Пока ничего не отмечено — кнопка «спит»: видно, что она есть, но нажать
 * нельзя (disabled + приглушённый вид). */
.cab-bulk[disabled] { opacity: 0.45; cursor: not-allowed; }

.cab-add { padding: 16px 20px; border-bottom: 1px solid var(--border); background: #fbfcfc; }
.cab-add-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.cab-add-row { display: flex; gap: 8px; max-width: 720px; }
.cab-add-row .input { flex: 1 1 auto; min-width: 0; }
.cab-note { color: var(--muted); font-size: 13px; margin-top: 8px; }
.cab-msg { margin-top: 8px; font-size: 13px; font-weight: 600; }
.cab-msg.is-err { color: var(--danger); }
.cab-msg.is-ok { color: var(--success); }
.cab-empty { padding: 32px 20px; color: var(--ink-2); text-align: center; }

.cab-cols, .cab-row {
  display: grid;
  /* 08.11: слева колонка под чекбокс. Ширина панели прежняя — 22 px берём у
   * первой колонки, поэтому название, «Размещено» и рейтинг сдвигаются
   * правее, как просил оператор. */
  grid-template-columns: 22px minmax(200px, 1.4fr) minmax(180px, 1.3fr) minmax(170px, 1fr) 276px;
  gap: 0 20px; align-items: center; padding: 0 20px;
}
.cab-c-sel, .cab-cols .cab-cols-sel { display: flex; align-items: center; justify-content: flex-start; }
.cab-c-sel input, .cab-cols-sel input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.cab-c-sel input:disabled { cursor: not-allowed; opacity: 0.4; }
/* Отмеченная карточка подсвечена — видно, что попадёт в массовую правку */
.cab-row.is-sel { background: #f4f8ff; }
.cab-row.is-sel:hover { background: #eef4ff; }
.cab-cols .cab-cols-sel input { cursor: pointer; }

/* Массовая правка: форма внутри окна подтверждения (08.11) */
.bulk-form { display: grid; gap: 4px; margin: 14px 0 2px; text-align: left; }
.bulk-form .plan-input { max-width: 170px; }
.bulk-form .field-label { margin-top: 10px; }
.bulk-form .seg { margin-top: 2px; width: 100%; }
.bulk-form .seg-btn { flex: 1 1 0; justify-content: center; }
.cab-cols { padding-top: 8px; padding-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--ink-2); border-bottom: 1px solid var(--border); }
.cab-cols span:last-child { text-align: right; }
.cab-row { padding-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border-2); }
.cab-row:last-child { border-bottom: 0; }
.cab-row:hover { background: #fafbfc; }
.cab-row.is-readonly .cab-c-prog, .cab-row.is-readonly .cab-c-rate { color: var(--ink-2); }
.cab-c-main { min-width: 0; }
.cab-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cab-title-link {
  color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.cab-title-link:hover { color: var(--accent); text-decoration: underline; }
.cab-title-link.is-pending { color: var(--muted); font-style: italic; font-weight: 600; }
.cab-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-width: 0; font-size: 12px; }
.cab-meta .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cab-meta .cab-src {
  color: var(--muted); text-decoration: none; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* постоянный пунктир: видно, что это ссылка, а не подпись */
  border-bottom: 1px dotted var(--border-input);
}
.cab-meta .cab-src:hover, .cab-meta .cab-src:focus-visible {
  color: var(--accent); border-bottom-color: var(--accent); outline: none;
}

/* 31.10: подтверждение приёма задачи воркером — «воркер принял 09:52».
   Не бейдж и не тревога: спокойная подпись рядом со статусом карточки. */
.cab-meta .cab-ack {
  color: var(--muted); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.cab-meta .cab-ack::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

.prog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; }
.prog-n b { font-size: 16px; font-weight: 800; }
.prog-aside { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.prog-month { color: var(--ink-2); }
/* Предыдущий месяц в начале колонки «Размещено отзывов» (01.11): «1 в октябре»
 * перед текущим. Ширина колонки не меняется — сжимается блок текущего месяца
 * (.prog-n), поэтому длинный текст обрезается многоточием, а не растягивает сетку. */
.prog-prev { color: var(--muted); font-size: 12px; white-space: nowrap; flex: 0 0 auto; }
.prog-prev b { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.prog-prev-s { display: none; }
.prog-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cab-c-prog .link-btn { font-size: 13px; }
.rate-v { font-weight: 700; font-size: 15px; white-space: nowrap; }
.rate-star { color: #b38600; font-size: 14px; vertical-align: -1px; }
.cab-c-rate .muted { font-size: 12px; margin-top: 2px; }
/* Отзыв сняли: видно сразу и заметно — не серым «−1» в подписи */
.cab-c-rate .rate-drop {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--danger-bg); color: var(--danger);
  font-size: 12px; font-weight: 800;
}
.cab-c-rate .rate-drop i { font-size: 13px; }
.cab-c-ctl { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.cab-c-orders {
  grid-column: 1 / -1; margin-top: 10px; display: flex; gap: 10px; align-items: center;
  background: var(--bg); border-radius: var(--r-ctl); padding: 6px 10px; font-size: 13px; color: var(--ink-2);
}
.cab-group {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 10px 20px;
  background: var(--bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 13px; color: var(--ink-2);
}
.cab-group .muted { font-weight: 500; }

@media (max-width: 1060px) {
  .cab-cols { display: none; }
  /* Узкий экран: чекбокс — первая колонка, «Заведение» — справа от него,
   * «Размещено» и «Рейтинг» — по своим колонкам (без явных мест они
   * попадали в 22-пиксельную колонку чекбокса и текст наезжал). */
  .cab-row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr); gap: 12px 24px; }
  .cab-c-main { grid-column: 2 / -1; }
  .cab-c-sel { align-self: start; padding-top: 2px; }
  .cab-c-prog { grid-column: 2; }
  .cab-c-rate { grid-column: 3; }
  .cab-c-orders { grid-column: 1 / -1; }
  .cab-c-ctl { grid-column: 1 / -1; justify-content: flex-start; }
  .prog-month { display: none; }
  .prog-prev-m { display: none; }
  .prog-prev-s { display: inline; }
  .cab-c-prog::before, .cab-c-rate::before {
    content: attr(data-l); display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
  }
}

/* ── карточка изнутри ── */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; margin-bottom: 12px; min-height: 32px; }
.d-head {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 16px 20px; margin-bottom: 16px;
}
.d-head-l { min-width: 0; flex: 1 1 320px; }
.d-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.d-h { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; min-width: 0; }
.ren-input { font-size: 18px; font-weight: 700; max-width: 520px; }
.d-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
/* Колонки независимые: вертикальный ритм задаёт .d-col, а не высота
   соседнего блока (иначе промежутки в колонках получаются разными).
   Промежуток 16 px — тот же, что между шапкой карточки и «Планом». */
.d-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.d-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.d-title { font-size: 14px; font-weight: 800; }
.d-rows { display: flex; flex-direction: column; }
.d-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--border-2); font-size: 13px; }
.d-row dt { color: var(--ink-2); }
.d-row dd { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.plan-row { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-input { width: 140px; flex: none; }
.d-panel > .btn-secondary, .d-panel > .btn-danger-quiet { align-self: flex-start; }
.order-list { list-style: none; display: flex; flex-direction: column; }
.order { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border-2); font-size: 13px; }
.order:first-child { border-top: 0; }
.order-t { color: var(--ink-2); flex: 1 1 160px; }
.ext-link { font-weight: 600; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tbl th:not(:first-child) { text-align: right; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border-2); }
.d-panel .cab-c-prog, .d-panel .cab-c-rate { display: block; }
@media (max-width: 860px) {
  .d-grid { grid-template-columns: minmax(0, 1fr); }
  /* На телефоне колонки раскрываются в общий поток: порядок блоков
     остаётся прежним — план → результат → заказы → история → о карточке. */
  .d-col { display: contents; }
  .d-plan { order: 1 } .d-prog { order: 2 } .d-ords { order: 3 }
  .d-hist { order: 4 } .d-info { order: 5 }
}

/* ═══════════════ КЛИЕНТЫ ═══════════════ */
.cli-panel .sec-head { margin-bottom: 16px; }
.cli-totals {
  display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel);
}
.cli-total { padding: 10px 18px; border-right: 1px solid var(--border-2); display: flex; flex-direction: column; }
.cli-total:last-child { border-right: 0; }
.cli-total-l { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cli-total-n { font-size: 18px; font-weight: 800; white-space: nowrap; }

.cli-cols, .cli-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.7fr) minmax(130px, 1.1fr) minmax(100px, 0.9fr) 70px minmax(110px, 1fr) minmax(110px, 1fr) 60px 104px;
  gap: 0 16px; align-items: center; padding: 0 16px;
}
.cli-cols span:nth-child(n+3):nth-child(-n+7) { text-align: right; }
.cli-cols {
  padding-top: 8px; padding-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.cli-rows { background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--r-panel) var(--r-panel); }
.cli-rows:empty { display: none; }
.cli-row { padding-top: 10px; padding-bottom: 10px; border-top: 1px solid var(--border-2); cursor: pointer; }
.cli-row:first-child { border-top: 0; }
.cli-row:hover, .cli-row.is-open { background: #fafbfc; }
.cli-who { min-width: 0; }
.cli-toggle {
  display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0;
  text-align: left; min-width: 0; max-width: 100%; color: var(--ink);
}
.cli-toggle i { font-size: 18px; color: var(--ink-2); flex: none; }
.cli-who-t { display: flex; flex-direction: column; min-width: 0; }
.cli-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-toggle:hover .cli-name { color: var(--accent); text-decoration: underline; }
.cli-login { color: var(--muted); font-size: 12px; }
.cli-num { text-align: right; }
.cli-sub { color: var(--muted); font-size: 12px; }
.cli-row-acts { display: flex; justify-content: flex-end; }
.cli-detail { border-top: 1px solid var(--border-2); background: var(--bg); padding: 12px 16px 16px; }
.cli-tools { display: flex; gap: 8px; align-items: baseline; margin-bottom: 10px; }
.cli-nocard { color: var(--ink-2); }
.cli-detail > .cli-card:first-child { border-top: 0; }
.cli-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(4, minmax(110px, 1fr));
  gap: 6px 16px; align-items: start; padding: 10px 12px;
  border-top: 1px solid var(--border-2);
}
.cli-card-head { padding-top: 0; padding-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cli-detail .rate-v { font-size: 13px; }
.cli-card-head .cli-c-cell:not(:first-child) { color: var(--ink-2); }
.cli-c-name { display: flex; gap: 8px; align-items: center; min-width: 0; font-weight: 700; }
.cli-c-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-c-cell { font-size: 13px; min-width: 0; }
.cli-c-foot { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cab-status-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cli-c-hist { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.cli-pill { background: var(--surface-2); border-radius: 3px; padding: 2px 8px; font-size: 12px; color: var(--ink-2); }
.cli-empty { padding: 24px 16px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-panel) var(--r-panel); }
.cli-msg { color: var(--danger); margin-top: 8px; }

@media (max-width: 960px) {
  .cli-cols { display: none; }
  .cli-rows { border-radius: var(--r-panel); }
  .cli-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 12px 16px; }
  .cli-who { grid-column: 1 / -1; }
  .cli-row-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .cli-cell { text-align: left; }
  .cli-cell::before {
    content: attr(data-l); display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--muted);
  }
  .cli-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cli-card-head { display: none; }
  .cli-c-name { grid-column: 1 / -1; }
  .cli-c-cell[data-l]::before {
    content: attr(data-l); display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--muted);
  }
}

/* ═══════════════ ПОЧТЫ (пул) ═══════════════ */
.pool-stats-strip {
  display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 16px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel);
  color: var(--ink-2);
}
.ps-v { font-weight: 800; color: var(--ink); }
.ps-item.is-ok .ps-v { color: var(--success); }
.ps-item.is-bad .ps-v { color: var(--danger); }
.ps-item.is-warn .ps-v { color: var(--warning); }
.pool-deficit { padding: 10px 12px; border-radius: var(--r-ctl); margin-bottom: 12px; font-weight: 600; }
.pool-deficit.is-err { background: var(--danger-bg); color: var(--danger); }
.pool-deficit:empty { display: none; }

.pool-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel);
  padding: 16px 20px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px;
}
.pool-one { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.pool-one label, .pool-bulk label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.pool-bulk textarea { min-height: 120px; font-variant-numeric: tabular-nums; font-size: 13px; resize: vertical; }
.pool-bulk code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.pool-auth-hint, .pool-note { color: var(--ink-2); font-size: 13px; max-width: 80ch; }
.pool-form-actions { display: flex; gap: 8px; }
.pool-msg { font-size: 13px; font-weight: 600; }
.pool-msg.is-err { color: var(--danger); }
.pool-msg:empty { display: none; }
.pool-filter { margin-bottom: 12px; }

.pool-scroll { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); overflow: hidden; }
.pool-table { width: 100%; border-collapse: collapse; }
.pool-table th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-2);
  padding: 8px 16px; border-bottom: 1px solid var(--border);
}
.pool-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-2); vertical-align: top; font-size: 13px; }
.pool-table tr:last-child td { border-bottom: 0; }
.pool-email { font-weight: 700; overflow-wrap: anywhere; }
.pool-reason { color: var(--danger); font-size: 12px; margin-top: 4px; max-width: 36ch; }
.pool-act { text-align: right; white-space: nowrap; }
.pool-table th:nth-child(4) { text-align: right; }
.pool-act .btn-sm + .btn-sm { margin-left: 6px; }
.pool-empty { color: var(--ink-2); text-align: center; padding: 24px 16px !important; }

@media (max-width: 760px) {
  .pool-table thead { display: none; }
  .pool-table, .pool-table tbody, .pool-table tr, .pool-table td { display: block; width: 100%; }
  .pool-table tr { padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
  .pool-table tr:last-child { border-bottom: 0; }
  .pool-table td { padding: 4px 0; border: 0; }
  .pool-table td[data-l]:not(.pool-email)::before {
    content: attr(data-l) " · "; color: var(--muted); font-size: 12px; font-weight: 700;
  }
  .pool-act { text-align: left; padding-top: 8px !important; display: flex !important; gap: 8px; flex-wrap: wrap; }
  .pool-table td.num { text-align: left; }
  .pool-table td.is-empty { display: none; }
  .pool-act .btn-sm + .btn-sm { margin-left: 0; }
}

/* ═══════════════ ДИАГНОСТИКА (выдвижная панель) ═══════════════ */
.diag-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(560px, 100vw); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); box-shadow: var(--shadow-pop); padding: 0 20px 24px;
}
html.has-drawer body::after {
  content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(9, 30, 66, 0.32);
}
.diag-head {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--border);
}
.diag-title { font-size: 18px; font-weight: 800; }
.diag-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.diag-ts { color: var(--muted); font-size: 12px; margin-right: 4px; }
.diag-close { width: 36px; padding: 0; }
.diag-verdict { margin: 16px 0 12px; padding: 12px 14px; border-radius: var(--r-ctl); font-weight: 700; font-size: 15px; }
.diag-verdict:empty { display: none; }
.diag-verdict.is-ok { background: var(--success-bg); color: var(--success); }
.diag-verdict.is-warn { background: var(--warning-bg); color: var(--warning); }
.diag-verdict.is-bad { background: var(--danger-bg); color: var(--danger); }
.dash-tiles {
  display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--r-ctl); font-size: 13px; color: var(--ink-2);
}
.tile { display: inline-flex; flex-direction: row-reverse; gap: 5px; align-items: baseline; }
.tile-num { font-weight: 800; color: var(--ink); }
.tile.is-warn .tile-num { color: var(--warning); }
.tile.is-bad .tile-num { color: var(--danger); }
.tile.is-empty .tile-num { color: var(--muted); }
.diag-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.diag-sum b { color: var(--ink); }
.diag-sum .is-bad b { color: var(--danger); }
.diag-sec { margin-top: 16px; }
.diag-sec h3 { font-size: 13px; font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.diag-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--border-2); font-size: 13px;
}
.diag-lv { font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 3px; background: var(--neutral-bg); color: var(--neutral); }
.diag-lv-FAIL { background: var(--danger-bg); color: var(--danger); }
.diag-lv-WARN { background: var(--warning-bg); color: var(--warning); }
.diag-lv-OK { background: var(--success-bg); color: var(--success); }
.diag-name { font-weight: 700; overflow-wrap: anywhere; }
.diag-detail, .diag-hint { grid-column: 2; color: var(--ink-2); overflow-wrap: anywhere; }
.diag-hint { color: var(--accent-hover); }
.diag-empty { color: var(--muted); font-size: 13px; }
.diag-alert { padding: 8px 0; border-top: 1px solid var(--border-2); font-size: 13px; }
.diag-alert-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.diag-sev { font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 3px; background: var(--neutral-bg); color: var(--neutral); text-transform: uppercase; }
.diag-sev-critical, .diag-sev-error { background: var(--danger-bg); color: var(--danger); }
.diag-sev-warning, .diag-sev-warn { background: var(--warning-bg); color: var(--warning); }
.diag-time { color: var(--muted); font-size: 12px; }
.diag-text { margin-top: 2px; overflow-wrap: anywhere; }

/* ═══════════════ МОДАЛКА И ТОСТЫ ═══════════════ */
.adm-modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(9, 30, 66, 0.48);
  display: grid; place-items: center; padding: 16px; overscroll-behavior: contain;
  animation: fade 150ms var(--ease);
}
.adm-modal {
  width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow-pop);
  padding: 20px 24px; display: flex; flex-direction: column; gap: 12px;
  animation: rise 200ms var(--ease);
}
.adm-modal-title { font-size: 18px; font-weight: 800; }
.adm-modal-rows { display: flex; flex-direction: column; }
.adm-modal-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--border-2); font-size: 14px; }
.adm-modal-row:first-child { border-top: 0; }
.adm-modal-row dt { color: var(--ink-2); }
.adm-modal-row dd { font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.adm-modal-row dd.is-money { font-weight: 800; font-size: 16px; }
.adm-modal-note { color: var(--ink-2); font-size: 13px; }
.adm-modal-error { background: var(--danger-bg); color: var(--danger); border-radius: var(--r-ctl); padding: 8px 10px; font-size: 13px; font-weight: 600; }
.adm-modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.adm-modal .chips { margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.adm-toasts {
  position: fixed; left: 16px; bottom: 16px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.adm-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 8px 10px 14px; border-radius: var(--r-ctl);
  background: var(--ink); color: #fff; box-shadow: var(--shadow-pop); font-weight: 600;
  animation: rise 200ms var(--ease);
}
.adm-toast > i { font-size: 18px; line-height: 1.25; flex: none; }
.adm-toast.is-ok > i { color: #7ee2b8; }
.adm-toast.is-err { background: var(--danger); }
.adm-toast.is-info > i { color: #8fb8f6; }
.adm-toast span { flex: 1 1 auto; }
.adm-toast-x { background: none; border: 0; color: inherit; opacity: 0.8; width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-ctl); flex: none; }
.adm-toast-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }

/* ═══════════════ ТЕЛЕФОН ═══════════════ */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .dash-top { padding: 0 16px; gap: 0 12px; }
  .dash-top .logo img { height: 26px; }
  .dash-tabs { order: 3; flex: 1 0 100%; margin: 0 -16px; padding: 0 8px; border-top: 1px solid var(--border-2); overflow-x: auto; }
  .dash-tab { min-height: 44px; white-space: nowrap; }
  .dash-user { gap: 8px; min-height: 56px; }
  .dash-user-text, .dash-diag-label, .dash-logout span { display: none; }
  .dash-avatar { display: none; }
  .dash-diag, .dash-logout { min-width: 44px; min-height: 44px; padding: 0 10px; justify-content: center; }
  .dash-wrap { padding: 20px 16px 32px; }
  .dash-hello, .sec-title { font-size: 21px; }

  .cab-headrow { margin-bottom: 14px; gap: 12px; }
  .cab-money { width: 100%; }
  .cab-m { flex: 1 1 0; padding: 10px 14px; }
  .cab-v { font-size: 18px; }
  .cab-topup { flex: 1 0 100%; margin: 0; border-radius: 0 0 var(--r-panel) var(--r-panel); border-width: 1px 0 0; min-height: 44px; }
  .cab-head { padding: 12px 16px; }
  .cab-add { padding: 14px 16px; }
  .cab-add-row { flex-direction: column; }
  .cab-add-row .input { min-height: 44px; font-size: 16px; }
  .cab-add-open { min-height: 40px; }
  /* Сортировка на мобильном — в одной строке с поиском, справа от него:
   * иначе значок вставал отдельной строкой, а меню уезжало за левый край. */
  .cab-search { order: 5; flex: 1 1 0; min-width: 0; margin-left: 0; }
  .cab-sort { order: 6; }
  .cab-sort-menu { right: 0; min-width: 200px; max-width: calc(100vw - 32px); }
  .cab-sort-item { padding: 11px 12px; font-size: 15px; }
  .cab-search input { width: 100%; font-size: 16px; }
  .cab-row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr); padding: 14px 16px; gap: 12px 12px; }
  .cab-c-ctl { grid-column: 1 / -1; }
  .cab-bulk { flex: 1 0 100%; margin-left: 0; min-height: 40px; justify-content: center; }
  .prog-top { flex-wrap: wrap; }
  .cab-c-ctl { justify-content: space-between; }
  .seg { flex: 1 1 auto; }
  .seg-btn { flex: 1 1 0; justify-content: center; min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .cab-group { padding: 10px 16px; }

  .search { width: 100%; }
  .search input { width: 100%; font-size: 16px; }
  .sec-tools { width: 100%; margin-left: 0; }
  .cli-total { flex: 1 1 45%; border-bottom: 1px solid var(--border-2); }
  .btn-sm { min-height: 40px; }
  .input, .pool-one input, .pool-one select, .pool-bulk textarea { min-height: 44px; font-size: 16px; }
  .adm-modal { padding: 18px 16px; }
  .adm-modal-actions .btn, .adm-modal-actions .btn-primary, .adm-modal-actions .btn-secondary,
  .adm-modal-actions .btn-quiet, .adm-modal-actions .btn-danger { min-height: 44px; flex: 1 1 auto; }
  .chip { min-height: 40px; }
  .link-btn { min-height: 40px; }
}

/* Чек-лист в дашборде (11.11): панель вкладки «Проверка». Верхняя панель
   тут не липкая — в дашборде уже липкие шапка и вкладки, вторая липкая
   полоса наезжала бы на список. */
.check-panel .chk-bar { position: static; top: auto; }
.check-panel .chk-toast { z-index: 30; }

/* Чек-лист «Проверка отзывов» (09.11). Стили переехали из check.php 11.11,
 * чтобы тот же блок рисовался вкладкой в дашборде и отдельной страницей. */
  /* Своя вёрстка: страница живёт одна, без шапки и вкладок дашборда.
     Токены и кнопки берём из style.css, чтобы не заводить второй язык. */
  .chk-body { background: var(--bg); color: var(--ink); font-family: var(--font); min-height: 100vh; }

  .chk-top {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 12px 24px; background: var(--surface);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
  }
  .chk-top h1 { font-size: 16px; font-weight: 800; }
  .chk-top .chk-user { margin-left: auto; color: var(--muted); font-size: 13px; }
  .chk-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
  .chk-brand span { color: var(--accent); }

  .chk-main { max-width: 1180px; margin: 0 auto; padding: 20px 24px 64px; }

  /* Панель управления: счётчики, фильтры, поиск. */
  .chk-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel);
    position: sticky; top: 57px; z-index: 4;
  }
  .chk-nums { display: flex; gap: 18px; }
  .chk-num { display: flex; flex-direction: column; line-height: 1.15; }
  .chk-num b { font-size: 20px; font-variant-numeric: tabular-nums; }
  .chk-num span { font-size: 12px; color: var(--muted); }
  .chk-num.is-left b { color: var(--accent); }
  .chk-num.is-checked b { color: var(--success); }
  .chk-num.is-gone b { color: var(--danger-solid); }

  .chk-seg { display: inline-flex; border: 1px solid #c1c7d0; border-radius: var(--r-ctl); overflow: hidden; }
  .chk-seg button {
    min-height: 34px; padding: 0 12px; border: 0; background: var(--surface);
    font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  }
  .chk-seg button + button { border-left: 1px solid #c1c7d0; }
  .chk-seg button:hover { background: var(--surface-2); }
  .chk-seg button.is-on { background: var(--accent-soft); color: var(--accent); }
  .chk-seg button .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
  .chk-seg button.is-on .n { color: inherit; }

  .chk-search { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .chk-search input {
    min-height: 34px; width: 260px; padding: 0 10px;
    border: 1px solid var(--border-input); border-radius: var(--r-ctl);
    font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
  }
  .chk-search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

  /* Список: таблица свёрстана на div'ах — так проще липкие дни и одну
     колонку с галочкой, которая должна быть крупной и clickable целиком. */
  .chk-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); overflow: hidden; }
  .chk-day {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; background: var(--surface-2);
    font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-2); border-top: 1px solid var(--border-2);
  }
  .chk-day:first-child { border-top: 0; }
  .chk-day .n { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; }

  .chk-head {
    display: grid; grid-template-columns: 76px 130px minmax(220px, 1.5fr) minmax(200px, 1.3fr) 190px;
    gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border-2);
    font-size: 12px; font-weight: 700; color: var(--muted);
  }

  .chk-row {
    display: grid; grid-template-columns: 76px 130px minmax(220px, 1.5fr) minmax(200px, 1.3fr) 190px;
    gap: 12px; align-items: center;
    padding: 10px 16px; border-top: 1px solid var(--border-2);
  }
  .chk-head > span:last-child { text-align: right; }
  .chk-row:first-of-type { border-top: 0; }
  .chk-row:hover { background: #fafbfc; }
  .chk-row.is-checked { background: #fbfdfc; }
  .chk-row.is-checked .chk-when, .chk-row.is-checked .chk-email, .chk-row.is-checked .chk-place { color: var(--muted); }
  .chk-row.is-checked .chk-title { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }

  /* Две отметки в одной ячейке: ✓ «есть» и ✗ «нет». Состояние одно,
     поэтому кнопки взаимоисключающие — нажал крестик, галочка снялась. */
  .chk-cell-sel { display: flex; align-items: center; gap: 6px; }
  .chk-box {
    width: 22px; height: 22px; margin: 0; cursor: pointer;
    accent-color: var(--success);
  }
  .chk-box:disabled, .chk-x:disabled { opacity: .5; cursor: progress; }
  .chk-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0; cursor: pointer;
    border: 1px solid #c1c7d0; border-radius: var(--r-ctl);
    background: var(--surface); color: var(--muted);
    font-size: 16px; line-height: 1;
  }
  .chk-x:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
  .chk-x.is-on {
    background: var(--danger-bg); border-color: var(--danger-solid);
    color: var(--danger-solid);
  }
  .chk-row.is-gone { background: #fffafa; }
  .chk-row.is-gone .chk-title { color: var(--danger); }
  .chk-row.is-gone .chk-email .d { color: var(--danger); }
  .chk-when { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }
  .chk-when small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
  .chk-title { font-weight: 700; font-size: 14px; }
  .chk-place { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
  .chk-email { font-size: 13px; word-break: break-all; }
  .chk-email .d { display: block; font-size: 12px; color: var(--muted); }

  .chk-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .chk-links a {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 9px; border: 1px solid #c1c7d0; border-radius: var(--r-ctl);
    font-size: 12px; font-weight: 600; color: var(--ink); text-decoration: none; background: var(--surface);
  }
  .chk-links a:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .chk-links a i { font-size: 14px; }

  .chk-empty { padding: 40px 16px; text-align: center; color: var(--muted); }
  .chk-note { margin-top: 14px; font-size: 12px; color: var(--muted); }
  .chk-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
    padding: 10px 16px; border-radius: var(--r-ctl); background: var(--ink); color: #fff;
    font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none;
    transition: opacity 150ms var(--ease), transform 150ms var(--ease);
  }
  .chk-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

  @media (max-width: 900px) {
    .chk-top { padding: 10px 14px; }
    .chk-main { padding: 14px 14px 48px; }
    .chk-bar { top: 0; position: static; }
    .chk-search { margin-left: 0; width: 100%; }
    .chk-search input { width: 100%; }
    .chk-head { display: none; }
    .chk-row {
      grid-template-columns: 76px minmax(0, 1fr); gap: 6px 10px; padding: 12px 14px;
      align-items: start;
    }
    .chk-cell-sel { grid-row: 1; grid-column: 1; padding-top: 2px; }
    .chk-when { grid-column: 2; }
    .chk-title-cell { grid-column: 2; }
    .chk-email { grid-column: 2; }
    .chk-links { grid-column: 2; justify-content: flex-start; }
  }

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