/* ══════════════════════════════════════════════════════════════════
   WHY PAY CRM — тема «Ясная» (13.11.2026)

   Заменяет встроенные стили index.html и style.css. Подключается
   ПОСЛЕДНЕЙ (после chat.css, leads.css, ai.css), поэтому здесь же
   поправлены их жёстко заданные цвета.

   Правила темы:
   • одно главное действие на экране — синяя кнопка .btn-primary;
   • второстепенные — белые с рамкой (.btn-ghost), опасные — красные;
   • выбранное всегда видно и цветом, и галочкой;
   • старые имена переменных (--primary, --red-bg …) оставлены: ими
     пользуются модули и inline-стили.
   ══════════════════════════════════════════════════════════════════ */

:root {
  --font: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;

  /* поверхности */
  --page-bg: #F3F4F6;
  --card-bg: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #EDEFF3;
  --border: #E1E4EA;
  --border-light: #ECEEF2;
  --border-strong: #C9CFD8;

  /* текст */
  --text-1: #12151A;
  --text-2: #434C5A;
  --text-3: #626B7A;

  /* акцент = действие */
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-press: #1E40AF;
  --accent-soft: #EAF1FE;
  --accent-soft-2: #D5E3FD;
  --accent-line: #9DBAF9;
  --accent-ink: #1D4ED8;
  --ring: 0 0 0 3px rgba(37, 99, 235, .28);

  /* смыслы */
  --ok: #15803D;   --ok-bg: #E8F6EE;   --ok-line: #A8DDBB;
  --warn: #A15C07; --warn-bg: #FEF5E4; --warn-line: #F3CF86;
  --bad: #D92D20;  --bad-bg: #FDEEEC;  --bad-line: #F4B3AC;

  /* зоны Health Score */
  --z-green: #22A55B;
  --z-yellow: #E3A008;
  --z-orange: #F2711C;
  --z-red: #E5342B;

  /* боковое меню */
  --sidebar-bg: #14171C;
  --sb-text: #C3CAD4;
  --sb-dim: #8B94A2;
  --sb-hover: #1E2229;
  --sb-active: #1F2D49;
  --sb-line: #252A33;

  /* тени и радиусы */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .10);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .24);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* совместимость со старыми модулями */
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --primary-bg: var(--accent-soft);
  --purple: #7C3AED;
  --purple-bg: #F3EEFE;
  --red: #D92D20;
  --red-bg: #FDEEEC;
  --orange: #EA580C;
  --orange-bg: #FFF1E7;
  --yellow: #D99A00;
  --yellow-bg: #FEF6E0;
  --green: #22A55B;
  --green-bg: #E8F6EE;
  --green-dark: #15803D;
  --lime: #84CC16;
}

/* ───────────── БАЗА ───────────── */

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

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--page-bg);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }
a { color: var(--accent-ink); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { display: flex; align-items: center; justify-content: center; }
.icon svg { display: block; }

/* Иконки набора (viewBox 24×24) без своего правила не раздуваются на всю
   ширину и не заливаются чёрным. :where — нулевая специфичность: любой
   класс выше перекрывает. */
:where(svg[viewBox="0 0 24 24"]) {
  width: 1.25em; height: 1.25em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* В колонках фиксированной высоты (окна, мастер, карточка клиента) блоки
   с overflow:hidden иначе сжимаются flex-ом и обрезают содержимое */
.modal:not(.wiz) > *, .wiz-main > *, .wiz-side > *, .drawer-body > * { flex-shrink: 0; }

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CDD2DA; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #AEB6C2; }

/* ───────────── БОКОВОЕ МЕНЮ ───────────── */

.sidebar {
  width: 248px; min-width: 248px;
  height: 100vh;
  position: sticky; top: 0;
  z-index: 30;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sb-text);
}

.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 20px 18px 14px; }

