/* OSTRO AI — админка
   Layout: рабочий стол оператора — постоянное меню слева, справа заголовок раздела и данные;
   цифры, ключи и даты набраны моноширинным, статусы — цветными чипами, демо-данные помечены. */

:root {
  color-scheme: dark;
  /* Цвет: та же система, что и на лендинге; тёмная тема по умолчанию */
  --bg: #070912;
  --side: #0a0d1a;
  --surface: #0e1222;
  --surface-2: #141a30;
  --sunken: #090c18;
  --line: #1c2239;
  --line-strong: #2a3253;
  --ink: #eef1fb;
  --muted: #9098b1;
  --faint: #626a86;
  --brand: #2433c4;
  --accent: #3b4ef0;
  --accent-hover: #4d60ff;
  --on-accent: #ffffff;
  --accent-text: #a0acff;
  --accent-soft: rgba(84, 104, 255, .13);
  --signal: #4fd99a;
  --signal-soft: rgba(79, 217, 154, .12);
  --warn: #f0c060;
  --warn-soft: rgba(240, 192, 96, .12);
  --danger: #ff8a9b;
  --danger-soft: rgba(255, 107, 129, .12);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .7);

  --f-display: "Geologica", "Onest", system-ui, sans-serif;
  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --side-w: 248px;
  --radius: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fa;
  --side: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f5fb;
  --sunken: #f7f8fc;
  --line: #e1e4ef;
  --line-strong: #cbd1e3;
  --ink: #0b1027;
  --muted: #535b76;
  --faint: #848ba3;
  --accent: #2433c4;
  --accent-hover: #1b28a8;
  --accent-text: #2433c4;
  --accent-soft: rgba(36, 51, 196, .07);
  --signal: #0b8f57;
  --signal-soft: rgba(11, 143, 87, .10);
  --warn: #9a6400;
  --warn-soft: rgba(196, 128, 0, .10);
  --danger: #c3284a;
  --danger-soft: rgba(195, 40, 74, .08);
  --shadow: 0 30px 70px -36px rgba(20, 30, 90, .28);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box }
html, body { min-height: 100% }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-family: var(--f-display); font-weight: 650; font-variation-settings: "SHRP" 50; letter-spacing: -.025em; line-height: 1.15 }
p { margin: 0 }
a { color: inherit }
button, input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px }
::selection { background: var(--accent); color: var(--on-accent) }
svg { display: block }

.muted { color: var(--muted) }
.mono { font-family: var(--f-mono); font-size: 13px }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.kicker, .crumb {
  font: 500 11px/1.2 var(--f-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
}

/* ---------- Shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 14px 16px;
  background: var(--side);
  border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; text-decoration: none; border-radius: 12px }
.side-brand img { width: 30px; height: 30px; flex-shrink: 0 }
.side-brand b, .side-brand small { display: block }
.side-brand b { font: 700 16px/1.1 var(--f-display); font-variation-settings: "SHRP" 60; letter-spacing: -.02em }
.side-brand small { margin-top: 3px; font: 500 10px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint) }
/* Leadogen.Ai instead of OSTRO AI (12.11.2026, as in the new cabinet): «.Ai» in the accent */
.side-brand b i, .login-brand b i { font-style: normal; color: var(--accent-text) }

.side-nav { display: grid; align-content: start; gap: 18px; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding: 2px }
.nav-group { display: grid; gap: 8px }
.nav-group[hidden] { display: none !important }
.nav-group-title { padding: 0 12px; color: var(--faint); font: 500 11px/1.4 var(--f-body) }
.nav-group-items { display: grid; gap: 2px }
.side-nav .nav { min-height: 36px }
.nav {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font: 500 14px/1 var(--f-body); text-align: left; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.nav:hover { background: var(--surface); color: var(--ink) }
.nav.active { background: var(--accent-soft); color: var(--ink) }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; color: var(--faint); flex: 0 0 18px }
.nav.active .nav-icon { color: var(--accent-text) }
.nav-icon svg, .logout-button svg, .icon-button svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.side-bottom { margin-top: auto; display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line) }
.account { display: flex; align-items: center; gap: 10px; padding: 0 6px }
.account-avatar {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.account b, .account small { display: block }
.account b { font-size: 13px; font-weight: 600 }
.account small { font: 500 11px/1.3 var(--f-mono); color: var(--faint) }
.side-actions { display: flex; gap: 8px }
.icon-button, .logout-button {
  height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s, background-color .15s;
}
.icon-button { width: 36px; flex-shrink: 0 }
.logout-button { flex: 1; padding: 0 12px; font-size: 13px; font-weight: 500 }
.icon-button:hover, .logout-button:hover { color: var(--ink); border-color: var(--accent-text); background: var(--surface) }
.theme-toggle .i-moon { display: none }
:root[data-theme="light"] .theme-toggle .i-sun { display: none }
:root[data-theme="light"] .theme-toggle .i-moon { display: block }

/* 29.10.2026: every tab as wide as «Пользователи» (it was the only one without the 1520px cap), with 5% more side space;
   only on very wide screens the content stops growing - the dashboard's charts get taller with the width */
.workspace { min-width: 0; width: 100%; max-width: none; margin-inline: auto; padding: 28px clamp(17px, 3.15vw, 50px) 64px }
@media (min-width: 2300px) { .workspace { max-width: 2200px } }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 22px; margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { margin-top: 8px; font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -.035em }
.period-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.period-tools[hidden] { display: none }
.custom-period { display: none; align-items: center; gap: 6px; color: var(--faint) }
.custom-period.visible { display: flex }

/* ---------- Controls ---------- */
select, input:not([type="checkbox"]):not([type="radio"]), textarea {
  min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--sunken); color: var(--ink);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent-text) 40%, var(--line-strong)) }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft) }
input[type="date"] { font-family: var(--f-mono); font-size: 13px }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; font-family: var(--f-mono) }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0 }
textarea { width: 100%; min-height: 96px; resize: vertical; line-height: 1.55 }
::placeholder { color: var(--faint) }

button.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px;
  border: 0; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background-color .15s, transform .15s;
}
button.primary:hover { background: var(--accent-hover) }
button.primary:active { transform: translateY(1px) }
.small-button { min-height: 34px !important; padding: 0 14px !important; font-size: 13px !important }

.table-action {
  min-height: 30px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: transparent; color: var(--ink);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.table-action:hover { border-color: var(--accent-text); background: var(--accent-soft) }
.danger-action { color: var(--danger) }
.danger-action:hover { border-color: var(--danger); background: var(--danger-soft) }

/* ---------- Panels ---------- */
.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.panel + .panel, .panel + #user-detail .panel, .access-list { margin-top: 16px }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px }
.panel-head h3 { font-size: 17px }
.panel-head > span { font: 500 12px/1.2 var(--f-mono); color: var(--faint) }
.pill, .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  font: 500 12px/1.2 var(--f-mono); white-space: nowrap;
}
.pill { background: var(--accent-soft); color: var(--accent-text) }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor }
.chip-ok { background: var(--signal-soft); color: var(--signal) }
.chip-warn { background: var(--warn-soft); color: var(--warn) }
.chip-off { background: var(--surface-2); color: var(--faint) }

.save-note { color: var(--signal); font-size: 13px }

/* ---------- Dashboard ---------- */
.stat-line, .dashboard-preview-grid {
  display: grid;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stat-line { grid-template-columns: repeat(3, minmax(0, 1fr)) }
/* four tiles (the dashboard and «Расходы» with «Поддержка»): the columns follow the number of tiles */
.stat-line:has(> .panel:nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)) }
.stat-line:has(> .panel:nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)) }
/* five tiles («Расходы» with CRM): one row on a wide screen, 3 + 2 below 1180px */
.stat-line:has(> .panel:nth-child(5)) .panel { padding: 18px 18px }
.stat-line:has(> .panel:nth-child(5)) strong { font-size: clamp(26px, 2.3vw, 38px) }
@media (min-width: 601px) and (max-width: 1180px) {
  .stat-line:has(> .panel:nth-child(5)) { grid-template-columns: repeat(6, minmax(0, 1fr)) }
  .stat-line:has(> .panel:nth-child(5)) .panel { grid-column: span 2 }
  .stat-line:has(> .panel:nth-child(5)) .panel:nth-child(n+4) { grid-column: span 3; border-top: 1px solid var(--line) }
  .stat-line:has(> .panel:nth-child(5)) .panel:nth-child(4) { border-left: 0 }
  .stat-line:has(> .panel:nth-child(5)) strong { font-size: 32px }
}
/* six tiles («Лидоген соцсети»): one row on a wide screen, 3 + 3 below 1180px */
@media (min-width: 1181px) {
  .stat-line:has(> .panel:nth-child(6)) { grid-template-columns: repeat(6, minmax(0, 1fr)) }
}
@media (min-width: 601px) and (max-width: 1180px) {
  .stat-line:has(> .panel:nth-child(6)) .panel:nth-child(n+4) { grid-column: span 2 }
}
/* seven tiles («Соцсети» with ВКонтакте, 01.11.2026): one row from 1400px, 4 + 3 below - the key names
   (VK_SERVICE_TOKEN) don't fit seven columns of a narrower screen */
@media (min-width: 1400px) {
  .stat-line:has(> .panel:nth-child(7)) { grid-template-columns: repeat(7, minmax(0, 1fr)) }
  .stat-line:has(> .panel:nth-child(7)) .panel { padding: 18px 14px }
}
@media (min-width: 601px) and (max-width: 1399px) {
  .stat-line:has(> .panel:nth-child(7)) { grid-template-columns: repeat(12, minmax(0, 1fr)) }
  .stat-line:has(> .panel:nth-child(7)) .panel { grid-column: span 3 }
  .stat-line:has(> .panel:nth-child(7)) .panel:nth-child(4) { border-top: 0; border-left: 1px solid var(--line) }
  .stat-line:has(> .panel:nth-child(7)) .panel:nth-child(n+5) { grid-column: span 4; border-top: 1px solid var(--line) }
  .stat-line:has(> .panel:nth-child(7)) .panel:nth-child(5) { border-left: 0 }
}
/* eight tiles («Соцсети» with ВКонтакте and «Фриланс»): 4 + 4 on every screen but a phone */
@media (min-width: 601px) {
  .stat-line:has(> .panel:nth-child(8)) { grid-template-columns: repeat(4, minmax(0, 1fr)) }
  .stat-line:has(> .panel:nth-child(8)) .panel:nth-child(n) { grid-column: auto; padding: 18px 18px; border-top: 0; border-left: 1px solid var(--line) }  /* :nth-child(n) - over the seven tiles' spans */
  .stat-line:has(> .panel:nth-child(8)) .panel:nth-child(4n+1) { border-left: 0 }
  .stat-line:has(> .panel:nth-child(8)) .panel:nth-child(n+5) { border-top: 1px solid var(--line) }
}
/* two tiles («Лидогены»: month and today / average) */
.stat-line:not(:has(> .panel:nth-child(3))) { grid-template-columns: repeat(2, minmax(0, 1fr)) }
.dashboard-preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 12px }
.stat-line .panel, .dashboard-preview-grid .panel {
  display: flex; flex-direction: column; gap: 6px;
  border: 0; border-radius: 0; background: none;
  padding: 20px 22px;
}
.stat-line .panel + .panel, .dashboard-preview-grid .panel + .panel { margin-top: 0; border-left: 1px solid var(--line) }
.stat-line strong, .dashboard-preview-grid strong {
  margin-top: 8px;
  font: 700 38px/1 var(--f-display); font-variation-settings: "SHRP" 60;
  letter-spacing: -.035em; font-variant-numeric: tabular-nums;
}
.dashboard-preview-grid strong { font-size: 28px }
.stat-line small, .dashboard-preview-grid small { font-size: 13px }

.dashboard-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px }
.chart-panel { padding: 20px 20px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0 }
.chart-panel .panel-head { margin-bottom: 4px }
.chart-panel .panel-head span {
  padding: 4px 9px; border: 1px dashed var(--line-strong); border-radius: 999px;
  color: var(--warn); font: 500 11px/1.2 var(--f-mono);
}
.chart { width: 100%; height: auto }
.chart text { fill: var(--faint); font: 500 11px var(--f-mono) }
.chart-grid { fill: none; stroke: var(--line); stroke-dasharray: 2 6 }
.chart-axis { fill: none; stroke: var(--line-strong) }
.chart-line { fill: none; stroke: var(--accent-text); stroke-width: 2.5; stroke-linecap: round }
.chart-area { fill: var(--accent); opacity: .14 }
.chart-point { fill: var(--accent-text); stroke: var(--surface); stroke-width: 3 }
.chart-bar { fill: var(--accent) }
.chart-bar:nth-of-type(2n) { fill: var(--accent-text); opacity: .75 }

