/* ==========================================================================
   Кабинет Atletica — оформление в фирменном стиле сети.

   Откуда стиль: сайт atleticafit.ru и материалы клуба — графитовый фон #252525,
   один акцент — жёлтый #fddf40 (текст на жёлтом всегда тёмный), шрифт Montserrat,
   заголовки капсом, почти острые углы, прямоугольные кнопки, знак «А».

   Всё держится на токенах из :root: светлая и тёмная темы отличаются значениями
   переменных, а не отдельными правилами. Тёмная — по умолчанию (это лицо бренда),
   светлая — для работы днём, переключатель запоминает выбор.
   ========================================================================== */

/* ── шрифт: свой файл, а не Google Fonts — кабинет открывается и без внешних CDN ── */
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("fonts/montserrat-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("fonts/montserrat-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("fonts/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("fonts/montserrat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── токены: тёмная тема (по умолчанию) ────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg: #171717;
  --surface: #202020;
  --surface-2: #272727;
  --surface-3: #303030;
  --raised: #262626;
  --border: #2f2f2f;
  --border-strong: #444444;
  --text: #f4f4f1;
  --text-2: #cfcfca;
  --muted: #92928c;
  --faint: #6a6a65;
  --accent: #fddf40;
  --accent-hover: #ffe766;
  --accent-ink: #fddf40;
  --accent-soft: rgba(253, 223, 64, .12);
  --accent-line: rgba(253, 223, 64, .45);
  --on-accent: #1b1b1b;
  --ok: #57d68d;
  --ok-soft: rgba(87, 214, 141, .13);
  --warn: #ff9e45;
  --warn-soft: rgba(255, 158, 69, .14);
  --danger: #ff6461;
  --danger-soft: rgba(255, 100, 97, .13);
  --info: #8ab4ff;
  --info-soft: rgba(138, 180, 255, .12);
  --bubble-in: #2a2a2a;
  --bubble-agent: #23231c;
  --bubble-agent-border: rgba(253, 223, 64, .22);
  --bubble-human: #fddf40;
  --bubble-human-text: #1b1b1b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px rgba(253, 223, 64, .5);
  /* Боковая панель графитовая в обеих темах: это «рамка» бренда вокруг работы. */
  --side-bg: #111111;
  --side-border: #232323;
  --side-text: #a5a5a0;
  --side-text-strong: #f6f6f3;
  --side-muted: #6f6f6a;
  --side-hover: #1b1b1b;
  --side-active: #222222;

  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;
  --sidebar-w: 244px;
  --topbar-h: 56px;
  --tabbar-h: 62px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* Графики «Статистики»: заявки — жёлтый бренда, «написали» — графит. */
  --chart-leads: #fddf40;
  --chart-guests: #585852;
  --heat: 253, 223, 64;
}

/* ── токены: светлая тема — выбранная переключателем или системная ─────────── */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3ef;
  --surface: #ffffff;
  --surface-2: #f4f4f0;
  --surface-3: #e9e9e3;
  --raised: #ffffff;
  --border: #e3e3dc;
  --border-strong: #cbcbc2;
  --text: #191919;
  --text-2: #3b3b38;
  --muted: #6f6f69;
  --faint: #9a9a93;
  --accent: #fddf40;
  --accent-hover: #f6d31f;
  --accent-ink: #7d6200;
  --accent-soft: #fff6c4;
  --accent-line: #e7c400;
  --on-accent: #1b1b1b;
  --ok: #1b7c45;
  --ok-soft: #e2f3e8;
  --warn: #b25500;
  --warn-soft: #fcebd9;
  --danger: #c32a2a;
  --danger-soft: #fbe5e4;
  --info: #2457b8;
  --info-soft: #e5edfb;
  --bubble-in: #ffffff;
  --bubble-agent: #fffbe3;
  --bubble-agent-border: #f0dc7a;
  --bubble-human: #1d1d1d;
  --bubble-human-text: #fafaf7;
  --shadow-sm: 0 1px 2px rgba(25, 25, 20, .06);
  --shadow: 0 1px 2px rgba(25, 25, 20, .05), 0 10px 26px rgba(25, 25, 20, .08);
  --shadow-lg: 0 20px 60px rgba(25, 25, 20, .22);
  --focus: 0 0 0 3px rgba(212, 175, 0, .45);
  --chart-leads: #e6c000;
  --chart-guests: #cbcbc1;
  --heat: 214, 172, 0;
}

/* ── база ─────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 450;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; }
h1 { font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
b, strong { font-weight: 700; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

::selection { background: var(--accent); color: var(--on-accent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon svg { display: block; }

.boot { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: .95em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
a.tel { white-space: nowrap; }
.right { text-align: right; }
.spacer { flex: 1 1 auto; }
.hidden { display: none !important; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.caps { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 700; color: var(--muted); }

/* ── знак бренда ──────────────────────────────────────────────────────────── */
.mark { display: inline-block; color: var(--accent); flex: none; }
.mark svg { display: block; width: 100%; height: 100%; }
.wordmark { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
/* Косые штрихи «////» — повторяющийся элемент на материалах клуба. */
.slashes {
  display: inline-block; width: 26px; height: 10px; flex: none;
  background: repeating-linear-gradient(-60deg, var(--accent) 0 2px, transparent 2px 6px);
}

/* ── вход ─────────────────────────────────────────────────────────────────── */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: #111;
}
.login-hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 48px; color: #f4f4f1;
  background:
    radial-gradient(120% 80% at 85% 10%, rgba(253, 223, 64, .14), transparent 55%),
    #151515;
}
.login-hero::after {
  /* Знак «А» крупно, водяным знаком — как на карте абонемента клуба. */
  content: ""; position: absolute; right: -60px; bottom: -40px; width: 460px; height: 340px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 74'%3E%3Cpath d='M0 73 83 0l7 32z' fill='%23fddf40'/%3E%3Cpath d='M90 35 80 43l20 29z' fill='%23fddf40'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: .07; pointer-events: none;
}
.login-hero .brand-line { display: flex; align-items: center; gap: 12px; }
.login-hero .brand-line .mark { width: 44px; height: 33px; }
.login-hero .brand-line .wordmark { font-size: 22px; color: var(--accent); }
.login-hero h1 { font-size: 40px; line-height: 1.08; letter-spacing: .005em; max-width: 520px; }
.login-hero h1 em { font-style: normal; color: var(--accent); }
.login-hero p { color: #b9b9b3; max-width: 440px; font-size: 15px; }
.login-hero .slashes { width: 54px; height: 12px; margin-bottom: 18px; }
.login-side {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px; background: var(--bg);
}
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; font-weight: 800; text-transform: uppercase; margin-bottom: 6px; }
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.login-form .field { margin-bottom: 14px; }
.login-form .btn-block { margin-top: 6px; height: 46px; font-size: 14.5px; }
.login-foot { margin-top: 26px; color: var(--faint); font-size: 12px; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 46px; }
.pass-wrap .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* ── каркас ───────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid var(--side-border);
  padding: 18px 12px 14px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; color: var(--side-text-strong); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 34px; height: 25px; }
.brand-name { font-size: 16px; color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--side-muted); margin-top: 4px; letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1 1 auto; }
.nav-group { margin: 14px 10px 6px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); font-weight: 700; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px;
  color: var(--side-text); text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--side-hover); color: var(--side-text-strong); text-decoration: none; }
.nav-item.is-active { background: var(--side-active); color: var(--side-text-strong); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-item.is-active .icon { color: var(--accent); }
.nav-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent);
  border-radius: 10px; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
}