.logo-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 19px; height: 19px; stroke: #fff; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.logo-labels { line-height: 1.2; min-width: 0; }
.logo-name { font-size: 15px; font-weight: 700; color: var(--text-1); letter-spacing: .01em; }
.logo-sub  { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sidebar .logo-name { color: #fff; }
.sidebar .logo-sub  { color: var(--sb-dim); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 2px 12px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-nav::-webkit-scrollbar-thumb { background-color: #2E343E; }

.nav-section {
  font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--sb-dim);
  padding: 18px 10px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 10px;
  border-radius: 9px;
  color: var(--sb-text);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  cursor: pointer; user-select: none;
  transition: background-color .12s, color .12s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke: var(--sb-dim); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--sb-hover); color: #fff; }
.nav-item:hover svg { stroke: var(--sb-text); }
.nav-item.active { background: var(--sb-active); color: #fff; font-weight: 600; }
.nav-item.active svg { stroke: #82AAFF; }
.nav-item:focus-visible { outline-color: #82AAFF; }
.nav-txt { flex: 1; min-width: 0; }

.nav-badge {
  margin-left: auto;
  min-width: 24px; height: 20px; padding: 0 7px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .09); color: #D8DDE4;
}
.nav-badge:empty { display: none; }
.nb-indigo { background: rgba(255, 255, 255, .09); color: #D8DDE4; }
.nb-red    { background: #E5484D; color: #fff; }

/* промо-блок старой версии больше не показываем */
.sidebar-promo { display: none; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 14px 16px;
  border-top: 1px solid var(--sb-line);
}
.user-ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: #2B3340; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 12px; color: var(--sb-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-more {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px; background: transparent;
  color: var(--sb-dim); cursor: pointer;
}
.user-more:hover { background: var(--sb-hover); color: #fff; }
.user-more svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ───────────── ВЕРХНЯЯ ПОЛОСА ───────────── */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 32px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.search-box {
  flex: 1; max-width: 560px;
  height: 40px; padding: 0 12px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.search-box:focus-within { background: #fff; border-color: var(--accent); box-shadow: var(--ring); }
.search-box svg { width: 16px; height: 16px; flex-shrink: 0; stroke: var(--text-3); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.search-box input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 14px; color: var(--text-1); }
.search-box input::placeholder { color: var(--text-3); }

.kbd-pair { display: flex; gap: 3px; margin-left: auto; }
.kbd { font-size: 11px; font-weight: 500; color: var(--text-3); background: #fff; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

.topbar-sp { flex: 1; }

.date-btn {
  height: 40px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--text-1);
  cursor: pointer; white-space: nowrap;
}
.date-btn:hover { background: var(--surface-2); }
.date-btn svg { width: 16px; height: 16px; stroke: var(--text-2); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.date-btn-l { color: var(--text-3); font-weight: 400; }

.notif-btn {
  position: relative;
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 10px;
  cursor: pointer;
}
.notif-btn:hover { background: var(--surface-2); }
.notif-btn svg { width: 17px; height: 17px; stroke: var(--text-2); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ───────────── СТРАНИЦА ───────────── */

.content {
  flex: 1; min-width: 0;
  padding: 28px 32px 56px;
  display: flex; flex-direction: column; gap: 20px;
}

.page-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; color: var(--text-1); }
.page-sub { font-size: 14px; color: var(--text-2); margin-top: 6px; max-width: 760px; line-height: 1.5; }
.hd-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ───────────── КНОПКИ ───────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 600; line-height: 1;
  white-space: nowrap; text-decoration: none;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
a.btn { text-decoration: none; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }

/* «ghost» в старой разметке = второстепенная кнопка: белая с рамкой */
.btn-ghost, .btn-secondary { background: #fff; color: var(--text-1); border-color: var(--border-strong); }
.btn-ghost:hover, .btn-secondary:hover { background: var(--surface-2); border-color: #B3BBC7; }
.btn-ghost:active, .btn-secondary:active { background: var(--surface-3); }

.btn-text { background: transparent; color: var(--accent-ink); padding: 0 10px; }
.btn-text:hover { background: var(--accent-soft); }

.btn-danger { background: #fff; color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-danger-solid { background: var(--bad); color: #fff; }
.btn-danger-solid:hover { background: #B42318; }

.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }

.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: none; }

/* кнопка-крестик (закрыть окно) */
.drawer-x, .icon-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 9px; background: transparent;
  color: var(--text-2); font-size: 17px; line-height: 1;
  cursor: pointer; align-self: flex-start;
}
.drawer-x:hover, .icon-btn:hover { background: var(--surface-3); color: var(--text-1); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* кнопки панелей карточек, табы, периоды */
.ctrl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: #fff; color: var(--text-1);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.ctrl-btn:hover { background: var(--surface-2); }
.ctrl-btn svg { width: 15px; height: 15px; stroke: var(--text-2); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ctrl-btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); font-weight: 600; }
.ctrl-btn.on svg { stroke: var(--accent-ink); }
.ctrl-btn .cnt-badge { height: 20px; background: var(--accent); color: #fff; }
.ctrl-btn:disabled { opacity: .5; cursor: not-allowed; }

/* кнопки в строках таблиц */
.row-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text-1);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.row-btn:hover { background: var(--surface-2); }
.row-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rb-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.rb-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.rb-danger { color: var(--bad); border-color: var(--bad-line); }
.rb-danger:hover { background: var(--bad-bg); }
.row-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ───────────── МЕТКИ ───────────── */

.cnt-badge {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}

.st-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.st-draft    { background: var(--surface-3); color: var(--text-2); }
.st-running  { background: var(--accent-soft); color: var(--accent-ink); }
.st-done     { background: var(--ok-bg); color: var(--ok); }
.st-canceled { background: var(--bad-bg); color: var(--bad); }
.st-running::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); animation: camp-pulse 1.2s ease infinite;
}
@keyframes camp-pulse { 50% { opacity: .3; } }

.plan {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pl-basic    { background: var(--surface-3); color: var(--text-2); }
.pl-business { background: #F1ECFE; color: #6D28D9; }
.pl-pro      { background: var(--accent-soft); color: var(--accent-ink); }
.pl-starter  { background: var(--orange-bg); color: #C2410C; }

/* ───────────── КАРТОЧКИ ───────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}
.card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.card-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text-1); }
.card-ctrls { display: flex; gap: 8px; flex-wrap: wrap; }
.card-pad { padding: 18px 20px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.right-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.an-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* KPI */
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
  min-width: 0;
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 13.5px; font-weight: 500; color: var(--text-2); line-height: 1.35; }
.stat-ico {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-ico svg { width: 18px; height: 18px; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ico-red    { background: var(--bad-bg); }  .ico-red svg    { stroke: var(--bad); }
.ico-orange { background: var(--orange-bg); } .ico-orange svg { stroke: #C2410C; }
.ico-yellow { background: var(--warn-bg); } .ico-yellow svg { stroke: var(--warn); }
.ico-green  { background: var(--ok-bg); }   .ico-green svg  { stroke: var(--ok); }
.ico-blue   { background: var(--accent-soft); } .ico-blue svg { stroke: var(--accent-ink); }
.stat-val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text-1); font-variant-numeric: tabular-nums; }
.stat-delta { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; }
.stat-delta svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.d-up   { color: var(--ok); }
.d-down { color: var(--bad); }
.d-note { color: var(--text-3); font-weight: 400; }
.stat-static { cursor: default; }
.stat-static:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }

/* ───────────── ТАБЛИЦЫ ───────────── */

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th {
  padding: 10px 16px;
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  text-align: left; white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
thead th:first-child { padding-left: 20px; width: 44px; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; font-size: 14px; color: var(--text-1); }
tbody td:first-child { padding-left: 20px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F8FAFE; }
.camp-tbl thead th:first-child, .ai-sup-tbl thead th:first-child { width: auto; }

input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text-1); }
.th-arrow { color: var(--accent); }

.cl-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cl-cell .cl-name, .cl-cell .cl-email, .exp-top, .exp-bot { white-space: nowrap; }
.camp-tbl td:first-child { min-width: 220px; }
.camp-tbl thead th { white-space: normal; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2);
}
.cl-name  { font-size: 14px; font-weight: 600; color: var(--text-1); }
.cl-email { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.exp-top { font-size: 13.5px; font-weight: 600; }
.exp-bot { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ec-red    { color: var(--bad); }
.ec-orange { color: #C2410C; }
.ec-yellow { color: var(--warn); }
.ec-gray   { color: var(--text-1); }
.ec-dark   { color: var(--text-3); }

/* Health Score в строке */
.hs-cell  { display: flex; align-items: center; gap: 10px; min-width: 110px; }
.hs-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hs-fill  { height: 100%; border-radius: 99px; }
.hf-red    { background: var(--z-red); }
.hf-orange { background: var(--z-orange); }
.hf-yellow { background: var(--z-yellow); }
.hf-lime   { background: var(--lime); }
.hf-green  { background: var(--z-green); }
.hf-indigo { background: var(--accent); }
.hf-none   { background: var(--border); }
.hs-num { font-size: 13px; font-weight: 700; min-width: 26px; text-align: right; }
.hn-red    { color: var(--bad); }
.hn-orange { color: #C2410C; }
.hn-yellow { color: var(--warn); }
.hn-lime   { color: #4D7C0F; }
.hn-green  { color: var(--ok); }
.hn-none   { color: var(--text-3); }
.hs-zone { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* пагинация */
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
}
.pg-info { font-size: 13px; color: var(--text-2); }
.pg-nums { display: flex; gap: 4px; flex-wrap: wrap; }
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text-1);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.pg-btn:hover:not(.pg-on) { background: var(--surface-2); }
.pg-on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pg-btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pg-btn:disabled { opacity: .4; cursor: default; pointer-events: none; }
.pg-dots { min-width: 30px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--text-3); }

.empty { padding: 32px 20px; text-align: center; color: var(--text-3); font-size: 14px; line-height: 1.5; }

/* ───────────── ГЛАВНАЯ: виджеты ───────────── */

.donut-wrap { position: relative; width: 148px; height: 148px; margin: 4px auto 18px; }
.donut-svg { display: block; transform: rotate(-90deg); }
.donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.donut-num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text-1); }
.donut-lbl { font-size: 12px; color: var(--text-3); }

.hs-legend { display: flex; flex-direction: column; gap: 8px; }
.hs-row { display: flex; align-items: center; gap: 10px; }
.hs-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.hs-lbl { flex: 1; font-size: 13.5px; color: var(--text-2); }
.hs-cnt { font-size: 13.5px; font-weight: 700; color: var(--text-1); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.hs-pct { font-size: 12.5px; color: var(--text-3); min-width: 38px; text-align: right; }

.rev-meta { padding: 16px 20px 4px; }
.rev-val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--text-1); }
.rev-delta-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.rev-badge {
  display: inline-flex; align-items: center; gap: 3px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok);
  font-size: 12px; font-weight: 600;
}
.rev-badge svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rev-period { font-size: 12.5px; color: var(--text-3); }
.chart-body { padding: 4px 16px 10px; }
.line-svg { width: 100%; display: block; }
.chart-xlabels { display: flex; justify-content: space-between; padding: 2px 16px 14px; font-size: 11.5px; color: var(--text-3); }

.qa-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.qa-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.qa-title { font-size: 16px; font-weight: 600; color: var(--text-1); }
.qa-row { display: flex; flex-direction: column; gap: 8px; }
.qa-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text-1);
  font-size: 14px; font-weight: 500; text-align: left;
  cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.qa-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.qa-btn svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.qa-red svg    { stroke: var(--bad); }
.qa-indigo svg { stroke: var(--accent); }
.qa-green svg  { stroke: var(--ok); }

/* ───────────── ЧИПЫ И ФИЛЬТРЫ ───────────── */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: #fff; color: var(--text-1);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.chip:hover { background: var(--surface-2); border-color: #AEB6C2; }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); font-weight: 600; }
.chip.on::before {
  content: ''; flex-shrink: 0;
  width: 5px; height: 9px;
  border: solid currentColor; border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.chip:focus-visible { outline: none; box-shadow: var(--ring); }

.filter-panel {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
  padding: 4px 20px 18px;
}
.fgroups { display: flex; flex-direction: column; }
.fgroup {
  display: grid; grid-template-columns: 200px minmax(0, 1fr);
  gap: 10px 20px; align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.fgroup:last-child { border-bottom: none; }
.fgroup > :not(.fgroup-title) { grid-column: 2; }
.fgroup-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); padding-top: 6px; line-height: 1.35; }
.fgroup-title small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.fgroup-wide { }
.chip-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-sub + .chip-sub { margin-top: 8px; }
.chip-sub-l { min-width: 104px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.filter-actions { display: flex; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
.filter-sum { font-size: 13px; color: var(--text-2); align-self: center; }

/* свой диапазон дней */
.frange {
  margin-top: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  background: #fff;
  border: 1px dashed var(--border-strong); border-radius: 10px;
}
.frange-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.frange-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.frange-step {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
  font-size: 11px; font-weight: 700;
}
.frange-lbl { font-size: 13px; color: var(--text-2); }
.frange-unit { font-weight: 600; color: var(--text-1); }
.frange-inp {
  width: 84px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text-1); font-size: 14px;
}
.frange-inp:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.frange-hint { font-size: 13px; color: var(--text-2); }
.frange-hint.fr-on { color: var(--text-1); font-weight: 600; }
.frange-hint.fr-err { color: var(--bad); }
.frange-note { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.chip.frange-clear { height: 30px; color: var(--text-2); }

/* ───────────── ПОЛЯ ВВОДА ───────────── */

.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fld > label, .fld-l { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.fld-hint { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.fld input, .inp, .msg-search {
  height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: #fff; color: var(--text-1);
  font-size: 14px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.fld input:focus, .inp:focus, .msg-search:focus { border-color: var(--accent); box-shadow: var(--ring); }
.fld input::placeholder, .inp::placeholder, textarea::placeholder { color: #8A929E; }
.txt, .modal textarea {
  min-height: 140px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: #fff; color: var(--text-1);
  font-size: 14px; line-height: 1.55;
  resize: vertical; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.txt:focus, .modal textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
input[type="number"].inp { width: 100px; }

/* ───────────── КАРТОЧКА КЛИЕНТА (drawer) ───────────── */

#drawer-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15, 18, 24, .45); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  background: #fff;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: drawer-in .18s ease;
}
@keyframes drawer-in { from { transform: translateX(36px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-hd { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.drawer-score {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  border: 4px solid var(--border); color: var(--text-2);
}
.ds-green  { color: var(--ok);   border-color: var(--z-green);  background: var(--ok-bg); }
.ds-yellow { color: var(--warn); border-color: var(--z-yellow); background: var(--warn-bg); }
.ds-orange { color: #C2410C;     border-color: var(--z-orange); background: var(--orange-bg); }
.ds-red    { color: var(--bad);  border-color: var(--z-red);    background: var(--bad-bg); }
.drawer-hd-info { flex: 1; min-width: 0; }
.drawer-name { font-size: 17px; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-ids  { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.drawer-exp  { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 18px; }

.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dfield { background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 10px; padding: 10px 12px; }
.dfield-l { font-size: 12px; font-weight: 500; color: var(--text-3); }
.dfield-v { font-size: 14px; font-weight: 600; color: var(--text-1); margin-top: 2px; word-break: break-word; }
.dsec-title { font-size: 15px; font-weight: 600; color: var(--text-1); }

.factor-row { margin-bottom: 10px; }
.factor-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.factor-name { color: var(--text-2); }
.factor-val  { color: var(--text-3); font-weight: 600; white-space: nowrap; }
.factor-bar  { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.factor-fill { height: 100%; border-radius: 99px; }

/* таймлайн */
.tl { position: relative; padding-left: 34px; display: flex; flex-direction: column; gap: 16px; }
.tl::before { content: ''; position: absolute; left: 12px; top: 8px; bottom: 8px; width: 2px; background: var(--border-light); }
.tl-item { position: relative; min-height: 26px; }
.tl-dot {
  position: absolute; left: -34px; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border);
}
.tl-dot svg { width: 12px; height: 12px; stroke: var(--text-3); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.td-green  { background: var(--ok-bg); }       .td-green svg  { stroke: var(--ok); }
.td-red    { background: var(--bad-bg); }      .td-red svg    { stroke: var(--bad); }
.td-yellow { background: var(--warn-bg); }     .td-yellow svg { stroke: var(--warn); }
.td-orange { background: var(--orange-bg); }   .td-orange svg { stroke: #C2410C; }
.td-indigo { background: var(--accent-soft); } .td-indigo svg { stroke: var(--accent-ink); }
.td-purple { background: var(--purple-bg); }   .td-purple svg { stroke: var(--purple); }
.td-gray   { background: var(--surface-3); }
.tl-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.tl-date  { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.tl-meta  { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ───────────── ОКНА ───────────── */

#modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15, 18, 24, .5);
}
.modal {
  width: 520px; max-width: 100%;
  max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modal-in .16s ease;
}
@keyframes modal-in { from { transform: translateY(8px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-hd { display: flex; align-items: flex-start; gap: 12px; }
.modal-titles { flex: 1; min-width: 0; }
.modal-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: var(--text-1); }
.modal-sub { font-size: 13.5px; color: var(--text-2); margin-top: 4px; line-height: 1.45; }
.modal-cnt { font-size: 12.5px; color: var(--text-3); text-align: right; }
.modal-cnt.cnt-over { color: var(--bad); font-weight: 600; }
.modal-ft { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.modal-ft .sp { flex: 1; }
.camp-modal { width: 600px; }

/* окно подтверждения (uiConfirm) */
.cf-modal { width: 460px; }
.cf-text { font-size: 14px; color: var(--text-2); line-height: 1.55; white-space: pre-line; }

/* ───────────── ВСПЛЫВАШКИ ───────────── */

#toast-root {
  position: fixed; right: 24px; bottom: 24px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #12151A; color: #fff;
  font-size: 14px; font-weight: 500; line-height: 1.45;
  box-shadow: var(--shadow-md);
  animation: toast-in .18s ease;
}
.toast-err { background: var(--bad); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────────── ВХОД ───────────── */

#login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--page-bg);
}
.login-card {
  width: 400px; max-width: 100%;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-title { font-size: 21px; font-weight: 700; letter-spacing: -.01em; color: var(--text-1); margin-bottom: 6px; }
.login-sub { font-size: 14px; color: var(--text-2); margin-bottom: 20px; line-height: 1.5; }
.login-err { background: var(--bad-bg); color: var(--bad); font-size: 13.5px; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.login-card .btn { height: 46px; font-size: 15px; }
.login-code-hint {
  margin: 14px 0; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 10px;
  font-size: 13.5px; color: var(--text-2); line-height: 1.55; text-align: center;
}
.login-code-hint b { letter-spacing: 2px; font-size: 15px; color: var(--text-1); }
.login-wait { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13.5px; color: var(--text-3); margin-bottom: 12px; }
.login-wait::before {
  content: ''; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: rp-spin .8s linear infinite;
}
.login-card #login-cancel { margin-top: 4px; }
@keyframes rp-spin { to { transform: rotate(360deg); } }

/* ───────────── РАССЫЛКИ: список ───────────── */

.camp-prog { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.camp-prog .hs-track { flex: 1; min-width: 48px; }
.camp-prog-n { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; }
.camp-dlv { color: var(--ok); font-weight: 600; }
.camp-blk { color: var(--bad); font-weight: 600; }
.camp-ret { color: var(--ok); font-weight: 600; }
.camp-bonus-line { color: var(--text-2); margin-top: 2px; }
.camp-vars { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.camp-vars code, .note code, .fld-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; background: var(--surface-3); color: var(--text-1);
  border-radius: 4px; padding: 1px 5px;
}
.camp-seg { display: flex; flex-direction: column; gap: 10px; }
.camp-confirm { text-align: center; padding: 14px 6px 4px; }
.camp-confirm-num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text-1); }
.camp-confirm-sub { font-size: 13.5px; color: var(--text-2); margin-top: 6px; }
.camp-summary {
  font-size: 13.5px; color: var(--text-2); line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border-light);
  border-radius: 10px; padding: 10px 12px;
}
.camp-preview {
  font-size: 14px; font-weight: 600; line-height: 1.45;
  color: var(--accent-ink); background: var(--accent-soft);
  border-radius: 10px; padding: 10px 14px;
}
.camp-preview.cp-warn { color: #7A3E06; background: var(--warn-bg); }
.bonus-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bonus-inp {
  width: 100px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: #fff; color: var(--text-1); font-size: 15px; font-weight: 600;
}
.bonus-inp:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.bonus-inp-sm { width: 76px; }
.bonus-unit, .bonus-lbl { font-size: 14px; color: var(--text-2); }
.camp-media-prev { display: block; max-width: 100%; max-height: 180px; border-radius: 10px; border: 1px solid var(--border); margin-top: 6px; }
.camp-view-text {
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; line-height: 1.55;
}
.camp-btns-prev { display: flex; flex-direction: column; gap: 6px; }
.camp-btn-prev {
  padding: 9px 12px; border-radius: 10px;
  background: var(--surface-3); color: var(--text-1);
  font-size: 14px; font-weight: 500; text-align: center;
}

/* ───────────── МАСТЕР «НОВАЯ РАССЫЛКА» ───────────── */

.modal.wiz {
  width: 1120px;
  height: min(880px, calc(100vh - 48px));
  max-height: none;
  padding: 0; gap: 0;
  overflow: hidden;
}
.wiz-hd { display: flex; align-items: flex-start; gap: 16px; padding: 22px 28px 0; }
.wiz-titles { flex: 1; min-width: 0; }
.wiz-title { font-size: 21px; font-weight: 700; letter-spacing: -.01em; color: var(--text-1); }
.wiz-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; }

.wiz-steps {
  list-style: none;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 16px 28px 18px;
  border-bottom: 1px solid var(--border);
}
.wiz-step {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-width: 0; padding: 10px 12px;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: inherit; text-align: left;
  cursor: pointer;
}
.wiz-step:hover { background: var(--surface-2); }
.wiz-num {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
  font-size: 13px; font-weight: 700;
}
.wiz-step-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.wiz-step-t b { font-size: 14px; font-weight: 600; color: var(--text-2); }
.wiz-step-t small { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wiz-step.done .wiz-num { background: var(--ok); color: #fff; }
.wiz-step.done b { color: var(--text-1); }
.wiz-step.on { background: var(--accent-soft); border-color: var(--accent-line); }
.wiz-step.on .wiz-num { background: var(--accent); color: #fff; }
.wiz-step.on b { color: var(--accent-ink); }

.wiz-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 372px; }
.wiz-main { min-width: 0; overflow-y: auto; padding: 24px 28px 32px; display: flex; flex-direction: column; gap: 24px; }
.wiz-side {
  min-width: 0; overflow-y: auto;
  padding: 22px 22px 26px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
}
.wiz-ft {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.wiz-ft-note { flex: 1; text-align: center; font-size: 13px; color: var(--text-3); line-height: 1.4; }
.wiz-ft-r { display: flex; gap: 10px; }

.wiz-h { font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: var(--text-1); }
.wiz-lead { font-size: 14px; color: var(--text-2); margin-top: 4px; line-height: 1.5; max-width: 640px; }
.wiz-sec { display: flex; flex-direction: column; gap: 10px; }
.wiz-sec-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wiz-sec-t { font-size: 15px; font-weight: 600; color: var(--text-1); }
.wiz-sec-d { font-size: 13px; color: var(--text-3); }

/* готовые аудитории */
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.preset {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 14px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; color: inherit; text-align: left;
  cursor: pointer;
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.preset:hover { border-color: var(--border-strong); background: var(--surface-2); }
.preset.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.preset-t { font-size: 14px; font-weight: 600; color: var(--text-1); }
.preset-d { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.preset-n { margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.preset.on .preset-t { color: var(--accent-ink); }

/* выбор варианта (бонус) */
.opt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.opt {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 10px; align-items: start;
  padding: 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; color: inherit; text-align: left;
  cursor: pointer;
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.opt-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; margin-top: 1px; }
.opt-t { font-size: 14px; font-weight: 600; color: var(--text-1); }
.opt-d { grid-column: 2; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.on .opt-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 4px #fff; }
.opt:disabled { opacity: .55; cursor: not-allowed; }

.form-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.form-col { display: flex; flex-direction: column; gap: 6px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.seg button {
  height: 34px; padding: 0 14px;
  border: none; border-radius: 8px; background: transparent;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--text-1); font-weight: 600; box-shadow: var(--shadow-sm); }

/* подсказки и предупреждения */
.note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 10px;
  font-size: 13.5px; color: var(--text-2); line-height: 1.5;
}
.note b { color: var(--text-1); }
.note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.note ul { margin: 4px 0 0 18px; }
.note li + li { margin-top: 2px; }
.note-info { background: var(--accent-soft); border-color: var(--accent-soft-2); color: #1E3A8A; }
.note-info b { color: #172554; }
.note-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #6B3A06; }
.note-warn b { color: #4A2804; }
.note-bad { background: var(--bad-bg); border-color: var(--bad-line); color: #8F1D14; }
.note-ok { background: var(--ok-bg); border-color: var(--ok-line); color: #14532D; }

/* боковая колонка мастера: сколько человек + как увидит клиент */
.wiz-count {
  padding: 14px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
}
.wiz-count-l { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.wiz-count-n { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--text-1); font-variant-numeric: tabular-nums; }
.wiz-count-n small { font-size: 15px; font-weight: 500; color: var(--text-2); letter-spacing: 0; margin-left: 4px; }
.wiz-count-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.wiz-count.is-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.wiz-count.is-bad { background: var(--bad-bg); border-color: var(--bad-line); }
.wiz-side-t { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-bottom: -6px; }

/* «как увидит клиент» — Telegram */
.tg { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; }
.tg-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); }
.tg-ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
}
.tg-name { font-size: 14px; font-weight: 600; color: var(--text-1); line-height: 1.2; }
.tg-st { font-size: 12px; color: var(--text-3); }
.tg-chat { display: flex; flex-direction: column; gap: 6px; min-height: 230px; padding: 14px 12px 12px; background: #D9E3EC; }
.tg-msg {
  align-self: flex-start;
  width: fit-content; max-width: 94%;
  padding: 7px 10px 5px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  font-size: 13.5px; line-height: 1.45; color: #111;
  white-space: pre-wrap; word-break: break-word;
}
.tg-msg.has-media { width: 94%; padding-top: 4px; }
.tg-media { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; margin-bottom: 6px; background: #C9D3DE; }
.tg-time { text-align: right; font-size: 11px; color: #8A96A3; margin-top: 2px; }
.tg-empty { color: #8A96A3; font-style: italic; }
.tg-kb { display: flex; flex-direction: column; gap: 4px; width: 94%; }
.tg-kbtn {
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .72);
  color: #24517E; font-size: 13px; font-weight: 600; text-align: center;
}
.var-hl { background: #FFF1B8; border-radius: 3px; padding: 0 2px; }
.tg-note { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }

/* текст: вставка переменных, счётчик */
.var-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.var-bar-l { font-size: 12.5px; color: var(--text-3); margin-right: 2px; }
.var-btn {
  height: 30px; padding: 0 10px;
  border: 1px dashed var(--accent-line); border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.var-btn:hover { background: var(--accent-soft-2); }
.txt-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.txt-meta .cnt-over { color: var(--bad); font-weight: 600; }

/* вложение */
.drop {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: 12px;
  background: #fff;
}
.drop-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-3); flex-shrink: 0; }
.drop-info { flex: 1; min-width: 160px; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.drop-info b { color: var(--text-1); }

/* ИИ-помощник текста */
.ai-help { border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.ai-help > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  font-size: 14px; font-weight: 600; color: var(--text-1);
  cursor: pointer; list-style: none;
}
.ai-help > summary::-webkit-details-marker { display: none; }
.ai-help > summary svg { width: 18px; height: 18px; stroke: var(--accent-ink); }
.ai-help > summary::after { content: '▾'; margin-left: auto; color: var(--text-3); }
.ai-help[open] > summary::after { content: '▴'; }
.ai-help > summary small { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.ai-help-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }

/* проверка перед запуском */
.rv { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.rv-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 12px; align-items: start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.rv-row:last-child { border-bottom: none; }
.rv-k { font-size: 13px; font-weight: 500; color: var(--text-3); padding-top: 1px; }
.rv-v { font-size: 14px; font-weight: 600; color: var(--text-1); line-height: 1.45; word-break: break-word; }
.rv-v small { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--text-2); }
.rv-edit {
  padding: 3px 8px; border: none; border-radius: 6px;
  background: none; color: var(--accent-ink);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.rv-edit:hover { background: var(--accent-soft); }

.steps-list { list-style: none; counter-reset: st; display: flex; flex-direction: column; gap: 12px; }
.steps-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.steps-list li::before {
  counter-increment: st; content: counter(st);
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-1);
  font-size: 13px; font-weight: 700;
}
.steps-list b { color: var(--text-1); }

.wiz-num svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wiz-filters { box-shadow: none; }
.wiz-filters .filter-panel { background: #fff; border-bottom: none; padding: 0 18px 4px; }
.frange-open { justify-self: start; margin-top: 8px; padding: 0 8px; }
.opt:disabled .opt-radio { background: var(--surface-3); }

/* ───────────── СООБЩЕНИЯ И ЧАТ (поверх chat.css) ───────────── */

.msg-toolbar { padding: 12px 20px; border-bottom: 1px solid var(--border-light); }
.msg-search { width: 100%; max-width: 360px; }
.msg-item { padding: 12px 20px; gap: 12px; }
.msg-item:hover { background: #F8FAFE; }
.msg-name { font-size: 14px; }
.msg-last { font-size: 13px; }
.msg-unread { background: var(--accent); }
.msg-more-wrap { padding: 12px 20px; }

.chatbox { background: #E3EAF1; border: 1px solid var(--border-light); border-radius: 12px; padding: 14px; gap: 8px; }
.chat-msg { font-size: 14px; line-height: 1.45; padding: 8px 11px; border-radius: 14px; }
.chat-msg.cm-in { background: #fff; border: 1px solid var(--border-light); color: var(--text-1); border-bottom-left-radius: 4px; }
.chat-msg.cm-out { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.cm-cast { background: var(--accent-soft); border: 1px solid var(--accent-soft-2); color: var(--text-1); }
.cm-cast-tag { color: var(--accent-ink); }
.chatbox.cm-drop { outline: 2px dashed var(--accent-line); background: var(--accent-soft); }
.chatview-hd { margin-bottom: 14px; }
.chatview-title { font-size: 17px; }
.chat-input { gap: 10px; align-items: flex-end; }
.chat-input textarea {
  min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 14px; line-height: 1.45; outline: none;
}
.chat-input textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.chat-input .btn { height: 44px; }
.cm-chip { border-color: var(--border-strong); border-radius: 10px; }
.fwd-row:hover { background: #F8FAFE; }
.fwd-row.on { background: var(--accent-soft); }
.fwd-row.on .fwd-box { background: var(--accent); border-color: var(--accent); }
.fwd-att { color: var(--accent-ink); }

/* ───────────── АНАЛИТИКА, ФИНАНСЫ, НАСТРОЙКИ ───────────── */

.period-bar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  width: fit-content; max-width: 100%;
  padding: 4px;
  background: var(--surface-3); border-radius: 12px;
}
.period-bar .ctrl-btn { height: 32px; border-color: transparent; background: transparent; color: var(--text-2); }
.period-bar .ctrl-btn:hover { background: rgba(255, 255, 255, .7); }
.period-bar .ctrl-btn.on { background: #fff; border-color: var(--border); color: var(--text-1); box-shadow: var(--shadow-sm); }
.period-custom { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; padding-left: 8px; border-left: 1px solid var(--border-strong); }
.period-custom input[type="date"] {
  height: 32px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text-1); font-size: 13px; outline: none;
}
.period-custom input[type="date"]:focus { border-color: var(--accent); box-shadow: var(--ring); }

.saved-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--ok-bg); border: 1px solid var(--ok-line); border-radius: var(--radius-lg);
}
.saved-ic { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; background: #fff; display: flex; align-items: center; justify-content: center; }
.saved-ic svg { width: 19px; height: 19px; stroke: var(--ok); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.saved-text { font-size: 15px; font-weight: 700; color: #14532D; }
.saved-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.bars-wrap { padding: 18px 20px 14px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.bar { border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-l { text-align: center; font-size: 11px; color: var(--text-3); }

/* график выручки: линия + мягкая заливка, подписи — HTML поверх (не масштабируются) */
.lc {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-rows: 240px 30px;
  padding: 22px 24px 4px 8px;
}
.lc-y { position: relative; }
.lc-y span {
  position: absolute; right: 12px; transform: translateY(-50%);
  font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.lc-plot { position: relative; min-width: 0; }
.lc-gl { position: absolute; left: 0; right: 0; height: 1px; background: var(--border-light); }
.lc-gl.lc-base { background: var(--border); }
.lc-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.lc-area { stroke: none; }
.lc-x { position: relative; }
.lc-x span {
  position: absolute; top: 8px; transform: translateX(-50%);
  font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.lc-x span.lc-first { transform: none; }
.lc-x span.lc-last { transform: translateX(-100%); }
.lc-dot {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px #fff;
  transform: translate(-50%, -50%); pointer-events: none;
}
.lc-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); pointer-events: none; }
.lc-peak {
  position: absolute; transform: translate(-50%, calc(-100% - 10px));
  padding: 2px 7px; border-radius: 6px;
  background: #fff; box-shadow: 0 0 0 1px var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-1); white-space: nowrap; pointer-events: none;
}
.lc.lc-hover .lc-peak { opacity: 0; }
.lc-peak.lc-peak-l { transform: translate(-6px, calc(-100% - 10px)); }
.lc-peak.lc-peak-r { transform: translate(calc(-100% + 6px), calc(-100% - 10px)); }
.lc-tip {
  position: absolute; top: 6px; z-index: 2; min-width: 160px;
  padding: 9px 12px; border-radius: 10px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-md);
  font-size: 12.5px; color: var(--text-2); pointer-events: none;
}
.lc-tip b { display: block; margin: 2px 0 1px; font-size: 16px; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.lc-tip-n { color: var(--text-3); }
.lc-hit { position: absolute; inset: 0; cursor: crosshair; border-radius: 6px; }
.lc-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.lc-note { padding: 0 24px 4px 64px; font-size: 12.5px; color: var(--text-3); }
.lc-table { padding: 4px 24px 16px 64px; }
.lc-table > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-ink); width: fit-content; padding: 4px 0; }
.lc-table table { margin-top: 8px; }
.lc-table .tbl-wrap { max-height: 320px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 10px; }
.lc-table td, .lc-table th { padding: 7px 12px; font-size: 13px; }
.lc-table td:nth-child(n+2), .lc-table th:nth-child(n+2) { text-align: right; }
@media (max-width: 820px) {
  .lc { grid-template-columns: 58px minmax(0, 1fr); grid-template-rows: 200px 30px; padding: 16px 14px 4px 0; }
  .lc-note, .lc-table { padding-left: 16px; padding-right: 16px; }
}

/* разбивки на «Финансах»: доля числом и тонкой полосой */
.fin-share { font-weight: 600; color: var(--text-2); margin-left: 4px; }
.fin-bar { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.fin-bar > div { height: 100%; border-radius: 99px; background: var(--accent); }

/* гистограмма на «Аналитике»: тонкие столбцы со скруглённым верхом */
.bar-col { align-items: center; }
.bar { width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; }

.fin-row { padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.fin-row:last-child { border-bottom: none; }
.fin-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.fin-k { font-size: 13.5px; color: var(--text-2); }
.fin-v { font-size: 13.5px; font-weight: 700; color: var(--text-1); white-space: nowrap; }

.set-cols { grid-template-columns: 400px minmax(0, 1fr); }
.set-pad { padding: 16px 20px; }
.set-hint { font-size: 13px; color: var(--text-3); line-height: 1.5; margin-bottom: 12px; }
.sw-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.sw-row:last-of-type { border-bottom: none; }
.sw-lbl { flex: 1; font-size: 13.5px; color: var(--text-2); }
.sw-row b { font-variant-numeric: tabular-nums; }
.sw-inp {
  width: 72px; height: 34px; padding: 0 8px; text-align: right;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text-1); font-size: 14px; outline: none;
}
.sw-inp:focus { border-color: var(--accent); box-shadow: var(--ring); }
.sw-pct { font-size: 12.5px; color: var(--text-3); }
.sw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.fin-sub .sw-lbl { padding-left: 16px; color: var(--text-3); }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.team-row:last-child { border-bottom: none; }
.team-info { flex: 1; min-width: 0; }
.audit-row { padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 13.5px; }
.audit-row:last-child { border-bottom: none; }
.audit-top { display: flex; justify-content: space-between; gap: 10px; }
.audit-text {
  margin-top: 6px; padding: 9px 11px;
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 8px;
  font-size: 13px; color: var(--text-1);
  white-space: pre-wrap; word-break: break-word;
}

/* ИИ-советы: цвета, которые были прибиты гвоздями */
.ai-banner { border-color: var(--accent-soft-2); }
.ai-phase { border-color: var(--accent-soft-2); }
.ai-step.on { border-color: var(--accent); }
.ai-force:hover { background: var(--surface-2); }
.ai-raw, .ai-snap pre, .ai-tile, .ai-chip { background: var(--surface-2); }

/* ───────────── МОБИЛЬНАЯ ВЁРСТКА ───────────── */

.burger-btn {
  display: none;
  width: 40px; height: 40px; flex-shrink: 0;
  align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 10px;
  cursor: pointer;
}
.burger-btn:hover { background: var(--surface-2); }
.burger-btn svg { width: 18px; height: 18px; stroke: var(--text-1); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
#sb-overlay { display: none; }

/* Главная: при ширине меньше ~1500 таблица «Требуют внимания» — на всю
   ширину, зоны и быстрые действия — рядом под ней */
@media (max-width: 1499px) {
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
  .dash-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 1240px) {
  .wiz-body { grid-template-columns: minmax(0, 1fr) 330px; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .an-two, .set-cols { grid-template-columns: minmax(0, 1fr); }
  .wiz-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .wiz-main { overflow: visible; }
  .wiz-side { overflow: visible; border-left: none; border-top: 1px solid var(--border); }
  .opt-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 70;
    transform: translateX(-102%);
    transition: transform .2s ease;
  }
  body.sb-open .sidebar { transform: none; box-shadow: 12px 0 32px rgba(0, 0, 0, .3); }
  body.sb-open #sb-overlay { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(15, 18, 24, .45); }
  .burger-btn { display: flex; }
  .topbar { height: 60px; padding: 0 14px; gap: 8px; }
  .kbd-pair, .date-btn-l { display: none; }
  .date-btn { padding: 0 10px; }
  .content { padding: 18px 14px 40px; gap: 16px; }
  .page-title { font-size: 22px; }
  .page-hd { flex-direction: column; align-items: stretch; gap: 12px; }
  .hd-btns .btn { flex: 1 1 auto; }
  .card-hd { padding: 14px 16px; }
  .fgroup { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .fgroup > :not(.fgroup-title) { grid-column: 1; }
  .fgroup-title { padding-top: 0; }
  .drawer { width: 100%; }
  #modal-overlay { padding: 10px; }
  .modal { padding: 18px; max-height: calc(100vh - 20px); }
  .modal.wiz { height: calc(100vh - 20px); }
  .wiz-hd { padding: 16px 16px 0; }
  .wiz-steps { display: flex; overflow-x: auto; padding: 12px 16px 14px; }
  .wiz-step { width: auto; flex-shrink: 0; }
  .wiz-step-t small { display: none; }
  .wiz-main { padding: 18px 16px 24px; }
  .wiz-side { padding: 18px 16px 22px; }
  .wiz-ft { padding: 12px 16px; flex-wrap: wrap; }
  .wiz-ft-note { order: -1; flex-basis: 100%; }
  .wiz-ft-r { flex: 1; justify-content: flex-end; }
  .preset-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .rv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .rv-k { grid-column: 1 / -1; }
  .period-custom { margin-left: 0; padding-left: 0; border-left: none; }
}

@media (max-width: 520px) {
  .stats-row { grid-template-columns: minmax(0, 1fr); }
  .dgrid { grid-template-columns: minmax(0, 1fr); }
  .search-box { max-width: none; }
}

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