.dashboard-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px }
.dashboard-columns .panel + .panel { margin-top: 0 }
.dashboard-empty {
  min-height: 140px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px;
  padding: 20px;
  border: 1px dashed var(--line-strong); border-radius: 12px;
}
.dashboard-empty b { font: 600 15px/1.3 var(--f-display) }
.dashboard-empty span { color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 42ch }
/* «Последние лиды» / «Активность AI-сейлза»: fixed height, newest on top, older ones fade out at the bottom */
.feed { height: 380px; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent) }
.feed .dashboard-empty, .feed .loading-state { flex: 1 }
.feed-item { flex: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2) }
.feed-item.fresh { animation: feed-in 1.2s ease-out }
@keyframes feed-in { from { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-6px) } 30% { transform: none } }
.feed-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline }
.feed-top b { font: 600 13px/1.3 var(--f-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.feed-top time { flex: none; color: var(--faint); font: 500 11px var(--f-mono) }
.feed-item p { margin: 4px 0 6px; font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere }
.feed-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px }
@media (prefers-reduced-motion: reduce) { .feed-item.fresh { animation: none } }


/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px }
.admin-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px }
.admin-table th {
  padding: 0 12px 10px; text-align: left; white-space: nowrap;
  font: 500 11px/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--line);
}
.admin-table th.num { text-align: right }
.admin-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap }
.admin-table td.muted { white-space: normal; min-width: 220px }
.admin-table tbody tr:last-child td { border-bottom: 0 }
.admin-table tbody tr { transition: background-color .12s }
.admin-table tbody tr:hover { background: var(--surface-2) }
.admin-table td.actions { text-align: right; white-space: nowrap }
.nowrap { white-space: nowrap }
.admin-table td.empty-row { padding: 32px 12px; text-align: center; color: var(--muted) }
.admin-table .row-actions { display: inline-flex; gap: 6px }

/* ---------- Доступы ---------- */
.form-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap }
/* what a key opens: the plans and the products of their own as buttons (21.10.2026) */
.plan-pick { display: grid; gap: 12px; margin-bottom: 16px }
.plan-pick-group { display: grid; gap: 6px }
.plan-pick-label { color: var(--muted); font-size: 13px }
.plan-pick-items { display: flex; flex-wrap: wrap; gap: 8px }
.plan-pick-item { min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--sunken); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer }
.plan-pick-item:hover { border-color: var(--accent) }
.plan-pick-item.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text, var(--ink)); font-weight: 600 }
/* the key builder (06.11.2026): the presets, a group of products a fieldset, each product a checkbox */
.key-builder { display: grid; gap: 12px; margin-bottom: 16px }
.key-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.key-presets .plan-pick-item { min-height: 32px; padding: 0 12px; font-size: 13px }
.key-group { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line-strong); border-radius: 12px; min-width: 0 }
.key-group legend { padding: 0 6px; color: var(--muted); font-size: 13px }
.key-group legend .text-link { font: inherit; font-size: 12px; margin-left: 4px; padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer }
.key-group-items { display: flex; flex-wrap: wrap; gap: 8px }
.key-check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--sunken); color: var(--ink); font-size: 14px; cursor: pointer }
.key-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600 }
.key-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent) }
.key-summary { font-size: 13px }
.form-row label { display: grid; gap: 6px; min-width: 200px; color: var(--muted); font-size: 13px }
.notice {
  margin-top: 16px; padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--signal) 35%, transparent); border-radius: 12px;
  background: var(--signal-soft); color: var(--ink); font-size: 14px;
}
.key-notice { display: flex; align-items: center; justify-content: space-between; gap: 14px }
.key-notice b { font: 600 16px/1.3 var(--f-mono); letter-spacing: .02em; word-break: break-all }
.copy-key {
  flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.copy-key:hover { border-color: var(--accent-text) }
.copy-key svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round }
.copy-key.copied { background: var(--signal); border-color: var(--signal); color: var(--bg) }
.copy-check { font-weight: 700 }

/* ---------- Тарифы ---------- */
.plans-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 16px; align-items: start }
.plans-layout .panel + .panel { margin-top: 0 }
.plan-table { min-width: 520px }
.plan-table tbody tr { cursor: pointer }
.plan-table tbody tr.selected { background: var(--accent-soft) }
.plan-table tbody tr.selected td:first-child strong { color: var(--accent-text) }
.plan-table td:first-child strong { font-weight: 600 }
.plan-table td small { margin-left: 2px; color: var(--faint); font-size: 12px }
.plan-detail { position: sticky; top: 24px; min-height: 320px }
.plan-detail .panel-head { align-items: flex-start }
.plan-detail .panel-head h3 { margin-top: 6px; font-size: 21px }
.plan-detail-state { padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text) !important }
.plan-detail-description { margin-bottom: 18px; font-size: 13px; line-height: 1.55 }
.plan-detail-empty { min-height: 280px; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line-strong); border-radius: 12px }
.plan-editor-fields { display: grid; gap: 12px }
.plan-editor-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 13px }
.plan-editor-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px }

/* ---------- Пользователи ---------- */
.user-detail { margin-top: 16px }
.user-detail .panel-head h3 { margin-top: 6px; font-size: 20px }
.user-access-meta { margin-bottom: 18px; color: var(--muted); font: 500 12px/1.6 var(--f-mono) }
.user-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start }
.user-settings-section { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--sunken) }
.user-settings-section.is-disabled { opacity: .55 }
.user-settings-section .panel-head { margin-bottom: 6px }
.user-settings-section .panel-head h3 { font-size: 16px }
.user-settings-section label { display: grid; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 13px }
.user-settings-section textarea, .user-settings-section select { width: 100%; background: var(--surface) }
.user-settings-section :disabled { cursor: not-allowed; opacity: .7 }
.user-settings-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px }

/* ---------- Сотрудники ---------- */
.employee-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line) }
.employee-form h3 { margin-bottom: 14px; font-size: 16px }

/* ---------- Toast ---------- */
.admin-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 100;
  padding: 12px 16px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface-2); color: var(--ink);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
.admin-toast.visible { opacity: 1; transform: none }

/* ---------- Loading ---------- */
.loading-state { display: grid; gap: 12px }
.loading-state i { height: 120px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite }
.loading-state i:nth-child(2) { height: 260px }
@keyframes shimmer { from { background-position: 100% 0 } to { background-position: 0 0 } }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 60;
  display: none; place-items: center; padding: 16px;
  background: var(--bg);
  overflow-x: hidden; overflow-y: auto; align-items: safe center; isolation: isolate;
}
.login-screen::before {
  content: ""; position: fixed; z-index: -1; inset: 50% auto auto 50%;
  width: 1100px; height: 1100px; transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    repeating-radial-gradient(circle, transparent 0 64px, color-mix(in srgb, var(--accent-text) 10%, transparent) 64px 65px);
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  pointer-events: none;
}
.login-card {
  width: min(400px, 100%);
  display: grid;
  padding: 32px;
  border: 1px solid var(--line-strong); border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px }
.login-brand b, .login-brand small { display: block }
.login-brand b { font: 700 17px/1.1 var(--f-display); font-variation-settings: "SHRP" 60 }
.login-brand small { margin-top: 3px; font: 500 10px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint) }
.login-card h2 { font-size: 28px; font-weight: 700; letter-spacing: -.035em }
.login-card p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.55 }
.login-field { margin-top: 24px; margin-bottom: 6px; color: var(--muted); font-size: 13px }
.login-card input { width: 100%; min-height: 46px; font-size: 15px }
.login-card .primary { width: 100%; min-height: 46px; margin-top: 14px; font-size: 15px }
.login-error { min-height: 20px; margin-top: 10px; color: var(--danger); font-size: 13px }
.login-back { justify-self: start; color: var(--faint); font-size: 13px; text-decoration: none }
.login-back:hover { color: var(--ink) }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dashboard-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .dashboard-preview-grid .panel:nth-child(3) { border-left: 0 }
  .dashboard-preview-grid .panel:nth-child(n+3) { border-top: 1px solid var(--line) }
  .dashboard-charts { grid-template-columns: 1fr }
}
@media (max-width: 960px) {
  .plans-layout { grid-template-columns: 1fr }
  .plan-detail { position: static; min-height: 0 }
  .user-settings-grid { grid-template-columns: 1fr }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr }
  .side {
    position: sticky; z-index: 30; height: auto;
    display: grid; grid-template-columns: 1fr auto; gap: 12px;
    padding: 12px 16px 0;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .side-nav {
    grid-column: 1 / -1; grid-row: 2;
    display: flex; align-items: start; gap: 20px; margin: 0 -16px; padding: 2px 16px 10px;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none }
  .nav-group { flex: 0 0 auto; gap: 6px }
  .nav-group-title { padding: 0 12px; white-space: nowrap }
  .nav-group-items { display: flex; gap: 4px }
  .side-nav .nav { scroll-margin-inline: 16px }
  .nav { width: auto; flex-shrink: 0; min-height: 36px; padding: 0 12px; white-space: nowrap }
  .side-bottom { margin-top: 0; padding-top: 0; border-top: 0; grid-column: 2; grid-row: 1; align-self: center }
  .account { display: none }
  .logout-button span { display: none }
  .logout-button { flex: 0 0 36px; padding: 0 }
  .workspace { padding-top: 20px }
  .dashboard-columns { grid-template-columns: 1fr }
}
@media (max-width: 600px) {
  .stat-line, .dashboard-preview-grid { grid-template-columns: 1fr }
  .stat-line .panel + .panel, .dashboard-preview-grid .panel + .panel { border-left: 0; border-top: 1px solid var(--line) }
  .stat-line .panel, .dashboard-preview-grid .panel { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 12px; padding: 16px 18px }
  .stat-line .kicker, .dashboard-preview-grid .kicker { flex-basis: 100% }
  .stat-line strong, .dashboard-preview-grid strong { font-size: 30px; margin-top: 4px }
  .form-row label { min-width: 0; flex: 1 1 100% }
  .form-row .primary { width: 100% }
  .key-notice { align-items: flex-start }
  .period-tools, .period-tools select { width: 100% }
  .panel { padding: 16px }
  .table-wrap { margin: 0 -16px; padding: 0 16px }
  .login-card { padding: 26px 22px }
}

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

.plan-table tbody tr.plan-trial{cursor:default;background:var(--surface-2)}.plan-table tbody tr.plan-trial:hover{background:var(--surface-2)}

.spend-summary{margin:4px 0 22px}.spend-summary .panel-head{margin-bottom:8px}.spend-summary .panel-head h3{font-size:16px}.spend-table{max-width:560px}.spend-table tr.spend-total td{font-weight:700;border-top:1px solid var(--line-strong)}

