/* Панель управления ИИ-ботами. Стиль «Liquid Glass»:
   «рамка» (меню, всплывающие окна, выпадающие списки) — матовое стекло поверх
   сиреневого фона с цветными пятнами; содержимое — плотные белые карточки с мягкой
   тенью, без стекла, чтобы текст читался. Акцент — фирменный зелёный.
   Без интернета шрифт Inter не загрузится — подставится системный, вёрстка не поедет. */
/* Inter — локальная копия (было: Google Fonts). Переменный шрифт: один файл на все начертания 400–700. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-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: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-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;
}

/* Rubik — заголовки и цифры (OFL, локальная копия). Казахские буквы — в cyrillic-ext, ₸ — в latin-ext. */
@font-face {
  font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/rubik-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: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/rubik-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/rubik-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/rubik-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;
}

* { box-sizing: border-box; margin: 0; }

:root {
  /* Основные цвета */
  /* Фирменный зелёный — из логотипа IT-COMP. Имена --blue* остались прежними, чтобы не
     трогать сотни мест; это просто «акцент». Белый текст на --blue: контраст ≥ 4.5. */
  --blue: #078040;
  --blue-dark: #066a35;
  --blue-soft: #e2f3e8;       /* вторичные кнопки, активный пункт меню */
  --blue-softer: #f0f9f3;
  /* Цвет текста-акцента: ссылки, вторичные кнопки, активный пункт меню. В светлой теме — фирменный
     зелёный; в тёмной — светлый, почти белый: насыщенный зелёный текст на тёмном фоне «кислит». */
  --accent-text: #078040;
  --bg: #e8e9f1;              /* светло-серо-сиреневый фон под «стеклом» */
  /* Три мягких цветных пятна на фоне: фирменное зелёное, сиреневое, салатовое */
  --blob-1: rgba(7, 128, 64, .30);
  --blob-2: rgba(150, 140, 235, .32);
  --blob-3: rgba(181, 242, 107, .40);
  --card: #fff;
  --surface: #f3f4f8;         /* поля ввода, неактивные плашки внутри карточек */
  --surface-hover: #ebecf2;
  --border: #e6e8ef;
  --nav-text: #43464e;        /* неактивный пункт меню: тише основного текста, но контраст ≥ 7:1 */
  --text: #1c1d1f;
  --muted: #6b6e75;           /* серый текст: #7a7d84 на белом не дотягивал до 4.5:1 */
  --ink: #111214;             /* чёрная акцентная кнопка */
  --ink-text: #fff;

  /* Акцентные «плитки» */
  --lime: #b5f26b;
  --lime-soft: #ecfdd6;
  --lime-text: #2f6b00;
  --peach: #ffe9c2;
  --peach-soft: #fff4e0;
  --peach-text: #8a4b00;
  --red-soft: #ffeceb;
  --red-text: #c62a2a;
  --green: #1aa053;
  --amber: #ff9f0a;
  --violet-soft: #efe9ff;
  --violet-text: #5b2fc9;

  /* Сообщения */
  --msg-user: #fff;
  --msg-bot: #dcf2e3;
  --msg-operator: #d9f7b0;
  --chat-bg: #f5f6fa;

  /* Форма */
  --r-xl: 32px;
  --r-lg: 28px;
  --r-md: 16px;
  --r-sm: 12px;
  /* Тень карточки — двухслойная: короткая плотная у края и длинная мягкая */
  --shadow-sm: 0 2px 6px rgba(40, 42, 80, .04), 0 12px 32px rgba(40, 42, 80, .06);
  --shadow-md: 0 4px 10px rgba(40, 42, 80, .05), 0 18px 40px rgba(40, 42, 80, .10);
  --shadow-lg: 0 24px 64px rgba(30, 32, 70, .20);
  --ring: 0 0 0 3px rgba(7, 128, 64, .25);

  /* Стекло — только на «рамке»: меню, окна, выпадающие списки */
  --glass: linear-gradient(140deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .30));
  /* Окна и списки с формами — стекло плотнее: под ним бывает пёстрое содержимое */
  --glass-strong: linear-gradient(140deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .84));
  /* Блик по верхнему левому краю — то, что делает стекло «жидким» */
  --glass-shine: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, .55), transparent 45%);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .25);
  --glass-shadow: 0 12px 40px rgba(40, 42, 80, .12);
  --glass-blur: blur(26px) saturate(180%);
  --glass-solid: #f6f6fa;     /* без размытия (старый браузер, «меньше прозрачности») */
  --glass-hover: rgba(255, 255, 255, .45);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Rubik", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);

  color-scheme: light;
}

/* Тёмная тема — только по желанию: <html data-theme="dark">.
   Сама по системным настройкам не включается — панель всегда белая. */