.side-foot { border-top: 1px solid var(--side-border); padding-top: 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px;
  border-radius: var(--radius-sm); color: var(--side-text-strong); text-decoration: none;
}
.side-user:hover { background: var(--side-hover); text-decoration: none; }
.side-user.is-active { background: var(--side-active); }
.side-user-text { min-width: 0; }
.side-user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 11.5px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; gap: 6px; padding: 0 4px; }
.sidebar .btn { color: var(--side-text); background: transparent; border-color: var(--side-border); }
.sidebar .btn:hover { background: var(--side-hover); color: var(--side-text-strong); border-color: #3a3a3a; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #2b2b2b; color: var(--accent);
  font-weight: 800; font-size: 12.5px; letter-spacing: .02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.light { background: var(--surface-3); color: var(--text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.view { padding: 28px 32px 48px; width: 100%; max-width: 1320px; margin: 0 auto; }
.view.full { max-width: none; padding: 0; height: 100vh; overflow: hidden; }

.tabbar { display: none; }

/* ── заголовок экрана ─────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { min-width: 0; flex: 1 1 320px; }
.page-title h1 { display: flex; align-items: center; gap: 12px; }
.page-sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── кнопки ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px;
  font: inherit; font-weight: 650; font-size: 13.5px; line-height: 1;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 750; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); background: transparent; border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.08); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 6px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 5px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14.5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); cursor: pointer; font-weight: 650; }
.link-btn:hover { text-decoration: underline; }

/* ── поля ─────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label { font-weight: 650; font-size: 12.5px; color: var(--text-2); }
.field .hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.field .req { color: var(--accent-ink); margin-left: 2px; }

.input {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
:root:not([data-theme="light"]) .input { background-color: #1a1a1a; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--muted); }
.input:focus { border-color: var(--accent-line); box-shadow: var(--focus); outline: none; }
.input:disabled { opacity: .6; cursor: not-allowed; }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 44px; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2392928c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm { height: 32px; font-size: 13px; padding: 0 10px; }
select.input-sm { padding-right: 30px; background-position: right 10px center; }
.input-search {
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2392928c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center;
}

.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fields-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.fields-2 > .field:last-child, .fields-3 > .field { margin-bottom: 16px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.form-error {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 550; user-select: none; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }

/* Переключатель — для «включено/выключено», где галочка выглядит как вопрос анкеты. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 38px; height: 22px; flex: none; border-radius: 11px;
  background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .15s, border-color .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .15s var(--ease), background .15s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--on-accent); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* Сегменты — короткий выбор из 2–4 вариантов («Все / Мои / Ждут»). */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.seg button:hover, .seg a:hover { color: var(--text); text-decoration: none; }
.seg .is-active { background: var(--raised); color: var(--text); box-shadow: var(--shadow-sm); }
:root:not([data-theme="light"]) .seg .is-active { background: #353535; }
.seg .count { font-size: 11px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg .is-active .count { color: var(--accent-ink); }
.seg .count.hot { color: var(--on-accent); background: var(--accent); border-radius: 9px; padding: 0 6px; line-height: 17px; }

/* Чипы — фильтры списков. */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px;
  font: inherit; font-size: 12.5px; font-weight: 650;
  color: var(--text-2); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 16px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-count { font-size: 11px; font-weight: 800; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.chip.is-active .chip-count { color: var(--bg); }
.chip-count:empty { display: none; }

/* ── карточки ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 52px;
}
.card-head h2 { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.card-head .spacer { flex: 1; }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 500; }
.card-body { padding: 18px; }
.card-body.tight { padding: 4px 18px 14px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card.accent { border-color: var(--accent-line); }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .12s, transform .12s; }
a.card:hover { border-color: var(--border-strong); text-decoration: none; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-nowrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.section-gap { margin-top: 16px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── показатели (KPI) ─────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile {
  position: relative; display: block; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; color: inherit; text-decoration: none;
  transition: border-color .12s, background .12s;
}
a.tile:hover { border-color: var(--border-strong); text-decoration: none; }
.tile-label { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.tile-value { font-size: 38px; font-weight: 800; line-height: 1.05; margin: 12px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile-note { font-size: 12.5px; color: var(--muted); }
.tile.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tile.accent .tile-label, .tile.accent .tile-note { color: rgba(27, 27, 27, .72); }
.tile.accent::after {
  content: ""; position: absolute; right: -14px; bottom: -18px; width: 110px; height: 82px; opacity: .14;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 74'%3E%3Cpath d='M0 73 83 0l7 32z'/%3E%3Cpath d='M90 35 80 43l20 29z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.tile.warn .tile-value { color: var(--warn); }
.tile .arrow { position: absolute; top: 16px; right: 16px; color: var(--faint); }

/* ── значки статусов ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; max-width: 100%;
  font-size: 11.5px; font-weight: 700; line-height: 1; white-space: nowrap;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.badge > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge.accent { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.badge.outline { background: transparent; }
.row-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── плашки ───────────────────────────────────────────────────────────────── */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); border-left-width: 3px;
}
.banner > .icon { align-self: flex-start; margin-top: 1px; }
.banner-body { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text-2); }
.banner-body strong { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 2px; }
.banner .btn { flex: none; }
.banner.ok { border-left-color: var(--ok); }
.banner.ok > .icon { color: var(--ok); }
.banner.warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--surface) 70%); }
.banner.warn > .icon { color: var(--warn); }
.banner.danger { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-soft), var(--surface) 70%); }
.banner.danger > .icon { color: var(--danger); }
.banner.info { border-left-color: var(--info); }
.banner.info > .icon { color: var(--info); }
.banner.accent { border-left-color: var(--accent); }
.banner.accent > .icon { color: var(--accent-ink); }
.banner.slim { padding: 9px 12px; }
/* «Вы сегодня на смене?» (app/shift.py) — над экраном, пока сотрудник не ответил. */
#shift-bar { width: 100%; max-width: 1320px; margin: 0 auto; padding: 14px 32px 0; }
#shift-bar:empty { display: none; }
.shift-bar { border-left-color: var(--accent); flex-wrap: wrap; }
.shift-bar > .icon { color: var(--accent-ink); }

/* ── строки состояния ─────────────────────────────────────────────────────── */
.status-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.status-line:last-child { border-bottom: 0; }
.status-line .label { color: var(--text-2); min-width: 0; }

/* ── таблицы ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table tr.is-off td { opacity: .55; }
.cell-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-wide { min-width: 220px; }
.cell-actions { white-space: nowrap; text-align: right; width: 1%; }
.cell-actions .btn + .btn { margin-left: 4px; }

/* ── полоски (распределение) ──────────────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.bar-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-value { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── причины вызова менеджера: текст целиком, кто и когда ─────────────────── */
.reason-list { display: flex; flex-direction: column; margin: -6px -10px; }
.reason { display: block; padding: 9px 10px; border-radius: var(--radius); color: inherit; }
a.reason:hover { background: var(--surface-2); text-decoration: none; }
.reason + .reason { border-top: 1px solid var(--border); }
.reason-list:not(.is-open) .reason.is-hidden { display: none; }
.reason-text { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.reason-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.reason-more { margin: 10px 0 0 -10px; }

/* ── вкладки ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 14px 12px; color: var(--muted); font-weight: 700; font-size: 13px;
  text-decoration: none; white-space: nowrap; background: none; border: 0; font-family: inherit; cursor: pointer;
}
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .is-active { color: var(--text); }
.tabs .is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; background: var(--accent); border-radius: 2px 2px 0 0; }

/* ── состояния: загрузка, пусто, ошибка ───────────────────────────────────── */
.loading { color: var(--muted); padding: 18px 0; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.loading::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.skeleton { display: flex; flex-direction: column; gap: 12px; padding: 6px 0; }
.sk-line { height: 12px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }
.sk-line::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); animation: shimmer 1.3s infinite; }
:root[data-theme="light"] .sk-line::after { background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .05), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