/* Расходы и графики дашборда: два модуля - две проверенные категории цвета (синий / янтарный) */
:root{--series-1:#5468ff;--series-2:#c0802b}
:root[data-theme="light"]{--series-1:#3b4ef0;--series-2:#d97a00}
.series-1{fill:var(--series-1);background:var(--series-1)}
.series-2{fill:var(--series-2);background:var(--series-2)}
.chart-wrap{position:relative}
.chart-bars{pointer-events:none}
.chart-hit{fill:transparent}
.chart-hit.hover{fill:var(--accent-soft)}
.chart .chart-empty{fill:var(--muted);font:500 13px var(--f-body)}
.chart-tip{position:absolute;top:6px;left:0;transform:translateX(-50%);min-width:170px;padding:10px 12px;border:1px solid var(--line-strong);border-radius:10px;background:var(--surface-2);box-shadow:var(--shadow);color:var(--ink);font:500 12px/1.5 var(--f-body);pointer-events:none;z-index:5}
.chart-tip[hidden]{display:none}
.chart-tip b{display:block;margin-bottom:4px;font-weight:600}
.chart-tip .tip-row{display:flex;align-items:center;justify-content:space-between;gap:14px}
.chart-tip .tip-row span{display:flex;align-items:center;gap:6px;color:var(--muted)}
.chart-tip .tip-row em{font:500 12px var(--f-mono);font-style:normal}
.chart-tip .tip-total{margin-top:4px;padding-top:4px;border-top:1px solid var(--line)}
.chart-tip .tip-total span,.chart-tip .tip-total em{color:var(--ink);font-weight:600}
.sw{display:inline-block;width:10px;height:10px;border-radius:3px;flex-shrink:0}
.chart-legend{display:flex;flex-wrap:wrap;gap:14px;align-items:center}
.chart-panel .panel-head .chart-legend span{display:flex;align-items:center;gap:6px;padding:0;border:0;border-radius:0;color:var(--muted);font:500 12px/1.2 var(--f-body)}
.spend-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.month-switch{display:inline-flex;align-items:center;gap:6px;padding:4px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.month-switch b{min-width:150px;text-align:center;font:600 15px var(--f-display)}
.month-switch .icon-button{height:34px;width:34px;font-size:18px;line-height:1}
.month-switch .icon-button:disabled{opacity:.35;cursor:default}
.spend-chart{margin-top:12px}
.spend-clients,.hour-panel{margin-top:12px}
.spend-filters{display:flex;flex-wrap:wrap;gap:8px}
.spend-filters select{min-width:150px;min-height:34px;font-size:13px}
.more-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:12px}
.cell-note{display:block;font-size:12px}
@media (max-width:760px){.spend-toolbar{justify-content:center}.panel-head:has(.spend-filters){flex-direction:column;align-items:flex-start}.spend-filters select{min-width:0;flex:1}}
.chart-scroll{overflow-x:auto}
/* phones: barChart draws the chart as wide as the screen */

/* Роли: менеджер, поддержка и аналитик только просматривают - элементы изменения скрыты (API тоже не даст изменить) */
body[data-readonly] .access-create,body[data-readonly] .plan-editor-actions,body[data-readonly] .user-settings-actions,body[data-readonly] #employee-form,body[data-readonly] .row-actions,body[data-readonly] [onclick="showEmployeeForm()"]{display:none!important}
body[data-readonly] .plan-editor-fields,body[data-readonly] .user-settings-grid{pointer-events:none;opacity:.75}
.access-root [hidden]{display:none!important}
.access-tabs{display:flex;gap:24px;margin-bottom:24px;border-bottom:1px solid var(--line-strong);overflow-x:auto;scrollbar-width:none}
.access-tabs button{flex:none;white-space:nowrap}
.access-tabs button{padding:0 0 12px;border:0;border-bottom:2px solid transparent;background:none;color:var(--muted);font:500 14px var(--f-body);cursor:pointer}
.access-tabs button[aria-selected="true"]{color:var(--ink);border-bottom-color:var(--accent)}
.access-tabs button:hover{color:var(--ink)}
.employees-panel>.panel-head{flex-wrap:wrap}
/* «Дашборд» → «Настройщики» (28.10.2026) */
.setters-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.setters-head p{margin:0}
.setters-periods{display:flex;gap:8px}.setters-periods .table-action.is-active{background:var(--accent-soft);border-color:var(--accent-hover,var(--accent));color:var(--ink)}
.setters-panel{margin-top:12px}
.setter-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px}
.setter-card{display:flex;flex-direction:column;gap:14px;padding:16px 18px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface)}
.setter-card-top{display:flex;align-items:center;justify-content:space-between;gap:10px}.setter-card-top b{font-size:16px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.setter-card-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0}.setter-card-stats dt{font-size:12px;color:var(--muted)}.setter-card-stats dd{margin:4px 0 0;font:600 20px/1.1 var(--f-display);font-variant-numeric:tabular-nums}
.setter-clients{display:flex;flex-direction:column;gap:8px}
.setter-client{display:grid;grid-template-columns:minmax(0,1fr) auto 170px;align-items:center;gap:16px;width:100%;padding:12px 16px;border:1px solid var(--line);border-radius:var(--radius);background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
.setter-client:hover,.setter-client:focus-visible{border-color:var(--accent-hover,var(--accent));background:var(--accent-soft)}
.setter-client.is-waiting{box-shadow:inset 3px 0 0 var(--warn,#e0a03a)}
.setter-client-main{display:flex;flex-direction:column;gap:3px;min-width:0}.setter-client-main b,.setter-client-main small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.setter-client-main small,.setter-client-stats small{color:var(--muted);font-size:12px}
.setter-client-stats{display:flex;gap:24px;white-space:nowrap;font-variant-numeric:tabular-nums}.setter-client-stats>span{display:flex;flex-direction:column;gap:3px}
.setter-client-state{justify-self:end}
@media (max-width:760px){.setter-client{grid-template-columns:1fr}.setter-client-state{justify-self:start}}
.employees-heading{display:flex;align-items:center;gap:8px}
.roles-help{display:inline-flex}
.roles-help-button{display:inline-grid;place-items:center;width:28px;height:28px;padding:4px;border:0;border-radius:6px;background:none;color:var(--muted);cursor:pointer}
.roles-help-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
.roles-help-button:hover,.roles-help-button[aria-expanded="true"]{color:var(--accent-text);background:var(--accent-soft)}
.roles-help-button:focus-visible,.access-tabs button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.roles-popover{position:fixed;inset:auto;margin:0;width:min(360px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:18px;box-sizing:border-box;background:var(--surface);color:var(--muted);border:1px solid var(--line-strong);border-radius:8px;box-shadow:var(--shadow);font:400 13px/1.55 var(--f-body)}
.roles-popover:popover-open{display:grid;gap:10px}
.roles-popover p{margin:0}
.roles-popover b{color:var(--ink);font-weight:600}
@media(max-width:600px){.access-tabs{gap:20px;margin-bottom:18px}.access-tabs button{font-size:13px}}

/* Сохранение: кнопка серая, пока в форме ничего не изменено; плашка о результате сверху по центру */
button.primary:disabled,button.primary:disabled:hover{background:var(--surface-2);color:var(--faint);cursor:default;transform:none}
.admin-toast{top:20px;bottom:auto;left:50%;right:auto;display:flex;align-items:center;gap:10px;max-width:calc(100vw - 32px);transform:translate(-50%,-10px)}
.admin-toast.visible{transform:translate(-50%,0)}
.admin-toast i{display:grid;place-items:center;flex-shrink:0;width:22px;height:22px;border-radius:50%;font:700 13px/1 var(--f-body);font-style:normal}
.admin-toast.is-ok{border-color:color-mix(in srgb,var(--signal) 45%,var(--line-strong))}
.admin-toast.is-ok i{background:var(--signal-soft);color:var(--signal)}
.admin-toast.is-error{border-color:color-mix(in srgb,var(--danger) 45%,var(--line-strong))}
.admin-toast.is-error i{background:var(--danger-soft);color:var(--danger)}

/* Карточка клиента: преднастройка и готовые сценарии AI-сейлза, как в мини-аппе */
.template-apply{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap;margin:0 0 18px}
.template-apply label{display:grid;gap:6px;min-width:260px;flex:0 1 380px}
.template-apply .table-action{min-height:40px}
.scenario-list{display:grid;gap:8px;margin-top:6px}
.scenario-title{color:var(--muted);font-size:13px;font-weight:500}
.check-row{display:flex!important;align-items:center;gap:10px;cursor:pointer;font-size:14px}
.check-row input{width:16px;height:16px;margin:0;accent-color:var(--accent)}
.user-settings-section.is-disabled .check-row{cursor:default}
body[data-readonly] .template-apply{display:none!important}

/* Рассылки: карточки уведомлений с тумблером, панель оформления текста, форма рассылки */
.mailing-panel + .mailing-panel{margin-top:12px}
.panel-note{margin:-6px 0 16px;color:var(--muted);font-size:13px;line-height:1.55;max-width:860px}
.notice-list{display:grid;gap:12px}
.notice-card{display:grid;gap:10px;padding:16px;border:1px solid var(--line);border-radius:14px;background:var(--sunken)}
.notice-card.is-off{opacity:.62}
.notice-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.notice-when{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.notice-when select{min-width:190px}
.notice-days{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:13px}
.notice-days[hidden]{display:none}
.notice-days input{width:78px}
.notice-card textarea,.broadcast-form textarea{width:100%;min-height:96px;resize:vertical}
.notice-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:13px}
.notice-foot .row-actions{display:inline-flex;align-items:center;gap:10px}
.switch{position:relative;display:inline-flex;align-items:center;gap:8px;cursor:pointer;user-select:none}
.switch input{position:absolute;opacity:0;width:1px;height:1px}
.switch-track{position:relative;width:38px;height:22px;border-radius:999px;background:var(--line-strong);transition:background-color .15s}
.switch-track::after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .15s var(--ease)}
.switch input:checked + .switch-track{background:var(--accent)}
.switch input:checked + .switch-track::after{transform:translateX(16px)}
.switch input:focus-visible + .switch-track{outline:2px solid var(--accent-text);outline-offset:2px}
.switch em{font-style:normal;font-size:13px;color:var(--muted);min-width:72px}
.text-tools{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.text-tools button{min-height:30px;padding:0 10px;border:1px solid var(--line-strong);border-radius:8px;background:var(--surface);color:var(--ink);font:500 12px var(--f-body);cursor:pointer}
.text-tools button:hover{border-color:var(--accent-text);background:var(--accent-soft)}
.text-tools button[data-insert]{font-family:var(--f-mono);color:var(--accent-text)}
.text-tools-sep{width:1px;height:18px;margin:0 4px;background:var(--line-strong)}
.broadcast-form{display:grid;gap:10px;margin-bottom:12px}
.broadcast-actions{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap}
.broadcast-actions label{display:grid;gap:6px;min-width:260px}
#broadcastHistory{margin-top:4px}
.message-cell{max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-readonly] #addNotification,body[data-readonly] .notice-foot .row-actions,body[data-readonly] .text-tools,body[data-readonly] .broadcast-form,body[data-readonly] .broadcast-stop{display:none!important}
body[data-readonly] .notice-card{pointer-events:none}

/* Карточка клиента → Лидоген: полная настройка, плашки слов, тестовое сообщение в группу и окно-подсказка */
.user-settings-grid.single{grid-template-columns:1fr}
.leadgen-panel{margin-top:12px;display:grid;gap:16px}
.leadgen-panel .panel-head{margin-bottom:0}
.pill-warn{color:var(--warn);background:var(--warn-soft)}
.leadgen-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.leadgen-facts div{display:grid;gap:4px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--sunken)}
.leadgen-facts span{color:var(--muted);font-size:12px}
.leadgen-facts b{font-weight:600}
.leadgen-form{display:grid;gap:16px}
.leadgen-form > label,.leadgen-row > label{display:grid;gap:6px}
.leadgen-form small{font-size:12px}
.leadgen-row{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}
.leadgen-row > label{flex:1 1 420px}
.lead-chat-line{display:flex;gap:8px;flex-wrap:wrap}
.lead-chat-line select{flex:1 1 240px}
.lead-chat-line .table-action{min-height:40px}
.leadgen-ai{padding-bottom:22px}
.tag-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tag-editor{display:grid;gap:10px;align-content:start;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--sunken)}
.tag-editor-head{display:flex;align-items:center;justify-content:space-between;font-weight:600}
.tag-list{display:flex;flex-wrap:wrap;gap:6px;max-height:260px;overflow:auto}
.tag{display:inline-flex;align-items:center;gap:4px;padding:4px 4px 4px 10px;border:1px solid var(--line-strong);border-radius:999px;background:var(--surface);font-size:13px}
.tag button{display:grid;place-items:center;width:20px;height:20px;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer;font-size:15px;line-height:1}
.tag button:hover{background:var(--danger-soft);color:var(--danger)}
.tag-add{display:flex;gap:8px}
.tag-add input{flex:1;min-width:0}
.leadgen-sub{padding-top:14px;border-top:1px solid var(--line)}
.leadgen-sub .panel-head{margin-bottom:10px}
.team-add{display:flex;align-items:flex-end;gap:8px;flex-wrap:wrap;margin-top:12px}
.team-add label{display:grid;gap:6px;flex:0 1 220px}
.team-add .table-action{min-height:40px}
.help-banner-backdrop{position:fixed;inset:0;z-index:200;display:grid;place-items:center;padding:16px;background:rgba(4,6,14,.6)}
.help-banner{width:min(520px,100%);display:grid;gap:12px;padding:24px;border:1px solid color-mix(in srgb,var(--warn) 45%,var(--line-strong));border-radius:16px;background:var(--surface);box-shadow:var(--shadow)}
.help-banner-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:var(--warn-soft);color:var(--warn);font:700 18px/1 var(--f-body)}
.help-banner h3{margin:0;font-size:18px}
.help-banner p{margin:0;color:var(--muted);line-height:1.5}
.help-banner ol{margin:0;padding-left:20px;display:grid;gap:6px;line-height:1.5}
.help-banner .primary{justify-self:start;margin-top:4px}
@media (max-width:760px){.leadgen-facts,.tag-grid{grid-template-columns:1fr}}
body[data-readonly] .leadgen-save,body[data-readonly] .lead-chat-test,body[data-readonly] .tag-add,body[data-readonly] .tag button,body[data-readonly] .team-add{display:none!important}
body[data-readonly] .leadgen-form,body[data-readonly] #leadgenSources .switch{pointer-events:none}
.leadgen-panel,.leadgen-form{grid-template-columns:minmax(0,1fr)}
.leadgen-panel > *,.leadgen-form > *,.lead-chat-line select,.leadgen-row > label{min-width:0}
.user-detail .panel-head{flex-wrap:wrap}
.cabinet-link{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:-4px 0 16px;font-size:13px}

/* FAQ tab */
.faq-group+.faq-group{margin-top:22px}
.faq-group h4{margin:0 0 10px;font:600 15px var(--f-body);color:var(--ink)}
.faq-group h4 .muted{font-weight:400;font-size:13px}
.faq-list,#faqNew{display:grid;gap:12px}
#faqNew:not(:empty){margin-bottom:22px}
.faq-card{display:grid;gap:10px;padding:16px;border:1px solid var(--line);border-radius:14px;background:var(--sunken);min-width:0}
.faq-card.is-off{opacity:.62}
.faq-head{display:grid;grid-template-columns:minmax(0,1fr) 170px auto;align-items:center;gap:12px}
.faq-question-field{position:relative;min-width:0}
.faq-question-field input{width:100%;padding-right:56px;font-weight:600}
.faq-count{position:absolute;right:10px;bottom:9px;font:500 11px var(--f-mono)}
.faq-card textarea{width:100%;resize:none;overflow:hidden;line-height:1.5}
.faq-card .table-action[disabled]{opacity:.35;cursor:default}
@media (max-width:720px){.faq-head{grid-template-columns:minmax(0,1fr)}}
body[data-readonly] #addFaq,body[data-readonly] .faq-card .row-actions{display:none!important}
body[data-readonly] .faq-card{pointer-events:none}

/* Client card: AI-manager panel */
.sales-panel{margin-top:12px;display:grid;gap:16px;grid-template-columns:minmax(0,1fr)}
.sales-panel .panel-head{margin-bottom:0}
.sales-panel .leadgen-facts{grid-template-columns:repeat(4,minmax(0,1fr))}
.sales-form{display:grid;gap:16px;grid-template-columns:minmax(0,1fr)}
.sales-form label{display:grid;gap:6px;min-width:0}
.sales-form label.switch{display:inline-flex}
.sales-form small{font-size:12px}
.sales-form textarea{width:100%;resize:vertical}
.sales-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start}
.sales-grid.tight{gap:12px}
.sales-fields-box{display:grid;gap:8px;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--sunken)}
.field-caption{font-size:13px;font-weight:600}
.sales-field{display:flex;align-items:center;gap:12px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.sales-field > span{flex:1;min-width:0;font-weight:600}
.sales-field .check-row{display:flex!important;font-size:13px;color:var(--muted)}
.sales-field-add{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.sales-field-add select,.sales-field-add input{flex:1 1 200px;min-width:0}
.sales-advanced summary{cursor:pointer;font-weight:600;font-size:14px}
.sales-advanced[open]{display:grid;gap:10px}
.mono-area{font-family:var(--f-mono);font-size:12px;line-height:1.5}
.warn-note{color:var(--warning,#b25e09)}
.team-add label.grow{flex:1 1 320px}
@media (max-width:900px){.sales-grid,.sales-panel .leadgen-facts{grid-template-columns:minmax(0,1fr)}}
body[data-readonly] .sales-save,body[data-readonly] .sales-field-add,body[data-readonly] #salesPushes .team-add,body[data-readonly] #salesPushes .row-actions,body[data-readonly] .sales-field .table-action{display:none!important}
body[data-readonly] .sales-form,body[data-readonly] #salesPushes .switch{pointer-events:none}

:root{--series-3:#199e70;--series-4:#9085e9}
:root[data-theme="light"]{--series-3:#199e70;--series-4:#4a3aa7}
.series-3{fill:var(--series-3);background:var(--series-3)}
.series-4{fill:var(--series-4);background:var(--series-4)}
.series-name{display:inline-flex;align-items:center;gap:8px}
.chart-marks{pointer-events:none}
.chart-mark{fill:none;stroke:var(--muted);stroke-width:1;stroke-dasharray:3 4}
.chart .chart-mark-label{fill:var(--muted);font:500 10px var(--f-body)}
.seg-filter{display:inline-flex;gap:4px;padding:4px;border:1px solid var(--line-strong);border-radius:12px;background:var(--surface)}
.seg-filter .seg{display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 16px;border:0;border-radius:9px;background:transparent;color:var(--muted);font:600 13px/1 var(--f-body);cursor:pointer;transition:background-color .15s,color .15s}
.seg-filter .seg:hover{background:var(--surface-2);color:var(--ink)}
.seg-filter .seg.active{background:var(--accent);color:var(--on-accent)}
.seg-filter .seg.active .sw{box-shadow:0 0 0 2px var(--on-accent)}
@media (max-width:760px){.spend-toolbar{flex-wrap:wrap}.seg-filter{width:100%}.seg-filter .seg{flex:1;justify-content:center;padding:0 8px}}

/* AI-сейлз в карточке клиента: подключение к Telegram Business */
.warn-text{color:var(--warn)}
.sales-note{display:grid;gap:6px;align-content:start}

/* «Лидогены»: переключатель дашбордов значками (расходы / проверки) */
.view-switch .seg svg{width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media (max-width:760px){.view-switch{width:100%}.view-switch .seg{flex:1;justify-content:center}}

/* client card → «Управление доступом» */
.access-manage{margin:12px 0;padding:14px;border:1px solid var(--line);border-radius:var(--radius);display:flex;flex-direction:column;gap:10px}
.access-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.access-head .muted{font-size:12px}
.access-row{display:flex;align-items:center;gap:8px}
.access-manage .access-row select.access-input,.access-manage .access-row input.access-input{height:34px;min-height:34px;padding:0 10px;font-size:13px;border-radius:8px}
.access-manage .access-row select.access-input{flex:1 1 auto;min-width:0;padding-right:30px}
.access-days{position:relative;flex:1 1 auto;display:flex;align-items:center;min-width:0}
.access-manage .access-days input.access-input{width:100%;padding-right:48px}
.access-days span{position:absolute;right:10px;font-size:12px;color:var(--muted);pointer-events:none}
.access-manage .access-row .table-action{flex:0 0 136px;min-height:34px;white-space:nowrap}
.access-manage>.danger-action{align-self:flex-start}

/* «Лидогены» → «Потрачено за последний час» */
.hour-now{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap;margin-top:6px}
.hour-now strong{font-size:32px;line-height:1.1;font-variant-numeric:tabular-nums}
.hour-split{display:flex;gap:16px;flex-wrap:wrap;margin-left:auto;font-size:13px}

/* «Пользователи»: the table with a search on the left, the client's card on the right */
.workspace:has(.users-layout){max-width:none}  /* kept: the users' table may use any width */
.users-layout{display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:16px;align-items:start}
.users-layout>.panel{margin-top:0}
.users-table-panel .panel-head{gap:12px;flex-wrap:wrap}
.users-table-panel .panel-head h3 .muted{font-weight:500}
.clients-tools{display:flex;flex:1 1 420px;flex-wrap:wrap;gap:8px;justify-content:flex-end}
.clients-search{flex:1 1 220px;max-width:340px;min-height:36px;padding:0 12px;font-size:13px}
.clients-filter{min-height:36px;padding:0 30px 0 12px;font-size:13px;flex:0 1 auto;max-width:200px}
.clients-table th.sortable{padding:0}
.sort-button{display:flex;align-items:center;justify-content:flex-end;gap:4px;width:100%;min-height:42px;padding:11px 8px;border:0;border-radius:inherit;background:none;color:inherit;font:inherit;line-height:1.25;text-align:right;cursor:pointer}
.sort-button:hover{color:var(--ink)}
.sort-button:focus-visible{outline:2px solid var(--accent-text);outline-offset:-2px}
.sort-mark{flex:none;width:12px;color:var(--faint);font-family:var(--f-mono)}
.sortable.sorted .sort-button{color:var(--ink)}
.sortable.sorted .sort-mark{color:var(--accent-text)}
.clients-table{min-width:0;font-size:13px}
.clients-table th{white-space:normal;line-height:1.25}
.clients-table th,.clients-table td{padding-left:8px;padding-right:8px}
.clients-table td{padding-top:10px;padding-bottom:10px}
.clients-table td .cell-note{display:block}
.clients-table td.muted{min-width:0}
.client-name{max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.clients-table td:nth-child(4){white-space:normal;min-width:86px;max-width:120px;line-height:1.3}
.clients-table{border-collapse:separate;border-spacing:0 6px;margin-top:-6px}
.clients-table th{background:var(--surface-2);padding-top:11px;padding-bottom:11px;border-bottom:0;color:var(--muted)}
.clients-table th:first-child,.clients-table td:first-child{border-radius:10px 0 0 10px}
.clients-table th:last-child,.clients-table td:last-child{border-radius:0 10px 10px 0}
.clients-table td{border-bottom:0;background:color-mix(in srgb,var(--surface-2) 45%,transparent)}
.clients-table tbody tr{cursor:pointer}
.clients-table tbody tr:hover td{background:var(--surface-2)}
.clients-table tbody tr.selected td{background:var(--accent-soft)}
.clients-table tbody tr.selected td:first-child{box-shadow:inset 3px 0 0 var(--accent)}
.users-table-panel .panel-note{margin-top:10px}
.user-card{position:sticky;top:16px}
.client-card{display:flex;flex-direction:column;gap:12px}
.referral-admin-card{display:flex;flex-direction:column;gap:10px;padding:13px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2)}
.referral-admin-card .panel-head{margin:0;align-items:center}
.referral-admin-card .panel-head h3{font-size:14px}
.referral-admin-count{display:grid;place-items:center;min-width:28px;height:25px;padding:0 6px;border-radius:8px;background:var(--accent-soft);color:var(--accent-text);font:700 13px var(--f-mono)}
.referral-admin-label{color:var(--muted);font-size:12px;font-weight:600}
.referral-admin-balance{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.referral-admin-balance>div{display:flex;flex-direction:column;gap:3px;padding:9px 10px;border-radius:9px;background:var(--surface)}
.referral-admin-balance span{color:var(--muted);font-size:11px}
.referral-admin-balance strong{font-size:16px;font-variant-numeric:tabular-nums}
.referral-writeoff{width:100%;min-height:36px}
.referral-admin-note{font-size:11px}
.referral-admin-gift{padding:8px 10px;border-radius:9px;background:var(--accent-soft);color:var(--accent-text);font-size:12px;font-weight:650}
.client-title{display:flex;flex-direction:column;gap:2px}
.client-title h3{margin:0;font-size:18px}
.client-title .user-access-meta{margin:6px 0 0}
.client-pill{align-self:flex-start}
.client-who{margin-top:8px;overflow-wrap:anywhere}
.user-card .access-manage{margin:0}
.cabinet-button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:10px;background:var(--accent);color:var(--on-accent);font-weight:600;font-size:14px;text-decoration:none;transition:background-color .15s}
.cabinet-button:hover{background:var(--accent-hover)}
.cabinet-note{font-size:12px;text-align:center;margin-top:-6px}
.feature-toggle{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:12px}
.feature-toggle b{font-size:14px}
.feature-toggle small{display:block;font-size:12px;line-height:1.4;margin-top:2px}
.user-card .admin-table{min-width:0}
/* narrower screens (thresholds measured): the table keeps its total, drops the per-module spend, then the dialogs
   with a narrower card; below 1350px the card goes under the table and all columns come back */
@media (min-width:1350px) and (max-width:1609px){.clients-table th:nth-child(11),.clients-table td:nth-child(11){white-space:nowrap}.clients-table th:nth-child(8),.clients-table td:nth-child(8),.clients-table th:nth-child(9),.clients-table td:nth-child(9){display:none}}
@media (min-width:1350px) and (max-width:1489px){.clients-table th:nth-child(7),.clients-table td:nth-child(7){display:none}.users-layout{grid-template-columns:minmax(0,1fr) 360px}}
@media (max-width:1349px){.users-layout{grid-template-columns:1fr}.user-card{position:static}}

/* ---------- «Сайт»: funnel and blocks as bars, load facts ---------- */
.site-bars{display:grid;gap:12px}
.site-bar-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:6px;font-size:14px}
.site-bar-head b{font-size:14px;font-weight:600;white-space:nowrap}
.site-bar-head small{color:var(--muted);font-weight:500}
.site-bar-track{height:8px;border-radius:999px;background:var(--surface-2);overflow:hidden}
.site-bar-track i{display:block;height:100%;border-radius:inherit;background:var(--series-1)}
.site-note{margin:14px 0 0}
.site-funnel-switch{padding:3px}.site-funnel-switch .seg{height:28px;padding:0 12px;font-size:12px}
.panel-head:has(.site-funnel-switch){flex-wrap:wrap}
.site-sub{font-size:12px;margin-top:2px}
.site-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:16px}
.site-facts div{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface-2)}
.site-facts span{font-size:12px}
.site-facts b{font-size:17px}
/* the Yandex Metrica link: as tall as the period switch next to it */
.metrika-link{display:inline-flex;align-items:center;gap:10px;height:44px;padding:0 12px 0 6px;border:1px solid var(--line-strong);border-radius:12px;background:var(--surface);color:var(--ink);text-decoration:none;transition:border-color .15s,background-color .15s}
.metrika-link:hover{border-color:var(--accent);background:var(--surface-2)}
.metrika-icon{display:grid;place-items:center;width:32px;height:32px;border-radius:9px;background:var(--accent-soft)}
.metrika-icon svg{width:18px;height:18px;fill:var(--accent-text)}
.metrika-text{display:flex;flex-direction:column;gap:2px;line-height:1.1}
.metrika-text b{font:600 13px var(--f-body)}
.metrika-text small{font-size:11px;color:var(--muted)}
.metrika-arrow{width:16px;height:16px;margin-left:4px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:stroke .15s,transform .15s}
.metrika-link:hover .metrika-arrow{stroke:var(--ink);transform:translate(1px,-1px)}
@media (max-width:760px){.metrika-link{width:100%}.metrika-arrow{margin-left:auto}}

/* ---------- Phones (12.10.2026): two tiles in a row, charts as wide as the screen, clients as cards, 16px fields
   (iOS zooms the page into a smaller field and leaves it zoomed - the top bar then looks cut) ---------- */
@media (max-width:600px){
  body{font-size:14px}
  input:not([type="checkbox"]):not([type="radio"]),select,textarea{font-size:16px}
  .page-head{padding-bottom:14px;margin-bottom:16px}
  .page-head .crumb{display:none}
  .page-head h1{margin-top:0;font-size:24px}
  .side-brand small{display:none}
  .workspace{padding:16px 12px 48px}
  /* tiles: two in a row (the :has() rules above are stronger than a plain .stat-line, so they are repeated here) */
  .stat-line,.stat-line:has(> .panel:nth-child(4)),.stat-line:has(> .panel:nth-child(5)),.stat-line:not(:has(> .panel:nth-child(3))),.dashboard-preview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat-line .panel,.dashboard-preview-grid .panel{flex-direction:column;flex-wrap:nowrap;align-items:flex-start;gap:4px;padding:14px}
  .stat-line .panel + .panel,.dashboard-preview-grid .panel + .panel{border-top:0;border-left:1px solid var(--line)}
  .stat-line .panel:nth-child(odd),.dashboard-preview-grid .panel:nth-child(odd){border-left:0}
  .stat-line .panel:nth-child(n+3),.dashboard-preview-grid .panel:nth-child(n+3){border-top:1px solid var(--line)}
  .stat-line .panel:last-child:nth-child(odd){grid-column:1/-1}
  .stat-line .kicker,.dashboard-preview-grid .kicker{flex-basis:auto;font-size:10px}
  .stat-line strong,.dashboard-preview-grid strong{margin-top:4px;font-size:26px;overflow-wrap:anywhere}
  .stat-line small,.dashboard-preview-grid small{font-size:12px;line-height:1.35}
  .chart-panel{padding:14px 12px 8px}
  .chart-panel .panel-head{flex-wrap:wrap;gap:6px 12px}
  .chart-legend{gap:6px 12px}
  /* tables shrink to their content; only really wide ones scroll */
  .admin-table{min-width:0;font-size:13px}
  .admin-table th{padding:0 8px 8px}
  .admin-table td{padding:10px 8px}
  .admin-table td.muted{min-width:180px}
  .table-wrap{margin:0 -16px;padding:0 8px}
  .table-action{min-height:36px;padding:0 12px}
  .panel-head{flex-wrap:wrap}
  .month-switch b{min-width:0;padding:0 6px}
  .hour-split{margin-left:0}
  .feed{height:340px}
  .admin-toast{top:12px}
  /* «Пользователи»: each client is a card - name and status, ID and plan, new dialogs and the month's total */
  .users-table-panel .panel-head{margin-bottom:12px}
  .clients-tools{flex:1 1 100%;justify-content:stretch}
  .clients-search{max-width:none;flex:1 1 100%}
  .clients-filter{flex:1 1 0;max-width:none}
  .clients-table,.clients-table tbody{display:block;margin:0}
  .clients-table thead{display:none}
  .clients-table tbody tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;align-items:center;margin-bottom:8px;padding:12px 14px;border-radius:12px;background:color-mix(in srgb,var(--surface-2) 45%,transparent)}
  .clients-table tbody tr.selected{background:var(--accent-soft);box-shadow:inset 3px 0 0 var(--accent)}
  .clients-table td,.clients-table tbody tr:hover td,.clients-table tbody tr.selected td{display:block;padding:0;background:none;border-radius:0!important;box-shadow:none!important;max-width:none;min-width:0}
  .clients-table td:nth-child(1){grid-row:2;grid-column:1;color:var(--faint);font-size:12px}
  .clients-table td:nth-child(2){grid-row:1;grid-column:1;font-weight:600}
  .clients-table td:nth-child(2) .client-name{max-width:none}
  .clients-table tbody tr td:nth-child(3),.clients-table tbody tr td:nth-child(8),.clients-table tbody tr td:nth-child(9){display:none}
  .clients-table td:nth-child(4){grid-row:2;grid-column:2;text-align:right;color:var(--muted);font-size:12px}
  .clients-table td:nth-child(5){grid-row:1;grid-column:2;justify-self:end}
  .clients-table td:nth-child(6){grid-row:3;grid-column:1;text-align:left;font-family:var(--f-body);font-size:12px}
  .clients-table td:nth-child(6)::before{content:"Заявки: ";color:var(--muted)}
  .clients-table td:nth-child(6) .leads-sales::after{content:" AI-сейлз"}
  .clients-table td:nth-child(7){grid-row:4;grid-column:1;text-align:left;color:var(--muted);font-family:var(--f-body);font-size:12px}
  .clients-table td:nth-child(7)::before{content:"Новые диалоги: "}
  .clients-table td:nth-child(10){grid-row:3;grid-column:2;text-align:right}
  .clients-table td:nth-child(10)::before{content:"За месяц ";color:var(--muted);font:400 12px var(--f-body)}
  .clients-table td:nth-child(11){grid-row:4;grid-column:2;text-align:right;color:var(--muted);font-size:12px}
  .clients-table td:nth-child(11)::before{content:"Заявка: "}
  .clients-table td.empty-row{grid-column:1/-1;padding:20px 0}
  .users-table-panel .panel-note{margin:4px 0 0}
  /* «Сайт», «Лидогены»: the toolbars stack */
  .spend-toolbar{flex-direction:column;align-items:stretch}
  .month-switch{justify-content:space-between}
  .site-funnel-switch{width:auto}
  .site-funnel-switch .seg{flex:0 1 auto}
  .faq-card,.notice-card{padding:12px}
  .access-manage .access-row .table-action{flex-basis:120px}
}
/* the sticky top bar on narrow screens must not cover the client card scrolled into view */
@media (max-width:1349px){#user-detail{scroll-margin-top:16px}}
@media (max-width:860px){#user-detail{scroll-margin-top:124px}}
/* narrow screens: the empty «choose a client / plan» box under the list only takes space */
@media (max-width:1349px){.user-card:has(> .plan-detail-empty){display:none}}
@media (max-width:960px){.plan-detail:has(> .plan-detail-empty){display:none}}
/* phones: table rows as cards - the first cell is the title, the others «column - value» (data-label from admin-spend.js);
   16px in every field, or iOS zooms the page in */
@media (max-width:600px){
  .workspace input:not([type="checkbox"]):not([type="radio"]),.workspace select,.workspace textarea{font-size:16px!important}
  .table-wrap:has(> .admin-table:not(.clients-table)){margin:0;padding:0;overflow:visible}
  .admin-table:not(.clients-table),.admin-table:not(.clients-table) tbody,.admin-table:not(.clients-table) tr,.admin-table:not(.clients-table) td{display:block}
  .admin-table:not(.clients-table) thead{display:none}
  .admin-table:not(.clients-table) tbody tr{margin-bottom:8px;padding:8px 12px;border:1px solid var(--line);border-radius:12px;background:var(--sunken)}
  .admin-table:not(.clients-table) tbody tr:last-child{margin-bottom:0}
  .admin-table:not(.clients-table) tbody tr:hover{background:var(--sunken)}
  .admin-table:not(.clients-table) tbody tr.selected{background:var(--accent-soft);border-color:var(--accent)}
  .admin-table:not(.clients-table) td,.admin-table:not(.clients-table) td.muted{min-width:0;max-width:none;padding:5px 0;border:0;white-space:normal;overflow-wrap:anywhere;text-align:right}
  .admin-table:not(.clients-table) td::before{content:attr(data-label);float:left;max-width:48%;margin-right:12px;color:var(--faint);font:500 11px/1.9 var(--f-mono);letter-spacing:.04em;text-transform:uppercase;text-align:left}
  .admin-table:not(.clients-table) td::after{content:"";display:block;clear:both}
  .admin-table:not(.clients-table) td[data-label=""]::before{display:none}
  .admin-table:not(.clients-table) td:first-child{padding-bottom:6px;text-align:left;font-weight:600}
  .admin-table:not(.clients-table) td:first-child::before{display:none}
  .admin-table:not(.clients-table) td.empty-row{padding:16px 0;text-align:center;font-weight:400}
  .admin-table:not(.clients-table) td:empty{display:none}
  .admin-table:not(.clients-table) .cell-note{display:block}
  .admin-table:not(.clients-table) .row-actions{flex-wrap:wrap;justify-content:flex-end}
  .spend-table tr.spend-total{border-color:var(--line-strong)}
}

/* dashboard: «Заявки по дням» and «Новые пользователи» side by side, «Расход по дням» under them (13.10.2026) */
.dashboard-charts > .chart-panel:nth-child(3){grid-column:1/-1}
/* «Заявки» (13.10.2026) took the room of «Регистрация»: under 1690px the registration date is hidden (phones show cards) */
@media (min-width:601px) and (max-width:1689px){.clients-table th:nth-child(3),.clients-table td:nth-child(3){display:none}}

/* «Соцсети» (admin-social.js) */
.social-meter{height:6px;margin-top:10px;border-radius:99px;background:var(--surface-2);overflow:hidden}
.social-meter span{display:block;height:100%;background:var(--accent);border-radius:inherit}
.social-admin select{min-height:34px;padding:0 10px;font-size:13px}
.social-common .form-row{align-items:end}

.social-admin .link-button{background:none;border:0;padding:0;color:var(--ink);font:inherit;font-weight:600;cursor:pointer;text-align:left}
.social-sources-row td{background:var(--sunken, var(--surface-2))}
.social-sources{display:grid;gap:14px;padding:6px 0}
.social-group{display:grid;gap:4px}
.social-group-head{font-family:var(--f-mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:0 2px 4px}
.social-source{display:grid;grid-template-columns:minmax(160px,1.4fr) 110px 80px 80px minmax(0,1fr) auto;align-items:center;gap:14px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.social-source.is-off{opacity:.55}
.social-source-name{font-weight:600;color:var(--ink);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.social-source-name:hover{color:var(--accent-text);text-decoration:underline}
.social-source-meta{font-size:12.5px;white-space:nowrap}
.social-source-error{color:var(--danger);font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.social-source-actions{display:flex;align-items:center;gap:8px;justify-content:flex-end}
.social-source-actions .table-action{min-height:30px;padding:0 12px;font-size:12.5px}
.social-source-actions .social-delete{padding:0 10px;color:var(--danger)}
@media (max-width:860px){.social-source{grid-template-columns:1fr auto;row-gap:4px}.social-source-name{grid-column:1/-1}.social-source-error{grid-column:1/-1;white-space:normal}.social-source-actions{grid-column:1/-1;justify-content:flex-start}}

/* Desktop sidebar: the compact rail keeps the same groups and navigation targets. */
.side-head{display:flex;align-items:center;justify-content:space-between;gap:4px;min-height:42px}
.side-head .side-brand{min-width:0}
.side-toggle{display:inline-grid;place-items:center;flex:0 0 28px;width:28px;height:32px;padding:4px;border:1px solid transparent;background:none;color:var(--faint);cursor:pointer}
.side-toggle:hover{background:var(--surface);color:var(--ink);border-color:var(--line-strong)}
.side-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.nav-icon .spend-nav-icon{width:15.2px;height:15.2px;stroke:none}
@media(min-width:861px){
  :root[data-side-collapsed="true"]{--side-w:76px}
  [data-side-collapsed="true"] .side{padding-inline:10px;gap:20px}
  [data-side-collapsed="true"] .side-head{flex-direction:column;gap:10px}
  [data-side-collapsed="true"] .side-brand{padding:4px;justify-content:center}
  [data-side-collapsed="true"] .side-brand>span,
  [data-side-collapsed="true"] .nav-label,
  [data-side-collapsed="true"] .nav-group-title,
  [data-side-collapsed="true"] .account,
  [data-side-collapsed="true"] .logout-button span{display:none}
  [data-side-collapsed="true"] .side-toggle{flex-basis:28px;height:28px}
  [data-side-collapsed="true"] .side-toggle svg{transform:rotate(180deg)}
  [data-side-collapsed="true"] .side-nav{gap:12px}
  [data-side-collapsed="true"] .nav-group{gap:0}
  [data-side-collapsed="true"] .nav-group+.nav-group{border-top:1px solid var(--line);padding-top:12px}
  [data-side-collapsed="true"] .side-nav .nav{justify-content:center;min-height:42px;padding:0}
  [data-side-collapsed="true"] .side-actions{flex-direction:column;align-items:center}
  [data-side-collapsed="true"] .logout-button{flex:0 0 36px;width:36px;padding:0}
  [data-side-collapsed="true"] .crm-nav-count{position:absolute;top:1px;right:0;min-width:14px;padding:1px 3px;font-size:9px}
}
@media(max-width:860px){.side-head{display:block;min-height:0}.side-toggle{display:none}}

/* Keep CRM above the account while the three main groups scroll independently. */
.nav-main{display:contents}
@media(min-width:861px){
  .side-nav{display:flex;flex-direction:column;flex:1;overflow:visible}
  .nav-main{display:grid;align-content:start;gap:18px;flex:1;min-height:0;overflow-y:auto;scrollbar-width:thin;padding:2px}
  .nav-crm{flex-shrink:0}
  .side-bottom{margin-top:0;flex-shrink:0}
  [data-side-collapsed="true"] .nav-main{gap:12px}
}
@media(max-width:860px){.nav-crm{align-self:end}}
/* Лидоген → Автоотключение чатов (19.10.2026) */
.prune-panel{margin-bottom:16px}
.prune-panel .panel-note{margin:0 0 14px;max-width:760px}
.prune-switch{display:flex;flex-direction:column;gap:6px}
.prune-switch .switch{margin-top:4px}
/* «Настройки»: one menu item, its sections are tabs above the content (19.10.2026) */
.nav.nav-sub{display:none !important}
.nav.is-section-active{background:var(--accent-soft);color:var(--ink)}
.nav.is-section-active .nav-icon{color:var(--accent-text)}
.settings-tabs[hidden]{display:none}
.social-source-leads{color:var(--muted)}
.social-source-leads.has-leads{color:var(--signal);font-weight:600}
/* a hint behind an «i» button: on hover, on focus and on a tap (19.10.2026) */
.employees-heading:has(.hint){position:relative}
.hint{display:inline-flex}
.hint-pop{display:none;position:absolute;left:0;top:calc(100% + 6px);z-index:30;width:min(400px,calc(100vw - 72px));padding:14px 16px;box-sizing:border-box;background:var(--surface);color:var(--muted);border:1px solid var(--line-strong);border-radius:8px;box-shadow:var(--shadow);font:400 13px/1.5 var(--f-body);text-transform:none;letter-spacing:0}
.hint-pop b{color:var(--ink);font-weight:600}
.hint:hover .hint-pop,.hint:focus-within .hint-pop,.hint.is-open .hint-pop{display:block}
.hint.is-open .roles-help-button{color:var(--accent-text);background:var(--accent-soft)}
/* «Соцсети → Клиенты»: fixed columns, numbers under their headings (19.10.2026) */
@media (min-width:861px){.social-clients{table-layout:fixed}.social-clients th:nth-child(2){width:120px}.social-clients th:nth-child(3),.social-clients th:nth-child(5){width:120px}.social-clients th:nth-child(4){width:160px}}

/* The four products (21.10.2026): chips in the client list and card, the card's per-product access, spend by product */
.product-chips{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
/* «География» on the dashboard (22.10.2026): the map shaded purple → orange by clients, the top 5 on the right */
.country-panel{margin:16px 0;--geo-empty:#1f3352;--geo-line:var(--surface)}
:root[data-theme="light"] .country-panel{--geo-empty:#d9deeb}
.geo-body{display:grid;grid-template-columns:14px minmax(0,1fr) minmax(220px,360px);gap:24px;align-items:center}
.geo-legend{display:grid;grid-template-rows:1fr 1fr;grid-template-columns:6px auto;column-gap:8px;height:150px;font-size:11px;color:var(--muted)}
.geo-legend i{grid-row:1/3;border-radius:3px;background:linear-gradient(to top,rgb(123,47,190),rgb(245,160,0))}
.geo-legend span:last-child{align-self:end}
.geo-map-box{min-width:0}
.geo-map{display:block;width:100%;height:auto;max-width:720px;margin:0 auto}
.geo-map path{stroke:var(--geo-line);stroke-width:.5;transition:opacity .15s}
.geo-map path:hover{opacity:.75}
.geo-map-empty{display:grid;place-items:center;aspect-ratio:2/1}
.geo-list{display:grid;gap:14px}
.geo-row{display:grid;grid-template-columns:minmax(0,1fr) auto;row-gap:6px;font-size:13px}
.geo-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.geo-share{color:var(--ink)}
.geo-bar{grid-column:1/3;height:8px;border-radius:99px;background:var(--surface-2);overflow:hidden}
.geo-bar b{display:block;height:100%;border-radius:99px}
.country-note{margin:12px 0 0}
@media (max-width:860px){.geo-body{grid-template-columns:14px minmax(0,1fr)}.geo-legend{height:110px}.geo-list{grid-column:1/3}}
/* the client list: the products say the plan already - one row of chips, no plan name above them */
.clients-table td.plan-cell{min-width:196px;width:196px;max-width:none}
.plan-cell .product-chips{margin-top:0}
.product-chip{display:inline-flex;align-items:center;padding:1px 7px;border-radius:999px;font-size:11px;line-height:18px;white-space:nowrap;border:1px solid var(--line);color:var(--muted)}
.product-chip.is-open{color:var(--ink);border-color:color-mix(in srgb,var(--accent) 45%,var(--line));background:color-mix(in srgb,var(--accent) 12%,transparent)}
.product-chip.is-ended{text-decoration:line-through;opacity:.75}
.access-products{display:flex;flex-direction:column;gap:8px;margin-top:6px;padding-top:12px;border-top:1px solid var(--line)}
/* the products as one table: name | days | Продлить | Закрыть - the same columns in every row */
.product-grid{display:grid;grid-template-columns:minmax(0,1fr) 92px 104px 92px;column-gap:8px}
.product-row{display:contents}
.product-grid{row-gap:14px;margin-top:4px}
.product-row>*{align-self:center}
.product-row .table-action{width:100%;justify-content:center;text-align:center}
.product-row-name{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:0}
.product-row-name small{font-size:12px}
.product-row.is-net .product-row-name b{font-weight:500;padding-left:14px;display:inline-flex;align-items:center;gap:7px}
/* the networks' marks - one colour (06.11.2026, admin-net-icons.js) */
.net-ico{display:inline-grid;place-items:center;width:20px;height:20px;flex:0 0 auto;color:var(--muted)}
.net-ico .net-svg{width:14px;height:14px}
.product-row-name small.is-danger{color:var(--danger)}
.product-align{margin-top:2px;padding:0;border:0;background:none;color:var(--accent,#5b8cff);font:inherit;font-size:12px;cursor:pointer;text-align:left}
.product-align:hover{text-decoration:underline}
.product-nets{align-self:flex-start;margin-top:6px;padding:4px 10px;font-size:12px}
.product-net-pick{width:15px;height:15px;margin:0 8px 0 0;vertical-align:-2px;accent-color:var(--accent,#5b8cff)}
.product-nets-bar .product-row-name b{font-size:13px}
.product-days-field{position:relative;display:flex;align-items:center}
.product-grid .product-days-field input.product-days{width:100%;height:30px;min-height:30px;padding:0 30px 0 10px;font-size:13px}  /* as tall as the buttons beside it */
.product-days-field span{position:absolute;right:9px;font-size:12px;color:var(--muted);pointer-events:none}
@media (max-width:520px){.product-grid{grid-template-columns:minmax(0,1fr) 76px 92px}.product-row>:last-child{grid-column:3}}
.product-spend{margin:16px 0}
.product-spend-title{margin:0 0 10px;font-size:15px;font-weight:600}

/* «Клиенты по странам» folded like a disclosure (21.10.2026) */
.country-summary{list-style:none;cursor:pointer;margin-bottom:0}
.country-summary::-webkit-details-marker{display:none}
.country-summary::after{content:'';width:8px;height:8px;margin-left:12px;flex:none;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:translateY(-3px) rotate(45deg);transition:transform .15s}
.country-panel[open] .country-summary{margin-bottom:12px}
.country-panel[open] .country-summary::after{transform:translateY(2px) rotate(-135deg)}
.country-summary>span{margin-left:auto}

/* «Дашборд» и «Расходы», вариант D (22.10.2026): карточки с цветной линией и свечением, кольца, столбики с градиентом */
:root{--series-users:#b65cf0}
:root[data-theme="light"]{--series-users:#8a2fc9}
.series-users{fill:var(--series-users);background:var(--series-users)}
.series-1-stop{stop-color:var(--series-1)}.series-2-stop{stop-color:var(--series-2)}.series-3-stop{stop-color:var(--series-3)}.series-4-stop{stop-color:var(--series-4)}.series-users-stop{stop-color:var(--series-users)}
.kpi-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.kpi-card{position:relative;overflow:hidden;display:flex;flex-direction:column;gap:6px;min-width:0;padding:20px 22px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface)}
.kpi-card::before{content:'';position:absolute;inset:0 0 auto;height:3px;background:var(--series-1)}  /* one blue for all (22.10.2026: mixed colours tired the eyes) */
.kpi-card strong{margin-top:8px;font:650 36px/1 var(--f-display);letter-spacing:-.035em;font-variant-numeric:tabular-nums}
.kpi-card small{font-size:13px}
.dash-middle{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin-top:12px}
.kpi-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.kpi-grid .kpi-card{justify-content:center}
.kpi-grid .kpi-card strong{font-size:30px}
.ring-panel{margin:0}
.ring-row{display:grid;grid-template-columns:minmax(140px,200px) minmax(0,1fr);gap:28px;align-items:center}
.ring{width:100%;height:auto;display:block}
.ring-value{font:650 26px var(--f-display);fill:var(--ink);letter-spacing:-.02em}
.ring-caption{font:500 11px var(--f-mono);fill:var(--muted);letter-spacing:.06em}
.ring-legend{display:grid;gap:12px}
.ring-legend>div{display:grid;grid-template-columns:10px minmax(0,1fr) auto;gap:10px;align-items:center;font-size:14px}
.ring-legend i{width:10px;height:10px;border-radius:50%}
.ring-legend b{font:600 14px var(--f-mono)}
.ring-legend-money span small{display:block;color:var(--muted);font-size:12px}
.ring-legend-money b{font-size:17px}
.delta{display:inline-block;margin-left:10px;padding:2px 8px;border-radius:99px;font:600 12px var(--f-mono);letter-spacing:0;vertical-align:middle}
.delta.up{color:var(--signal);background:var(--signal-soft)}
.delta.down{color:var(--danger);background:var(--danger-soft)}
.spend-head{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:4px 0 18px}
.spend-head .stat-line{border:0;border-radius:0;background:none}
.spend-shares-legend{display:flex;flex-wrap:wrap;gap:8px 18px;align-items:center;margin:0 22px;font-size:13px;color:var(--muted)}
.spend-shares-legend span{display:inline-flex;align-items:center;gap:6px}
.spend-hour{margin-left:auto}.spend-hour b{color:var(--ink)}
.spend-charts{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr);gap:12px;margin-top:12px}
.spend-split-cell{width:22%;min-width:120px}
.spend-split{display:flex;height:7px;border-radius:99px;overflow:hidden;background:var(--surface-2)}
.spend-split b{display:block;height:100%}
@media (max-width:1100px){.kpi-row{grid-template-columns:repeat(2,minmax(0,1fr))}.dash-middle,.spend-charts{grid-template-columns:1fr}}
@media (max-width:600px){.kpi-row,.kpi-grid{grid-template-columns:1fr}.ring-row{grid-template-columns:1fr;justify-items:center}.ring{max-width:200px}.ring-legend{width:100%}.spend-hour{margin-left:0}.spend-split-cell{display:none}}
/* variant D: AI-сейлз orange as in the mockup (the brand sheet makes series-2 purple everywhere else) */
.kpi-row,.dash-middle,.dashboard-charts,.spend-head,.spend-charts,.spend-clients{--series-2:#f5a000}
:root[data-theme="light"] :is(.kpi-row,.dash-middle,.dashboard-charts,.spend-head,.spend-charts,.spend-clients){--series-2:#d97a00}
/* a ring panel narrower than the ring and its legend side by side: the legend goes under the ring */
.ring-panel{container-type:inline-size}
@container (max-width:520px){.ring-row{grid-template-columns:1fr;justify-items:center;gap:18px}.ring-row .ring{max-width:190px}.ring-row .ring-legend{width:100%}}
/* the head of «Расходы»: the month, the four products, support, CRM and the last hour - 4 + 4 cells, always all of them */
.spend-head{padding:0}
.spend-head .stat-line{grid-template-columns:repeat(4,minmax(0,1fr))!important}
.spend-head .stat-line .panel{grid-column:auto!important;padding:18px 22px!important;border-top:0!important;border-left:1px solid var(--line)!important}
.spend-head .stat-line .panel:nth-child(4n+1){border-left:0!important}
.spend-head .stat-line .panel:nth-child(n+5){border-top:1px solid var(--line)!important}
.spend-head .stat-line strong{font-size:clamp(26px,2.3vw,36px)!important}
.spend-head .spend-hour-cell strong{color:var(--muted)}
@media (max-width:760px){.spend-head .stat-line{grid-template-columns:repeat(2,minmax(0,1fr))!important}.spend-head .stat-line .panel:nth-child(4n+1){border-left:1px solid var(--line)!important}.spend-head .stat-line .panel:nth-child(odd){border-left:0!important}.spend-head .stat-line .panel:nth-child(n+3){border-top:1px solid var(--line)!important}}
/* nine cells (with «AI-сейлз ВКонтакте» and Apify, 01.11.2026): the month's total on the left over two rows and 4 + 4
   beside it; on a phone the total takes its own row and the rest go in pairs */
@media (min-width:761px){
  .spend-head .stat-line:has(> .panel:nth-child(9)){grid-template-columns:repeat(5,minmax(0,1fr))!important}
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel{border-left:1px solid var(--line)!important;border-top:0!important}
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel:first-child{grid-row:span 2;border-left:0!important}
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel:nth-child(n+6){border-top:1px solid var(--line)!important}
}
@media (max-width:760px){
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel:first-child{grid-column:span 2!important}
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel:nth-child(even){border-left:0!important}
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel:nth-child(odd):not(:first-child){border-left:1px solid var(--line)!important}
  .spend-head .stat-line:has(> .panel:nth-child(9)) .panel:nth-child(n+2){border-top:1px solid var(--line)!important}
}
/* «Сайт»: a long table - 5 rows and an arrow for the rest (22.10.2026) */
.site-fold:not(.open) tbody tr:nth-child(n+6){display:none}
.site-fold-more{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;margin-top:6px;padding:10px;border:0;border-top:1px solid var(--line);background:none;color:var(--muted);font:500 13px var(--f-body);cursor:pointer}
.site-fold-more:hover{color:var(--ink)}
.site-fold-more i{width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(-2px) rotate(45deg);transition:transform .15s}
.site-fold.open .site-fold-more i{transform:translateY(2px) rotate(-135deg)}

/* «Пользователи», вариант A (22.10.2026): карточки-фильтры над таблицей и кружок с инициалами у клиента */
.clients-quick{margin-bottom:12px}
.kpi-filter{font:inherit;color:inherit;text-align:left;cursor:pointer;transition:border-color .15s,background .15s}
.kpi-filter:hover{border-color:var(--line-strong)}
.kpi-filter.selected{border-color:var(--accent);background:linear-gradient(180deg,var(--accent-soft),transparent 75%),var(--surface)}
.clients-quick .kpi-card strong{font-size:30px}
.client-who{display:flex;align-items:center;gap:10px;min-width:0}
.client-who-text{min-width:0}
.client-avatar{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;color:#fff;font:650 12px var(--f-display);letter-spacing:0}
@media (max-width:600px){.clients-quick{grid-template-columns:repeat(2,minmax(0,1fr))!important}.clients-quick .kpi-card strong{font-size:24px}.client-avatar{width:28px;height:28px;font-size:11px}}

/* «Сайт», вариант A (22.10.2026): воронка ступенями, «Куда перешли», точка скорости загрузки, полоски у источников */
.site-funnel{margin-top:12px}
.site-steps{display:grid;gap:8px}
.site-step{display:grid;grid-template-columns:210px minmax(0,1fr) 64px;gap:14px;align-items:center;font-size:13px}
.site-step-track{position:relative;height:30px;background:var(--surface-2);overflow:hidden}
.site-step-track i{position:absolute;inset:0 auto 0 0;background:linear-gradient(90deg,var(--series-1),color-mix(in srgb,var(--series-1) 60%,#fff))}
.site-step-track b{position:absolute;left:10px;top:50%;transform:translateY(-50%);font-size:12px;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.4)}
.site-step em{font-style:normal;text-align:right;font-size:12px;color:var(--muted)}
.site-step-drop{padding-left:224px;margin:-2px 0 2px;font-size:11px;color:var(--faint)}
.site-health{display:flex;align-items:center;gap:7px}
.site-dot{width:8px;height:8px;border-radius:50%;background:var(--faint);flex:none}
.site-dot.ok{background:var(--signal)}.site-dot.warn{background:var(--warn)}.site-dot.bad{background:var(--danger)}
.site-messengers{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.site-messengers strong{display:block;margin-top:4px;font:650 30px/1.1 var(--f-display);letter-spacing:-.03em}
.site-messengers div:first-child .kicker{color:var(--series-1)}.site-messengers div:last-child .kicker{color:var(--series-3)}
.site-split{display:flex;gap:3px;height:10px;margin:14px 0 8px;background:var(--surface-2);border-radius:99px;overflow:hidden}
.site-split i{display:block;height:100%;min-width:4px}
.site-split-legend{margin-bottom:6px}
td.site-source-bar,th.site-source-bar{width:70px;min-width:50px;padding-left:4px;padding-right:4px}
.site-sources-table{min-width:0!important}.site-sources-table th{white-space:normal}.site-sources-table td:first-child{overflow-wrap:anywhere}
td.site-source-bar .site-bar-track{display:block}
@media (max-width:760px){.site-step{grid-template-columns:110px minmax(0,1fr) 44px;gap:8px}.site-step-drop{padding-left:118px}td.site-source-bar,th.site-source-bar{display:none}}

/* «Ключи», «Сотрудники», «Тарифы», вариант A (22.10.2026) */
.keys-cards{margin-bottom:12px}
.keys-cards .kpi-card strong{font-size:30px}
.staff-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px}
.staff-card{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px 14px;align-items:start;padding:16px;border:1px solid var(--line);background:var(--sunken)}
.staff-avatar{width:46px;height:46px;font-size:17px}
.staff-info{display:grid;gap:4px;min-width:0}
.staff-info b{font:650 16px var(--f-display)}
.staff-info .mono{font-size:12px}
.staff-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.chip-role{color:var(--accent-text);border-color:color-mix(in srgb,var(--accent) 45%,transparent);background:var(--accent-soft)}
.staff-actions{grid-column:1/-1;display:flex;gap:6px;justify-content:flex-end}
.plan-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:12px}
.plan-card{position:relative;display:grid;gap:12px;align-content:start;padding:18px;border:1px solid var(--line);background:var(--sunken);color:var(--ink);font:inherit;text-align:left;cursor:pointer;transition:border-color .15s}
.plan-card::before{content:'';position:absolute;inset:0 0 auto;height:3px;background:var(--series-1)}
.plan-card-trial::before{background:var(--line-strong)}
.plan-card:hover{border-color:var(--line-strong)}
.plan-card.selected{border-color:var(--accent);background:linear-gradient(180deg,var(--accent-soft),transparent 60%),var(--sunken)}
.plan-card-name{font:650 16px var(--f-display)}
.plan-card-price{font:650 32px/1 var(--f-display);letter-spacing:-.03em}
.plan-card-price small{margin-left:6px;font:500 13px var(--f-body);color:var(--muted);letter-spacing:0}
.plan-card ul{margin:0;padding:0;list-style:none;display:grid;gap:6px;font-size:13px}
.plan-card li{display:flex;justify-content:space-between;gap:10px;color:var(--muted)}
.plan-card li b{color:var(--ink);font:600 13px var(--f-mono)}
.plan-card-clients{font-size:12px;color:var(--muted)}.plan-card-clients b{color:var(--ink)}

/* «Лог действий», вариант A (22.10.2026): лента по дням, цветная точка по типу действия */
.log-filters{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-bottom:6px}
.log-chip{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;border:1px solid var(--line);background:none;color:var(--muted);font:500 12px var(--f-body);cursor:pointer}
.log-chip i{width:7px;height:7px;border-radius:50%;background:var(--c)}
.log-chip:hover{color:var(--ink)}
.log-chip.active{border-color:var(--accent);color:var(--ink);background:var(--accent-soft)}
.log-filters .clients-filter{margin-left:auto}
.log-day{display:flex;align-items:center;gap:12px;margin:20px 0 8px;font:600 11px var(--f-mono);letter-spacing:.12em;text-transform:uppercase;color:var(--faint)}
.log-day::after{content:'';flex:1;height:1px;background:var(--line)}
.log-line{position:relative;padding-left:26px}
.log-line::before{content:'';position:absolute;left:9px;top:8px;bottom:8px;width:2px;background:var(--line)}
.log-event{position:relative;display:flex;justify-content:space-between;gap:16px;padding:10px 14px;margin-bottom:6px;border:1px solid var(--line);background:var(--sunken)}
.log-event::before{content:'';position:absolute;left:-22px;top:15px;width:10px;height:10px;border-radius:50%;background:var(--c);box-shadow:0 0 0 4px var(--surface)}
.log-text{min-width:0;font-size:13px;line-height:1.45}
.log-text b{font-weight:600}
.log-target{color:var(--accent-text)}
.log-text small{display:block;margin-top:2px;overflow-wrap:anywhere}
.log-meta{flex:none;display:flex;flex-direction:column;align-items:flex-end;gap:2px;font-size:11px;color:var(--faint)}
.log-meta time{font-size:12px;color:var(--muted)}
@media (max-width:600px){.log-filters .clients-filter{margin-left:0;width:100%}.log-event{flex-direction:column;gap:4px}.log-meta{flex-direction:row;gap:10px}}
@media (max-width:1500px){td.site-source-bar,th.site-source-bar{display:none}}  /* the bar only where the half-width table has room for it */
.staff-seen{display:flex;align-items:center;gap:6px;margin-top:4px;font-size:12px}
.staff-online{width:8px;height:8px;border-radius:50%;background:var(--signal);box-shadow:0 0 0 3px var(--signal-soft)}

/* «Показать ещё» under a long list (22.10.2026) */
.admin-table tr.page-more-row td,.clients-table tr.page-more-row td{padding:12px 8px;text-align:center!important;background:transparent!important;border:0}
.more-button{min-width:220px;justify-content:center}

/* Apify in «Расходы» (25.10.2026) */
.series-apify{fill:#e8738a;background:#e8738a}.series-apify-stop{stop-color:#e8738a}

/* the admin panel on a phone (05.11.2026): «Меню» opens the sections grouped, two in a row; the client card scrolls as a
   whole - its head took most of the screen and the tabs' content was a strip of a few lines */
.mobile-menu-button{display:none}
@media (max-width:860px){
  .mobile-menu-button{display:inline-flex;align-items:center;gap:6px;width:auto!important;padding:0 12px!important}
  .mobile-menu-button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
  .mobile-menu-button span{font:600 13px var(--f-body)}
  .side{position:sticky;top:0}
  .side-actions{display:flex;gap:8px;align-items:center}
  .side-nav{display:none!important}
  .side.menu-open .side-nav{display:grid!important;gap:14px;margin:0;padding:6px 0 14px;overflow:auto;max-height:calc(100dvh - 80px)}
  .side.menu-open .nav-main{display:grid;gap:14px}
  .side.menu-open .nav-group{display:grid;gap:6px}
  .side.menu-open .nav-group-title{padding:0 2px;white-space:normal}
  .side.menu-open .nav-group-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .side.menu-open .nav{width:100%;min-width:0;justify-content:flex-start;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}

/* «Что не работает» over the client list (06.11.2026): one click - the clients with that problem */
.client-issues{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:-4px 0 14px}
.client-issues .muted{font-size:13px;margin-right:4px}
.client-issues button{display:inline-flex;align-items:center;gap:6px;padding:6px 11px;border-radius:9px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font:inherit;font-size:13px;cursor:pointer}
.client-issues button b{font-weight:600;color:var(--muted)}
.client-issues button.is-on{border-color:var(--accent);background:var(--accent-soft)}
.client-issues button.is-on b{color:var(--ink)}

/* 23.11.2026: the phone's top bar (the logo, «Меню», the theme, the exit) needed 395 px - an iPhone's page (390, 375 px)
   moved sideways. The logo's column may shrink now, and on a narrow phone the gaps are smaller, so all fits as it is. */
@media (max-width:860px){
  .side{grid-template-columns:minmax(0,1fr) auto}
  .side-head,.side-brand,.side-brand span{min-width:0}
  .side-brand b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media (max-width:420px){
  .side{gap:8px}
  .side-brand{gap:8px;padding:4px}
  .side-actions{gap:6px}
}
/* the narrowest phones (an iPhone SE, 375 px): «Меню» is its icon (aria-label «Разделы») - the logo stays whole */
@media (max-width:380px){
  .mobile-menu-button span{display:none}
  .mobile-menu-button{padding:0 9px!important}
}

/* 28.11.2026: the quick filter of a list of chats (admin.js listFind) - a found-nothing line, rows hidden by it */
.list-find{display:block;width:100%;max-width:420px;margin:0 0 10px}
[data-find][hidden],[data-find-none][hidden]{display:none!important}
.list-find-none{margin:6px 0 0}

/* «Оплаты» (20.11.2026, app/static/admin-payments.js): the table of the payments, a row opens its details */
.pay-off{margin-bottom:12px;padding:14px 18px;font-size:14px;line-height:1.5}
/* «Оплаты» by a period (01.12.2026): the period on top, four numbers with the change and the revenue by day, the list's
   status tabs (as the client card's), what was bought, the search; the page stays dimmed while a new answer loads */
.pay-top{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;margin:0 0 14px}
.pay-dates{display:inline-flex;align-items:center;gap:8px;color:var(--muted)}
.pay-dates input{height:38px;padding:0 10px;border:1px solid var(--line-strong);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;font-size:14px;color-scheme:dark}
:root[data-theme="light"] .pay-dates input{color-scheme:light}
.pay-compare{margin-left:auto;font-size:13px}
.pay-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) minmax(0,1.5fr);gap:12px;margin:0 0 16px}
.pay-kpi strong{font-size:clamp(24px,2.1vw,30px);white-space:nowrap}
.pay-cur{margin-left:.14em;color:var(--muted);font-size:.62em;font-weight:600}
.pay-kpi-foot{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin-top:2px}
.pay-delta{color:var(--muted);font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}
.pay-delta.is-up{color:var(--pay-ok)}.pay-delta.is-down{color:var(--pay-off)}
.pay-chart{gap:8px}
.pay-bars{display:flex;align-items:flex-end;gap:var(--gap,3px);height:78px;margin-top:8px;padding-bottom:1px;border-bottom:1px solid var(--line)}
.pay-bars i{flex:1 1 0;min-width:2px;height:var(--h);border-radius:4px 4px 0 0;background:var(--series-1);opacity:.8;transition:opacity .12s}
.pay-bars i:hover{opacity:1}
.pay-bars i.is-zero{height:0}
.pay-bars-axis{display:flex;justify-content:space-between;color:var(--faint);font:11px/1 var(--f-mono)}
.pay-list-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:6px 16px;margin:-6px 0 0;border-bottom:1px solid var(--line)}
.pay-tabs{display:flex;flex-wrap:wrap;gap:0 22px}
.pay-tabs button{margin-bottom:-1px;padding:12px 0 13px;background:none;border:0;border-bottom:2px solid transparent;color:var(--muted);font:500 14px var(--f-body);cursor:pointer}
.pay-tabs button:hover{color:var(--ink)}
.pay-tabs button[aria-selected=true]{color:var(--ink);border-bottom-color:var(--accent)}
.pay-list-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:8px 0 10px}
.pay-kinds{padding:3px}.pay-kinds .seg{height:30px;padding:0 12px;font-size:12.5px}
.pay-search-box{position:relative;display:flex;align-items:center}
.pay-search-box svg{position:absolute;left:11px;width:15px;height:15px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round;pointer-events:none}
.pay-search-box input.pay-search{min-width:340px;padding-left:33px}
.pay-count{margin:12px 0 8px;font-size:13px}
.pay-when{color:var(--muted)}
.pay-table td:nth-child(2){min-width:170px;max-width:260px}
.pay-table td:nth-child(2) .cell-note{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pay-table .pay-id{margin-top:2px;color:var(--faint);font-size:11.5px}
.pay-more{display:block;margin:14px auto 2px}
.pay-page.is-loading .pay-kpis,.pay-page.is-loading .pay-list .table-wrap,.pay-page.is-loading .pay-count{opacity:.5;transition:opacity .15s}
@media (max-width:1280px){.pay-kpis{grid-template-columns:repeat(4,minmax(0,1fr))}.pay-chart{grid-column:1/-1}.pay-bars{height:64px}}
@media (max-width:1100px){.pay-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:760px){.pay-compare{margin-left:0;width:100%}.pay-list-tools{width:100%}.pay-search-box{flex:1 1 100%}.pay-search-box input.pay-search{min-width:0;width:100%}
  .pay-kinds{width:100%}.pay-kinds .seg{flex:1 1 auto;padding:0 6px;font-size:12px}.pay-tabs{gap:0 16px;overflow-x:auto;overflow-y:hidden;flex-wrap:nowrap;max-width:100%;padding-bottom:1px;scrollbar-width:none}.pay-tabs::-webkit-scrollbar{display:none}.pay-tabs button{white-space:nowrap}.pay-kpi strong{font-size:24px}}
.pay-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 12px;margin:0 0 12px}
.pay-search{min-width:260px;height:38px;padding:0 12px;border:1px solid var(--line-strong);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;font-size:14px}
.pay-row{cursor:pointer}
.pay-toolbar .seg-filter{flex-wrap:wrap;max-width:100%}
.pay-table{min-width:0}
.pay-table td{vertical-align:top}
.pay-table td:nth-child(2),.pay-table td:nth-child(3){white-space:normal;min-width:120px}
.pay-table .cell-note{display:block;font-size:12px}
.pay-table td.num{white-space:nowrap}
.pay-row:hover td,.pay-row.is-open td{background:var(--surface-2)}
.pay-row:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.pay-detail-row td{padding:0!important;background:var(--surface-2);white-space:normal}
.pay-error{color:var(--danger)}
@media (max-width:860px){
  .pay-search{min-width:0;width:100%}
  .admin-table.pay-table .pay-detail-row td::before{content:none}
}

/* statuses by colour (20.11.2026, разработчик): paid green, waiting yellow, canceled red; the details as tiles and blocks */
:root{--pay-ok:#34d399;--pay-wait:#fbbf24;--pay-off:#f87171;--pay-bad:#fb923c;--pay-back:#a78bfa}
:root[data-theme="light"]{--pay-ok:#059669;--pay-wait:#b45309;--pay-off:#dc2626;--pay-bad:#c2410c;--pay-back:#7c3aed}
.pay-status{display:inline-flex;align-items:center;gap:7px;font-weight:600;white-space:nowrap}
.pay-status i{width:8px;height:8px;border-radius:50%;background:currentColor;flex:none}
.pay-status.is-ok{color:var(--pay-ok)}.pay-status.is-wait{color:var(--pay-wait)}.pay-status.is-off{color:var(--pay-off)}
.pay-status.is-bad{color:var(--pay-bad)}.pay-status.is-back{color:var(--pay-back)}
.pay-detail{padding:18px 20px 16px;border-top:1px solid var(--line)}
.pay-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:10px 16px;margin-bottom:14px}
.pay-head > div:first-child{display:grid;gap:2px}
.pay-what{font:650 18px/1.3 var(--f-display);color:var(--ink)}
.pay-head-side{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.pay-head-side .pay-status{font-size:15px}
.pay-tiles{display:flex;flex-wrap:wrap;align-items:stretch;gap:10px;margin-bottom:14px}
.pay-tile{min-width:150px;padding:12px 16px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.pay-tile span{display:block;color:var(--muted);font-size:12px}
.pay-tile b{display:block;margin-top:4px;color:var(--ink);font:650 21px/1.15 var(--f-display);font-variant-numeric:tabular-nums;white-space:nowrap}
.pay-tile.is-net b{color:var(--pay-ok)}
.pay-tile-note{flex:1 1 260px;align-self:center;margin:0;color:var(--muted);font-size:13px;line-height:1.5}
.pay-blocks{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.pay-block{min-width:0;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.pay-block h4{margin:0 0 10px;color:var(--muted);font:600 11px/1 var(--f-mono);letter-spacing:.08em;text-transform:uppercase}
.pay-block p{margin:0 0 6px;font-size:14px;line-height:1.45;overflow-wrap:anywhere}
.pay-block .table-action{margin-top:6px}
.pay-big{color:var(--ink);font-weight:650;font-size:15px!important}
.pay-access{padding-left:12px;border-left:3px solid var(--line-strong)}
.pay-access.is-ok{border-color:var(--pay-ok)}.pay-access.is-wait{border-color:var(--pay-wait)}
.pay-key{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin-top:10px!important}
.pay-timeline{display:grid;gap:9px;margin:0;padding:0;list-style:none}
.pay-timeline li{display:grid;grid-template-columns:86px minmax(0,1fr);gap:8px;font-size:13px;line-height:1.4}
.pay-timeline time{color:var(--muted);font:12px/1.4 var(--f-mono)}
.pay-timeline small{display:block;color:var(--muted);font-size:12px}
.pay-tech{margin:12px 0 0;color:var(--muted);font-size:11.5px;overflow-wrap:anywhere}
@media (max-width:1100px){.pay-blocks{grid-template-columns:repeat(2,minmax(0,1fr))}.pay-blocks .pay-block:last-child{grid-column:1/-1}}
@media (max-width:860px){.pay-blocks{grid-template-columns:1fr}.pay-tile{flex:1 1 140px;min-width:0}.pay-detail{padding:14px}}