:root[data-theme="dark"] {
  --blue: #23a35b; --blue-dark: #2fb86a; --blue-soft: #1d2a22; --blue-softer: #172019; --accent-text: #d3eedd;
  --bg: #0d0e12; --card: #17181d; --surface: #22232a; --surface-hover: #2a2b33;
  --blob-1: rgba(47, 184, 106, .22); --blob-2: rgba(110, 100, 220, .22); --blob-3: rgba(181, 242, 107, .10);
  --border: #26282f; --text: #eef0f4; --muted: #8f939f; --nav-text: #b9bcc6; --ink: #f2f3f5; --ink-text: #111214;
  --lime-soft: #22311a; --lime-text: #a8e46a; --peach: #3d2e17; --peach-soft: #2e2416; --peach-text: #ffc46b;
  --red-soft: #3a1f1f; --red-text: #ff8a80; --violet-soft: #2a2340; --violet-text: #b9a2ff;
  --msg-user: #26272b; --msg-bot: #1c3a27; --msg-operator: #2b4a19; --chat-bg: #151618;
  --shadow-sm: 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(47, 184, 106, .35);
  --glass: linear-gradient(140deg, rgba(40, 42, 50, .62), rgba(24, 25, 30, .40));
  --glass-strong: linear-gradient(140deg, rgba(36, 38, 46, .92), rgba(22, 23, 28, .86));
  --glass-shine: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, .07), transparent 45%);
  --glass-edge: rgba(255, 255, 255, .10);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -1px 0 rgba(255, 255, 255, .03);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --glass-solid: #1a1b21;
  --glass-hover: rgba(255, 255, 255, .06);
  color-scheme: dark;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  min-height: 100vh;
  /* Фон под стеклом: без пятен размытие нечего «размывать» и стекло выглядит серым */
  background:
    radial-gradient(520px 420px at 8% 12%, var(--blob-1), transparent 70%),
    radial-gradient(620px 520px at 92% 18%, var(--blob-2), transparent 70%),
    radial-gradient(560px 460px at 70% 100%, var(--blob-3), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
::selection { background: rgba(7, 128, 64, .22); }
.hidden, [hidden] { display: none !important; }
/* Заявки, ждущие подтверждения: их легко забыть, поэтому видно сразу. */
.muted { color: var(--muted); font-size: 14px; }
p.muted { margin: 6px 0 12px; line-height: 1.5; }
b, strong { font-weight: 600; }
a { color: var(--accent-text); }
code { background: var(--blue-soft); color: var(--accent-text); padding: 2px 7px; border-radius: 6px; font-size: .9em; }
pre { background: #16171a; color: #d7dae0; padding: 16px 18px; border-radius: var(--r-md); overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 8px 0 14px; }

/* Тонкие полосы прокрутки */
* { scrollbar-width: thin; scrollbar-color: rgba(128, 132, 140, .35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(128, 132, 140, .35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(128, 132, 140, .55); }

:focus-visible { outline: none; box-shadow: var(--ring); }

/* ================= Заголовки ================= */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); }
h2 { font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; margin-bottom: 10px; }
h3 { font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; margin-bottom: 12px; }
h4 { font-size: 15px; font-weight: 600; margin: 16px 0 6px; }
h3 .muted, h2 .muted { font-weight: 500; font-size: .85em; }
h3 > .ico { color: var(--accent-text); margin: -3px 8px 0 0; }
.learning-banner .ico { color: var(--peach-text); margin: -2px 8px 0 0; }
.upload-btn .ico { width: 20px; height: 20px; }

/* ================= Кнопки ================= */
button { font-family: inherit; }

/* Кнопки без класса (например, «Отключить» в настройках) — спокойные серые. */
button:not([class]), button[class=""] {
  background: var(--surface); color: var(--text); border: none;
  padding: 10px 18px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; font-weight: 500;
  transition: background-color .15s ease, transform .12s ease;
}
button:not([class]):hover, button[class=""]:hover { background: var(--surface-hover); }

button.primary, button.secondary, .upload-btn, .mode-btn, .outcome-btn, .logout, .fix-btn, .icon-btn {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
button:active:not(:disabled), .upload-btn:active { transform: scale(.97); }

button.primary {
  background: var(--blue); color: #fff; border: none;
  padding: 10px 20px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; font-weight: 500; line-height: 20px;
}
button.primary:hover { background: var(--blue-dark); }
button.primary .muted { color: rgba(255, 255, 255, .75); font-size: 13px; }

/* Вторичная — светло-синяя */
button.secondary {
  background: var(--blue-soft); color: var(--accent-text); border: none;
  padding: 10px 20px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; font-weight: 500; line-height: 20px;
}
button.secondary:hover { background: color-mix(in srgb, var(--blue-soft) 70%, var(--blue) 12%); }
button.small { padding: 7px 14px; font-size: 13px; line-height: 18px; border-radius: 10px; }
button:disabled { opacity: .5; cursor: default; }

/* Кнопки, стоящие рядом в карточке, не слипаются */
.card > button + button, .card > button + span.muted { margin-left: 8px; }
.card > button, .card > .actions { margin-top: 4px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between h3 { margin-bottom: 0; }
.card > .row-between { margin-bottom: 12px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ================= Поля ввода ================= */
input:not([type]), input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="time"], input[type="email"], input[type="tel"], input[type="url"], textarea, select {
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 11px 14px;
  line-height: 20px;
  outline: none;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
input:not([type]):hover, input[type="text"]:hover, input[type="password"]:hover, input[type="number"]:hover,
input[type="time"]:hover, textarea:hover, select:hover { background-color: var(--surface-hover); }
input:not([type]):focus, input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="search"]:focus,
input[type="time"]:focus, input[type="email"]:focus, input[type="tel"]:focus, input[type="url"]:focus, textarea:focus, select:focus {
  background-color: var(--card); border-color: var(--blue); box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
textarea { resize: vertical; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
  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='%237a7d84' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
input[type="number"] { font-variant-numeric: tabular-nums; }

label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 500; color: var(--text); }
label input, label textarea, label select { display: block; width: 100%; margin-top: 6px; font-weight: 400; }

/* Флажки: синие, со скруглением */
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
label input[type="checkbox"], label input[type="radio"] { display: inline-block; width: 18px; margin: 0; vertical-align: middle; }

/* Переключатель вместо галочки у «включено/выключено» */
.switch-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500; margin: 2px 0 6px; cursor: pointer; user-select: none;
}
.switch-label input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: relative; width: 40px; height: 24px; margin: 0;
  border-radius: 999px; background: #c9cdd3; cursor: pointer;
  transition: background-color .2s ease;
}
.switch-label input[type="checkbox"]::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .25s var(--ease-spring);
}
.switch-label input[type="checkbox"]:checked { background: var(--blue); }
.switch-label input[type="checkbox"]:checked::before { transform: translateX(16px); }
.switch-label input[type="checkbox"]:disabled { opacity: .45; cursor: default; }

/* ================= Вход ================= */
.login-screen {
  /* Фон — общий, с цветными пятнами (body) */
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
/* Карточка входа — стекло, как всплывающее окно (стекло задано ниже, в «Стекле») */
.login-card {
  padding: 40px 40px 32px; border-radius: var(--r-xl);
  width: 400px; max-width: 100%; text-align: center;
  animation: rise-in .6s var(--ease-out) both;
}
/* ЛОГОТИП на экране входа — по центру: куб и «comp». Файлы: img/logo-light.png,
   в тёмной теме — img/logo-dark.png (белая надпись). Путь считается от style.css. */
.login-card::before {
  content: ""; display: block; width: 196px; height: 72px; margin: 0 auto 22px;
  background: url("img/logo-light.png") center / contain no-repeat;
  animation: logo-in .7s var(--ease-spring) .1s both;
}
:root[data-theme="dark"] .login-card::before { background-image: url("img/logo-dark.png"); }
.login-card h1 { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -.025em; margin-bottom: 8px; hyphens: none; -webkit-hyphens: none; }
.login-card p { color: var(--muted); margin-bottom: 28px; font-size: 15px; }
.login-card input { width: 100%; padding: 14px 16px; margin-bottom: 12px; font-size: 16px; }
/* Телефон входа: «+7» слева, номер — в том же поле */
.phone-field { display: flex; align-items: center; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid transparent; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; cursor: text; }
.phone-field:focus-within { background: var(--card); border-color: var(--blue); box-shadow: var(--ring); }
.phone-cc { padding: 14px 10px 14px 16px; font-size: 16px; color: var(--text); border-right: 1px solid var(--border); }
.login-card .phone-field input, .login-card .phone-field input:focus { margin: 0; padding-left: 12px; background: transparent; border: 0; box-shadow: none; letter-spacing: .02em; }
.login-card button {
  width: 100%; padding: 14px; background: var(--blue); color: #fff; border: none;
  border-radius: 16px; box-shadow: 0 8px 20px rgba(7, 128, 64, .25); font-size: 16px; font-weight: 500; cursor: pointer;
  transition: background-color .15s ease, transform .12s ease;
}
.login-card button:hover { background: var(--blue-dark); }
.error { color: var(--red-text); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ================= Каркас ================= */
.app { display: flex; min-height: 100vh; }

/* Меню — отдельная стеклянная плашка с отступом от края экрана (стекло — в «Стекле») */
.sidebar {
  width: 256px; flex-shrink: 0; color: var(--text);
  margin: 16px 0 16px 16px; border-radius: var(--r-xl);
  padding: 22px 14px 16px; display: flex; flex-direction: column;
  position: sticky; top: 16px; height: calc(100vh - 32px); overflow-y: auto;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.15; letter-spacing: -.02em;
  padding: 4px 12px 22px; overflow: hidden;
  /* Меню — колонка высотой в экран: без этого при длинном списке разделов шапка сжималась
     и логотип с названием обрезались сверху. */
  flex-shrink: 0;
}
/* ЛОГОТИП в шапке слева от названия — куб IT-COMP. Файл: img/icon-256.png */
.logo::before {
  content: ""; width: 40px; height: 40px; flex-shrink: 0;
  /* В шапке — только куб: название и так написано рядом. */
  background: url("img/icon-256.png") center / contain no-repeat;
  transition: transform .3s var(--ease-spring);
}
.logo:hover::before { transform: scale(1.05); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar a {
  display: flex; align-items: center; gap: 12px; position: relative;
  color: var(--nav-text); text-decoration: none;
  padding: 9px 12px; border-radius: 14px;
  font-size: 15px; font-weight: 500;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.sidebar a:hover { background: var(--glass-hover); color: var(--text); }
/* Активный пункт — белая «таблетка» с тенью и тонкой зелёной полоской у края меню */
.sidebar a.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.sidebar a.active::before {
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px;
  width: 3px; border-radius: 3px; background: var(--blue);
}
.sidebar a:active { transform: scale(.98); }

/* Иконки — скруглённые линии, синие. Рисуются маской, цвет задаётся background-color. */
.nav-ico, .ico {
  display: inline-block; flex-shrink: 0; vertical-align: middle;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.ico { width: 1.25em; height: 1.25em; }
/* Значки меню — тонкие, цвета подписи; у активного пункта — фирменного цвета */
.nav-ico {
  width: 22px; height: 22px; background-color: currentColor;
  transition: transform .25s var(--ease-spring);
}
.sidebar a.active .nav-ico { background-color: var(--accent-text); }
.sidebar a:hover .nav-ico { transform: scale(1.08); }
.sidebar a.active .nav-ico { transform: scale(1.08); }

/* Подписи групп в меню: сами по себе не кликаются, только разделяют смысл. */
.nav-group { font-size: 12px; font-weight: 500; color: var(--muted); padding: 16px 12px 6px; }
.sidebar nav > .nav-group:first-child { padding-top: 0; }
.nav-sep { height: 1px; background: color-mix(in srgb, var(--text) 10%, transparent); margin: 12px 12px 8px; }

/* Настройки разложены по вкладкам: показывается одна подсистема за раз. */
.set-pane { display: flex; flex-direction: column; }

.logout {
  background: var(--glass-hover); border: none; color: var(--nav-text);
  padding: 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; font-weight: 500; margin-top: 12px;
}
.logout:hover { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

.content { flex: 1; min-width: 0; padding: 34px 40px 48px 32px; max-width: 1264px; }
.page { display: none; }
/* Заполнение backwards, а не both: анимация, оставшаяся «в силе» после конца, держит transform,
   и тогда position: fixed внутри раздела (список «Настроить» в «Компаниях», переписка
   на телефоне) отсчитывается от раздела или карточки, а не от экрана. */
.page.active { display: block; animation: page-in .45s var(--ease-out) backwards; }

/* Карточки-плитки */
/* Содержимое — плотные белые карточки без стекла: текст на них читается как на бумаге */
.card {
  background: var(--card); border: 1px solid transparent; border-radius: var(--r-lg);
  padding: 24px 28px; margin-top: 18px; box-shadow: var(--shadow-sm);
}
.page.active > .card, .page.active > .set-pane > .card, .page.active > .stat-cards, .page.active > .mode-grid > .mode-card {
  animation: rise-in .5s var(--ease-out) backwards;
}
.page.active > .card:nth-of-type(2), .page.active > .set-pane > .card:nth-of-type(2) { animation-delay: .04s; }
.page.active > .card:nth-of-type(3), .page.active > .set-pane > .card:nth-of-type(3) { animation-delay: .08s; }
.page.active > .card:nth-of-type(4), .page.active > .set-pane > .card:nth-of-type(4) { animation-delay: .12s; }
.page.active > .card:nth-of-type(n+5), .page.active > .set-pane > .card:nth-of-type(n+5) { animation-delay: .16s; }

/* ================= Плашки-предупреждения ================= */
/* Banner (вопросы по базе знаний) */
.banner {
  background: var(--peach); border: none; border-radius: var(--r-lg);
  padding: 18px 24px; margin-top: 16px; font-size: 15px; color: var(--text);
  animation: rise-in .5s var(--ease-out) both;
}
.banner .q-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; margin-top: 10px; background: color-mix(in srgb, var(--card) 60%, transparent); border-radius: var(--r-sm);
}
/* Кнопки у вопроса, на который бот не смог ответить */
.banner .q-acts { display: flex; gap: 8px; flex-shrink: 0; }
.banner button.secondary { background: color-mix(in srgb, var(--card) 85%, transparent); color: var(--text); }
.banner button.secondary:hover { background: var(--card); }

/* Предупреждение о том, что документ разобран не целиком */
.doc-note { font-size: 13px; color: var(--peach-text); background: var(--peach-soft); border-radius: 10px; padding: 8px 12px; margin: 6px 0 2px; }

/* Режим обучения: полоса сверху на всех страницах */
.learning-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 20px; padding: 14px 18px 14px 22px; border: none;
  background: var(--peach); color: var(--peach-text); border-radius: var(--r-lg); font-size: 14px;
}
.learning-banner b { color: var(--text); }
.learning-banner-actions { display: flex; align-items: center; gap: 12px; }
.learning-banner a { color: var(--peach-text); font-weight: 600; text-decoration: none; }
.learning-banner a:hover { text-decoration: underline; }

/* Предупреждение, когда данные раздела не загрузились: пустая форма похожа
   на стёртые настройки, и человек должен видеть разницу. */
.load-error {
  margin: 0 0 16px; padding: 14px 18px;
  border: none; border-left: 4px solid var(--red-text); border-radius: var(--r-md);
  background: var(--red-soft); color: var(--red-text); line-height: 1.5;
}

/* ================= Вкладки-пилюли ================= */
.tabs { display: flex; gap: 4px; margin: 14px 0; flex-wrap: wrap; }
.tabs button {
  border: none; background: transparent; color: var(--text);
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 500; line-height: 20px;
  transition: background-color .15s ease, color .15s ease, transform .12s ease;
}
.tabs button:hover { background: var(--card); }
.card .tabs button:hover, .conv-side .tabs button:hover { background: var(--surface); }
.tabs button.active, .tabs button.active:hover { background: var(--blue-soft); color: var(--accent-text); }
/* Вкладки на сером фоне страницы — белые, чтобы читались */
.page > .tabs button.active { background: var(--card); color: var(--accent-text); box-shadow: var(--shadow-sm); }
/* Счётчик позиций в кнопке вкладки */
.tabs button span { margin-left: 6px; opacity: .55; font-variant-numeric: tabular-nums; }
.tabs button.active span { opacity: .8; }

/* ================= База знаний ================= */
#kb-search { width: 100%; margin-top: 12px; }
.kb-item { border-top: 1px solid var(--border); padding: 16px 4px; }
.kb-item:first-child { border-top: none; }
.kb-item .cat {
  display: inline-block; font-size: 12px; font-weight: 500; color: var(--accent-text);
  background: var(--blue-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.kb-item h4 { font-size: 15px; margin: 0 0 4px; }
.kb-item p { font-size: 14px; color: var(--muted); white-space: pre-wrap; line-height: 1.5; }
.kb-item p.muted { font-size: 13px; margin: 6px 0 0; }
.kb-item .actions { margin-top: 10px; display: flex; gap: 4px; flex-wrap: wrap; }
.kb-item .actions button {
  background: none; border: none; color: var(--accent-text); cursor: pointer;
  font-size: 13px; font-weight: 500; padding: 5px 10px; border-radius: 8px; margin-left: -2px;
  transition: background-color .15s ease;
}
.kb-item .actions button:hover { background: var(--blue-soft); }
.kb-item .actions button.danger { color: var(--red-text); }
.kb-item .actions button.danger:hover { background: var(--red-soft); }

/* Выключенный элемент остаётся на виду, но заметно тише: он не в промпте. */
.kb-item.disabled h4, .kb-item.disabled p { opacity: .5; }
.kb-item .muted-cat { color: var(--muted); background: var(--surface); margin-left: 6px; }

.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.doc-row:last-child { border-bottom: none; }
.doc-row .status-ready { color: var(--green); }
.doc-row .status-processing { color: var(--amber); }
.doc-row .status-error { color: var(--red-text); }
/* Чёрная акцентная кнопка */
.upload-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  background: var(--ink); color: var(--ink-text); padding: 11px 20px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 14px; font-weight: 500;
}
.upload-btn:hover { background: color-mix(in srgb, var(--ink) 85%, var(--blue)); }

/* Форма добавления памятки: два поля и кнопка выбора файла в столбик. */
.handout-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.handout-form .upload-btn { align-self: flex-start; margin-top: 4px; }

/* Разбор переписок: черновики статей, которые ждут решения владельца. */
.inline { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 14px; font-weight: 400; flex-wrap: wrap; }
.inline input[type="checkbox"] { margin: 0; }
.inline input:not([type="checkbox"]) { display: inline-block; margin: 0; padding: 7px 10px; }
.time-input { max-width: 90px; text-align: center; }
.draft {
  border: none; border-radius: var(--r-md); padding: 16px; margin-bottom: 12px; background: var(--surface);
}
.draft input, .draft textarea { width: 100%; margin-bottom: 8px; background: var(--card); }
.draft input { font-weight: 600; }
.draft textarea { min-height: 150px; font-size: 14px; line-height: 1.55; }
.draft .src { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.draft .same { font-size: 13px; color: var(--peach-text); background: var(--peach); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.draft .actions { display: flex; gap: 8px; }
.draft .actions button:first-child { background: var(--blue); color: #fff; }
.draft .actions button:first-child:hover { background: var(--blue-dark); }
.draft .actions button.danger { background: var(--card); color: var(--red-text); border: none; padding: 10px 18px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; font-weight: 500; }
.draft .actions button.danger:hover { background: var(--red-soft); }

/* ================= Диалоги ================= */
.dialogs-layout { display: flex; gap: 16px; margin-top: 18px; height: calc(100vh - 140px); min-height: 520px; }
.conv-side { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
#conv-search {
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237a7d84' 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") 14px center no-repeat;
  padding-left: 42px; border-radius: 999px;
}
#conv-search:focus { background-color: var(--card); }
.conv-side .tabs { margin: 0; flex-wrap: nowrap; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.conv-side .tabs::-webkit-scrollbar { display: none; }
.conv-side .tabs button { padding: 8px 12px; white-space: nowrap; flex-shrink: 0; }
.conv-side .tabs button:hover { background: var(--card); }
.conv-list {
  flex: 1; background: var(--card); border: none; border-radius: var(--r-lg);
  overflow-y: auto; padding: 6px; box-shadow: var(--shadow-sm);
}
.conv-row {
  padding: 12px 14px; border-bottom: none; border-radius: var(--r-md);
  cursor: pointer; position: relative; margin-bottom: 2px;
  transition: background-color .15s ease;
}
.conv-row + .conv-row::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: -1px; height: 1px; background: var(--border);
  transition: opacity .15s ease;
}
.conv-row:hover::before, .conv-row.active::before, .conv-row:hover + .conv-row::before, .conv-row.active + .conv-row::before { opacity: 0; }
/* Клиент написал последним — такой диалог видно, не вчитываясь. */
/* Как непрочитанный диалог: последнее сообщение тёмное и жирнее, без значков */
.conv-row.waiting { border-left: none; }
.conv-row.waiting .last { color: var(--text); font-weight: 500; }
.conv-row .when { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.conv-row .marks { display: flex; gap: 4px 14px; margin-top: 5px; flex-wrap: wrap; }
/* Статусы — просто цветной текст, без плашек и значков.
   Тексты приходят из программы в разном регистре («Сделка», «ждёт ответа») —
   выравниваем: всё строчными, первая буква заглавная. */
.conv-row .mark {
  display: inline-block;
  font-size: 13px; font-weight: 600; line-height: 18px;
  background: none; border-radius: 0; padding: 0; color: #5f636b;
  text-transform: lowercase;
}
.conv-row .mark::first-letter { text-transform: uppercase; }
.conv-row .mark.wait { color: #d9590b; }
.conv-row .mark.pause { color: #5f636b; }
/* Номер из списка молчания: бот здесь не отвечает никогда, а не «пока». */
.conv-row .mark.silent { color: #6a3fd1; }
.conv-row .mark.deal { color: #16883f; }
.conv-row .mark.refused { color: #d32f2f; }
.conv-row .mark.done { color: #5f636b; }
.conv-row:hover { background: var(--surface); }
.conv-row.active { background: var(--blue-soft); }
.conv-row .name { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-row .last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }

.chan { font-size: 11.5px; font-weight: 500; color: #fff; background: #6b7280; border-radius: 999px !important; padding: 2px 9px !important; white-space: nowrap; }
.chan.telegram { background: #229ed9; }
.chan.whatsapp { background: #1fbd5a; }
.chan.instagram { background: #e1306c; }
.chan.widget { background: #7c3aed; }

.conv-view {
  flex: 1; min-width: 0; background: var(--card); border: none; border-radius: var(--r-lg);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm);
}
.conv-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-weight: 600; font-size: 15px;
}
.conv-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Итог диалога: серым — не отмечен, зелёным — сделка, красным — отказ. */
.outcome-btn {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; border: none;
  background: var(--surface); color: var(--text);
}
.outcome-btn:hover { background: var(--surface-hover); }
.outcome-btn.deal { background: var(--lime-soft); color: var(--lime-text); }
.outcome-btn.refused { background: var(--red-soft); color: var(--red-text); }
.outcome-btn.muted { background: var(--surface); color: var(--muted); }
.conv-header .switch-label { margin: 0 0 0 6px; font-weight: 500; }

.conv-messages { flex: 1; overflow-y: auto; padding: 20px; background: var(--chat-bg); scroll-behavior: smooth; }
.conv-messages.tall { min-height: 380px; max-height: 60vh; }
.placeholder { color: var(--muted); text-align: center; margin-top: 40px; font-size: 15px; }
.msg {
  max-width: 72%; width: fit-content; margin: 6px 0; padding: 10px 14px; border-radius: 18px;
  font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; color: var(--text);
}
.msg.user { background: var(--msg-user); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); }
.msg.assistant { background: var(--msg-bot); margin-left: auto; border-bottom-right-radius: 6px; }
.msg.operator { background: var(--msg-operator); margin-left: auto; border-bottom-right-radius: 6px; }
.msg .who { display: block; font-size: 12px; font-weight: 400; color: var(--text); opacity: .5; margin-bottom: 3px; }

/* Вложение внутри сообщения */
.msg .att-image { display: block; max-width: 260px; max-height: 260px; border-radius: 12px; margin-top: 8px; cursor: zoom-in; transition: transform .2s var(--ease-out); }
.msg .att-image:hover { transform: scale(1.02); }
.msg .att-file {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 12px;
  border: none; border-radius: var(--r-sm); background: var(--card); color: var(--accent-text);
  text-decoration: none; font-size: 13px; font-weight: 500;
}
.msg .att-file:hover { background: var(--blue-softer); }
.msg .att-loading { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Палитра смайликов над строкой ответа */
.emoji-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--card); animation: rise-in .25s var(--ease-out) both; }
.emoji-bar button { background: none; border: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 6px; border-radius: 10px; transition: background-color .12s ease, transform .2s var(--ease-spring); }
.emoji-bar button:hover { background: var(--surface); transform: scale(1.15); }

.conv-reply { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--card); }
.conv-reply input { flex: 1; min-width: 0; border-radius: 999px; padding: 11px 18px; }
.conv-reply button {
  background: var(--blue); color: #fff; border: none; padding: 11px 20px; border-radius: 999px;
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background-color .15s ease, transform .12s ease;
}
.conv-reply button:hover { background: var(--blue-dark); }
.conv-reply button.secondary { background: var(--surface); color: var(--text); }
.conv-reply button.secondary:hover { background: var(--surface-hover); }

.icon-btn, .conv-reply .icon-btn {
  background: transparent; border: none; border-radius: 50%; cursor: pointer;
  font-size: 20px; line-height: 1; width: 40px; height: 40px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent-text);
}
.icon-btn .ico { width: 24px; height: 24px; transition: transform .25s var(--ease-spring); }
.icon-btn:hover .ico { transform: scale(1.1) rotate(-6deg); }
.icon-btn:hover, .conv-reply .icon-btn:hover { background: var(--surface); }
.icon-btn:disabled { opacity: .5; cursor: default; }

/* Тестирование: чат во всю карточку */
.card.test-chat { padding: 0; overflow: hidden; }
.card.test-chat .conv-messages.tall { min-height: 440px; }

/* «Исправить ответ» под ответом бота в Тестировании */
.fix-btn {
  display: block; margin: -2px 4px 12px auto; padding: 4px 12px; font-size: 12px; font-weight: 500;
  border: none; border-radius: 999px; background: var(--card); color: var(--accent-text); cursor: pointer;
}
.fix-btn:hover { background: var(--blue-soft); }
#fix-answer { font-family: inherit; font-size: 14px; }

/* ================= Статистика ================= */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.stat-card {
  background: var(--card); border: none; border-radius: var(--r-lg);
  padding: 20px 22px; min-width: 0; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .num {
  font-family: var(--font-display); font-size: 38px; line-height: 1.05; font-weight: 700;
  letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; margin-bottom: 6px;
}
.stat-card .lbl { font-size: 14px; font-weight: 500; color: var(--text); }
.stat-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* Первая плитка — главный показатель: белая, как остальные, акцент — только цифра */
.stat-card:first-child .num { color: var(--accent-text); }
.stat-card.good { background: var(--lime-soft); }
.stat-card.good .num { color: var(--lime-text); }
.stat-card.warn { background: var(--peach); border: none; }
.stat-card.warn .num { color: var(--peach-text); }

/* Воронка в статистике */
.funnel { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.funnel-step { display: grid; grid-template-columns: 180px 1fr auto; gap: 14px; align-items: center; font-size: 14px; }
.funnel-bar { background: var(--blue-softer); border-radius: 999px; height: 30px; position: relative; overflow: hidden; }
.funnel-bar i {
  position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 999px; display: block;
  transform-origin: left center; animation: grow-x .9s var(--ease-out) both;
}
.funnel-step:nth-child(2) .funnel-bar i { animation-delay: .08s; }
.funnel-step:nth-child(3) .funnel-bar i { animation-delay: .16s; }
.funnel-step:nth-child(n+4) .funnel-bar i { animation-delay: .24s; }
.funnel-step .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.funnel-step .val small { font-weight: 400; color: var(--muted); }
#stats-funnel-hint { margin-top: 14px; }

.chart-box { margin-top: 8px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.chart .bar {
  flex: 1; background: var(--blue); border-radius: 6px 6px 3px 3px; min-height: 3px; position: relative;
  transform-origin: bottom; animation: grow-y .7s var(--ease-out) both;
  transition: background-color .15s ease;
}
.chart .bar:hover { background: var(--blue-dark); z-index: 3; }
/* День без сообщений виден полоской: иначе провал не отличить от края графика. */
.chart .bar.empty { background: var(--surface-hover); min-height: 3px; }
.chart .bar:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--ink-text); font-size: 12px; font-weight: 500;
  padding: 4px 8px; border-radius: 8px; white-space: nowrap; z-index: 2; pointer-events: none;
  animation: fade-in .15s ease both;
}
.chart-labels { display: flex; gap: 4px; margin-top: 8px; }
.chart-labels span { flex: 1; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.chan-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15px; }

/* Каналы: состояние подключения */
.chan-status { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent); }
.dot.off { background: #c4c8ce; }

/* ================= Таблицы ================= */
/* Заголовок липкий: при прокрутке сотни строк колонки остаются подписанными. */
.table-wrap { margin-top: 14px; max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.cat-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.cat-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 12px 16px; text-align: left;
  font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted);
}
.cat-table td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.cat-table tbody tr:first-child td { border-top: none; }
.cat-table tbody tr { transition: background-color .12s ease; }
.cat-table tbody tr:hover td { background: var(--surface); }
/* tabular-nums — чтобы разряды чисел выстроились в столбик. */
.cat-table .num { width: 130px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-table td:last-child { width: 140px; }

/* ================= Поведение: карточки режимов ================= */
/* Ровно 3 колонки: 9 режимов ложатся сеткой 3×3, без «сиротской» карточки внизу */
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.mode-card {
  background: var(--card); border: none; border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 26px 26px 24px; display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow .25s var(--ease-out);
}
.mode-card:hover { box-shadow: var(--shadow-md); }
.mode-grid > .mode-card:nth-child(2) { animation-delay: .03s; }
.mode-grid > .mode-card:nth-child(3) { animation-delay: .06s; }
.mode-grid > .mode-card:nth-child(4) { animation-delay: .09s; }
.mode-grid > .mode-card:nth-child(5) { animation-delay: .12s; }
.mode-grid > .mode-card:nth-child(6) { animation-delay: .15s; }
.mode-grid > .mode-card:nth-child(7) { animation-delay: .18s; }
.mode-grid > .mode-card:nth-child(8) { animation-delay: .21s; }
.mode-grid > .mode-card:nth-child(n+9) { animation-delay: .24s; }
.mode-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.mode-icon {
  width: 56px; height: 56px; border-radius: 18px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background-color .2s ease, color .2s ease, transform .3s var(--ease-spring);
}
.mode-icon .ico { width: 28px; height: 28px; }
.mode-card.on .mode-icon { background: var(--blue-soft); color: var(--accent-text); }
.mode-card:hover .mode-icon { transform: scale(1.05); }
/* Статус — просто цветной текст, как статусы в диалогах */
.mode-state { font-size: 14px; font-weight: 600; color: var(--muted); background: none; padding: 0; }
.mode-state .dot { display: none; }
.mode-state.on { color: #16883f; }
.mode-card h3 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.mode-card p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); flex: 1; }
/* Компактная кнопка слева. Выключен — синяя «Включить», включён — светлая «Настроить». */
.mode-btn {
  align-self: flex-start; margin-top: 18px; padding: 10px 20px; border-radius: var(--r-sm);
  border: none; background: var(--blue); color: #fff;
  cursor: pointer; font-size: 14px; font-weight: 500; line-height: 20px;
}
.mode-btn:hover { background: var(--blue-dark); }
.mode-card.on .mode-btn { background: var(--blue-soft); color: var(--accent-text); }
.mode-card.on .mode-btn:hover { background: color-mix(in srgb, var(--blue-soft) 70%, var(--blue) 12%); }
@media (max-width: 1000px) and (min-width: 801px) {
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.days { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.day-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.day-row .switch-label { flex: 1; margin: 0; }
.day-row input[type='time'] { max-width: 120px; padding: 8px 10px; }
.mode-fields { margin-top: 8px; }
.mode-sub { font-size: 15px; margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
/* Напоминаниям некуда приходить: группа менеджеров не настроена. */
.mode-warn { font-size: 13px; color: var(--peach-text); background: var(--peach-soft); border-radius: 10px; padding: 8px 12px; margin: 6px 0 2px; }

/* «Пора повторить»: список кому и когда — строка в одну линию, подробности мелко. */
.rp-group { font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 2px; }
.rp-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rp-row:last-of-type { border-bottom: 0; }
.rp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rp-name { font-weight: 600; color: var(--text); text-decoration: none; }
.rp-name:hover { text-decoration: underline; }
.rp-what { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-note { font-size: 12px; color: var(--muted); }
.rp-when { font-size: 13px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.rp-when.rp-wait { color: var(--muted); font-weight: 400; }
.rp-skip { background: none; border: 0; padding: 4px 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.rp-skip:hover { color: var(--text); text-decoration: underline; }
.rp-more { background: none; border: 0; padding: 8px 0; font-size: 13px; color: var(--accent-text); cursor: pointer; }
.rp-sent { padding: 8px 0; border-bottom: 1px solid var(--border); }
.rp-sent:last-child { border-bottom: 0; }
.rp-sent p { margin: 4px 0 0; font-size: 13px; }

/* CRM: строка состояния подключения. */
.crm-state { font-weight: 600; color: var(--accent-text); margin: 4px 0 10px; }
.crm-state.bad { color: var(--peach-text); }

/* «Запись клиентов»: ссылка-подписка на календарь. */
.booking-ics { font-size: 12px; word-break: break-all; flex: 1; margin-right: 8px; }

/* Instagram: комментарии → директ, внутри карточки канала. */
.igc-box { margin-top: 12px; }
.igc-box label { display: block; margin-top: 8px; }

/* Группа в списке: включение и отдельная галочка «отвечать на всё». */
.group-row { border-bottom: 1px solid var(--border); padding: 8px 0; }
.group-row:last-child { border-bottom: 0; }
.group-row label { margin-bottom: 4px; }
.group-open { margin-left: 52px; font-size: 13px; opacity: .85; }
.group-open input:disabled + span { opacity: .45; }

/* Кнопка «← Диалоги» нужна только на телефоне, где переписка закрывает список. */
.conv-back { display: none; }

/* ================= Модальное окно ================= */
.modal {
  position: fixed; inset: 0; background: rgba(20, 22, 40, .32);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
  animation: fade-in .2s ease both;
}
/* Окно — плотное стекло (задано ниже, в «Стекле») */
.modal-card {
  border-radius: var(--r-xl); padding: 28px 28px 24px;
  width: 540px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  animation: modal-in .35s var(--ease-out) both;
}
.modal-card h3 { font-size: 24px; letter-spacing: -.02em; }

/* «Задайте свой пароль» (вход временным): поверх всего, фон панели не виден. */
.modal.must-change { z-index: 200; background: rgba(20, 22, 40, .55); }
.must-change .modal-card { width: 440px; }
/* Окно «Пора повторить»: в нём список клиентов — шире обычного, на телефоне как все. */
.modal-card.modal-wide { width: 880px; }
.followup-row.rp-settings { display: grid; grid-template-columns: 170px 150px 1fr; gap: 12px; align-items: end; }
.rp-settings input { width: 100%; }
@media (max-width: 800px) {
  .followup-row.rp-settings { grid-template-columns: 1fr 1fr; }
  .rp-settings .rp-words { grid-column: 1 / -1; }
}
.must-change label { display: block; margin-top: 12px; }
.must-change-rules { list-style: none; margin: 14px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.must-change-rules li { position: relative; padding-left: 20px; line-height: 1.7; }
.must-change-rules li::before { content: '•'; position: absolute; left: 4px; }
.must-change-rules li[data-rule]::before { content: '○'; left: 2px; }
.must-change-rules li.ok { color: var(--accent-text); }
.must-change-rules li.ok::before { content: '✓'; }

/* ================= Анимации ================= */
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes logo-in { from { opacity: 0; transform: scale(.6) rotate(-8deg); } to { opacity: 1; transform: none; } }

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

/* Без мыши ховеры не залипают после касания */
@media (hover: none) {
  .stat-card:hover, .mode-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .mode-card:hover .mode-icon { transform: none; }
}

/* ================= Ноутбук 1366 ================= */
@media (max-width: 1400px) {
  .content { padding: 28px 28px 40px; }
  .sidebar { width: 232px; }
  .conv-side { width: 310px; }
}

/* ================= Телефон и узкие окна ================= */
@media (max-width: 800px) {
  body { font-size: 15px; }
  .app { flex-direction: column; }
  /* Меню превращается в верхнюю стеклянную плашку с отступом от краёв */
  .sidebar {
    width: auto; height: auto; position: sticky; top: 8px; z-index: 50;
    margin: 8px 8px 0; border-radius: 22px;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 14px 8px 10px; overflow: visible;
  }
  /* На телефоне в полосе меню — логотип, текущий раздел и кнопка ☰; разделы раскрываются списком */
  .logo { font-size: 0; padding: 0; gap: 0; flex-shrink: 0; }
  .logo::before { width: 42px; height: 42px; }
  .sidebar .nav-current { display: block; flex: 1; min-width: 0; font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar .nav-toggle { display: flex; }
  .sidebar nav, .sidebar .logout { display: none; }
  .sidebar.open { flex-wrap: wrap; max-height: calc(100dvh - 16px); overflow-y: auto; padding-bottom: 12px; box-shadow: var(--glass-hi), var(--shadow-lg); }
  .sidebar.open nav { display: flex; flex-direction: column; flex-basis: 100%; gap: 2px; padding-top: 6px; }
  .sidebar.open .nav-group { display: block; padding: 12px 14px 4px; }
  .sidebar.open .nav-sep { display: block; }
  .sidebar a { white-space: nowrap; padding: 12px 14px; border-radius: 14px; font-size: 16px; gap: 12px; }
  .sidebar a.active::before { left: -10px; }
  .nav-ico { width: 20px; height: 20px; }
  .sidebar.open .logout { display: block; flex-basis: 100%; margin: 6px 0 4px; padding: 12px 14px; font-size: 15px; border-radius: 14px; }

  .content { padding: 18px 12px 32px; }
  h2 { font-size: 28px; }
  .card { padding: 18px 16px; border-radius: 20px; }
  .banner, .learning-banner { border-radius: 20px; padding: 14px 16px; }
  .banner .q-item { flex-direction: column; align-items: stretch; }
  .banner .q-acts > button { flex: 1; }

  .dialogs-layout { flex-direction: column; height: auto; min-height: 0; }
  .conv-side { width: 100%; }
  .conv-side .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .conv-list { width: 100%; max-height: 300px; }
  .conv-view { min-height: 70vh; }
  .conv-header { padding: 12px 14px; }
  .conv-messages { padding: 14px 12px; }
  .msg { max-width: 88%; }
  .conv-reply { padding: 10px; gap: 4px; }
  .conv-reply button[type="submit"] { padding: 11px 16px; }
  /* Поле в 16px — iOS не увеличивает страницу при фокусе */
  input, textarea, select { font-size: 16px !important; }

  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px; border-radius: 20px; }
  .stat-card .num { font-size: 30px; }
  .funnel-step { grid-template-columns: 1fr auto; }
  .funnel-step .funnel-bar { grid-column: 1 / -1; grid-row: 2; height: 24px; }
  .mode-grid { grid-template-columns: 1fr; }
  .modal { align-items: flex-end; padding: 0; }
  /* Пальцем по мелкой кнопке не попасть: не меньше 44 точек в высоту. */
  button.small, .test-chips button { min-height: 44px; }
  /* Окна «Оплата» и «ИИ» в «Компаниях» прокручиваются к себе — заголовок не под верхней полосой. */
  #ta-card, #tb-card { scroll-margin-top: 80px; }
  /* Тестирование: чат пониже, чтобы примеры и поле ответа были видны без прокрутки. */
  .card.test-chat .conv-messages.tall { min-height: 240px; max-height: 45vh; }
  .login-card { padding: 32px 22px 26px; }

  /* Диалоги: либо список, либо переписка. Открытая переписка — во весь экран. */
  .conv-list { max-height: none; min-height: 50vh; }
  .dialogs-layout .conv-view { display: none; }
  .dialogs-layout.conv-open .conv-side { display: none; }
  .dialogs-layout.conv-open .conv-view {
    display: flex; position: fixed; inset: 0; z-index: 60;
    height: 100vh; height: 100dvh; min-height: 0; border-radius: 0;
  }
  .conv-back {
    display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px 8px 10px; margin: 0;
    border: none; border-radius: 999px; background: var(--blue-soft); color: var(--accent-text);
    font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  }
  .conv-header { padding: 10px 12px; gap: 8px 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
  #conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conv-head-right { flex-basis: 100%; gap: 6px 8px; }
  .conv-head-right .outcome-btn { min-height: 36px; }
  /* Анимация появления раздела держит transform — и position: fixed переписки
     отсчитывался бы от раздела, а не от экрана. Пока переписка открыта, её нет. */
  body.conv-full .page.active { animation: none; }
  body.conv-full { overflow: hidden; }
  .dialogs-layout.conv-open .conv-reply { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .modal-card { border-radius: 24px 24px 0 0; max-height: 92vh; padding: 24px 18px calc(20px + env(safe-area-inset-bottom)); animation-name: sheet-in; }
  .day-row { flex-wrap: wrap; }
  .group-open { margin-left: 0; }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ================= Иконки меню ================= */
a[data-page="dialogs"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5c-4.97 0-9 3.58-9 8 0 1.86.71 3.57 1.9 4.93L4 20.5l4.3-1.6c1.13.4 2.38.6 3.7.6 4.97 0 9-3.58 9-8s-4.03-8-9-8z'/%3E%3C/svg%3E"); }
a[data-page="clients"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 19.5c0-3 2.7-5 6-5s6 2 6 5'/%3E%3Cpath d='M15.5 4.8a3.5 3.5 0 0 1 0 6.4'/%3E%3Cpath d='M17.5 14.7c2.1.6 3.5 2.3 3.5 4.8'/%3E%3C/svg%3E"); }
a[data-page="stats"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='17' height='17' rx='5'/%3E%3Cpath d='M8.5 16v-3M12 16V8M15.5 16v-5.5'/%3E%3C/svg%3E"); }
a[data-page="commissions"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M14.8 9.2c-.5-.9-1.6-1.4-2.8-1.4-1.6 0-2.8.8-2.8 2.1 0 2.9 5.8 1.5 5.8 4.3 0 1.3-1.3 2.1-3 2.1-1.3 0-2.5-.6-3-1.5M12 6.3v1.5M12 16.3v1.5'/%3E%3C/svg%3E"); }
.cm-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.cm-head label { display: flex; flex-direction: column; gap: 4px; }
.cm-total { font-size: 18px; font-weight: 600; }
a[data-page="tenants"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20.5V6.5l6-3v17'/%3E%3Cpath d='M10 9.5h8.5a1.5 1.5 0 0 1 1.5 1.5v9.5'/%3E%3Cpath d='M2.5 20.5h19M7 9v.01M7 12.5v.01M7 16v.01M14 13v.01M14 16.5v.01M17 13v.01M17 16.5v.01'/%3E%3C/svg%3E"); }
a[data-page="kb"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 7a3.5 3.5 0 0 1 3.5-3.5h8A3.5 3.5 0 0 1 19.5 7v10a3.5 3.5 0 0 1-3.5 3.5H8A3.5 3.5 0 0 1 4.5 17z'/%3E%3Cpath d='M8.5 8.5h7M8.5 12h7M8.5 15.5h4'/%3E%3C/svg%3E"); }
a[data-page="behavior"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 8H13M17 8h2.5M4.5 16H7M11 16h8.5'/%3E%3Ccircle cx='15' cy='8' r='2'/%3E%3Ccircle cx='9' cy='16' r='2'/%3E%3C/svg%3E"); }
a[data-page="scenarios"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13.2 3.5 5.6 13.1a.6.6 0 0 0 .47.97H11l-1 6.4 7.6-9.6a.6.6 0 0 0-.47-.97H12.2z'/%3E%3C/svg%3E"); }
a[data-page="test"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 3.5h5M10.5 3.5v5.2L5.6 17.2a2.2 2.2 0 0 0 1.9 3.3h9a2.2 2.2 0 0 0 1.9-3.3l-4.9-8.5V3.5'/%3E%3Cpath d='M7.6 14.5h8.8'/%3E%3C/svg%3E"); }
a[data-page="broadcasts"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.2v3.6c0 .94.76 1.7 1.7 1.7H7l6.6 4.2c.6.38 1.4-.05 1.4-.76V5.06c0-.71-.8-1.14-1.4-.76L7 8.5H5.7c-.94 0-1.7.76-1.7 1.7z'/%3E%3Cpath d='M18.5 9a4.5 4.5 0 0 1 0 6'/%3E%3C/svg%3E"); }
a[data-page="settings"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); }

/* ================= Иконки интерфейса ================= */
.ico-headphones { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15v-3a8 8 0 0 1 16 0v3'/%3E%3Crect x='3.5' y='14' width='4.5' height='6.5' rx='2'/%3E%3Crect x='16' y='14' width='4.5' height='6.5' rx='2'/%3E%3C/svg%3E"); }
.ico-clock { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E"); }
.ico-calendar { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='4'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.ico-timer { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='13.5' r='7.5'/%3E%3Cpath d='M12 10v3.5l2 1.5M10 2.5h4M18.5 6.5l-1.2 1.2'/%3E%3C/svg%3E"); }
.ico-envelope { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5.5' width='17' height='13' rx='3.5'/%3E%3Cpath d='m4.5 7.5 7.5 5.5 7.5-5.5'/%3E%3C/svg%3E"); }
.ico-link { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1'/%3E%3Cpath d='M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1'/%3E%3C/svg%3E"); }
.ico-mic { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5v3'/%3E%3C/svg%3E"); }
.ico-reply { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E"); }
.ico-chat { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5c-4.97 0-9 3.58-9 8 0 1.86.71 3.57 1.9 4.93L4 20.5l4.3-1.6c1.13.4 2.38.6 3.7.6 4.97 0 9-3.58 9-8s-4.03-8-9-8z'/%3E%3Cpath d='M8 11.5h.01M12 11.5h.01M16 11.5h.01'/%3E%3C/svg%3E"); }
.ico-learn { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 9 12 4.5 21.5 9 12 13.5z'/%3E%3Cpath d='M6.5 11v4.5c0 1.5 2.5 3 5.5 3s5.5-1.5 5.5-3V11M21.5 9v5'/%3E%3C/svg%3E"); }
.ico-smile { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M8.5 14a4.5 4.5 0 0 0 7 0M9 9.5h.01M15 9.5h.01'/%3E%3C/svg%3E"); }
.ico-attach { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m20 11.5-7.8 7.8a5 5 0 0 1-7.07-7.07l8.13-8.13a3.33 3.33 0 0 1 4.71 4.71l-8.14 8.13a1.67 1.67 0 0 1-2.36-2.36l7.6-7.6'/%3E%3C/svg%3E"); }
.ico-upload { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M7.5 8.5 12 4l4.5 4.5'/%3E%3Cpath d='M4 14.5v2A3.5 3.5 0 0 0 7.5 20h9a3.5 3.5 0 0 0 3.5-3.5v-2'/%3E%3C/svg%3E"); }

/* «Глазок» у полей пароля: кнопка внутри поля справа */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 46px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; border: none; border-radius: 10px; background: transparent; color: var(--muted, #7a7d84); cursor: pointer; box-shadow: none; }
.pw-eye:hover { color: var(--accent-text); background: var(--blue-softer); }
.pw-eye:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
/* На экране входа все кнопки формы — большие синие; глазку это не нужно. */
.login-card .pw-wrap { margin-bottom: 12px; }
.login-card .pw-wrap > input { margin-bottom: 0; }
.login-card button.pw-eye { width: 36px; height: 36px; padding: 0; margin: 0; background: transparent; color: var(--muted, #7a7d84); font-size: 0; box-shadow: none; border-radius: 10px; }
.login-card button.pw-eye:hover { background: var(--blue-softer); color: var(--accent-text); }

/* Кнопка меню ☰ — только на телефоне */
.nav-current, .nav-toggle { display: none; }
.nav-toggle {
  width: 42px; height: 42px; flex-shrink: 0; align-items: center; justify-content: center;
  padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card); cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); position: relative; transition: transform .2s, background .2s;
}
.nav-toggle span::before, .nav-toggle span::after { content: ''; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.sidebar.open .nav-toggle span { background: transparent; }
.sidebar.open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
.sidebar.open .nav-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

/* Статья-шаблон без служебных строк: вопрос клиента над ответом */
.kb-item p.kb-asks { font-style: italic; margin-bottom: 4px; }
.draft-label { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; }
.draft-label > input, .draft-label > textarea { margin-top: 4px; }
.msg b, .kb-item p b { font-weight: 650; }

/* Кто вошёл — внизу меню */
.role-badge { margin-top: auto; padding: 8px 12px 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.role-badge:empty { display: none; }
.role-badge + .logout { margin-top: 6px; }
@media (max-width: 800px) {
  .sidebar .role-badge { display: none; }
  .sidebar.open .role-badge:not(:empty) { display: block; flex-basis: 100%; margin-top: 4px; }
}

/* Длинное сообщение бота свёрнуто до нескольких строк */
.msg.collapsed { max-height: 11.5em; overflow: hidden; position: relative; padding-bottom: 40px; }
.msg.collapsed::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; pointer-events: none;
  background: linear-gradient(transparent, var(--msg-bot) 70%);
}
.msg-more {
  display: block; margin: 6px 0 0; padding: 0; border: none; background: none; color: var(--accent-text);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.msg.collapsed .msg-more { position: absolute; left: 14px; bottom: 10px; z-index: 1; }

/* Примеры вопросов в Тестировании */
.test-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.test-chips .muted { width: 100%; font-size: 13px; }
.test-chips button {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--text); font-size: 14px; cursor: pointer;
}
.test-chips button:hover { border-color: var(--blue); color: var(--accent-text); }

/* Звук и тема — внизу меню */
.side-tools { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; }
.side-tools + .role-badge { margin-top: 0; }
.side-tool {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: none; border-radius: var(--r-sm);
  background: none; color: var(--muted); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.side-tool:hover { background: var(--glass-hover); color: var(--text); }
.side-tool .ico { width: 18px; height: 18px; }
.side-tool.off { opacity: .7; }
@media (max-width: 800px) {
  .sidebar .side-tools { display: none; }
  .sidebar.open .side-tools { display: flex; flex-basis: 100%; padding-top: 6px; }
  .side-tool { padding: 12px 14px; font-size: 15px; border-radius: 14px; }
}

/* Число ждущих ответа у пункта «Диалоги» */
.nav-badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: #ff5a3c; color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
}

/* Пустой список: значок, заголовок и подсказка */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 32px 16px; color: var(--muted); font-size: 14px; line-height: 1.5;
}
.empty-state .ico {
  width: 28px; height: 28px; padding: 14px; box-sizing: content-box; margin-bottom: 4px; position: relative;
  border-radius: 18px; background: var(--blue-soft); -webkit-mask: none; mask: none;
}
.empty-state .ico::after {
  content: ''; position: absolute; inset: 14px; background-color: var(--blue);
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.empty-state b { color: var(--text); font-size: 15.5px; font-weight: 600; }
.empty-state span { max-width: 380px; }
.conv-messages > .empty-state { margin: auto; padding-top: 80px; }

.ico-bell { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2h-15z'/%3E%3Cpath d='M10 21h4'/%3E%3C/svg%3E"); }
.ico-bell-off { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16.5V11a6 6 0 0 1 9.5-4.9M18 11v5.5l1.5 2H8'/%3E%3Cpath d='M10 21h4M4 4l16 16'/%3E%3C/svg%3E"); }
.ico-moon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z'/%3E%3C/svg%3E"); }
.ico-sun { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4'/%3E%3C/svg%3E"); }
/* Клиент ждёт ответа — точка на кнопке меню, видно и при закрытом меню */
.nav-toggle { position: relative; }
.nav-toggle.has-waiting::after {
  content: ''; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: #ff5a3c; box-shadow: 0 0 0 2px var(--card);
}

/* Голосовое и видео — проигрыватель прямо в сообщении */
.msg audio.att-media { display: block; width: 280px; max-width: 100%; height: 40px; margin-top: 8px; }
.msg video.att-media { display: block; max-width: 280px; max-height: 320px; border-radius: 12px; margin-top: 8px; }

/* ================= Вход по телефону и «Сотрудники» ================= */
.login-alt { margin: 16px 0 0; text-align: center; font-size: 14px; }
.login-alt a { color: var(--muted); }
.user-off td { opacity: .55; }
.users-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
/* Действия у строки компании: «Открыть» и список «Настроить» в одну строку */
.tn-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.tn-here { font-size: 13px; font-weight: 600; color: var(--muted); padding: 7px 4px; }
.row-menu { position: relative; }
.row-menu-btn {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px 7px 14px; font-size: 13px; line-height: 18px; font-weight: 500; border-radius: 10px;
  background: var(--blue-soft); color: var(--accent-text);
}
.row-menu-btn::-webkit-details-marker { display: none; }
.row-menu-btn::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
.row-menu[open] .row-menu-btn::after { transform: translateY(1px) rotate(-135deg); }
/* Выпадающий список — плотное стекло (задано ниже, в «Стекле») */
.row-menu-list {
  position: fixed; z-index: 60; min-width: 220px; padding: 6px; display: grid; gap: 2px;
  border-radius: 18px;
}
.row-menu-list button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--text);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.row-menu-list button:hover, .row-menu-list button:focus-visible { background: var(--card); box-shadow: var(--shadow-sm); }
.row-menu-list .on { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--accent-text); }
.users-actions button { padding: 6px 10px; font-size: 13px; }

/* ================= Свой логотип клиента ================= */
/* Загруженную картинку не кадрируем, как стандартную, — показываем целиком. */
.custom-logo .logo::before,
.custom-logo .login-card::before { background: var(--logo) center / contain no-repeat; }
.custom-logo .logo::before { border-radius: 0; }
/* Широкий логотип — над названием, высотой 36px и шириной по пропорциям (не шире меню) */
.logo-wide .logo { flex-direction: column; align-items: flex-start; gap: 8px; }
.logo-wide .logo::before { height: 36px; width: min(200px, calc(36px * var(--logo-ratio, 3))); background-position: left center; }
.logo-setting { display: flex; gap: 18px; align-items: flex-start; }
.logo-preview {
  width: 88px; height: 88px; flex-shrink: 0; border-radius: 16px; border: 1px solid var(--border);
  background: url("img/icon-256.png") center / 70% no-repeat;
}
.custom-logo .logo-preview { background: var(--logo) center / contain no-repeat; }
.logo-setting .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0 6px; }

/* ---------- Модули профиля itcomp: товары, закупки, заявки 1С ---------- */
a[data-page="catalog"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 20 7.5v9L12 20.5 4 16.5v-9z'/%3E%3Cpath d='M4 7.5l8 4 8-4M12 11.5v9'/%3E%3C/svg%3E"); }
a[data-page="shop"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5 5.3 4.8a1.5 1.5 0 0 1 1.45-1.1h10.5a1.5 1.5 0 0 1 1.45 1.1L20 9.5'/%3E%3Cpath d='M4 9.5a2.7 2.7 0 0 0 5.33 0 2.7 2.7 0 0 0 5.34 0 2.7 2.7 0 0 0 5.33 0'/%3E%3Cpath d='M5.5 12.2v6.8a1.5 1.5 0 0 0 1.5 1.5h10a1.5 1.5 0 0 0 1.5-1.5v-6.8'/%3E%3Cpath d='M10 20.5v-4.5h4v4.5'/%3E%3C/svg%3E"); }
a[data-page="purchase"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 4.5h2.2l2.1 10.2a1.5 1.5 0 0 0 1.5 1.2h7.6a1.5 1.5 0 0 0 1.5-1.1l1.6-6.3H6.6'/%3E%3Ccircle cx='10' cy='19.5' r='1.2'/%3E%3Ccircle cx='17' cy='19.5' r='1.2'/%3E%3C/svg%3E"); }

#cat-search { width: 100%; margin-top: 12px; }
.cat-table .cat-name { line-height: 1.45; }
.cat-table .cat-art { width: 110px; font-family: ui-monospace, "Consolas", monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cat-table .price { font-weight: 600; }

/* Наличие на складе: есть, нет, неизвестно, услуга. */
.stock { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.stock.in { background: var(--lime-soft); color: var(--lime-text); }
.stock.out { background: var(--surface); color: var(--muted); }
.stock.unknown { background: var(--peach-soft); color: var(--peach-text); }
.stock.svc { background: var(--blue-soft); color: var(--accent-text); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager button:disabled { opacity: .4; cursor: default; }
#cat-range { font-variant-numeric: tabular-nums; }
/* Счётчик позиций в кнопке вкладки */
#cat-kinds button span { margin-left: 5px; opacity: .6; font-variant-numeric: tabular-nums; }

#page-purchase textarea { width: 100%; margin-bottom: 8px; font-family: inherit; font-size: 14px; }
#page-purchase .handout-form input { margin-bottom: 8px; }
.preview-text { white-space: pre-wrap; font-family: inherit; font-size: 14px; margin: 0; }

/* Ответы поставщиков: цена крупно, под ней исходное сообщение. */
.offer { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--card); }
.offer.best { border-color: var(--green); background: var(--lime-soft); }
.offer-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.offer-price { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.offer details { margin-top: 6px; }
.offer summary { cursor: pointer; font-size: 12px; color: var(--muted); }

/* Заявки, которые ждут отметки «Сделка», чтобы уйти в 1С. */
.hold-note:not(:empty) { background: var(--peach-soft); color: var(--peach-text); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }

/* ================= Компании (суперадмин) ================= */
.tenant-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.pw-gen { display: flex; gap: 8px; align-items: center; }
.pw-gen input { flex: 1; min-width: 0; }
.tenant-result { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--surface); line-height: 1.5; }
.tenant-result textarea { width: 100%; font-family: ui-monospace, monospace; margin: 6px 0; }
.tenant-result .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-about { margin: -4px 0 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); font-size: 14px; }
.profile-about:empty { display: none; }
.budget-bar { display: block; max-width: 420px; height: 12px; margin: -4px 0 14px; }

/* ================= Магазин ================= */
/* Статус заказа: новый — заметно, итоговые — спокойно. */
.ord-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); color: var(--text); white-space: nowrap; }
.ord-status.new { background: var(--peach); color: var(--peach-text); }
.ord-status.confirmed, .ord-status.assembled, .ord-status.shipped { background: var(--blue-soft); color: var(--accent-text); }
.ord-status.delivered { background: var(--lime-soft); color: var(--lime-text); }
.ord-status.cancelled { color: var(--muted); }
.stat-cards + .actions { margin-top: 14px; }
.shop-field-hint { margin: -10px 0 14px; font-size: 13px; }
.shop-lines { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 14.5px; }
.shop-lines td { padding: 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.shop-lines td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
.shop-lines tr.total td { font-weight: 700; border-bottom: none; }
.shop-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14.5px; }
.shop-facts dt { color: var(--muted); }
.shop-facts dd { margin: 0; overflow-wrap: anywhere; }
input[type="color"] { width: 46px; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); flex: none; cursor: pointer; }
@media (max-width: 640px) {
  .shop-facts { grid-template-columns: 1fr; gap: 0; }
  .shop-facts dd { margin-bottom: 8px; }
}

/* ================= Уведомление внизу экрана ================= */
.toast {
  /* По центру без transform: его занимает анимация появления. */
  position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); margin: 0 auto;
  width: max-content; z-index: 300; max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--ink-text); font-size: 14.5px; font-weight: 500; line-height: 1.4;
  box-shadow: var(--shadow-lg); animation: rise-in .3s var(--ease-out) both;
}
.toast.error { background: var(--red-text); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }

/* Выданный пароль: крупно и моноширинно, чтобы не спутать l и I при диктовке. */
.secret-value { font-family: ui-monospace, "Consolas", monospace !important; font-size: 17px !important; letter-spacing: .04em; }
#ask-fields label { margin-bottom: 12px; }
#ask-error:empty { display: none; }

/* ================= С чего начать ================= */
.onboard { border: 1px solid var(--blue-soft); }
.onboard-steps { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 12px; }
.onboard-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.onboard-mark {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.onboard-steps li.done .onboard-mark { background: var(--green); border-color: var(--green); color: #fff; }
.onboard-steps li.done b { color: var(--muted); font-weight: 500; }
.onboard-steps li.todo-link .onboard-mark { border-style: dashed; }
.onboard-steps a { font-weight: 600; text-decoration: none; }
.onboard-steps a:hover { text-decoration: underline; }

/* ================= Таблицы на телефоне — карточками ================= */
/* Сотрудники, компании, менеджеры IT-COMP, история оплаты: в 620 точек таблица
   на телефоне не влезала и прокручивалась вбок. Здесь каждая строка — карточка. */
@media (max-width: 640px) {
  .table-wrap.cards-wrap { border: none; border-radius: 0; max-height: none; overflow: visible; }
  .cat-table.cards-sm { min-width: 0; }
  .cards-sm thead { display: none; }
  .cards-sm, .cards-sm tbody, .cards-sm tr, .cards-sm td { display: block; width: 100%; }
  .cards-sm tr { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; background: var(--card); }
  .cards-sm tbody tr:hover td { background: none; }
  .cat-table.cards-sm td { border: none; padding: 3px 0; width: auto; }
  .cards-sm td.card-title { font-size: 15.5px; font-weight: 600; padding-bottom: 6px; }
  .cards-sm td[data-label] { display: flex; gap: 12px; justify-content: space-between; }
  .cards-sm td[data-label]::before { content: attr(data-label); color: var(--muted); flex-shrink: 0; }
  .cards-sm td[data-label] > * { text-align: right; }
  .cat-table.cards-sm td.card-actions { padding-top: 10px; }
  .cards-sm td.card-actions:empty { display: none; }
  .cards-sm .users-actions { justify-content: stretch; }
  .cards-sm .users-actions > * { flex: 1 1 auto; min-height: 44px; }
  .cards-sm .users-actions > span { min-height: 0; align-self: center; text-align: center; }
}

/* ================= Реклама ================= */
a[data-page="ads"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Ccircle cx='12' cy='12' r='.8'/%3E%3C/svg%3E"); }
.dot.err { background: var(--red-text); }
.ads-alert { background: var(--red-soft); color: var(--red-text); border: none; }
.ads-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.ads-filters .tabs { margin: 10px 0; }
.ads-dir-pick { display: flex; align-items: center; gap: 8px; margin: 0; }
.ads-dir-pick select { margin: 0; width: auto; min-width: 180px; }

/* Предложение ИИ: что, почему, кнопки */
.ads-prop { border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px; }
.ads-prop-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15.5px; }
.ads-prop p { margin: 8px 0 10px; line-height: 1.5; }
.ads-prop-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ads-prop-btns { display: flex; gap: 8px; }
.ads-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface); white-space: nowrap; }
.ads-badge.pause { background: var(--red-soft); color: var(--red-text); }
.ads-badge.setBudget { background: var(--blue-soft); color: var(--accent-text); }
.ads-badge.requestCreatives, .ads-badge.regenerate, .ads-badge.expandAudience { background: var(--peach); color: var(--peach-text); }

/* Журнал действий */
.ads-log, .ads-acc, .ads-acc-mini { list-style: none; padding: 0; margin: 0; }
.ads-log li, .ads-acc li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ads-log li:last-child, .ads-acc li:last-child { border-bottom: none; }
.ads-log details { margin-top: 4px; font-size: 14px; }
.ads-log summary { cursor: pointer; color: var(--accent-text); }
.ads-log details p { margin: 6px 0 0; line-height: 1.5; }
.ads-st { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface); color: var(--muted); }
.ads-st.applied { background: var(--lime-soft); color: var(--lime-text); }
.ads-st.failed { background: var(--red-soft); color: var(--red-text); }
.ads-st.blocked { background: var(--peach); color: var(--peach-text); }
.ads-err { color: var(--red-text); font-size: 13.5px; margin-top: 4px; overflow-wrap: anywhere; }
.ads-acc .users-actions { margin-top: 8px; justify-content: flex-start; flex-wrap: wrap; }
.ads-acc .dot, .ads-acc-mini .dot { margin-right: 6px; vertical-align: middle; }
.ads-acc-mini li { padding: 6px 0; }

/* Направления: режим и выбор кампаний */
.ads-mode-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); }
.ads-mode-badge.autopilot { background: var(--lime-soft); color: var(--lime-text); }
.ads-dir-form { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 4px; }
.ads-entities { border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 12px; max-height: 280px; overflow: auto; margin-bottom: 14px; }
.ads-ent { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 7px 0; font-weight: 500; }
.ads-ent.sub { padding-left: 26px; font-weight: 400; }
.ads-modes { display: grid; gap: 10px; margin-bottom: 8px; }
.ads-mode { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; margin: 0; font-weight: 400; line-height: 1.45; cursor: pointer; }
.ads-mode:has(input:checked) { border-color: var(--blue); background: var(--blue-softer); }
.ads-mode input { margin-top: 2px !important; }
@media (max-width: 640px) {
  .ads-dir-pick { width: 100%; }
  .ads-dir-pick select { flex: 1; min-width: 0; }
  .ads-prop-btns { width: 100%; }
  .ads-prop-btns > button { flex: 1; min-height: 44px; }
}

/* ---------- Реклама: мастер «Новая кампания», креативы, предпросмотр ---------- */
.invisible { visibility: hidden; }
.ads-badge.narrowAudience { background: var(--peach); color: var(--peach-text); }
.ads-drafts { list-style: none; padding: 0; margin: 12px 0 0; }
.ads-drafts li { padding: 10px 0; border-top: 1px solid var(--border); }
.ads-drafts .users-actions { margin-top: 8px; justify-content: flex-start; flex-wrap: wrap; }

.wiz-steps { list-style: none; padding: 0; margin: 4px 0 6px; display: flex; gap: 6px; flex-wrap: wrap; counter-reset: none; }
.wiz-steps li { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13.5px; }
.wiz-steps li span { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card); font-weight: 600; font-size: 12.5px; }
.wiz-steps li b { font-weight: 500; }
.wiz-steps li.done { color: var(--lime-text); background: var(--lime-soft); }
.wiz-steps li.active { color: var(--accent-text); background: var(--blue-soft); }
.wiz-steps li.active span { background: var(--blue); color: #fff; }
.wiz-now { display: none; font-weight: 600; margin: 4px 0 12px; }
.wiz-step { display: none; padding-top: 10px; }
.wiz-step.active { display: block; }
.wiz-q { font-weight: 600; margin: 6px 0 10px; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.wiz input[type="date"] { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 14px; line-height: 20px; outline: none; }
.wiz input[type="date"]:focus { background: var(--card); border-color: var(--blue); box-shadow: var(--ring); }
.wiz-goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wiz-goal { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin: 0; font-weight: 400; line-height: 1.45; cursor: pointer; }
.wiz-goal b { display: block; font-size: 15.5px; margin-bottom: 2px; }
.wiz-goal:has(input:checked) { border-color: var(--blue); background: var(--blue-softer); }
.wiz-goal input { margin-top: 2px !important; }
.wiz-hint p { margin: 0 0 8px; line-height: 1.5; }
.wiz-ok { color: var(--lime-text); }
.wiz-search { display: block; }
.wiz-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 10px; }
.wiz-opt { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.wiz-opt:hover { border-color: var(--blue); }
.wiz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wiz-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--blue-soft); color: var(--accent-text); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 14px; font-weight: 500; }
.wiz-chip button { border: none; background: none; color: inherit; font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; }
.wiz-review { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.adf-review { grid-template-columns: minmax(0, 380px); margin: 6px 0 14px; }
.wiz-summary { list-style: none; padding: 0; margin: 0 0 12px; }
.wiz-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.wiz-summary li span { color: var(--muted); flex-shrink: 0; }
.wiz-summary li b { font-weight: 500; text-align: right; }
.wiz-result { border-radius: var(--r-md); padding: 12px 16px; margin-top: 12px; line-height: 1.5; }
.wiz-result p, .wiz-result ul { margin: 6px 0 0; }
.wiz-result ul { padding-left: 18px; }
.wiz-result li { margin-bottom: 6px; }
.wiz-result.ok { background: var(--lime-soft); color: var(--lime-text); }
.wiz-result.bad { background: var(--red-soft); color: var(--red-text); }
.wiz-result .secondary { margin-left: 6px; }
#wiz-final > p { margin: 12px 0; line-height: 1.5; }

/* Креатив: картинки, варианты текста */
.ce-images { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.ce-img { position: relative; width: 96px; height: 96px; padding: 0; border: 2px solid transparent; border-radius: 14px; overflow: hidden; background: var(--surface); cursor: pointer; }
.ce-img.vertical { width: 64px; }
.ce-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ce-img.sel { border-color: var(--blue); box-shadow: var(--ring); }
.ce-img span { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.ce-gen { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; margin: 8px 0 14px; }
.ce-brief { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 14px; }
.ce-brief summary { cursor: pointer; color: var(--accent-text); font-weight: 500; }
.ce-brief[open] summary { margin-bottom: 12px; }
.ce-var { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 8px; line-height: 1.45; }
.ce-var p { margin: 0 0 4px; white-space: pre-wrap; }
.ce-var b { display: block; }
.ce-var .actions { margin-top: 6px; }
.ce-warn p { margin: 0 0 6px; font-size: 13.5px; }
.ads-vars { margin: 0 0 10px; }
.ads-vars .ce-var { background: var(--surface); border: none; }

/* Предпросмотр «как в ленте» */
.fb-ad { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; max-width: 380px; font-size: 14px; color: var(--text); }
.fb-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.fb-head b { display: block; font-size: 14px; }
.fb-head span { font-size: 12px; color: var(--muted); }
.fb-ava { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: inline-flex !important; align-items: center; justify-content: center; font-weight: 700; font-size: 15px !important; flex-shrink: 0; }
.fb-text { padding: 0 12px 10px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-more { color: var(--muted); }
.fb-img { aspect-ratio: 1 / 1; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.fb-img.vertical { aspect-ratio: 4 / 5; }
.fb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface); }
.fb-foot div { min-width: 0; }
.fb-foot small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.fb-foot b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-foot span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-cta { flex-shrink: 0; background: var(--surface-hover); border-radius: 8px; padding: 8px 12px; font-weight: 600; font-size: 13.5px !important; color: var(--text) !important; }

@media (max-width: 640px) {
  .wiz-steps { display: none; }
  .wiz-now { display: block; }
  .wiz-review { grid-template-columns: minmax(0, 1fr); }
  .wiz-nav { position: sticky; bottom: 0; background: var(--card); margin: 18px -16px -18px; border-radius: 0 0 20px 20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 2; }
  .wiz-nav > button { flex: 1; min-height: 46px; }
  .wiz-nav > button.invisible { display: none; }
  .ce-img { width: 30%; height: auto; aspect-ratio: 1 / 1; }
  .ce-img.vertical { width: 20%; aspect-ratio: 9 / 16; }
  .ce-img-btns > button, .ads-drafts .users-actions > button { flex: 1; min-height: 44px; }
  .fb-ad { max-width: none; }
}

/* ================= Тариф ================= */
a[data-page="invite"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='9' width='17' height='11.5' rx='2.5'/%3E%3Cpath d='M3.5 13h17M12 9v11.5'/%3E%3Cpath d='M12 9c-1.8-3.8-6-4-6-1.6C6 9 9.5 9 12 9zM12 9c1.8-3.8 6-4 6-1.6C18 9 14.5 9 12 9z'/%3E%3C/svg%3E"); }
.invite-share { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.invite-link { display: flex; gap: 8px; align-items: center; }
.invite-link input { flex: 1; min-width: 0; }
a[data-page="plan"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5.5' width='17' height='13' rx='3'/%3E%3Cpath d='M3.5 10h17M7.5 14.5h3'/%3E%3C/svg%3E"); }

/* Использование: каналы, документы, сотрудники, ответы ИИ */
.plan-usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 24px; margin-top: 12px; }
.plan-meter .label { font-size: 13px; color: var(--muted); }
.plan-meter .val { font-size: 14px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.plan-meter .val b { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.plan-bar { height: 8px; border-radius: 999px; background: var(--surface); margin-top: 6px; overflow: hidden; }
.plan-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--blue); transition: width .6s var(--ease-out); }
.plan-meter.warn .plan-bar i { background: var(--amber); }
.plan-meter.over .plan-bar i { background: var(--red-text); }
.plan-meter .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
/* «Поведение» → «Длина ответов» */
.reply-length { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.reply-length h3 { margin-bottom: 4px; }
.reply-length .muted { max-width: 60ch; }
.sum-company { margin-top: 4px; font-size: 15px; }
.plan-period { display: inline-flex; gap: 4px; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-sm); }
.plan-period button {
  border: none; background: transparent; color: var(--text); cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; line-height: 20px; min-height: 36px;
}
.plan-period button small { color: var(--green); font-weight: 600; margin-left: 4px; }
.plan-period button.active { background: var(--blue-soft); color: var(--accent-text); }

.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 14px; }
.plan-card {
  background: var(--card); border: 2px solid transparent; border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.plan-card.current { border-color: var(--blue); }
.plan-card h4 { font-size: 22px; letter-spacing: -.02em; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-tag { font-size: 12px; font-weight: 600; color: var(--accent-text); background: var(--blue-soft); padding: 3px 10px; border-radius: 999px; letter-spacing: 0; }
.plan-card .who { color: var(--muted); font-size: 14px; min-height: 40px; }
/* Цифры — Rubik, как заголовки */
.plan-price, .plan-sum, .plan-meter .val b { font-family: var(--font-display); }
.plan-price { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-alt { font-size: 13px; color: var(--muted); min-height: 18px; }
.plan-alt b { color: var(--green); font-weight: 600; white-space: nowrap; }
.plan-alt s { margin-left: 4px; }
.plan-lines { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 14px; flex: 1; }
.plan-lines li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.plan-lines li::before { content: '✓'; color: var(--green); font-weight: 700; flex-shrink: 0; width: 14px; }
.plan-lines li.no { color: var(--muted); }
.plan-lines li.no::before { content: '—'; color: var(--muted); font-weight: 400; }
.plan-card .actions { margin-top: 8px; }
.plan-card .actions button { width: 100%; }
.plan-card .plan-note { font-size: 13px; color: var(--muted); }

/* Счёт выставлен: ссылка и реквизиты */
#plan-invoice pre { white-space: pre-wrap; color: var(--text); background: var(--surface); padding: 12px; border-radius: var(--r-sm); font: inherit; font-size: 14px; }
.plan-sum { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Упор в тариф в разделах: рассылки, сценарии */
.plan-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.plan-banner .button-link { font-weight: 600; color: var(--peach-text); text-decoration: none; white-space: nowrap; }
.plan-banner .button-link:hover { text-decoration: underline; }
.plan-limit-note { color: var(--peach-text); }

@media (max-width: 640px) {
  .plan-head { margin-top: 20px; }
  .plan-period { width: 100%; justify-content: space-between; }
  .plan-period button { flex: 1; padding: 8px 6px; }
  .plan-card { padding: 18px 16px; }
  .plan-card .who { min-height: 0; }
  .plan-card .actions button { min-height: 44px; }
}

/* ================= Стекло («Liquid Glass») ================= */
/* Только «рамка»: меню, всплывающие окна, выпадающие списки, карточка входа.
   На карточках содержимого стекла нет — размытие дорогое, а текст на нём читается хуже.
   Блик в верхнем левом углу — отдельный слой фона, а не ::before: ::before у входа
   и у логотипа уже заняты картинкой. */
.sidebar, .modal-card, .row-menu-list, .login-card {
  border: 1px solid var(--glass-edge);
  background: var(--glass-shine), var(--glass);
  box-shadow: var(--glass-hi), var(--glass-shadow);
}
.sidebar, .row-menu-list, .login-card {
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
/* Окна, списки и вход — стекло плотнее: на них формы и мелкий текст. У окна размытие
   даёт затемнение под ним (.modal), своё было бы лишним слоем. */
.modal-card, .row-menu-list, .login-card {
  background: var(--glass-shine), var(--glass-strong);
  box-shadow: var(--glass-hi), var(--shadow-lg);
}
/* Вкладки над списком диалогов стоят на фоне страницы — активная белая, как в меню */
.conv-side .tabs button.active, .conv-side .tabs button.active:hover { background: var(--card); color: var(--accent-text); box-shadow: var(--shadow-sm); }
#conv-search { box-shadow: var(--shadow-sm); }
.nav-toggle { border-color: var(--glass-edge); background: var(--glass-hover); }

/* Старый браузер без размытия и «Уменьшить прозрачность» в системе — непрозрачный фон */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .sidebar { background: var(--glass-solid); }
  .modal-card, .row-menu-list, .login-card { background: var(--card); }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar, .row-menu-list, .login-card, .modal { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sidebar { background: var(--glass-solid); }
  .modal-card, .row-menu-list, .login-card { background: var(--card); }
  .modal { background: rgba(20, 22, 40, .55); }
}

/* ================= Сводка ================= */
a[data-page="summary"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='7' height='9' rx='2'/%3E%3Crect x='13.5' y='3.5' width='7' height='5' rx='2'/%3E%3Crect x='13.5' y='11.5' width='7' height='9' rx='2'/%3E%3Crect x='3.5' y='15.5' width='7' height='5' rx='2'/%3E%3C/svg%3E"); }
.ico-clipboard { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4h6v3H9z'/%3E%3Cpath d='M7.5 5.5H6v15h12v-15h-1.5'/%3E%3Cpath d='m9 13.5 2 2 4-4'/%3E%3C/svg%3E"); }
.ico-bot { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='8' width='16' height='11' rx='4'/%3E%3Cpath d='M12 4.5V8M9 13h.01M15 13h.01M2 13v2M22 13v2'/%3E%3C/svg%3E"); }

/* Тёмная стеклянная плашка «Ждут ответа». В тёмной теме — наоборот, светлое стекло (как dark.png). */
:root {
  --ink-glass: linear-gradient(150deg, rgba(28, 29, 34, .80), rgba(14, 15, 18, .88));
  --ink-glass-edge: rgba(255, 255, 255, .14);
  --ink-glass-text: #f4f5f8;
  --ink-glass-muted: #a9acb8;
  --ink-glass-row: rgba(255, 255, 255, .10);
  --ink-glass-time: var(--lime);
  --ink-glass-btn: var(--lime);
  --ink-glass-btn-text: #14260a;
}
:root[data-theme="dark"] {
  --ink-glass: linear-gradient(150deg, rgba(245, 246, 250, .86), rgba(225, 227, 235, .78));
  --ink-glass-edge: rgba(255, 255, 255, .5);
  --ink-glass-text: #14151a;
  --ink-glass-muted: #50535e;
  --ink-glass-row: rgba(0, 0, 0, .07);
  --ink-glass-time: #0b7a3d;
}

.sum-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sum-head h2 { margin-bottom: 0; }

/* Плитки: цифра крупно, значок, мини-график, изменение к прошлому периоду */
.sum-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.sum-stat {
  display: grid; grid-template-columns: 1fr auto; gap: 14px 10px; align-content: start;
  background: var(--card); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm);
  color: var(--text); text-decoration: none; min-width: 0;
  transition: box-shadow .2s var(--ease-out);
}
a.sum-stat:hover { box-shadow: var(--shadow-md); }
.sum-ic { width: 42px; height: 42px; border-radius: 14px; background: var(--ink); color: var(--ink-text); display: grid; place-items: center; }
.sum-ic .ico { width: 21px; height: 21px; }
.sum-spark { grid-column: 2; grid-row: 2 / span 2; align-self: center; width: 92px; height: 40px; }
.sum-spark path { fill: none; stroke: var(--text); stroke-width: 2.6; stroke-linecap: round; }
.sum-spark path.flat { stroke: var(--border); stroke-dasharray: 4 6; }
.sum-num { grid-column: 1; font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sum-delta { grid-column: 1; font-size: 13px; color: var(--muted); line-height: 1.4; }
.sum-delta b.up { color: var(--accent-text); }
.sum-delta b.down { color: var(--red-text); }

.sum-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sum-card-head h3 { font-size: 18px; margin-bottom: 2px; }
.sum-card-head p.muted { font-size: 13px; margin: 0; }
.sum-pill {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 999px; flex-shrink: 0;
  background: var(--card); box-shadow: var(--shadow-sm); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none;
}
.sum-pill:hover { box-shadow: var(--shadow-md); }
.empty-state .sum-pill { margin-top: 8px; background: var(--blue); color: #fff; }

.sum-mid, .sum-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin-top: 18px; align-items: stretch; }
.sum-replies { align-self: start; }
.sum-mid > .card, .sum-bottom > .card { margin-top: 0; }

/* График «Сообщения по дням» */
/* Карточка тянется по высоте соседней «Ждут ответа», а график — по высоте карточки (app.js мерит место) */
.sum-chart { display: flex; flex-direction: column; }
#sum-chart { margin-top: 10px; min-height: 240px; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.sum-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sum-svg .grid line { stroke: var(--border); stroke-dasharray: 4 6; }
.sum-svg .ax { font-size: 12px; fill: var(--muted); font-family: var(--font); }
.sum-svg .curve { fill: none; stroke: var(--text); stroke-width: 2.4; }
.sum-svg .area { fill: url(#sum-fill); }
.sum-svg .f0 { stop-color: var(--blue); stop-opacity: .16; }
.sum-svg .f1 { stop-color: var(--blue); stop-opacity: 0; }
.sum-svg .pt { fill: var(--text); stroke: var(--card); stroke-width: 3; }
.sum-svg .pt.sel { fill: var(--blue); stroke-width: 4; }
.sum-svg .tip rect { fill: var(--ink); }
.sum-svg .tip .n { fill: var(--ink-text); font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.sum-svg .tip .s { fill: var(--ink-text); opacity: .7; font-family: var(--font); font-weight: 500; font-size: 11px; }
#sum-chart .empty-state { min-height: 240px; justify-content: center; }

/* «Ждут ответа» — стеклянная плашка: стоит на сиреневом фоне рядом с белыми карточками */
.sum-wait {
  position: relative; border-radius: 30px; padding: 22px 20px 16px; color: var(--ink-glass-text);
  background: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, .12), transparent 45%), var(--ink-glass); border: 1px solid var(--ink-glass-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 24px 60px rgba(10, 12, 30, .30);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
}
.sum-wait h3 { font-size: 18px; color: inherit; margin-bottom: 2px; }
.sum-wait-sub { font-size: 13px; color: var(--ink-glass-muted); }
#sum-wait-list { display: grid; gap: 4px; margin-top: 14px; }
.sum-wait-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  padding: 10px; border: 0; border-radius: 16px; background: none; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.sum-wait-row.hot, .sum-wait-row:hover { background: var(--ink-glass-row); }
.sum-wait-row:focus-visible { box-shadow: 0 0 0 3px var(--ink-glass-time); }
.sum-ch { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--ink-glass-row); }
.sum-who { min-width: 0; }
.sum-who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-who span { display: block; color: var(--ink-glass-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-wait-row time { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-glass-time); white-space: nowrap; }
.sum-wait-empty { display: grid; gap: 4px; padding: 18px 10px; text-align: center; font-size: 14px; }
.sum-wait-empty span { color: var(--ink-glass-muted); font-size: 13px; }
.sum-wait-go {
  margin-top: 12px; width: 100%; height: 46px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--ink-glass-btn); color: var(--ink-glass-btn-text); font: 600 15px var(--font);
}
.sum-wait-go:hover { filter: brightness(.96); }
/* «Ждут ответа человека: N (дольше 15 мин: M)» — к вкладке «Ждут человека» в Диалогах */
.sum-human {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 12px; padding: 10px 12px;
  border: 0; border-radius: 16px; background: var(--ink-glass-row); color: inherit; font: 500 14px var(--font); text-align: left; cursor: pointer;
}
.sum-human b { font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-human .late { color: var(--ink-glass-time); font-weight: 600; }
.sum-human .note { flex-basis: 100%; font-size: 12px; color: var(--ink-glass-muted); }
.sum-human:hover { filter: brightness(1.08); }
.sum-human:focus-visible { box-shadow: 0 0 0 3px var(--ink-glass-time); }

/* Последние заявки */
#sum-leads-list { margin-top: 10px; }
.sum-lead {
  display: grid; grid-template-columns: 40px minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .6fr) 92px;
  gap: 14px; align-items: center; width: 100%; padding: 12px 0; border: 0; border-top: 1px solid var(--border);
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.sum-lead:first-child { border-top: 0; }
.sum-lead:hover b { color: var(--accent-text); }
.sum-lead b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-lead .m { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-av { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--ink-text); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.sum-tag { justify-self: end; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.sum-tag.deal { background: var(--blue-soft); color: var(--accent-text); }
.sum-tag.refused { background: var(--red-soft); color: var(--red-text); }
.sum-tag.open { background: var(--peach-soft); color: var(--peach-text); }
.sum-tag.done { background: var(--surface); color: var(--muted); }

/* Ответы ИИ в этом месяце: шкала лимита тарифа и прогноз */
.sum-big { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.sum-big small { font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.sum-meter { height: 12px; border-radius: 999px; background: var(--surface); margin: 14px 0 10px; overflow: hidden; }
.sum-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #3fcf7f); }
.sum-meter.warn i { background: var(--amber); }
.sum-meter.over i { background: var(--red-text); }
p.sum-forecast { font-size: 13px; margin: 0; }
p.sum-forecast.warn { color: var(--peach-text); }
p.sum-forecast.over { color: var(--red-text); }

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .sum-wait { background: #1c1d22; }
  :root[data-theme="dark"] .sum-wait { background: #e9eaf0; }
}
@media (prefers-reduced-transparency: reduce) {
  .sum-wait { -webkit-backdrop-filter: none; backdrop-filter: none; background: #1c1d22; }
  :root[data-theme="dark"] .sum-wait { background: #e9eaf0; }
}

@media (max-width: 1100px) {
  .sum-mid, .sum-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .sum-stats { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
  .sum-stat { padding: 18px; border-radius: 20px; }
  .sum-num { font-size: 30px; }
  .sum-mid, .sum-bottom { gap: 12px; margin-top: 12px; }
  .sum-wait { border-radius: 24px; padding: 18px 14px 14px; }
  /* Заявка на телефоне — две строки: имя и итог, под ними суть */
  .sum-lead { grid-template-columns: 36px minmax(0, 1fr) 92px; gap: 4px 12px; }
  .sum-lead .sum-av { grid-row: span 2; }
  .sum-lead .m { display: none; }
  .sum-lead .m.req { display: block; grid-column: 2 / -1; grid-row: 2; }
}

/* ================= Приглашения (реферальная программа) ================= */
/* «Пригласите знакомых» в «Тарифе»: ссылка отдельной строкой, баланс — цифрой Rubik */
#plan-referral .pw-gen { margin: 14px 0 12px; }
#plan-referral .pw-gen input { font-variant-numeric: tabular-nums; }
#plan-referral p b, #tr-body b { font-family: var(--font-display); font-weight: 700; }
#plan-referral .table-wrap { margin-top: 16px; }
/* Ссылка приглашения в «Приглашениях» длинная — переносится, а не вылезает за карточку */
#tr-body a { overflow-wrap: anywhere; }
/* «Пришёл по приглашению» в карточке диалога — акцентом: это повод для скидки */
.conv-ref { color: var(--accent-text); font-weight: 600; }
@media (max-width: 800px) {
  /* На телефоне заголовок в одну строку и обрезается — подпись о приглашении переносим ниже */
  #conv-title:has(.conv-ref) { white-space: normal; }
  #conv-title .conv-ref { display: block; font-size: 13px; line-height: 1.3; }
}

/* ================= Пригласить ================= */
/* Баланс под кнопками «Отправить…» — с отступом и цифрой Rubik, как остальные суммы */
#invite-body .invite-share + p { margin-top: 16px; }
#invite-body p b, #tr-body p b { font-family: var(--font-display); font-weight: 700; }
/* «Приглашения»: поле своего кода — узкое, кнопка «Сохранить» под ним; ссылка переносится */
#tr-body .tenant-form:has(#tr-own-code) { max-width: 360px; margin-top: 12px; }
#tr-body a { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* На телефоне ссылка — во всю ширину, «Скопировать» и кнопки отправки — под ней, по 44 точки */
  .invite-link { flex-direction: column; align-items: stretch; }
  .invite-link button, .invite-share > button { min-height: 44px; }
  .invite-share > button { flex: 1 1 100%; }
}

/* ================= Воронка ================= */
/* Колонки — стеклянные дорожки на сиреневом фоне, карточки в них — белые, как всё содержимое.
   Цвет статуса — только точкой у заголовка и полоской у карточки: доска не должна пестрить. */
a[data-page="deals"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 4.5h17l-6.5 8v5.6l-4 2.2v-7.8z'/%3E%3C/svg%3E"); }
.ico-funnel { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 4.5h17l-6.5 8v5.6l-4 2.2v-7.8z'/%3E%3C/svg%3E"); }
.ico-clock { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E"); }

.deal-col.st-new { --st: var(--amber); }
.deal-col.st-in_work { --st: var(--violet-text); }
.deal-col.st-won { --st: var(--green); }
.deal-col.st-lost { --st: var(--red-text); }

p.deals-sub { margin: 4px 0 0; }
.deals-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.deals-tools .plan-period button { min-height: 36px; }
.deals-tools select { width: auto; height: 44px; padding-top: 0; padding-bottom: 0; border-radius: 999px; background-color: var(--card); box-shadow: var(--shadow-sm); }
.deals-tools button.primary, .deals-tools button.secondary { height: 44px; border-radius: 999px; }

.deals-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 20px; align-items: start; }
.deal-col {
  border-radius: var(--r-lg); padding: 14px 10px 10px; min-height: 180px; min-width: 0;
  background: var(--glass-shine), var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-hi);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.deal-col.drop { border-color: var(--blue); box-shadow: var(--glass-hi), var(--ring); }
.deal-col-head { display: flex; align-items: center; gap: 8px; padding: 0 6px 12px; min-width: 0; }
.deal-col-head h3 { font-size: 16px; margin: 0; white-space: nowrap; }
.deal-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st); flex-shrink: 0; }
.deal-n { font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; line-height: 22px; padding: 0 7px; border-radius: 999px; text-align: center; background: var(--card); color: var(--muted); font-variant-numeric: tabular-nums; }
.deal-sum { margin-left: auto; font-family: var(--font-display); font-weight: 700; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.deal-list { display: grid; gap: 8px; }
.deal-empty { font-size: 13px; color: var(--muted); padding: 18px 8px; text-align: center; line-height: 1.45; border: 1px dashed var(--border); border-radius: var(--r-md); }

.deal-card {
  position: relative; display: grid; gap: 5px; min-width: 0;
  background: var(--card); border-radius: 18px; padding: 12px 14px 12px 16px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: box-shadow .15s ease, transform .15s ease;
}
.deal-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--st); }
.deal-card:hover { box-shadow: var(--shadow-md); }
.deal-card[draggable="true"] { cursor: grab; }
.deal-card.dragging { opacity: .45; transform: scale(.98); }
.deal-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.deal-top b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.deal-amount { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--accent-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.deal-phone { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.deal-req { font-size: 13.5px; line-height: 1.4; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.deal-next { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; line-height: 1.35; padding: 6px 8px; border-radius: 10px; background: var(--blue-softer); color: var(--accent-text); }
.deal-next .ico { width: 15px; height: 15px; margin-top: 1px; }
.deal-next span { min-width: 0; overflow-wrap: anywhere; }
.deal-next.overdue { background: var(--red-soft); color: var(--red-text); font-weight: 600; }
.deal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.deal-chip { background: var(--surface); border-radius: 999px; padding: 2px 8px; }
.deal-chip.lost { background: var(--red-soft); color: var(--red-text); }
.deal-owner { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--text); font-weight: 500; }
.deal-owner i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 9px; font-weight: 700; background: var(--ink); color: var(--ink-text); }
.deal-owner.none { color: var(--peach-text); }
/* Фишки статусов над лентой — только на телефоне */
.deals-tabs { display: none; }
.deals-upsell { grid-column: 1 / -1; }
.deals-upsell .empty-state { padding: 40px 16px; }
.deals-upsell .empty-state span { max-width: 460px; }

/* Окно сделки */
.deal-modal-card { width: 640px; }
.deal-modal-card > p.muted { margin-top: 2px; }
.deal-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin-top: 8px; }
.deal-form .full { grid-column: 1 / -1; }

fieldset.deal-next-box { display: block; border: 0; min-width: 0; padding: 14px; margin: 0 0 14px; border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: 14px; }
fieldset.deal-next-box legend { float: left; width: 100%; font-weight: 500; margin-bottom: 8px; padding: 0; }
.deal-next-row { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 8px; clear: both; }
.deal-next-row input { width: 100%; background: var(--card); }
input[type="datetime-local"] {
  font: inherit; font-size: 15px; color: var(--text); background: var(--card); border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 10px 12px; line-height: 20px; outline: none; min-width: 0;
}
input[type="datetime-local"]:focus { border-color: var(--blue); box-shadow: var(--ring); }
.deal-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.deal-quick button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); font-size: 13px; cursor: pointer; }
.deal-quick button:hover:not(:disabled) { border-color: var(--blue); color: var(--accent-text); }
fieldset.deal-next-box p.muted { font-size: 12.5px; margin: 8px 0 0; }
#deal-open-conv { margin-bottom: 4px; }
.deal-history { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; }
.deal-hist { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--border); }
.deal-hist:first-child { border-top: 0; }
.deal-hist time { color: var(--muted); font-variant-numeric: tabular-nums; }
.deal-hist span { overflow-wrap: anywhere; }

/* «Сводка»: «Бот принёс» */
.sum-crm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.sum-crm-cell { background: var(--surface); border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.sum-crm-cell b { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sum-crm-cell span { font-size: 13px; color: var(--muted); }

@media (max-width: 1100px) and (min-width: 801px) {
  /* Ноутбук с меню: четыре колонки узки — по две */
  .deals-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .deals-tools { width: 100%; }
  /* «Все / Мои» и период — одной строкой, «+ Сделка» — под ними во всю ширину */
  .deals-tools .plan-period { flex: 1 1 0; min-width: 0; }
  .deals-tools .plan-period button { flex: 1; }
  .deals-tools select { flex: 1 1 0; min-width: 0; }
  .deals-tools #deals-export { display: none; }
  .deals-tools #deals-add { flex: 1 1 100%; }
  /* На телефоне колонки — лентой, как в Trello: листаются вбок с прилипанием, следующая
     выглядывает справа (колонка — 85% ширины), карточки листаются внутри колонки, а не
     страница. Лента выходит на поля .content (12px), поэтому вбок не едет вся страница. */
  .deals-tabs:not(.hidden) {
    display: flex; gap: 6px; margin: 12px -12px 0; padding: 2px 12px; overflow-x: auto; scrollbar-width: none;
  }
  .deals-tabs::-webkit-scrollbar { display: none; }
  .deals-tabs button {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; min-height: 36px; padding: 0 12px;
    border: 0; border-radius: 999px; background: var(--card); box-shadow: var(--shadow-sm); color: var(--text);
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  }
  .deals-tabs button .deal-dot { width: 8px; height: 8px; }
  .deals-tabs button span { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
  .deals-tabs button.active { background: var(--blue-soft); color: var(--accent-text); }
  .deals-tabs button.active span { color: inherit; }
  .deals-tabs .st-new { --st: var(--amber); }
  .deals-tabs .st-in_work { --st: var(--violet-text); }
  .deals-tabs .st-won { --st: var(--green); }
  .deals-tabs .st-lost { --st: var(--red-text); }

  .deals-board {
    position: relative; display: flex; gap: 10px; align-items: stretch;
    margin: 10px -12px 0; padding: 0 12px calc(4px + env(safe-area-inset-bottom));
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding: 0 12px;
    overscroll-behavior-x: contain; scrollbar-width: none; touch-action: pan-x pan-y;
  }
  .deals-board::-webkit-scrollbar { display: none; }
  /* Пока карточку ведут пальцем, лента едет сама у края — прилипание бы её дёргало */
  .deals-board.dragging { scroll-snap-type: none; }
  .deal-col {
    flex: 0 0 min(85vw, 420px); scroll-snap-align: start; scroll-snap-stop: always;
    display: flex; flex-direction: column; min-height: 0; border-radius: 22px; padding: 12px 8px 8px;
    /* Высота — экран без верхней полосы меню и фишек статусов: доска целиком под пальцем, заголовок колонки
       не уезжает, листается только список под ним */
    height: calc(100vh - 160px); height: calc(100dvh - 160px - env(safe-area-inset-bottom)); min-height: 360px;
  }
  .deal-col-head { flex-shrink: 0; padding: 0 6px 10px; }
  .deal-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 2px 2px 8px; align-content: start; scrollbar-width: none; }
  .deal-list::-webkit-scrollbar { display: none; }
  .deals-upsell { display: block; flex: 1 0 100%; }
  .deal-card { padding: 12px 12px 12px 15px; touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .deal-card.lifting { transform: scale(.98); transition: transform var(--hold, .3s) ease; }
  .deal-card.placeholder { opacity: .35; }
  /* Поднятая карточка — над всем, под пальцем; события пальца идут сквозь неё к колонке */
  .deal-ghost {
    position: fixed; z-index: 120; margin: 0; pointer-events: none;
    box-shadow: var(--shadow-lg); transform-origin: 30% 30%; rotate: 2deg; scale: 1.03;
    transition: scale .15s ease, rotate .15s ease;
  }
  body.deal-dragging { -webkit-user-select: none; user-select: none; }
  .deal-col.drop { border-color: var(--blue); box-shadow: var(--glass-hi), var(--ring); }
  .deal-form { grid-template-columns: minmax(0, 1fr); }
  .deal-next-row { grid-template-columns: minmax(0, 1fr); }
  .deal-quick button { min-height: 40px; }
  .deal-hist { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* Окно сделки на телефоне — шторка во всю высоту до низа экрана, прокрутка внутри;
     страница под ней стоит (body.sheet-open). Низ — с учётом полосы жестов. */
  #deal-modal .deal-modal-card {
    height: calc(100vh - 12px); height: calc(100dvh - 12px - env(safe-area-inset-top)); max-height: none;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  body.sheet-open { overflow: hidden; }
  .deal-modal-card .row-end { flex-wrap: wrap; }
  .deal-modal-card .row-end button { flex: 1 1 auto; min-height: 44px; }
  .sum-crm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sum-crm-cell { padding: 12px; }
  .sum-crm-cell b { font-size: 22px; }
}

/* Меньше движения: карточка поднимается без наклона и увеличения */
@media (prefers-reduced-motion: reduce) {
  .deal-ghost { rotate: none; scale: none; transition: none; }
  .deal-card.lifting { transform: none; transition: none; }
}

/* ================= Комиссии менеджеров ================= */
input[type="month"] {
  font: inherit; font-size: 15px; color: var(--text); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 14px; line-height: 20px; outline: none; min-width: 0;
}
input[type="month"]:focus { border-color: var(--blue); box-shadow: var(--ring); }
.cm-intro { max-width: 760px; }
.cm-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 16px 0; }
.cm-toolbar label { margin: 0; }
.cm-toolbar input { width: 200px; }
.cm-toolbar button, .cm-row button { height: 44px; }
/* Две карточки настроек рядом: ставки и передача клиентов — одинаковой высоты. */
.cm-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.cm-settings .card { margin-top: 0; }
.cm-settings h3 { margin: 0 0 12px; }
.cm-settings .muted { margin: 10px 0 0; font-size: 13px; }
/* Поля и кнопка в одну линию по нижнему краю, чтобы кнопка стояла вровень с полями. */
.cm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.cm-row label { margin: 0; }
.cm-empty { text-align: center; padding: 28px 20px; }
.cm-empty p { margin: 4px 0; }
@media (max-width: 520px) {
  .cm-settings { grid-template-columns: minmax(0, 1fr); }
  .cm-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cm-row button { grid-column: 1 / -1; }
  .cm-toolbar { align-items: stretch; }
  .cm-toolbar label, .cm-toolbar input { width: 100%; }
  .cm-toolbar button { width: 100%; }
}

/* «Напоминание молчащим»: метка на карточке и строка в «Бот принёс» */
.deal-chip.revived { background: var(--lime-soft); color: var(--lime-text); }
p.sum-crm-revived { margin: 12px 0 0; font-size: 13px; }
p.sum-crm-revived b { font-family: var(--font-display); color: var(--text); }
.followup-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 640px) { .followup-row { grid-template-columns: minmax(0, 1fr); } }

/* «Бот сам ведёт карточку»: ожидаемая сумма и отметка «заполнил бот» */
.deal-amount.estimate { color: var(--muted); font-weight: 600; }
.deal-by-bot { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--violet-soft); color: var(--violet-text); vertical-align: 1px; }

/* Краткое содержание переписки наверху карточки сделки */
.deal-summary { margin: 4px 0 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--blue-softer); border-left: 3px solid var(--blue); }
.deal-summary-text p { margin: 0; font-size: 14px; line-height: 1.45; }
.deal-summary-text p + p { margin-top: 4px; }
.deal-summary-text b { font-weight: 600; }
p.deal-summary-at { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.deal-hist.bot span { color: var(--violet-text); }

/* Сумма сделки, подставленная из ожидаемой, ждёт подтверждения человека */
#deal-amount.needs-confirm { border-color: var(--amber); background: var(--peach-soft); }
.switch-label.deal-confirm { margin: -6px 0 14px; font-weight: 500; color: var(--peach-text); }

/* «Пригласить»: условия шагами и пример в тенге */
.invite-terms .card { margin-top: 0; margin-bottom: 16px; }
.invite-terms h3 { margin: 0 0 10px; }
.invite-steps { margin: 0 0 12px; padding-left: 22px; line-height: 1.55; }
.invite-steps li + li { margin-top: 4px; }
.invite-example { margin: 0 0 10px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--blue-soft); color: var(--accent-text); font-weight: 500; }
.invite-terms .muted { margin: 0; font-size: 13px; }
.invite-preview { margin-top: 12px; font-size: 14px; }
.invite-preview summary { cursor: pointer; color: var(--accent-text); font-weight: 500; }
.invite-preview p { margin: 8px 0 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
/* «Пригласить»: язык сообщения и чат с конкретным номером */
.invite-lang-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.invite-direct { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 14px; max-width: 560px; }
.invite-direct label { margin: 0; }
.invite-direct button { height: 44px; }
@media (max-width: 800px) {
  .invite-direct { grid-template-columns: minmax(0, 1fr); }
  .invite-lang-row .plan-period { width: 100%; }
}
/* Выбор месяца в «Комиссиях»: ‹ Октябрь 2026 › и сетка месяцев в стиле кабинета */
.cm-month { position: relative; }
.cm-month-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.month-step { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm); }
.month-step-arrow { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.month-step-arrow:hover:not(:disabled) { background: var(--blue-soft); color: var(--accent-text); }
.month-step-arrow:disabled { opacity: .3; cursor: default; }
.month-step-title { min-width: 150px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }
.month-step-title:hover, .month-step-title[aria-expanded="true"] { background: var(--blue-soft); color: var(--accent-text); }
.month-pop { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: 280px; padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.14)); }
.month-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-family: var(--font-display); font-size: 16px; }
.month-pop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.month-pop-m { height: 40px; border: 0; border-radius: 12px; background: transparent; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.month-pop-m:hover:not(:disabled) { background: var(--surface-hover); }
.month-pop-m.now { box-shadow: inset 0 0 0 1px var(--blue); }
.month-pop-m.active { background: var(--blue); color: #fff; font-weight: 600; }
.month-pop-m:disabled { color: var(--muted); opacity: .45; cursor: default; }
.month-pop-now { width: 100%; margin-top: 8px; height: 36px; border: 0; border-radius: 12px; background: var(--blue-soft); color: var(--accent-text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.month-step-arrow:focus-visible, .month-step-title:focus-visible, .month-pop-m:focus-visible, .month-pop-now:focus-visible { outline: none; box-shadow: var(--ring); }
@media (max-width: 520px) {
  .month-step { display: flex; width: 100%; }
  .month-step-title { flex: 1; }
  .month-pop { width: 100%; }
  .cm-toolbar .cm-month { width: 100%; }
}

/* «Показать ещё» под списком диалогов: следующая страница (50 диалогов). */
.conv-more {
  display: block; width: 100%; margin: 6px 0 2px; padding: 10px 12px;
  background: var(--surface); color: var(--text); border: none; border-radius: var(--r-md);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.conv-more:hover { background: var(--blue-soft); }
.conv-more:disabled { color: var(--muted); cursor: default; }

/* «Журнал»: отбор строкой над списком, записи — карточками-строками. */
a[data-page="audit"] .nav-ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3.5h8.5L19.5 7.5v11.5a1.5 1.5 0 0 1-1.5 1.5H7A1.5 1.5 0 0 1 5.5 19V5A1.5 1.5 0 0 1 7 3.5z'/%3E%3Cpath d='M15 3.5V8h4.5M8.5 12h7M8.5 15.5h7M8.5 8.5h3'/%3E%3C/svg%3E"); }
.audit-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 4px 0 14px; }
.audit-filters label { margin: 0; flex: 1 1 160px; max-width: 260px; }
.audit-filters select, .audit-filters input { width: 100%; }
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 132px 1fr; gap: 4px 16px; padding: 12px 4px; border-top: 1px solid var(--border); }
.audit-row:first-child { border-top: none; }
.audit-when { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.audit-what { font-weight: 600; }
.audit-what .audit-target { font-weight: 400; color: var(--muted); }
.audit-who { font-size: 13px; color: var(--muted); margin-top: 2px; }
.audit-change { font-size: 13px; margin-top: 6px; display: grid; gap: 2px; }
.audit-change code { font-size: 12px; background: var(--surface); padding: 1px 6px; border-radius: 6px; word-break: break-word; }
.audit-row.fail .audit-what { color: #d32f2f; }
@media (max-width: 600px) {
  .audit-row { grid-template-columns: 1fr; }
  .audit-filters label { max-width: none; flex-basis: calc(50% - 7px); }
}
.audit-filters input[type="date"] { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 14px; line-height: 20px; outline: none; box-sizing: border-box; }
.audit-filters input[type="date"]:focus { background: var(--card); border-color: var(--blue); box-shadow: var(--ring); }

/* ================= Выбор даты и времени (enhanceDateInputs в app.js) =================
   Родное поле скрыто и хранит значение; видна кнопка в виде обычного поля ввода.
   Окно — как выбор месяца в «Комиссиях»: карточка, скругление 12px, зелёный акцент. */
.dp-native { display: none !important; }
.dp-field {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-width: 0;
  font: inherit; font-size: 15px; font-weight: 400; line-height: 20px; color: var(--text); text-align: left;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 14px;
  cursor: pointer; outline: none; font-variant-numeric: tabular-nums;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
label .dp-field { margin-top: 6px; }
.dp-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-field.empty .dp-text { color: var(--muted); }
.dp-field:hover:not(:disabled) { background-color: var(--surface-hover); }
.dp-field:focus-visible, .dp-field[aria-expanded="true"] { background-color: var(--card); border-color: var(--blue); box-shadow: var(--ring); }
.dp-ico {
  flex: none; width: 18px; height: 18px; background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='3'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='3'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dp-field[aria-expanded="true"] .dp-ico { background: var(--blue); }
/* В карточке сделки поле лежит на сером блоке — само белое, как было у родного. */
.deal-next-row .dp-field { background: var(--card); }

/* Выше окон кабинета (.modal — 100): календарь открывают и из карточки сделки. */
.dp-pop {
  position: fixed; z-index: 140; padding: 12px; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  font-size: 14px; animation: dp-in .16s var(--ease-out) both;
}
@keyframes dp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dp-body { display: flex; gap: 12px; }
.dp-cal { width: 280px; flex: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-title { font-family: var(--font-display); font-size: 16px; font-weight: 500; }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week span { height: 28px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.dp-week span:nth-child(n+6) { color: var(--red-text); opacity: .8; }
.dp-day, .dp-time {
  height: 36px; border: 0; border-radius: 12px; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.dp-day:hover:not(:disabled), .dp-time:hover:not(:disabled) { background: var(--surface-hover); }
.dp-day.other { color: var(--muted); opacity: .6; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--blue); }
.dp-day.active, .dp-time.active { background: var(--blue); color: #fff; font-weight: 600; opacity: 1; }
.dp-day:disabled, .dp-time:disabled { color: var(--muted); opacity: .35; cursor: default; }
.dp-pop button:focus-visible { outline: none; box-shadow: var(--ring); }
.dp-day.today:focus-visible { box-shadow: inset 0 0 0 1px var(--blue), var(--ring); }

/* Время — колонкой справа от календаря, высотой с него; прокручивается. */
.dp-side { width: 112px; display: flex; flex-direction: column; border-left: 1px solid var(--border); padding-left: 12px; }
.dp-side-title { height: 36px; display: flex; align-items: center; margin-bottom: 6px; font-family: var(--font-display); font-size: 16px; font-weight: 500; }
.dp-times { position: relative; flex: 1 1 0; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: 1fr; align-content: start; gap: 2px; padding: 2px; overscroll-behavior: contain; }
.dp-other { display: block; margin: 8px 0 0; font-size: 12px; font-weight: 400; color: var(--muted); }
.dp-other input.dp-other-in { display: block; width: 100%; margin-top: 4px; padding: 7px 10px; font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; border-radius: 10px; }
.dp-other input.dp-other-in.set { border-color: var(--blue); color: var(--accent-text); font-weight: 600; }
.dp-other input[aria-invalid="true"] { border-color: var(--red-text); }
.dp-err { margin-top: 4px; font-size: 11.5px; line-height: 1.3; color: var(--red-text); }

.dp-foot { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.dp-btn {
  flex: 1; height: 36px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.dp-btn:hover:not(:disabled) { background: var(--surface-hover); }
.dp-btn.soft { background: var(--blue-soft); color: var(--accent-text); }
.dp-btn.fill { background: var(--blue); color: #fff; }
.dp-btn.fill:hover { background: var(--blue-dark); }

/* Телефон: шторка снизу во всю ширину, время — под календарём сеткой. */
.dp-pop.sheet {
  left: 0; right: 0; bottom: 0; top: auto; max-height: 88dvh; overflow-y: auto;
  border-radius: 24px 24px 0 0; border-width: 1px 0 0;
  padding: 14px max(16px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  animation-name: dp-sheet-in; animation-duration: .24s;
}
@keyframes dp-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
.dp-pop.sheet .dp-body { flex-direction: column; gap: 10px; }
.dp-pop.sheet .dp-cal { width: auto; }
.dp-pop.sheet .dp-day { height: 40px; }
.dp-pop.sheet .dp-side { width: auto; border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 6px; }
.dp-pop.sheet .dp-side-title { height: 28px; margin-bottom: 2px; font-size: 15px; }
.dp-pop.sheet .dp-times { flex: none; max-height: 120px; grid-template-columns: repeat(5, 1fr); }
.dp-pop.sheet .dp-other { display: flex; align-items: center; gap: 10px; }
.dp-pop.sheet .dp-other input.dp-other-in { width: 96px; margin-top: 0; }
.dp-pop.sheet .dp-btn { height: 44px; }
/* Анимации гасит общее правило prefers-reduced-motion выше; шторку — заодно и сдвиг. */
@media (prefers-reduced-motion: reduce) { .dp-pop, .dp-pop.sheet { animation: none; } }

/* ================= Праздники (src/holidays.ts) =================
   В календаре: выходной по режиму недели и праздник — красным, праздник ещё и точкой под
   числом (отличить от обычного воскресенья). Рабочая суббота по переносу — обычным днём. */
.dp-day { position: relative; }
.dp-day.off { color: var(--red-text); }
.dp-day.hol::after {
  content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--red-text);
}
.dp-day.active.off, .dp-day.active.hol { color: #fff; }
.dp-day.active.hol::after { background: #fff; }
/* Шестидневка — красное только «Вс», без выходных — ни одного. */
.dp-pop.wk6 .dp-week span:nth-child(6), .dp-pop.wk7 .dp-week span:nth-child(n+6) { color: var(--muted); opacity: 1; }
.dp-tip {
  position: absolute; z-index: 1; max-width: 240px; padding: 6px 10px; border-radius: 10px;
  background: var(--ink); color: var(--ink-text); font-size: 12.5px; line-height: 1.3; text-align: center;
  pointer-events: none; box-shadow: var(--shadow-md);
}

/* «График работы» → Праздники */
.hol-set { margin: 4px 0 16px; padding-top: 4px; border-top: 1px solid var(--border); }
.hol-set select { max-width: 320px; }
.hol-hint { margin: 6px 0 4px; font-size: 13px; }
.hol-own { margin-top: 10px; }
.hol-own-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.hol-own-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hol-own-list li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; background: var(--surface); border-radius: var(--r-sm); font-size: 14px; }
.hol-own-list li.hol-own-empty { background: transparent; padding-left: 0; font-size: 13px; }
.hol-own-date { font-variant-numeric: tabular-nums; font-weight: 500; flex: none; }
.hol-own-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.hol-own-del {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.hol-own-del:hover { background: var(--red-soft); color: var(--red-text); }
.hol-own-add { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.hol-own-add .dp-field, .hol-own-add input { margin-top: 0; }
@media (max-width: 520px) {
  .hol-own-add { grid-template-columns: 1fr auto; }
  .hol-own-add #hours-closed-name { grid-column: 1 / -1; grid-row: 2; }
}

/* Суперадмин: карточка «Праздники» в «Компаниях» */
.hol-year { display: flex; align-items: center; gap: 6px; margin: 8px 0 10px; }
.hol-year b { font-family: var(--font-display); font-size: 18px; font-weight: 500; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.hol-rules { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; font-size: 14px; }
.hol-rule {
  display: inline-flex; align-items: center; gap: 2px; margin: 2px 4px 2px 0; padding: 2px 2px 2px 10px;
  background: var(--red-soft); color: var(--red-text); border-radius: 999px; font-variant-numeric: tabular-nums;
}
.hol-rule .muted { color: inherit; opacity: .7; }
.hol-rule button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.hol-rule button:hover { background: rgba(198, 42, 42, .12); }
.hol-years { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.hol-st { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 14px; }
.hol-st b { font-variant-numeric: tabular-nums; min-width: 40px; }
.hol-st .switch-label { font-size: 13px; }
.hol-ok { color: var(--green); }
.hol-miss { color: var(--peach-text); }
.hol-warn { margin: 10px 0 4px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--peach-soft); color: var(--peach-text); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }

/* ================= Оплата через Kaspi ================= */
/* Окно в «Тарифе»: сумма и номер счёта сверху, QR целиком (без обрезки), шаги, «Я оплатил(а)». */
.kaspi-card { width: 560px; }
/* На компьютере с QR — две колонки: картинка целиком слева, сумма и шаги справа. */
@media (min-width: 801px) {
  .kaspi-card:has(.with-qr) { width: 860px; }
  #kaspi-body.with-qr { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); grid-template-areas: "qr sum" "qr rest"; grid-template-rows: auto 1fr; gap: 0 24px; align-items: start; }
  #kaspi-body.with-qr .kaspi-qr { grid-area: qr; margin: 14px 0 0; }
  #kaspi-body.with-qr .kaspi-sum { grid-area: sum; }
  #kaspi-body.with-qr .kaspi-rest { grid-area: rest; }
  #kaspi-body.with-qr .kaspi-qr img { max-height: 64vh; }
}
.kaspi-sum { display: grid; gap: 2px; margin: 14px 0 16px; padding: 6px 14px; border-radius: var(--r-md); background: var(--surface); }
.kaspi-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 44px; }
.kaspi-row + .kaspi-row { border-top: 1px solid var(--border); }
.kaspi-row b { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kaspi-row:first-child b { font-family: var(--font-display); font-size: 22px; }
.kaspi-qr { margin: 0 0 16px; text-align: center; }
.kaspi-qr img { display: block; margin: 0 auto; max-width: 100%; max-height: 56vh; width: auto; height: auto; object-fit: contain; border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-sm); }
.kaspi-qr figcaption { margin-top: 8px; font-size: 14px; }
.kaspi-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; line-height: 1.45; }
.kaspi-note { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); font-size: 14px; white-space: pre-wrap; }
.kaspi-card > .muted, .kaspi-card p.muted { font-size: 13.5px; line-height: 1.45; }
.kaspi-check { display: grid; gap: 4px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--peach-soft); color: var(--peach-text); line-height: 1.4; }
#plan-invoice .kaspi-check { margin-top: 12px; }
/* «Сообщили об оплате Kaspi» — в «Компаниях» и в окне «Оплата» */
.pay-badge { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--peach); color: var(--peach-text); white-space: nowrap; }
/* Настройка суперадмина */
.kaspi-admin-grid { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 20px; margin-top: 14px; align-items: start; }
.kaspi-qr-frame { display: flex; align-items: center; justify-content: center; min-height: 160px; padding: 8px; border-radius: var(--r-md); background: var(--surface); text-align: center; }
.kaspi-qr-frame img { max-width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--r-sm); }
.kaspi-admin-qr .muted { font-size: 13px; margin-top: 6px; }
.kaspi-admin-qr .actions { align-items: center; }
#kaspi-admin > label.inline { flex-wrap: nowrap; }
#kaspi-admin > label.inline input { flex: none; }
.kaspi-admin-form { grid-template-columns: minmax(0, 1fr); margin: 0; }
.kaspi-admin-form textarea { width: 100%; resize: vertical; }
@media (max-width: 800px) {
  /* Шторка до низа экрана: QR не выше 60% высоты, кнопки — во всю ширину, над полосой жестов */
  .kaspi-card { max-height: calc(100dvh - 12px); }
  .kaspi-qr img { max-height: 60vh; max-height: 60dvh; }
  /* Подпись — строкой выше, значение и «Скопировать» — в одну строку */
  .kaspi-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 8px 0; }
  .kaspi-row > .muted { grid-column: 1 / -1; font-size: 13px; }
  .kaspi-row:first-child b { font-size: 20px; }
  .kaspi-actions { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 12px -18px calc(-20px - env(safe-area-inset-bottom)); padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--glass-strong); }
  .kaspi-actions button { flex: 1 1 0; min-height: 48px; }
  .kaspi-admin-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Карточка «Kaspi QR»: красная шапка и подпись — чтобы код сразу узнавался как Kaspi */
.kaspi-qr { --kaspi-red: #f14635; border-radius: var(--r-lg, 20px); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); max-width: 340px; margin-left: auto; margin-right: auto; }
.kaspi-qr-head { display: grid; gap: 2px; padding: 12px 16px; background: var(--kaspi-red); color: #fff; text-align: center; }
.kaspi-qr-logo { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: .01em; }
.kaspi-qr-head span + span { font-size: 13px; opacity: .92; }
.kaspi-qr-code { padding: 14px 18px 4px; }
.kaspi-qr-code img, .kaspi-qr img { display: block; width: 100%; max-width: 280px; max-height: none; margin: 0 auto; border-radius: 0; box-shadow: none; background: #fff; }
.kaspi-qr figcaption { display: grid; gap: 8px; justify-items: center; padding: 8px 14px 14px; color: #1d1d1f; }
.kaspi-qr figcaption b { font-size: 15px; }
.kaspi-qr-ways { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.kaspi-qr-ways i { font-style: normal; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #fdeceb; color: #c0281b; }
.kaspi-qr figcaption a { font-size: 13px; color: #6b6b70; }
.kaspi-app-btn { display: none; }
@media (max-width: 800px) {
  .kaspi-app-btn { display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 0 0 14px; border-radius: 14px; background: #f14635; color: #fff; font-weight: 600; text-decoration: none; }
  .kaspi-app-btn:focus-visible { outline: none; box-shadow: var(--ring); }
}