.state { text-align: center; padding: 38px 18px; color: var(--muted); max-width: 460px; margin: 0 auto; }
.state .state-icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--accent-ink);
}
.state h3 { color: var(--text); font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.state p { font-size: 13px; line-height: 1.55; }
.state .btn { margin-top: 14px; }
.state.error h3 { color: var(--danger); }
.state.error .state-icon { color: var(--danger); background: var(--danger-soft); }
.state.compact { padding: 22px 12px; }

/* ── модальные окна ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(8, 8, 8, .62); backdrop-filter: blur(2px);
  animation: fade .14s ease-out;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: pop .16s var(--ease);
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ── тосты ────────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: #1d1d1d; color: #f4f4f1; border: 1px solid #333;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 550;
  animation: pop .18s var(--ease);
}
.toast > .icon { color: var(--accent); }
.toast.err > .icon { color: #ff7a77; }
.toast > div { flex: 1 1 auto; }
.toast .btn { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* ── прочее общего пользования ────────────────────────────────────────────── */
.code-box {
  font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: .12em;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 12px 16px; text-align: center;
}
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.steps li::marker { color: var(--accent-ink); font-weight: 800; }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.qr-holder { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: var(--radius); }
.qr-holder svg { width: 220px; height: 220px; }
.empty-hint { color: var(--muted); font-size: 13px; padding: 10px 0; }
.desktop-only { display: inline; }

/* ── обзор ────────────────────────────────────────────────────────────────── */
.overview-hello { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.overview-hello h1 { font-size: 26px; }
.health-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 15px; font-size: 12.5px; font-weight: 700;
  background: var(--ok-soft); color: var(--ok);
}
.health-pill.bad { background: var(--danger-soft); color: var(--danger); }
.health-pill.unknown { background: var(--surface-2); color: var(--muted); }
.health-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 20%, transparent); }
.todo-list { display: flex; flex-direction: column; }
.todo {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); color: inherit; text-decoration: none;
}
.todo:last-child { border-bottom: 0; }
.todo:hover { background: var(--surface-2); text-decoration: none; }
.todo .todo-num { font-size: 22px; font-weight: 800; min-width: 34px; font-variant-numeric: tabular-nums; }
.todo .todo-num.hot { color: var(--accent-ink); }
.todo .grow > div:first-child { font-weight: 700; }
.todo .grow > div:last-child { color: var(--muted); font-size: 12.5px; }

/* ── диалоги (inbox) ──────────────────────────────────────────────────────── */
.inbox {
  display: grid; grid-template-columns: 360px minmax(0, 1fr) 320px;
  height: 100vh; min-height: 0; background: var(--bg);
}
.inbox.no-side { grid-template-columns: 360px minmax(0, 1fr); }
.inbox-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--surface); }
.inbox-list-head { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--border); }
.inbox-list-head h1 { font-size: 18px; }
.inbox-list-head .live {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: none; letter-spacing: 0;
}
.inbox-list-head .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.inbox-list-head .live.on::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.inbox-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }

.conv {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  color: inherit; text-decoration: none; cursor: pointer;
  transition: background .1s;
}
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.is-active { background: var(--accent-soft); }
.conv.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.conv-avatar { grid-row: 1 / span 3; position: relative; align-self: start; width: max-content; height: max-content; }
.conv-avatar .ch {
  position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface); color: #fff; font-size: 8px; font-weight: 800;
}
.ch-instagram { background: linear-gradient(45deg, #f9a43a, #e1306c 55%, #833ab4); }
.ch-whatsapp { background: #25d366; }
.ch-telegram { background: #2aa3df; }
.ch-sandbox { background: #6a6a65; }
.conv-name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-phone { margin-left: 6px; font-weight: 500; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv.unread .conv-name { font-weight: 800; }
.conv-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.conv.unread .conv-time { color: var(--accent-ink); font-weight: 700; }
.conv-preview { grid-column: 2 / span 2; display: flex; gap: 8px; align-items: center; min-width: 0; }
.conv-preview .text { color: var(--muted); font-size: 12.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.conv.unread .conv-preview .text { color: var(--text-2); }
.conv-preview .who { color: var(--text-2); font-weight: 650; }
.conv-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.conv-flags { grid-column: 2 / span 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.conv-flags:empty { display: none; }

.inbox-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-head {
  display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.chat-head .who { min-width: 90px; flex: 1 1 auto; }
.chat-head .who-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); }
.chat-head .who-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex: none; }
.back-btn { display: none; }

.bot-state {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 18px; font-size: 12.8px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.bot-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; margin-top: 6px; }
.bot-state.paused .dot { background: var(--warn); }
.bot-state.silenced .dot { background: var(--danger); }
.bot-state .grow { color: var(--text-2); }
.bot-state b { color: var(--text); }

.chat-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 18px 22px 10px; overscroll-behavior: contain; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.day-sep::before, .day-sep::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 620px); margin: 2px 0; }
.msg.gap { margin-top: 12px; }
.msg.in { align-items: flex-start; margin-right: auto; }
.msg.out { align-items: flex-end; margin-left: auto; }
.msg-author { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 0 4px 4px; display: flex; gap: 6px; align-items: center; }
.msg-author .badge { height: 18px; font-size: 10.5px; padding: 0 6px; }
.msg-bubble {
  padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  background: var(--bubble-in); border: 1px solid var(--border); color: var(--text);
}
.msg.in .msg-bubble { border-top-left-radius: 4px; }
.msg.out .msg-bubble { background: var(--bubble-agent); border-color: var(--bubble-agent-border); border-top-right-radius: 4px; }
.msg.human .msg-bubble { background: var(--bubble-human); color: var(--bubble-human-text); border-color: transparent; }
.msg-meta { font-size: 11px; color: var(--faint); margin: 3px 4px 0; display: flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.msg-undelivered { display: flex; align-items: center; gap: 6px; margin: 4px 4px 0; color: var(--danger); font-size: 12px; font-weight: 650; }
.msg.system { max-width: none; align-items: center; margin: 10px auto; }
.msg.system .msg-bubble { background: transparent; border: 0; color: var(--muted); font-size: 12px; padding: 2px 8px; text-align: center; }
.event { display: flex; justify-content: center; margin: 12px 0; }
.event span { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 4px 11px; font-weight: 600; }

/* ── вложения в переписке: фото, видео, голосовое с расшифровкой, документ, карточки ──
   Цвета — от currentColor и полупрозрачного серого: те же блоки стоят и в тёмном пузыре
   гостя, и в жёлтом пузыре менеджера, в обеих темах. */
.msg-bubble.has-media { display: flex; flex-direction: column; gap: 8px; white-space: normal; padding: 6px; }
.msg-bubble.has-media > .att-caption { padding: 2px 7px 3px; white-space: pre-wrap; }
.att { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.att-img-link { display: block; line-height: 0; border-radius: 8px; overflow: hidden; max-width: 100%; }
.att-img { display: block; max-width: min(320px, 100%); max-height: 360px; width: auto; height: auto; border-radius: 8px; background: rgba(127, 127, 127, .12); min-width: 60px; min-height: 60px; object-fit: contain; }
.att-video { display: block; width: min(340px, 100%); max-height: 420px; border-radius: 8px; background: #000; }
.att-sticker { display: block; width: 128px; height: 128px; object-fit: contain; background: transparent; border-radius: 0; }
.att-voice { padding: 2px; }
.att-audio { display: block; width: min(300px, 72vw); height: 40px; }
.att-transcript { display: flex; flex-direction: column; gap: 2px; padding: 0 6px; }
.att-transcript-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .65; }
.att-transcript .att-text { white-space: pre-wrap; }
.att-note { font-size: 12.5px; opacity: .75; padding: 0 6px; font-style: italic; }
.att-download { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: inherit; opacity: .7; padding: 0 6px; text-decoration: none; }
.att-download:hover { opacity: 1; text-decoration: underline; }
.att-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 8px; font-size: 13px; line-height: 1.35; background: rgba(127, 127, 127, .14); border: 1px solid rgba(127, 127, 127, .22); color: inherit; }
.att-chip.muted { opacity: .8; }
.att-chip-icon { font-size: 16px; line-height: 1; flex: none; }
.att-file, .att-card { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; background: rgba(127, 127, 127, .14); border: 1px solid rgba(127, 127, 127, .22); color: inherit; text-decoration: none; min-width: min(240px, 100%); max-width: 340px; }
a.att-file:hover, a.att-card:hover { background: rgba(127, 127, 127, .22); }
.att-file .icon { flex: none; opacity: .85; }
.att-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.att-file-name { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file-size { font-size: 11.5px; opacity: .7; }
.att-card { flex-direction: column; align-items: flex-start; gap: 3px; }
.att-card-title { font-weight: 700; font-size: 13.5px; overflow-wrap: anywhere; }
.att-card-sub { font-size: 12px; opacity: .75; overflow-wrap: anywhere; }
.att-card-action { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; color: inherit; text-decoration: underline; text-underline-offset: 2px; margin-top: 2px; }
.att-card-phones { display: flex; flex-direction: column; gap: 2px; }
.att-heart { font-size: 36px; line-height: 1; padding: 2px 4px; }
.event-media { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 12px 0; }
.event-media .event { margin: 0; }
.event-media .msg-bubble { max-width: min(360px, 90%); }

.media-viewer { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .9); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); cursor: zoom-out; }
.media-viewer img { max-width: 100%; max-height: calc(100% - 56px); object-fit: contain; border-radius: 4px; }
.media-viewer-bar { display: flex; gap: 8px; }
.new-pill {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 16px;
  font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
}

.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 16px 14px; }
.composer-box { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea {
  flex: 1 1 auto; min-height: 44px; max-height: 200px; resize: none; line-height: 1.5;
}
.composer .hint-line { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.composer-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.composer-locked {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 14px 18px; display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--text-2);
}
.composer-locked > .icon { color: var(--muted); }

/* ── файлы гостю из кабинета: скрепка, выбранные файлы, пузырь с ходом загрузки ── */
.composer-attach { position: relative; overflow: hidden; flex: none; cursor: pointer; }
/* Поле файла — внутри скрепки, невидимое, но не display:none: Safari на iPhone открывает
   выбор файла нажатием на <label>, только если поле существует на странице. */
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; top: 0; }
.composer-tray { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.composer-tray[hidden] { display: none; }
.tray-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); max-width: 100%; min-width: 0; }
.tray-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; background: rgba(127, 127, 127, .14); }
.tray-file { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.tray-text { display: flex; flex-direction: column; min-width: 0; }
.tray-name { font-size: 13px; font-weight: 650; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-size { font-size: 11.5px; color: var(--muted); }
.upload-bar { height: 4px; border-radius: 2px; background: rgba(127, 127, 127, .25); overflow: hidden; margin: 0 6px; }
.upload-fill { display: block; height: 100%; width: 0; background: currentColor; opacity: .8; transition: width .2s ease; }
.upload-status { font-size: 12px; opacity: .8; padding: 0 6px; }
.upload-actions { display: flex; gap: 6px; padding: 0 4px 2px; flex-wrap: wrap; }
.upload-actions:empty { display: none; }
.msg.uploading .msg-bubble .att-img { opacity: .75; }
.msg.upload-failed .upload-status { color: var(--danger); opacity: 1; font-weight: 650; }
.msg.upload-failed .upload-bar { display: none; }
.inbox-chat.drop-active { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* ── цитата, удалённое, реакции, «Показать раньше» ── */
.msg-content { display: flex; flex-direction: column; max-width: 100%; min-width: 0; }
.msg.in .msg-content { align-items: flex-start; }
.msg.out .msg-content { align-items: flex-end; }
.msg-quote { display: flex; flex-direction: column; gap: 1px; max-width: min(420px, 100%); margin: 0 0 3px; padding: 4px 10px; border-left: 3px solid var(--accent); border-radius: 4px 8px 8px 4px; background: var(--surface-2); font-size: 12.5px; line-height: 1.35; color: var(--text-2); }
.msg-quote-head { font-size: 11px; font-weight: 750; color: var(--muted); }
.msg-quote-text { overflow-wrap: anywhere; }
/* Картинка, на которую ответил гость (статус клуба, процитированное фото). */
.msg-quote-pics { display: flex; gap: 6px; margin: 2px 0 3px; }
.msg-quote-pics .att-img-link { display: block; line-height: 0; }
.msg-quote-img { display: block; max-width: 160px; max-height: 200px; width: auto; height: auto; border-radius: 6px; object-fit: cover; }
.msg-bubble.is-deleted { opacity: .6; text-decoration: line-through; text-decoration-thickness: 1px; }
/* Всегда видна, бледно: «только при наведении» прятала её на телефонах, которые называют
   себя устройствами с наведением (Samsung, iPad с трекпадом), — навести там нечем. */
.msg-del { display: inline-flex; padding: 2px; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; opacity: .55; }
.msg-del:hover, .msg-del:focus-visible, .msg:hover .msg-del { color: var(--text); opacity: 1; }
@media (max-width: 860px) { .msg-del { padding: 6px; margin: -4px -4px -4px 0; } }
.msg-deleted { display: inline-flex; align-items: center; gap: 4px; margin: 3px 4px 0; font-size: 11.5px; font-style: italic; color: var(--muted); }
.msg-reactions { display: flex; gap: 4px; flex-wrap: wrap; margin: -6px 8px 0; position: relative; z-index: 1; }
.msg-reaction { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; line-height: 1; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); cursor: default; }
.event.reaction-line span { font-weight: 600; }
.event.reaction-line b { font-weight: 400; font-size: 14px; }
.older-row { display: flex; justify-content: center; margin: 4px 0 12px; }

.inbox-side { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; min-height: 0; }
.side-block { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.side-block:last-child { border-bottom: 0; }
.side-block h3 { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.side-profile { display: flex; align-items: center; gap: 12px; }
.side-profile .name { font-weight: 800; font-size: 15px; }
.side-kv { display: grid; grid-template-columns: 80px 1fr; gap: 7px 10px; font-size: 13px; }
.side-kv dt { color: var(--muted); }
.side-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 30px; max-width: 360px; }
.chat-empty .mark { width: 74px; height: 55px; opacity: .9; margin-bottom: 18px; }
.chat-empty h3 { color: var(--text); font-size: 16px; font-weight: 800; text-transform: uppercase; margin-bottom: 8px; }

/* ── база знаний ──────────────────────────────────────────────────────────── */
.kb { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.kb-nav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.kb-nav .group { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 10px 6px; }
.kb-nav .group:first-child { margin-top: 0; }
.kb-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 600; font-size: 13px; text-decoration: none;
}
.kb-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.kb-nav a.is-active { background: var(--surface); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.kb-nav .count { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.kb-nav .count.pending { color: var(--warn); }
.kb-nav .icon { color: var(--muted); }
.kb-nav a.is-active .icon { color: var(--accent-ink); }

.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.note-card.is-off { opacity: .6; }
.note-date {
  width: 54px; text-align: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; flex: none;
}
.note-date .m { background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 0; }
.note-date .d { font-size: 20px; font-weight: 800; padding: 3px 0 4px; font-variant-numeric: tabular-nums; }
.note-date.always .d { font-size: 18px; color: var(--muted); }
.note-title { font-weight: 800; font-size: 14px; margin-bottom: 3px; }
.note-text { color: var(--text-2); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.note-actions { display: flex; gap: 4px; }

.assistant { display: flex; flex-direction: column; height: min(640px, calc(100vh - 220px)); min-height: 420px; }
.assistant-scroll { flex: 1 1 auto; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.assistant .msg { max-width: 86%; }
.assistant .msg.out .msg-bubble { background: var(--surface-2); border-color: var(--border); }
.assistant .msg.in .msg-bubble { background: var(--bubble-human); color: var(--bubble-human-text); border-color: transparent; border-top-left-radius: 12px; border-top-right-radius: 4px; }
.assistant .msg.in { align-items: flex-end; margin-left: auto; margin-right: 0; }
.assistant .msg.out { align-items: flex-start; margin-right: auto; margin-left: 0; }
.proposal {
  margin-top: 6px; width: 100%; border: 1px solid var(--accent-line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.proposal-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--accent-soft); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); }
.proposal-body { padding: 12px; font-size: 13.5px; }
.proposal-body .was { color: var(--muted); text-decoration: line-through; }
.proposal-foot { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.proposal.done { border-color: var(--border); }
.proposal.done .proposal-head { background: var(--ok-soft); color: var(--ok); }
.proposal.cancelled { opacity: .55; }
.assistant-input { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 8px; align-items: flex-end; }
.assistant-input textarea { flex: 1; resize: none; max-height: 160px; }
.suggests { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 12px; }
.suggests .chip { height: auto; min-height: 30px; padding: 6px 12px; white-space: normal; text-align: left; border-radius: 15px; }

/* ── карточки каналов ─────────────────────────────────────────────────────── */
.channel-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 22px; }
.channel-logo { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.channel-logo.instagram { background: linear-gradient(45deg, #f9a43a, #e1306c 55%, #833ab4); }
.channel-logo.telegram { background: #2aa3df; }
.channel-logo.whatsapp { background: #25d366; }
.channel-logo.max { background: linear-gradient(135deg, #3d5afe, #8e24aa); }
.channel-logo.vk { background: #0077ff; }
.channel-logo.sm { width: 36px; height: 36px; border-radius: 10px; }
.channel-title { font-weight: 800; font-size: 16px; }
.channel-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.soon-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.soon { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.soon .channel-logo { filter: grayscale(.85); opacity: .7; }
.soon .t { font-weight: 700; }
.soon .s { color: var(--muted); font-size: 12px; }
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.person:last-child { border-bottom: 0; }
.person .grow > div:first-child { font-weight: 700; font-size: 13.5px; }
.person .grow > div:last-child { color: var(--muted); font-size: 12px; }

/* WhatsApp: номера и окно подключения QR-кодом */
.wa-numbers { display: flex; flex-direction: column; }
.wa-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.wa-row:last-child { border-bottom: 0; }
.wa-row > .channel-logo { margin-top: 2px; }
.wa-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 14px; }
.wa-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.wa-actions { display: flex; align-items: center; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.wa-connect { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 20px; align-items: start; }
.wa-qr-col { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.wa-qr { width: 252px; height: 252px; align-items: center; }
.wa-qr-img { width: 232px; height: 232px; image-rendering: pixelated; }
.wa-qr .wa-spin { width: 28px; height: 28px; border: 3px solid #25d366; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.wa-qr-stalled { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: #333; padding: 12px; }
.wa-ttl { text-align: center; min-height: 18px; }
.wa-steps .caps { margin-bottom: 6px; }
.wa-pair-code { font-size: 30px; letter-spacing: .18em; }
.state .state-icon.wa-done { color: var(--ok); }
@media (max-width: 860px) {
  .wa-row { flex-wrap: wrap; }
  .wa-row > .grow { flex-basis: calc(100% - 48px); }
  .wa-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
  .wa-connect { grid-template-columns: 1fr; }
  .wa-qr-col { order: -1; }
}

/* ── сотрудники ───────────────────────────────────────────────────────────── */
.staff-row { display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.staff-row:last-child { border-bottom: 0; }
.staff-row.is-off { opacity: .55; }
.staff-row .name { font-weight: 750; }
.staff-row .staff-login { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-row .tabs-list { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.perm {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
}
.perm:hover { border-color: var(--border-strong); }
.perm input { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.perm .t { font-weight: 700; font-size: 13px; }
.perm .s { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.perm.is-disabled { opacity: .45; cursor: not-allowed; }
.role-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.role-card { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.role-card input { position: absolute; opacity: 0; }
.role-card .t { font-weight: 800; font-size: 13px; }
.role-card .s { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.role-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.role-card:has(input:focus-visible) { box-shadow: var(--focus); }
.secret {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  font-family: var(--mono); font-size: 14px;
}

/* ── профиль ──────────────────────────────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 16px; padding: 22px; }
.profile-head .avatar { width: 60px; height: 60px; font-size: 20px; }
.profile-head .name { font-size: 20px; font-weight: 800; }

/* ── прочие экраны (наследие, в новом стиле) ──────────────────────────────── */
.dialogs { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0; }
.clients-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.clients-filters .input { width: auto; min-width: 170px; }
.clients-filters .input-search { min-width: 260px; flex: 1 1 260px; }
.facts { display: flex; flex-direction: column; gap: 8px; }
.fact { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.fact-text { flex: 1 1 auto; font-size: 13.5px; }
.fact-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.agent-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sandbox { display: flex; flex-direction: column; height: min(680px, calc(100vh - 180px)); min-height: 440px; }
.sandbox .chat-scroll { padding: 16px; }
.verdict { margin-top: 4px; }
.verdict-detail { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.unconfirmed-note { color: var(--warn); font-size: 12px; font-weight: 650; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.guest-mode { display: inline-flex; gap: 8px; align-items: center; }
.guest-mode select.input { width: auto; }
.status-select { width: auto; min-width: 140px; }
.wa-link { color: #25d366; font-weight: 700; }

/* ── адаптив: планшет ─────────────────────────────────────────────────────── */
@media (max-width: 1520px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr) 290px; }
}
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 330px minmax(0, 1fr); }
  .inbox-side { display: none; }
  .inbox.side-open .inbox-side {
    display: block; position: fixed; right: 0; top: 0; bottom: 0; width: 340px; z-index: 40;
    box-shadow: var(--shadow-lg);
  }
}
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .soon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-grid { grid-template-columns: 1fr; }
}

/* ── адаптив: телефон ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 25; height: var(--topbar-h);
    padding: 0 8px 0 16px; padding-top: env(safe-area-inset-top);
    background: var(--side-bg); color: var(--side-text-strong); border-bottom: 1px solid var(--side-border);
  }
  .topbar .mark { width: 26px; height: 19px; }
  .topbar-title { font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn { color: var(--side-text); background: transparent; border-color: transparent; }
  .view { padding: 18px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
  .view.full { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom)); padding: 0; }
  #shift-bar { padding: 10px 16px 0; }
  .page-head { margin-bottom: 16px; }
  /* Название раздела уже в верхней панели — на телефоне не повторяем его крупно. */
  .page-head .page-title h1 { display: none; }
  .page-head .page-sub { margin-top: 0; }
  .page-title h1, h1 { font-size: 19px; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn { flex: 1 1 auto; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--side-bg); border-top: 1px solid var(--side-border);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--side-muted); font: inherit; font-size: 10.5px; font-weight: 700; text-decoration: none;
    background: none; border: 0; cursor: pointer; padding: 0;
  }
  .tabbar .is-active { color: var(--side-text-strong); }
  .tabbar .is-active .icon { color: var(--accent); }
  .tabbar .is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; background: var(--accent); border-radius: 0 0 2px 2px; }
  .tabbar .nav-count { position: absolute; top: 6px; left: 54%; margin: 0; min-width: 18px; height: 17px; font-size: 10px; padding: 0 5px; }

  .sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(8, 8, 8, .55); animation: fade .14s; }
  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
    background: var(--surface); border-radius: 16px 16px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    animation: up .2s var(--ease); max-height: 86vh; overflow-y: auto;
  }
  .sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 4px auto 10px; }
  .sheet a, .sheet button.sheet-item {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 12px; border-radius: var(--radius);
    color: var(--text); font: inherit; font-weight: 650; font-size: 15px; text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer;
  }
  .sheet a:active, .sheet button.sheet-item:active { background: var(--surface-2); }
  .sheet .icon { color: var(--muted); }
  .sheet .sheet-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile-value { font-size: 30px; margin: 8px 0 4px; }
  .grid-2, .fields-2, .fields-3, .perm-grid, .role-cards { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 12px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .card-body.tight { padding: 2px 14px 10px; }
  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .btn-icon { width: 42px; }
  .btn-icon.btn-sm { width: 36px; }
  .input { height: 44px; font-size: 16px; }   /* 16px — иначе iOS увеличивает страницу при вводе */
  textarea.input { font-size: 16px; }
  .input-sm { height: 38px; font-size: 15px; }
  .banner { flex-wrap: wrap; }
  .banner .btn { width: 100%; }
  .desktop-only { display: none; }

  /* Таблица на телефоне — стопка карточек с подписями из заголовка колонки. */
  .table-wrap.stack-mobile { border: 0; background: transparent; overflow: visible; }
  .table-wrap.stack-mobile .table thead { display: none; }
  .table-wrap.stack-mobile .table, .table-wrap.stack-mobile tbody, .table-wrap.stack-mobile tr, .table-wrap.stack-mobile td { display: block; width: 100%; }
  .table-wrap.stack-mobile tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 0; }
  .table-wrap.stack-mobile td { border: 0; padding: 6px 14px; display: grid; grid-template-columns: 38% 1fr; gap: 10px; }
  .table-wrap.stack-mobile td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 650; }
  .table-wrap.stack-mobile td:not([data-label])::before, .table-wrap.stack-mobile td[data-label=""]::before { display: none; }
  .table-wrap.stack-mobile td:not([data-label]), .table-wrap.stack-mobile td[data-label=""] { grid-template-columns: 1fr; }
  .table-wrap.stack-mobile .cell-actions { text-align: left; }
  .table-wrap.stack-mobile .cell-num { text-align: left; }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; animation: up .2s var(--ease); }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); max-width: none; }

  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px 26px; min-height: auto; }
  .login-hero h1 { font-size: 26px; margin-top: 26px; }
  .login-hero p { display: none; }
  .login-hero::after { width: 240px; height: 180px; right: -30px; bottom: -30px; }
  .login-side { align-items: flex-start; padding: 26px 20px 40px; }

  /* Диалоги на телефоне: стек экранов список → переписка → карточка. */
  .inbox, .inbox.no-side { display: block; height: 100%; position: relative; }
  .inbox-list { height: 100%; border-right: 0; }
  .inbox-chat { display: none; height: 100%; }
  .inbox.has-chat .inbox-list { display: none; }
  .inbox.has-chat .inbox-chat { display: flex; }
  .inbox-list-head { padding: 14px 14px 10px; }
  .inbox-list-head h1 { display: none; }
  .conv { padding: 13px 14px; }
  .back-btn { display: inline-flex; margin-left: -8px; }
  .chat-head { padding: 8px 12px; min-height: 58px; gap: 8px; }
  .chat-head .actions .btn:not(.btn-primary) .btn-label { display: none; }
  .chat-scroll { padding: 14px 12px 8px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px; }
  .new-pill { bottom: 120px; }
  .inbox.side-open .inbox-side { width: 100%; left: 0; z-index: 60; }
  /* В открытой переписке на телефоне — весь экран под разговор, как в мессенджере. */
  body.chat-open .topbar, body.chat-open .tabbar { display: none; }
  body.chat-open .view.full { height: 100dvh; }
  body.chat-open .composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

  .kb { grid-template-columns: 1fr; gap: 14px; }
  .kb-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .kb-nav::-webkit-scrollbar { display: none; }
  .kb-nav .group { display: none; }
  .kb-nav a { flex: none; border: 1px solid var(--border-strong); border-radius: 16px; padding: 6px 12px; }
  .kb-nav a.is-active { box-shadow: none; background: var(--text); color: var(--bg); border-color: var(--text); }
  .kb-nav a.is-active .icon, .kb-nav a.is-active .count { color: var(--bg); }
  .note-card { grid-template-columns: auto minmax(0, 1fr); }
  .note-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .assistant { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 150px); }

  .channel-main { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .channel-main > .actions { grid-column: 1 / -1; }
  .channel-main > .actions .btn { width: 100%; }
  .soon-grid { grid-template-columns: 1fr 1fr; }
  .staff-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 12px 14px; }
  .staff-row .tabs-list { grid-column: 2 / -1; grid-row: 2; }
  .clients-filters .input, .clients-filters .input-search { min-width: 0; flex: 1 1 100%; }
  .bar-row { grid-template-columns: minmax(90px, 40%) 1fr auto; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .dialogs { grid-template-columns: 1fr; }
}
@keyframes up { from { transform: translateY(24px); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── всплывающее меню «…» ─────────────────────────────────────────────────── */
.pop-menu {
  position: fixed; z-index: 90; min-width: 220px; padding: 6px;
  background: var(--raised); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: pop .12s var(--ease);
}
.pop-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer;
}
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--surface-2); box-shadow: none; }
.pop-menu .icon { color: var(--muted); }

.assistant-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .assistant-grid { grid-template-columns: minmax(0, 1fr); } }
.assistant .typing .msg-bubble { color: var(--muted); font-style: italic; }
pre.preview {
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; max-height: 60vh; overflow: auto; margin: 0;
}
.person .note-date { width: 44px; }
.person .note-date .d { font-size: 16px; }

/* «Настройки подключения» — один раз, свёрнуты по умолчанию. */
details.advanced { border-top: 1px solid var(--border); }
details.advanced > summary {
  display: flex; align-items: center; gap: 10px; padding: 13px 22px; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 13px; color: var(--text-2);
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.advanced[open] > summary::after { transform: rotate(-135deg); }
details.advanced > summary .small { font-weight: 500; }
details.advanced > summary:hover { color: var(--text); }
.channel-main > .actions { justify-content: flex-end; }
.token-row .input { flex: 1 1 260px; width: auto; }
@media (max-width: 860px) {
  details.advanced > summary { padding: 13px 16px; }
  details.advanced > summary .small { display: none; }
  .token-row .btn { width: 100%; }
}

/* ── заявки ───────────────────────────────────────────────────────────────── */
.lead-list { display: flex; flex-direction: column; }
.lead-row {
  position: relative; display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(200px, 1.3fr) minmax(180px, 1.4fr) minmax(150px, 1fr) 150px auto;
  padding: 16px 18px 16px 21px; border-bottom: 1px solid var(--border);
}
.lead-row:last-child { border-bottom: 0; }
.lead-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border-strong); }
/* Цвет полосы — что делать с заявкой: красная — новая, ждёт «Беру»; жёлтая — человек
   интересовался, но номер не оставил (в счёт не идёт, написать ему в диалоге); синяя — в
   работе; зелёная — записался; серая — отказ. */
.lead-row.st-new::before { background: var(--danger); }
.lead-row.st-in_work::before { background: var(--info); }
.lead-row.st-won::before { background: var(--ok); }
.lead-row.st-lost::before { background: var(--faint); }
.lead-row.st-new { background: linear-gradient(90deg, var(--danger-soft), transparent 40%); }
.lead-row.no-contact::before { background: var(--accent); }
.lead-row.no-contact { background: linear-gradient(90deg, var(--accent-soft), transparent 40%); }
.badge.nocontact { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.nocontact-hint { margin-top: 6px; color: var(--accent-ink); font-weight: 650; }
:root[data-theme="light"] .nocontact-hint { color: var(--text-2); }
.lead-name { font-weight: 800; font-size: 14.5px; color: var(--text); }
a.lead-name:hover { color: var(--accent-ink); }
.lead-taken { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ok); }
.lead-comment { margin-top: 6px; color: var(--text-2); }
.lead-actions { display: flex; gap: 6px; justify-content: flex-end; }
.wa-btn { color: #25d366; }
.wa-slot { display: contents; }
.wa-choose { display: flex; flex-direction: column; gap: 8px; }
.wa-choose-item { justify-content: flex-start; text-align: left; height: auto; padding: 10px 12px; gap: 10px; }
.wa-choose-item .grow { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 1100px) {
  .lead-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lead-actions { justify-content: flex-start; }
}
@media (max-width: 860px) {
  .lead-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 14px 14px 17px; }
  .lead-status .input { width: 100%; }
  .lead-owner .btn, .lead-owner select { width: 100%; }
  .lead-actions .btn:first-child { flex: 1; }
}
@media (max-width: 860px) {
  /* В ячейке бывает несколько строк (имя, телефон, канал) — все во второй колонке, подпись слева. */
  .table-wrap.stack-mobile td::before { grid-row: 1 / span 6; overflow-wrap: anywhere; hyphens: auto; }
  .table-wrap.stack-mobile td > * { grid-column: 2; min-width: 0; }
  .table-wrap.stack-mobile td:not([data-label]) > *, .table-wrap.stack-mobile td[data-label=""] > * { grid-column: 1; }
  .clients-filters .input-search { width: 100%; }
}
@media (max-width: 860px) {
  .table-wrap.stack-mobile td { row-gap: 2px; column-gap: 10px; grid-auto-rows: min-content; }
}

.kb-picker { display: none; }
@media (max-width: 860px) {
  .kb-picker { display: block; margin-bottom: 14px; font-weight: 700; }
  .kb-nav { display: none; }
  /* Главное действие в шапке переписки — с подписью и на телефоне. */
  .chat-head .actions .btn-primary .btn-label { display: inline; }
}

/* ── Статистика ────────────────────────────────────────────────────────────
   Цвета графиков — из тех же токенов: жёлтый бренда — «заявки» (то, ради чего всё),
   нейтральный графит — «написали». Тепловая карта — один тон жёлтого от светлого к
   насыщенному. Числа и подписи — цветом текста, не цветом серии. */
.st-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.st-controls .input { width: auto; min-width: 140px; }
.st.is-loading > * { opacity: .55; transition: opacity .15s; }

.st-hero {
  display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; margin-bottom: 16px;
}
.st-hero-text {
  flex: 1 1 420px; font-size: 17px; font-weight: 600; line-height: 1.45; color: var(--text);
  padding: 4px 0; max-width: 760px;
}
.st-open {
  flex: 0 1 360px; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.st-open:hover { text-decoration: none; filter: brightness(1.06); }
.st-open-num { font-size: 30px; font-weight: 800; color: var(--warn); font-variant-numeric: tabular-nums; line-height: 1; }
.st-open .grow { display: flex; flex-direction: column; }
.st-open .grow span { color: var(--muted); font-size: 12.5px; }
.st-open.calm { background: var(--ok-soft); border-color: transparent; font-weight: 650; }
.st-open.calm .icon { color: var(--ok); }

.st-tiles .tile-value.empty { color: var(--faint); }
.st-delta { display: flex; gap: 4px; align-items: baseline; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.st-delta.good { color: var(--ok); }
.st-delta.bad { color: var(--danger); }
.st-delta.flat { color: var(--muted); font-weight: 600; }
.st-delta span:last-child { font-weight: 600; }
.tile.accent .st-delta { color: var(--on-accent); }

.st-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.st-card .card-body { padding: 16px 18px 18px; }
.st-foot { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.st-cell-sub { color: var(--muted); font-size: 12px; font-weight: 500; }
.st-strong { font-weight: 700; }
.st-sub-title { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

.st-empty { display: flex; gap: 12px; align-items: flex-start; padding: 18px; background: var(--surface-2); border-radius: var(--radius); }
.st-empty-icon { color: var(--muted); padding-top: 1px; }
.st-empty-title { font-weight: 700; }
.st-empty-hint { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* по дням */
.st-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
.st-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sw.guests { background: var(--chart-guests); }
.sw.leads { background: var(--chart-leads); }
.st-chart { position: relative; height: 220px; margin: 0 0 26px 30px; }
.st-ygrid { position: absolute; inset: 0; pointer-events: none; }
.st-yline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.st-yline span { position: absolute; right: 100%; transform: translateY(-50%); padding-right: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-cols { position: absolute; inset: 0; display: flex; gap: 2px; align-items: stretch; }
.st-cols.dense { gap: 1px; }
.st-col { position: relative; flex: 1 1 0; min-width: 0; cursor: pointer; outline: none; border-radius: 2px; }
.st-col:hover, .st-col:focus-visible { background: var(--surface-2); }
.st-bar { position: absolute; left: 12%; right: 12%; bottom: 0; border-radius: 3px 3px 0 0; }
.st-cols.dense .st-bar { left: 0; right: 0; border-radius: 1px 1px 0 0; }
.st-bar.guests { background: var(--chart-guests); }
.st-bar.leads { left: 30%; right: 30%; background: var(--chart-leads); box-shadow: 0 0 0 1px var(--surface); }
.st-cols.dense .st-bar.leads { left: 15%; right: 15%; }
.st-xlabel { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.st-tip {
  position: absolute; top: -6px; transform: translate(-50%, -100%); z-index: 5; pointer-events: none;
  background: var(--raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 8px 10px; font-size: 12.5px; white-space: nowrap;
}
.st-tip b { display: block; margin-bottom: 2px; }
.st-tip div { display: flex; align-items: center; gap: 6px; color: var(--text-2); }

/* путь заявки */
.st-funnel { display: flex; flex-direction: column; gap: 14px; }
.st-step-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.st-step-head b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.st-step-track { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.st-step-fill { height: 100%; background: var(--chart-guests); border-radius: 5px; }
.st-step:first-child .st-step-fill { background: var(--chart-leads); }
.st-step-fill.win { background: var(--ok); }
.st-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.st-mini-item { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; }
.st-mini-item b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.st-mini-item span { font-size: 12px; color: var(--muted); }
.st-mini-item.warn b { color: var(--warn); }

/* сотрудники */
.st-staff { display: flex; flex-direction: column; }
.st-staff-row {
  display: grid; grid-template-columns: minmax(180px, 2fr) repeat(7, minmax(0, 1fr));
  gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.st-staff-row:last-child { border-bottom: 0; }
.st-staff-head { padding-top: 0; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.st-staff-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-staff-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st-cell b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.st-cell.warn b { color: var(--warn); }
/* Телефон клуба строкой среди сотрудников, ссылка на переписку, воронка по клубам (18.10.2026). */
.st-phone-row .avatar { display: grid; place-items: center; }
.st-talks { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.st-warn-text { color: var(--warn); }
.st-fclub-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(5, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.st-fclub-row b { font-size: 15px; font-variant-numeric: tabular-nums; }
.st-fclub-row:last-child { border-bottom: 0; }
.st-inline-bar { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; max-width: 120px; margin-top: 4px; }
.st-inline-bar i { display: block; height: 100%; background: var(--chart-leads); border-radius: 2px; }

/* тепловая карта */
.st-heat { display: grid; gap: 3px; align-items: center; }
.st-heat-h { font-size: 10.5px; color: var(--muted); text-align: left; font-variant-numeric: tabular-nums; }
.st-heat-d { font-size: 11px; color: var(--muted); font-weight: 700; }
.st-heat-c { display: block; aspect-ratio: 1 / 1; min-height: 12px; border-radius: 2px; background: var(--surface-2); outline: none; cursor: default; }
.st-heat-c:focus-visible, .st-heat .st-heat-c:hover { box-shadow: 0 0 0 2px var(--text); }
.st-heat-c.l1 { background: rgba(var(--heat), .18); }
.st-heat-c.l2 { background: rgba(var(--heat), .36); }
.st-heat-c.l3 { background: rgba(var(--heat), .56); }
.st-heat-c.l4 { background: rgba(var(--heat), .78); }
.st-heat-c.l5 { background: rgb(var(--heat)); }
.st-heat-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; }
.st-heat-tip { font-size: 12.5px; color: var(--text-2); min-height: 18px; }
.st-heat-scale { display: flex; gap: 3px; align-items: center; font-size: 11px; color: var(--muted); }
.st-heat-scale i { width: 12px; min-height: 12px; height: 12px; }
.st-heat-scale span { margin: 0 4px; }

/* темы */
.st-topics { display: flex; flex-direction: column; gap: 12px; }
.st-topic-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; margin-bottom: 5px; }
.st-topic-head > span:first-child { font-weight: 700; }
.st-topic-head .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-topic-head b { font-variant-numeric: tabular-nums; }

/* бот и менеджеры */
.st-lines { display: flex; flex-direction: column; }
.st-line { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.st-line:first-child { padding-top: 0; }
.st-line:last-child { border-bottom: 0; padding-bottom: 0; }
.st-line-label { font-weight: 650; }
.st-line-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-line.warn .st-line-value { color: var(--warn); }

/* клубы и каналы */
.st-where { display: flex; flex-direction: column; }
.st-where-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.st-where-row b { font-size: 15px; font-variant-numeric: tabular-nums; }
.st-where-head { padding-top: 0; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.st-channels { margin-top: 18px; }
.st-chan-list { display: flex; flex-direction: column; gap: 8px; }
.st-chan { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); font-weight: 650; }
.st-chan .icon { color: var(--muted); }
.st-chan b { font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.st-future { margin-top: 10px; }

@media (max-width: 1280px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .st-controls { width: 100%; }
  .st-controls .seg { width: 100%; }
  .st-controls .seg button { flex: 1 1 0; }
  .st-controls .input { flex: 1 1 140px; min-width: 0; }
  .st-hero-text { font-size: 15px; flex-basis: 100%; }
  .st-open { flex-basis: 100%; }
  .st-chart { height: 180px; }
  .st-card .card-body { padding: 14px; }
  /* Сотрудник на телефоне — карточка: имя сверху, цифры сеткой 2 × N с подписями. */
  .st-staff-head { display: none; }
  .st-staff-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding: 14px 0; align-items: start; }
  .st-staff-who { grid-column: 1 / -1; }
  .st-cell::before { content: attr(data-label); font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  .st-where-row { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 8px; }
  .st-where-row b { font-size: 14px; }
  .st-cell-empty { display: none; }
  .st-fclub-row { gap: 6px; font-size: 12px; }
  .st-fclub-row b { font-size: 14px; }
  .st-fclub-row.st-where-head span { font-size: 9.5px; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; }
  .st-line-value { font-size: 19px; }
  .st-mini-item b { font-size: 18px; }
}

/* ── Диалоги: поиск по всем чатам и канал (17.10.2026) ── */
.inbox-search-row { display: flex; gap: 8px; min-width: 0; }
.inbox-search-row .input-search { flex: 1 1 auto; min-width: 0; }
.inbox-channel { flex: 0 0 auto; width: auto; max-width: 150px; }
/* «Отвечал сотрудник: X» (18.10.2026) — у маркетолога и управляющего; на телефоне — строкой ниже. */
.inbox-search-row:has(.inbox-staff) { flex-wrap: wrap; }
.inbox-staff { flex: 1 1 100%; min-width: 0; }
.inbox-staff.is-set { border-color: var(--accent); }
/* Прайс и шаблоны над полем ответа (18.10.2026): одна строка, на телефоне листается вбок. */
.composer-quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 2px; scrollbar-width: none; }
.composer-quick::-webkit-scrollbar { display: none; }
.composer-quick[hidden] { display: none; }
.quick-btn { flex: none; white-space: nowrap; }
.quick-price { font-weight: 750; }
.quick-list { display: flex; flex-direction: column; }
.quick-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.quick-row:last-child { border-bottom: 0; }
.quick-row.is-off { opacity: .6; }
.quick-text { margin-top: 4px; }
/* Путь заявки в её карточке (18.10.2026). */
.lead-path { list-style: none; margin: 0 0 14px; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.lead-path li { position: relative; padding: 0 0 10px 8px; font-size: 13px; }
.lead-path li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--surface); }
.lead-path li.done::before { background: var(--ok); }
.lead-path li.warn::before { background: var(--warn); }
.lead-path li b { font-weight: 700; }
.inbox-channel.is-set { border-color: var(--accent); }
.inbox-search-note { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: -4px; }
.inbox-search-note.hidden { display: none; }
.seg.is-dim { opacity: .55; }
.conv.found .conv-preview .text { color: var(--text-2); }
.conv-preview mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; font-weight: 700; }
.msg.msg-found .msg-bubble, .msg.msg-found .msg-content { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .3s; }
@media (max-width: 860px) {
  .inbox-channel { max-width: 120px; }
}

/* ── Каналы → WhatsApp → номер → «Синхронизация» ── */
.sync-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sync-tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.sync-tile b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.sync-tile span { font-size: 12px; color: var(--muted); }
.sync-section { margin-top: 14px; }
.sync-section h4 { font-size: 13px; margin: 0 0 8px; }
.sync-lines { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }

/* ── медиатека демо-номера (Агент → Живой менеджер) ───────────────────────── */
.lib-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.lib-item:last-child { border-bottom: 0; }
.lib-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lib-file { position: relative; }
.lib-thumb { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: rgba(127, 127, 127, .14); }
.lib-thumb-doc { font-size: 11px; font-weight: 800; color: var(--muted); }
.lib-remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.lib-remove:hover { color: var(--danger); }

/* Заявки: отбор по клубу, каналу и периоду над вкладками статусов (21.10.2026). */
.lead-head { flex-direction: column; align-items: stretch; gap: 10px; }
.lead-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lead-filters select { width: auto; min-width: 150px; max-width: 100%; }
.lead-filters select.is-set { border-color: var(--text); font-weight: 600; }
@media (max-width: 860px) {
  .lead-filters select { flex: 1 1 100%; }
}
