/* ==========================================================================
   CRM Telefon-ip — дизайн-система
   Никаких Bootstrap/AdminLTE: только собственные токены и компоненты.
   ========================================================================== */

/* --- Шрифты --------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-lat.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-cyr.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-lat.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-cyr.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* --- Токены --------------------------------------------------------------- */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Manrope", var(--font-sans);

  --bg: #f4f6fb;
  --bg-deep: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;

  --brand: #2f6fed;
  --brand-600: #2559c9;
  --brand-50: #eef4ff;
  --brand-100: #dbe7ff;
  --cyan: #0891b2;
  --green: #16a34a;
  --green-50: #ecfdf3;
  --amber: #d97706;
  --amber-50: #fffaeb;
  --red: #dc2626;
  --red-50: #fef3f2;
  --violet: #7c3aed;

  --sidebar: #0b1220;
  --sidebar-2: #111a2c;
  --sidebar-ink: #cbd5e1;
  --sidebar-muted: #7c8ba3;
  --sidebar-line: rgba(148, 163, 184, 0.14);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 8px 24px -12px rgba(16, 24, 40, 0.18);
  --shadow-lg: 0 24px 60px -28px rgba(16, 24, 40, 0.35);

  --sidebar-w: 264px;
  --topbar-h: 68px;
  --page-max: 1560px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* --- База ----------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg.icon { flex: 0 0 auto; }
[x-cloak] { display: none !important; }

::selection { background: var(--brand-100); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Каркас --------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px 14px;
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(47, 111, 237, 0.22), transparent 58%),
    linear-gradient(180deg, var(--sidebar), #0a101c 70%);
  color: var(--sidebar-ink);
  border-right: 1px solid rgba(15, 23, 42, 0.4);
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(8, 15, 30, 0.55);
  backdrop-filter: blur(2px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  color: #fff;
}
.brand:hover { color: #fff; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #dbeafe);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 8px 18px -8px rgba(47, 111, 237, 0.8);
  overflow: hidden;
}
.brand__mark img { width: 27px; height: 27px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand__sub { font-size: 11px; color: var(--sidebar-muted); letter-spacing: 0.02em; }

.nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.22) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 99px; }
.nav__section {
  padding: 12px 12px 8px;
  color: var(--sidebar-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  margin: 2px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-ink);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.nav-link .icon { color: var(--sidebar-muted); transition: color 0.15s var(--ease); }
.nav-link:hover { background: rgba(148, 163, 184, 0.1); color: #fff; }
.nav-link:hover .icon { color: #dbeafe; }
.nav-link.is-active {
  background: linear-gradient(90deg, rgba(47, 111, 237, 0.28), rgba(47, 111, 237, 0.08));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22);
}
.nav-link.is-active .icon { color: #93c5fd; }
.nav-link.is-active::before {
  content: "";
  width: 3px;
  height: 18px;
  margin-left: -12px;
  border-radius: 0 4px 4px 0;
  background: #60a5fa;
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.7);
}
.nav-link.is-disabled { opacity: 0.55; cursor: default; }
.nav-link__chevron { margin-left: auto; display: inline-flex; transition: transform 0.2s var(--ease); }
.nav-link__chevron.is-open { transform: rotate(180deg); }
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.nav-sub { padding: 2px 0 6px 34px; }
.nav-sub__link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: 12.5px;
}
.nav-sub__link:hover { color: #fff; background: rgba(148, 163, 184, 0.08); }
.nav-sub__link.is-active { color: #bfdbfe; background: rgba(47, 111, 237, 0.14); }
.nav-sub__link.is-disabled { opacity: 0.45; cursor: default; }

.sidebar__foot { padding: 12px 8px 4px; border-top: 1px solid var(--sidebar-line); }
.sidebar__company { display: flex; flex-direction: column; gap: 2px; padding: 10px 4px 12px; }
.sidebar__company-name { color: #e2e8f0; font-size: 11.5px; font-weight: 600; }
.sidebar__company-line { color: var(--sidebar-muted); font-size: 11px; }
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.sidebar__user-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar__user-name {
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role { color: var(--sidebar-muted); font-size: 10.5px; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 10px clamp(16px, 2.6vw, 36px);
  background: rgba(244, 246, 251, 0.82);
  border-bottom: 1px solid rgba(228, 231, 236, 0.9);
  backdrop-filter: blur(14px);
}
.topbar__menu { display: none; }
.topbar__heading { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.topbar__crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 11.5px;
  white-space: nowrap;
}
.topbar__crumb a { color: var(--muted); }
.topbar__crumb a:hover { color: var(--brand); }
.topbar__title {
  font-size: clamp(17px, 1.4vw, 21px);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.client-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 300px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
a.client-chip:hover { border-color: var(--brand-100); box-shadow: var(--shadow-sm); color: var(--ink); }
.client-chip--static { cursor: default; }
.client-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-50);
}
.client-chip__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.client-chip__label { color: var(--muted-2); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.client-chip__name {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.user-menu { position: relative; }
.user-menu summary { list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 5px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.user-menu__summary:hover { background: var(--surface); border-color: var(--line); }
.user-menu__name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.user-menu__pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 248px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}
.user-menu__head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.user-menu__head strong { font-size: 13px; }
.user-menu__head span { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.user-menu__divider { height: 1px; margin: 6px 4px; background: var(--line); }
.user-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
}
.user-menu__item:hover { background: var(--surface-2); color: var(--ink); }
.user-menu__item:disabled { opacity: 0.55; cursor: default; }
.user-menu__item--danger { color: var(--red); }
.user-menu__item--danger:hover { background: var(--red-50); color: var(--red); }
.soon {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
}

.readonly-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px clamp(16px, 2.6vw, 36px);
  background: #fffaeb;
  border-bottom: 1px solid #fdecc8;
  color: #93370d;
  font-size: 12px;
}
.readonly-bar .icon { color: #b54708; }
.readonly-bar strong { font-weight: 700; }

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 420px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  animation: toast-in 0.25s var(--ease);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.is-hiding { opacity: 0; transform: translateY(8px); }
.toast--success { border-color: #abefc6; background: var(--green-50); color: #05603a; }
.toast--error { border-color: #fecdca; background: var(--red-50); color: #912018; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 22px clamp(16px, 2.6vw, 36px) 44px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 2.6vw, 36px) 22px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 11.5px;
}
.footer__left, .footer__right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--brand); }
.footer__sep { opacity: 0.5; }

/* --- Заголовок страницы --------------------------------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.page-head__title { display: flex; flex-direction: column; gap: 4px; }
.page-head h2 { font-size: clamp(20px, 1.7vw, 26px); }
.page-head p { color: var(--muted); font-size: 12.5px; }
.page-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* --- Кнопки --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
  border-color: var(--brand);
  background: linear-gradient(180deg, #3b7bf5, var(--brand));
  color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn--primary:hover { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.btn--ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--sm { min-height: 30px; padding: 5px 10px; font-size: 11.5px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--danger { border-color: #fecdca; background: var(--red-50); color: #b42318; }
.btn--danger:hover { background: #fee4e2; color: #912018; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }

/* --- Карточки ------------------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card__title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 13.5px; font-weight: 800; }
.card__title .icon { color: var(--muted-2); }
.card__sub { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* --- Статистика ----------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, rgba(47, 111, 237, 0.1)), transparent 68%);
}
.stat__top { display: flex; align-items: center; gap: 9px; }
.stat__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--stat-bg, var(--brand-50));
  color: var(--stat-color, var(--brand));
}
.stat__label { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.stat__value {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.stat__value small { font-family: var(--font-sans); font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat__hint { margin-top: 6px; color: var(--muted-2); font-size: 11px; }
.stat--green { --stat-bg: var(--green-50); --stat-color: var(--green); --stat-glow: rgba(22, 163, 74, 0.12); }
.stat--amber { --stat-bg: var(--amber-50); --stat-color: var(--amber); --stat-glow: rgba(217, 119, 6, 0.12); }
.stat--violet { --stat-bg: #f4f3ff; --stat-color: var(--violet); --stat-glow: rgba(124, 58, 237, 0.12); }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
  gap: 16px;
  align-items: start;
}
.dash-side { display: grid; gap: 16px; }

/* --- Таблицы -------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:hover td { background: #fbfcfe; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .strong { color: var(--ink); font-weight: 600; }
.table .muted { color: var(--muted); }
.table .nowrap { white-space: nowrap; }
.table--compact td, .table--compact th { padding-top: 8px; padding-bottom: 8px; }

.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-person__text { display: flex; flex-direction: column; min-width: 0; }
.cell-person__name { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-person__meta { color: var(--muted-2); font-size: 10.5px; }
.cell-phone { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-contact { display: flex; flex-wrap: wrap; gap: 4px; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(145deg, #dbeafe, #eff6ff);
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  border: 1px solid #dbeafe;
}
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }

/* --- Бейджи --------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge--success { background: var(--green-50); color: #067647; border: 1px solid #abefc6; }
.badge--danger { background: var(--red-50); color: #b42318; border: 1px solid #fecdca; }
.badge--warn { background: var(--amber-50); color: #b54708; border: 1px solid #fdecc8; }
.badge--muted { background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.badge--info { background: var(--brand-50); color: var(--brand-600); border: 1px solid var(--brand-100); }

/* --- Формы и фильтры ------------------------------------------------------ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar__grow { flex: 1 1 220px; min-width: 180px; }
.toolbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { color: var(--muted); font-size: 11px; font-weight: 600; }
.input, .select {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder { color: var(--muted-2); }
.input:hover, .select:hover { border-color: #b9c2d0; }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}
.select { appearance: none; 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='%23667085' stroke-width='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 10px center; padding-right: 32px; }
.search {
  position: relative;
  flex: 1 1 220px;
  min-width: 170px;
}
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search .input { padding-left: 34px; }
.search__clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-row .field { min-width: 140px; }
.form-hint { color: var(--muted-2); font-size: 11px; }
.form-error { color: #b42318; font-size: 11.5px; }

/* --- Пустые состояния ----------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 44px 20px;
  text-align: center;
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: var(--surface-3);
  color: var(--muted-2);
}
.empty__title { font-weight: 700; color: var(--ink-2); }
.empty__text { max-width: 360px; color: var(--muted); font-size: 12px; }

/* --- Пагинация ------------------------------------------------------------ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.pagination__links { display: flex; align-items: center; gap: 4px; }
.page-link {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}
.page-link:hover { background: var(--surface-3); color: var(--ink); }
.page-link.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-link.is-disabled { opacity: 0.4; pointer-events: none; }

/* --- Утилиты -------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--brand-100);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.htmx-request .table-wrap { opacity: 0.55; transition: opacity 0.15s var(--ease); }

/* --- Клиентский пикер ----------------------------------------------------- */
.client-picker { max-width: 720px; margin: 24px auto; }
.client-picker .card__body { padding: 24px; }
.client-picker__title { font-size: 18px; margin-bottom: 4px; }
.client-picker__text { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.client-results { display: grid; gap: 6px; margin-top: 12px; }
.client-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  text-align: left;
}
.client-result:hover { border-color: var(--brand-100); background: var(--brand-50); color: var(--ink); }
.client-result__name { font-weight: 600; font-size: 12.5px; }
.client-result__meta { color: var(--muted-2); font-size: 10.5px; }

/* --- Логин ---------------------------------------------------------------- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  min-height: 100vh;
  background: var(--surface);
}
.auth__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 5vw, 64px);
  background:
    radial-gradient(90% 70% at 10% 0%, rgba(47, 111, 237, 0.5), transparent 60%),
    radial-gradient(70% 60% at 90% 100%, rgba(8, 145, 178, 0.35), transparent 60%),
    linear-gradient(160deg, #0b1220 10%, #101d38 55%, #0b1220 100%);
  color: #e2e8f0;
}
.auth__aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%);
  pointer-events: none;
}
.auth__aside > * { position: relative; z-index: 1; }
.auth__brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.auth__brand .brand__mark { width: 42px; height: 42px; }
.auth__brand .brand__name { color: #fff; font-size: 16px; }
.auth__brand .brand__sub { color: #94a3b8; }
.auth__hero { max-width: 480px; padding: 40px 0; }
.auth__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.08);
  color: #bfdbfe;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.auth__title {
  margin: 18px 0 12px;
  color: #f8fafc;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.auth__title em { color: #93c5fd; font-style: normal; }
.auth__lead { color: #94a3b8; font-size: 13.5px; line-height: 1.65; max-width: 420px; }
.auth__features { display: grid; gap: 12px; margin-top: 28px; }
.auth__feature { display: flex; gap: 11px; align-items: flex-start; color: #cbd5e1; font-size: 12px; }
.auth__feature .icon { margin-top: 1px; color: #60a5fa; }
.auth__feature b { display: block; color: #f1f5f9; font-size: 12.5px; margin-bottom: 1px; }
.auth__foot { color: #64748b; font-size: 11px; }
.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 56px);
  background:
    radial-gradient(80% 60% at 100% 0%, rgba(47, 111, 237, 0.08), transparent 60%),
    var(--surface);
}
.auth-card { width: 100%; max-width: 390px; }
.auth-card__head { margin-bottom: 22px; }
.auth-card__title { font-size: 25px; letter-spacing: -0.03em; }
.auth-card__sub { margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.auth-form { display: grid; gap: 14px; }
.field__wrap { position: relative; }
.field__wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.field__wrap .input { min-height: 44px; padding-left: 38px; border-radius: 11px; }
.field__wrap .input--password { padding-right: 44px; }
.field__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
}
.field__toggle:hover { background: var(--surface-3); color: var(--ink-2); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.auth-links a { color: var(--brand); font-weight: 600; }
.auth-note {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 12px;
  border: 1px solid #fdecc8;
  border-radius: 10px;
  background: #fffaeb;
  color: #93370d;
  font-size: 11px;
  line-height: 1.45;
}
.alert {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #fecdca;
  border-radius: 10px;
  background: var(--red-50);
  color: #912018;
  font-size: 12px;
}
.alert .icon { color: #d92d20; }

/* --- Ошибки --------------------------------------------------------------- */
.error-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(47, 111, 237, 0.12), transparent 70%),
    var(--bg);
}
.error-card {
  width: 100%;
  max-width: 460px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.error-code {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--brand);
  line-height: 1;
}
.error-title { margin-top: 8px; font-size: 20px; }
.error-text { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.error-actions { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }

/* --- Скелетоны ------------------------------------------------------------ */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-3) 25%, #e9eef6 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* --- Адаптив -------------------------------------------------------------- */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr); }
}

@media (max-width: 1100px) {
  .user-menu__name { display: none; }
  .client-chip__name { max-width: 150px; }
}

@media (max-width: 980px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    transform: translateX(-104%);
    transition: transform 0.24s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim { display: block; }
  .topbar__menu { display: inline-grid; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__aside { display: none; }
  .auth__panel { min-height: 100vh; }
}

@media (max-width: 720px) {
  .content { padding-top: 16px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 10px; }
  .topbar__crumb { display: none; }
  .client-chip__name { max-width: 120px; }
  .topbar__actions { gap: 6px; }
  .page-head { align-items: flex-start; }
  .toolbar { gap: 8px; }
  .toolbar__right { margin-left: 0; width: 100%; }
  .footer { flex-direction: column; align-items: flex-start; }

  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }
  .table--cards tbody tr:last-child { border-bottom: 0; }
  .table--cards td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }
  .table--cards td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
  }
  .table--cards td:first-child { padding-top: 0; }
  .table--cards td:last-child { padding-bottom: 0; }
  .table--cards .cell-person { justify-content: flex-end; text-align: right; }
  .table--cards .cell-person__text { align-items: flex-end; }
}

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

/* --- Дашборд: баланс, номера, быстрые действия ---------------------------- */
.balance-list { display: grid; gap: 2px; }
.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.balance-row:last-child { border-bottom: 0; }
.balance-row__main { display: flex; flex-direction: column; min-width: 0; }
.balance-row__name { color: var(--ink-2); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balance-row__meta { color: var(--muted-2); font-size: 10px; }
.balance-row__value { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; white-space: nowrap; }
.balance-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.balance-total strong { font-family: var(--font-display); font-size: 24px; letter-spacing: -0.03em; }

.peer-list { display: grid; }
.peer-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.peer-row:last-child { border-bottom: 0; }
.peer-row__status { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; }
.peer-row__status.is-online { background: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.peer-row__num { font-variant-numeric: tabular-nums; color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.peer-row__name { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }

.quick-links { display: grid; gap: 6px; }
.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.quick-link:hover { background: var(--surface-2); color: var(--brand); }
.quick-link span { flex: 1 1 auto; }
.quick-link .icon:first-child { color: var(--muted-2); }
.quick-link .icon:last-child { color: var(--muted-2); }

.empty--sm { padding: 26px 16px; }
.empty--sm .empty__icon { width: 38px; height: 38px; border-radius: 12px; }
.stat-grid--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 0; }
.stat-grid--compact .stat { border: 0; box-shadow: none; padding: 0 16px; }
.stat-grid--compact .stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.balance-total strong.text-red { color: var(--red); }

@media (max-width: 720px) {
  .stat-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .stat-grid--compact .stat + .stat { padding-left: 0; border-left: 0; }
  .peer-row__name { max-width: 55%; }
}
.client-result__text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }

@media (max-width: 720px) {
  .topbar__title { font-size: 17px; max-width: 150px; }
  .client-chip { padding: 7px 8px; gap: 6px; }
  .client-chip__text, .client-chip > .icon { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat__value { font-size: 20px; }
  .stat__hint { font-size: 10px; }
  .page-head__actions { width: 100%; }
}

@media (max-width: 720px) {
  .client-chip { display: none; }
  .topbar__title { max-width: none; }
  .stat-grid--compact .stat::after { display: none; }
  .stat-grid--compact .stat__value { margin-top: 6px; font-size: 20px; }
  .stat-grid--compact .stat__label { font-size: 10.5px; }
}

/* --- Телефония ------------------------------------------------------------ */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.segmented__item {
  padding: 5px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.segmented__item:hover { color: var(--ink); }
.segmented__item.is-active { background: var(--surface-3); color: var(--ink); }

.dash-grid--even { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.queue-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.queue-grid > div { display: flex; flex-direction: column; gap: 2px; }
.queue-grid strong { font-family: var(--font-display); font-size: 18px; letter-spacing: -0.02em; }

.server-list { display: grid; }
.server-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.server-row:last-child { border-bottom: 0; }
.server-row__name { color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.server-row__meta { margin-left: auto; color: var(--muted-2); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.settings-grid__wide { grid-column: span 2; }

@media (max-width: 980px) {
  .dash-grid--even { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-grid__wide { grid-column: span 1; }
}
@media (max-width: 560px) {
  .segmented { width: 100%; overflow-x: auto; }
  .segmented__item { flex: 1 0 auto; text-align: center; }
  .page-head__actions { gap: 6px; }
}

/* --- Профиль -------------------------------------------------------------- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.profile-card { display: flex; flex-direction: column; }
.profile-card .card__body { flex: 1; }
.profile-card--wide { grid-column: span 2; }
.profile-company { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.profile-company__text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.profile-company__text strong { font-size: 14px; }
.profile-company__text span { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.avatar--lg { width: 46px; height: 46px; font-size: 16px; }

.info-list { display: grid; gap: 0; margin: 0; }
.info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.info-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.info-list dt { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.info-list dd { margin: 0; color: var(--ink-2); font-size: 12px; text-align: right; word-break: break-word; }

.token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.token-row code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-2); letter-spacing: 0.03em; }

@media (max-width: 980px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-card--wide { grid-column: span 1; }
}

/* --- QR-меню: заказы и каталог -------------------------------------------- */
.crumb-back { margin-bottom: 2px; font-size: 11.5px; }
.crumb-back a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.crumb-back a:hover { color: var(--brand); }

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
  gap: 16px;
  align-items: start;
}
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line); }

.card-toolbar {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-pagination {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
}
.product-card:hover { transform: translateY(-2px); border-color: var(--brand-100); box-shadow: var(--shadow); color: var(--ink); }
.product-card__media {
  position: relative;
  display: grid;
  place-items: center;
  height: 128px;
  background:
    radial-gradient(80% 80% at 20% 10%, rgba(47, 111, 237, 0.12), transparent 70%),
    linear-gradient(145deg, #f1f5f9, #eef2ff);
  color: var(--brand-600);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
}
.product-card__type {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.product-card__body { display: flex; flex-direction: column; gap: 4px; padding: 12px 13px 13px; flex: 1; }
.product-card__category { color: var(--muted-2); font-size: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.product-card__title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }
.product-card__price { font-family: var(--font-display); font-size: 14px; font-weight: 800; letter-spacing: -0.02em; }

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}
.product-detail__media {
  display: grid;
  place-items: center;
  height: 220px;
  margin: 14px 14px 0;
  border-radius: 12px;
  background:
    radial-gradient(80% 80% at 20% 10%, rgba(47, 111, 237, 0.14), transparent 70%),
    linear-gradient(145deg, #f1f5f9, #eef2ff);
  color: var(--brand-600);
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 800;
}
.product-detail__price { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.04em; }

@media (max-width: 1280px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .order-grid { grid-template-columns: minmax(0, 1fr); }
  .product-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card__media { height: 104px; font-size: 30px; }
}

/* --- Рассылки ------------------------------------------------------------- */
.mailing-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
}
.mailing-state__item {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: help;
  outline: none;
}
.mailing-state__item--all { background: #f2f4f7; color: #344054; }
.mailing-state__item--all b { font-weight: 800; }
.mailing-state__item--wait { background: #fff7e6; border-color: #f6d38b; color: #b45309; }
.mailing-state__item--error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.mailing-state__item--send { background: #ecfdf3; border-color: #bbf7d0; color: #15803d; }
.mailing-state__item:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.mailing-state__item::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: 230px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #101828;
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -2px);
  transition: opacity .12s var(--ease), transform .12s var(--ease);
  pointer-events: none;
}
.mailing-state__item:last-child::after { left: auto; right: 0; transform: translate(0, -2px); }
.mailing-state__item:hover::after,
.mailing-state__item:focus-visible::after { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.mailing-state__item:last-child:hover::after,
.mailing-state__item:last-child:focus-visible::after { transform: translate(0, 0); }

.mailing-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) {
  .mailing-detail { grid-template-columns: minmax(0, 1fr); }
}

/* --- Платежи и баланс ----------------------------------------------------- */
.payments-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.paysys-list { display: grid; }
.paysys-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.paysys-row:last-child { border-bottom: 0; }
.paysys-row__logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand-50);
  color: var(--brand-600);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}
.paysys-row__text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.paysys-row__text strong { font-size: 12px; }
.paysys-row__text span { color: var(--muted-2); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paysys-row .badge { margin-left: auto; }

@media (max-width: 980px) {
  .payments-grid { grid-template-columns: minmax(0, 1fr); }
}

.payments-grid > *,
.payments-grid .dash-side,
.payments-grid .card { min-width: 0; }
.paysys-row__text { flex: 1 1 auto; }

/* --- Отчёты --------------------------------------------------------------- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.report-type {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.report-type:hover { transform: translateY(-2px); border-color: var(--brand-100); box-shadow: var(--shadow); color: var(--ink); }
.report-type__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--brand-50);
  color: var(--brand);
}
.report-type__body { display: flex; flex-direction: column; min-width: 0; gap: 2px; flex: 1 1 auto; }
.report-type__body strong { font-size: 13px; }
.report-type__body span { color: var(--muted); font-size: 11px; }
.report-type > .icon { color: var(--muted-2); }

.report-list { display: grid; }
.report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.report-row:last-child { border-bottom: 0; }
.report-row:hover { background: var(--surface-2); color: var(--ink); }
.report-row__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
}
.report-row__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; gap: 1px; }
.report-row__text strong { font-size: 12.5px; }
.report-row__text span { color: var(--muted-2); font-size: 10.5px; }
.report-row > .icon { color: var(--muted-2); }

@media (max-width: 1100px) {
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- Справка -------------------------------------------------------------- */
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.help-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.help-card:hover { transform: translateY(-2px); border-color: var(--brand-100); box-shadow: var(--shadow); color: var(--ink); }
.help-card__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--brand-50);
  color: var(--brand);
  flex: 0 0 auto;
}
.help-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.help-card__body strong { font-size: 13px; }
.help-card__body span { color: var(--muted); font-size: 11px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.help-card > .icon { color: var(--muted-2); }
.help-body { color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }
.help-body p { margin: 0 0 10px; }
.help-body p:last-child { margin-bottom: 0; }
@media (max-width: 760px) { .help-grid { grid-template-columns: minmax(0, 1fr); } }

/* --- Авторизация по звонку ------------------------------------------------ */
.authcall-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) {
  .authcall-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- Интеграции ----------------------------------------------------------- */
.integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.integration-card { display: flex; flex-direction: column; }
.integration-card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.integration-card__logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-50);
  color: var(--brand-600);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  flex: 0 0 auto;
}
.integration-card__title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; gap: 1px; }
.integration-card__title strong { font-size: 12.5px; }
.integration-card__title span { color: var(--muted-2); font-size: 10px; }
.integration-available { display: grid; }
.integration-available__row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.integration-available__row:last-child { border-bottom: 0; }
.integration-available__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; gap: 1px; }
.integration-available__text strong { font-size: 12px; }
.integration-available__text span { color: var(--muted-2); font-size: 10.5px; }
@media (max-width: 1100px) { .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .integration-grid { grid-template-columns: minmax(0, 1fr); } }

/* --- Формы редактирования ------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid__wide { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-actions .btn { min-width: 110px; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid__wide { grid-column: span 1; }
}
.inline-form { display: inline; }
.status-form { display: inline-flex; align-items: center; gap: 6px; }
.status-form .select { min-height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 11.5px; }

/* --- Публичные страницы (восстановление пароля) --------------------------- */
.auth-simple {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(47, 111, 237, 0.12), transparent 70%),
    var(--bg);
}
.auth-simple__card {
  width: 100%;
  max-width: 420px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.auth-simple__head { margin: 22px 0 16px; }
.auth-simple__head h1 { font-size: 23px; letter-spacing: -0.03em; }
.auth-simple__head p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.auth-simple__actions { margin-top: 16px; text-align: center; font-size: 12px; }
.auth-simple .auth-form { display: grid; gap: 14px; }
.auth-simple .brand__name { color: var(--ink); }
.auth-simple .brand__sub { color: var(--muted); }
.form-section-title { margin: 0 0 12px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 800px) { .form-grid--3 { grid-template-columns: minmax(0, 1fr); } }

/* --- Карточка звонка ------------------------------------------------------ */
.call-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
  align-items: start;
}
.recording-box { margin-top: 14px; }
@media (max-width: 900px) { .call-grid { grid-template-columns: minmax(0, 1fr); } }
.toolbar--bulk { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.merge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 16px; }
.merge-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface-2); }
@media (max-width: 700px) { .merge-grid { grid-template-columns: minmax(0, 1fr); } }

/* --- Регистрация: подсказки DaData --------------------------------------- */
.legal-fields { margin-top: 8px; }
.suggestion-field { position: relative; }
.suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% - 18px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.suggestion {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.suggestion:hover, .suggestion:focus { background: var(--surface-2); outline: none; }
.legal-fields[hidden] { display: none !important; }

/* --- Каталог интеграций --------------------------------------------------- */
.market-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.market-side { position: sticky; top: 86px; }
.market-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 14px; }
.market-search svg { color: var(--muted); flex: none; }
.market-search .input { border: 0; padding-left: 0; background: transparent; box-shadow: none; }
.market-nav { display: flex; flex-direction: column; gap: 3px; }
.market-nav__item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 10px; color: var(--ink-2); font-size: 14px; }
.market-nav__item > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.market-nav__item:hover { background: var(--surface-2); color: var(--ink); }
.market-nav__item.is-active { background: var(--surface-2); color: var(--ink); font-weight: 700; }
.market-nav__count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.market-nav__divider { height: 1px; background: var(--line); margin: 10px 0; }
.market-content__head { margin-bottom: 14px; }
.market-content__head h3 { font-size: 20px; margin: 0 0 3px; }
.market-content__head p { color: var(--muted); font-size: 13px; margin: 0; }
.market-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.market-card { display: flex; flex-direction: column; min-height: 220px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.market-card__top { display: flex; align-items: flex-start; justify-content: space-between; min-height: 44px; }
.market-card__logo { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.market-card__logo--letter { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--brand); }
.market-card__title { font-size: 16px; margin: 12px 0 4px; }
.market-card__descr { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.market-card__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.market-card__footer { display: flex; justify-content: flex-end; margin-top: 14px; }
@media (max-width: 900px) {
  .market-layout { grid-template-columns: minmax(0, 1fr); }
  .market-side { position: static; }
  .market-nav { flex-direction: row; flex-wrap: wrap; }
  .market-nav__divider { display: none; }
  .market-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Единый размер логотипов и 3 карточки в ряд */
.market-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.market-card__logo {
  width: 56px;
  height: 56px;
  padding: 8px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-sizing: border-box;
}
.market-card__logo--letter { padding: 0; border: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 1250px) { .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .market-grid { grid-template-columns: minmax(0, 1fr); } }

/* --- Динамический дашборд ------------------------------------------------ */
.dashboard-kpi .stat { min-height: 150px; }
.stat--balance { border-color: #c7d7fe; background: linear-gradient(160deg, #f5f8ff, var(--surface) 62%); }
.stat__top-action { margin-left: auto; flex: none; font-size: 10.5px; padding: 4px 8px; border-radius: 7px; white-space: nowrap; }
.stat__value--name { font-size: 22px; line-height: 1.2; }
.stat__value--muted { color: var(--muted); font-size: 20px; }
.service-card .card__body { padding: 18px 20px 20px; }
.service-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .8fr); gap: 22px; align-items: start; }
.service-side { border-left: 1px solid var(--line); padding-left: 18px; }
.service-panel-title { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; margin: 0 0 9px; }
.service-panel-title > span { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 12px; }
.operator-list { display: flex; flex-direction: column; gap: 2px; }
.operator-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.operator-row:last-child { border-bottom: 0; }
.operator-row__name { display: flex; flex-direction: column; gap: 1px; font-size: 13px; font-weight: 600; }
.operator-row__name span { color: var(--muted); font-weight: 400; font-size: 11px; }
.operator-row__value { font-size: 13px; font-weight: 700; white-space: nowrap; }
.auth-types { display: flex; flex-wrap: wrap; gap: 7px; }
.auth-type { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.auth-type b { color: var(--ink); }
@media (max-width: 1000px) {
  .service-grid { grid-template-columns: minmax(0, 1fr); }
  .service-side { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; }
}

.mailing-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 12px; }
.mailing-meta span { display: inline-flex; align-items: center; gap: 6px; }
.mailing-meta b { color: var(--ink); }
.bot-list { display: flex; flex-wrap: wrap; gap: 7px; }
.bot-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink-2); background: var(--surface-2); }

.user-menu__client {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 9px 10px;
  color: var(--ink-2);
  font-size: 12.5px;
}
.user-menu__client-label { display: inline-flex; align-items: center; gap: 9px; }
.user-menu__badge {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}

.token-row code { min-width: 0; overflow-wrap: anywhere; }
.token-row__toggle { margin-left: auto; flex: none; }

/* Заголовки секций формы не должны прилипать к предыдущему полю */
.form-section-title.mt-24 { margin-top: 32px; }

.token-state { border: 0; cursor: pointer; font-family: inherit; }
.token-state:hover { background: var(--line); color: var(--ink); }
.token-state:disabled { cursor: default; opacity: .65; }
.token-row code.is-copyable { cursor: copy; }
.token-row code.is-copyable:hover { color: var(--brand); }

/* Компактные показатели: значение ближе к подписи */
.stat-grid--compact .stat__value { margin-top: 7px; }

/* Компактные показатели: блок чуть выше и контент по центру */
.service-card .card__body { padding-top: 14px; }
.stat-grid--compact .stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
}
.stat-grid--compact .stat__value { margin-top: 5px; }


/* Компактные блоки: поднимаем строку и значение внутри */
.service-card .card__body { padding-top: 10px; }
.stat-grid--compact .stat__value { margin-top: 4px; }

/* Панель фильтров: все элементы по нижней линии контролов */
.toolbar { align-items: flex-end; }
.toolbar .segmented { min-height: 36px; box-sizing: border-box; }
.toolbar__right { align-self: flex-end; min-height: 36px; }

#auto-refresh-toggle.is-active { color: var(--brand); border-color: rgba(47, 111, 237, .28); background: var(--brand-50); }
#auto-refresh-status { align-self: center; white-space: nowrap; }
@media (max-width: 640px) { #auto-refresh-status { display: none; } }


.table tr.is-error-row > td { background: #fff7f5; }
.error-text {
  margin: 0;
  padding: 12px;
  border: 1px solid #fecdca;
  border-radius: 10px;
  background: #fffbfa;
  color: #7a271a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  overflow: auto;
}

/* --- Модальное окно заказа QR -------------------------------------------- */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, .48);
  overflow-y: auto;
}
.order-modal {
  width: min(100%, 1040px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(16, 24, 40, .25);
}
.order-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.order-modal__eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.order-modal__head h3 { margin: 2px 0 2px; font-family: var(--font-display); font-size: 24px; letter-spacing: -.02em; }
.order-modal__head p { margin: 0; color: var(--muted); font-size: 12px; }
.order-modal__head-actions { display: flex; align-items: center; gap: 10px; }
.order-modal__body { flex: 1 1 auto; min-height: 0; max-height: calc(100vh - 230px); padding: 18px 20px; overflow-y: auto; }
.order-modal__grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .8fr); gap: 22px; }
.order-modal__side { border-left: 1px solid var(--line); padding-left: 18px; }
.order-modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 800px) {
  .modal-backdrop { padding: 10px; }
  .order-modal { max-height: calc(100vh - 20px); border-radius: 14px; }
  .order-modal__grid { grid-template-columns: minmax(0, 1fr); }
  .order-modal__side { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 14px; }
  .order-modal__head h3 { font-size: 21px; }
}


.toolbar-refresh { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; color: var(--brand); }
.toolbar-refresh[hidden], .toolbar__right [hidden] { display: none !important; }
.toolbar-refresh .icon { animation: spin .8s linear infinite; }


.order-modal__comment-title { margin-top: 24px !important; }


.order-modal__status-actions { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.order-modal__status-actions .btn { white-space: nowrap; }
@media (max-width: 900px) {
  .order-modal__head { flex-wrap: wrap; }
  .order-modal__head-actions { width: 100%; justify-content: space-between; }
  .order-modal__status-actions { width: 100%; justify-content: flex-start; }
}


.table tbody tr[data-order-modal] { cursor: pointer; }
.table tbody tr[data-order-modal]:hover > td { background: var(--surface-2); }


.btn--success { border-color: #abefc6; background: var(--green-50); color: #05603a; }
.btn--success:hover { background: #dcfae6; color: #054f31; }
.btn--warn { border-color: #fedf89; background: var(--amber-50); color: #93370d; }
.btn--warn:hover { background: #fef0c7; color: #7a2e0e; }


/* Сворачивание сайдбара на десктопе */
@media (min-width: 981px) {
  .app { transition: grid-template-columns .2s var(--ease); }
  .app.is-sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .app.is-sidebar-collapsed .sidebar { transform: translateX(-104%); }
  .sidebar { transition: transform .2s var(--ease); }
}

.order-modal__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  color: var(--muted);
  font-size: 13px;
}

/* Отступ между строкой показателей и заголовками под ней */
.service-card .stat-grid--compact { margin-bottom: 16px; }

.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover > td { background: var(--surface-2); }
.comment-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comment-form .select { min-width: 260px; max-width: 420px; }
.transcript-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  max-height: 360px;
  overflow: auto;
}
.transcript-text.is-full { max-height: 520px; }
.transcript-summary { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.transcript-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--muted); font-size: 11px; }

/* Мобильные таблицы без карточного режима прокручиваются внутри карточки */
@media (max-width: 720px) {
  .table:not(.table--cards) {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }
  .paysys-row { flex-wrap: wrap; }
  .paysys-row__text { flex: 1 1 0; width: 0; }
  .paysys-row__text span { white-space: normal; overflow: visible; text-overflow: clip; }
  .paysys-row .badge { margin-left: 0; }
}

.table tbody tr[data-cdr-modal] { cursor: pointer; }
.table tbody tr[data-cdr-modal]:hover > td { background: var(--surface-2); }


.footer__legal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.footer__legal a { color: var(--muted); }
.footer__legal a:hover { color: var(--brand); }

.call-audio-player {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  width: min(380px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(16, 24, 40, .22);
}
.call-audio-player__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.call-audio-player__head .icon-btn { width: 28px; height: 28px; }
.call-audio-player__body { min-height: 34px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .call-audio-player { right: 16px; bottom: 16px; } }

.peer-row__edit { margin-left: auto; width: 28px; height: 28px; }
.peer-pagination { padding: 10px 14px; }

.stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finance-card .table td { vertical-align: middle; }
.finance-status { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--muted-2); }
.finance-status.is-active { background: var(--green); }
.finance-table td:first-child { font-size: 12.5px; }
@media (max-width: 720px) {
  .stat-grid--3 { grid-template-columns: minmax(0, 1fr); }
}

.voice-group + .voice-group { margin-top: 16px; }
.voice-group__title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.voice-list { display: flex; flex-direction: column; gap: 6px; }
.voice-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.voice-row:last-child { border-bottom: 0; }
.voice-row__title { flex: 1; min-width: 0; font-size: 12.5px; }

.product-card__media img,
.product-detail__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-card__media.is-empty,
.product-detail__media.is-empty { background: var(--surface-3); }
.product-card__descr {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__media { position: relative; }
.product-card__fallback { position: relative; z-index: 0; }
.product-card__media img { position: absolute; inset: 0; z-index: 1; }
.product-card__type { z-index: 2; }
.product-detail__media { position: relative; }
.product-detail__media img { position: absolute; inset: 0; border-radius: 12px; }

.site-qr { display: flex; align-items: center; gap: 14px; }
.site-qr img { border: 1px solid var(--line); border-radius: 10px; background: #fff; }



/* Компактная сетка каталога QR-меню: больше товаров на экране */
.product-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.product-card { border-radius: 12px; }
.product-card__media { height: 108px; font-size: 30px; }
.product-card__body { gap: 3px; padding: 9px 10px 10px; }
.product-card__category { font-size: 9.5px; }
.product-card__title { font-size: 12px; line-height: 1.3; -webkit-line-clamp: 2; }
.product-card__descr { font-size: 10.5px; line-height: 1.3; -webkit-line-clamp: 1; }
.product-card__foot { gap: 6px; padding-top: 6px; }
.product-card__price { font-size: 13px; }
.product-card__foot .badge { font-size: 9.5px; padding: 2px 6px; }
@media (max-width: 1280px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .product-card__media { height: 92px; font-size: 26px; }
}

.section-editor { display: flex; flex-direction: column; gap: 10px; }
.section-editor__box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.section-editor__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.section-editor__title { flex: 1 1 220px; min-width: 160px; font-weight: 700; }
.section-editor__status { width: auto; min-width: 105px; }
.section-editor__items { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.section-chip { display: inline-flex; align-items: center; gap: 3px; padding: 4px 6px 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 11px; }
.section-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 12px; }
.section-chip button:hover { color: var(--ink); }
.section-chip button:disabled { opacity: .35; cursor: default; }
.section-editor__add { display: flex; gap: 6px; align-items: center; }
.section-editor__add .select { max-width: 280px; }
.section-editor__actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }


/* Равная высота карточек «Сайт меню» и «Страницы» */
.settings-grid--equal { align-items: stretch; }
.settings-grid--equal > .card { display: flex; flex-direction: column; }
.settings-grid--equal > .card > .card__body { flex: 1; }

/* Не даём textarea растягиваться шире формы */
textarea.input {
  resize: vertical;
  max-width: 100%;
  box-sizing: border-box;
}


/* Редактор страницы QR-меню: форма на всю доступную ширину */
.page-form-card { width: 100%; max-width: none; }

/* Фото менеджера в KPI и просмотр */
.stat__avatar {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--surface-3);
  cursor: zoom-in;
}
.stat__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; }
.photo-lightbox[hidden] { display: none; }
.photo-lightbox__backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .72); }
.photo-lightbox__dialog { position: relative; z-index: 1; max-width: min(720px, 92vw); max-height: 88vh; }
.photo-lightbox__dialog img { display: block; max-width: 100%; max-height: 88vh; border-radius: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, .35); background: #fff; }
.photo-lightbox__close { position: absolute; top: -14px; right: -14px; background: #fff; border: 1px solid var(--line); }

/* Компактная таблица авторизаций */
.phone-compact { font-variant-numeric: tabular-nums; white-space: nowrap; }
.auth-type-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
  cursor: help;
}
.auth-type-icon:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.auth-type-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  z-index: 20;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 10.5px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(2px);
  transition: opacity .12s var(--ease), transform .12s var(--ease);
}
.auth-type-icon:hover .auth-type-tip,
.auth-type-icon:focus .auth-type-tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Карточный режим для узкой колонки авторизаций (не только по viewport) */
.authcall-table-wrap { container-type: inline-size; }
@container (max-width: 620px) {
  .authcall-table-wrap .authcall-table thead { display: none; }
  .authcall-table-wrap .authcall-table,
  .authcall-table-wrap .authcall-table tbody,
  .authcall-table-wrap .authcall-table tr,
  .authcall-table-wrap .authcall-table td { display: block; width: 100%; }
  .authcall-table-wrap .authcall-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .authcall-table-wrap .authcall-table tbody tr:last-child { border-bottom: 0; }
  .authcall-table-wrap .authcall-table td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding: 5px 0; border: 0; text-align: right;
  }
  .authcall-table-wrap .authcall-table td::before {
    content: attr(data-label); flex: 0 0 42%; color: var(--muted-2); font-size: 10px;
    font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left;
  }
  .authcall-table-wrap .authcall-table td:first-child { padding-top: 0; }
  .authcall-table-wrap .authcall-table td:last-child { padding-bottom: 0; }
}

/* График нагрузки авторизации за 24 часа */
.auth-hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  overflow: hidden;
  min-height: 164px;
  padding-top: 6px;
}
.auth-hourly-bar {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 164px;
}
.auth-hourly-bar__track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 140px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.auth-hourly-bar__total {
  position: relative;
  width: 100%;
  min-height: 0;
  border-radius: 3px 3px 0 0;
  background: var(--brand-100);
}
.auth-hourly-bar__rejected {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  background: #e5484d;
  border-radius: 3px 3px 0 0;
}
.auth-hourly-bar__label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
  white-space: nowrap;
}
.auth-hourly-bar__label.is-muted { display: none; }
.auth-hourly-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 10.5px; }
.auth-hourly-legend span { display: inline-flex; align-items: center; gap: 5px; }
.auth-hourly-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.auth-hourly-dot--total { background: var(--brand-100); }
.auth-hourly-dot--rejected { background: #e5484d; }

/* Ось времени отдельно под графиком */
.auth-hourly-chart { display: flex; flex-direction: column; gap: 6px; min-height: 0; padding-top: 6px; overflow: hidden; }
.auth-hourly-plot { display: flex; align-items: flex-end; gap: 2px; height: 140px; }
.auth-hourly-bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.auth-hourly-bar__track { display: flex; align-items: flex-end; width: 100%; height: 100%; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.auth-hourly-axis { display: flex; gap: 2px; padding-top: 1px; border-top: 1px solid var(--line); }
.auth-hourly-axis__label { flex: 1 1 0; min-width: 0; overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.2; text-align: center; white-space: nowrap; }
.auth-hourly-axis__label.is-empty { visibility: hidden; }

.auth-hourly-chart,
.auth-hourly-axis,
.auth-hourly-plot { min-width: 0; width: 100%; }
.auth-hourly-axis { overflow: hidden; }
.auth-hourly-axis__label { max-width: 100%; }

.authcall-grid > * { min-width: 0; }
.authcall-grid .dash-side,
.authcall-grid .dash-side > .card { min-width: 0; }

.auth-hourly-chart { overflow: visible; }
.auth-hourly-axis { overflow: visible; }
.auth-hourly-axis__label { overflow: visible; max-width: none; font-size: 7.5px; }

.auth-hourly-body { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.auth-hourly-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 28px;
  height: 140px;
  padding: 1px 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
  text-align: right;
  box-sizing: border-box;
}
.auth-hourly-plot { flex: 1 1 0; width: auto; min-width: 0; }
.auth-hourly-axis { padding-left: 34px; box-sizing: border-box; }
.auth-hourly-scale { margin-left: auto; color: var(--muted-2); font-size: 9.5px; }

.auth-hourly-chart { align-items: stretch; }

/* Увеличенное фото менеджера: компактный просмотр */
.photo-lightbox__dialog { max-width: min(240px, 80vw); max-height: 340px; }
.photo-lightbox__dialog img { max-height: 320px; }

/* Номера авторизации в узкой колонке — карточный режим */
.authcall-phones-wrap { container-type: inline-size; }
@container (max-width: 620px) {
  .authcall-phones-wrap .authcall-phones-table thead { display: none; }
  .authcall-phones-wrap .authcall-phones-table,
  .authcall-phones-wrap .authcall-phones-table tbody,
  .authcall-phones-wrap .authcall-phones-table tr,
  .authcall-phones-wrap .authcall-phones-table td { display: block; width: 100%; }
  .authcall-phones-wrap .authcall-phones-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .authcall-phones-wrap .authcall-phones-table tbody tr:last-child { border-bottom: 0; }
  .authcall-phones-wrap .authcall-phones-table td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding: 5px 0; border: 0; text-align: right;
  }
  .authcall-phones-wrap .authcall-phones-table td::before {
    content: attr(data-label); flex: 0 0 42%; color: var(--muted-2); font-size: 10px;
    font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left;
  }
  .authcall-phones-wrap .authcall-phones-table td:first-child { padding-top: 0; }
  .authcall-phones-wrap .authcall-phones-table td:last-child { padding-bottom: 0; }
}

/* Компактная таблица звонков: 10 колонок помещаются в контент */
.cdr-table th, .cdr-table td { padding-left: 7px; padding-right: 7px; }
.cdr-table td { font-size: 12px; }

/* Кнопка меню доступна и на десктопе: это сворачивание в иконки */
.topbar__menu { display: inline-grid; }

@media (min-width: 981px) {
  .app.is-sidebar-collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .app.is-sidebar-collapsed .sidebar {
    width: 76px;
    padding-left: 8px;
    padding-right: 8px;
    transform: none;
    overflow: hidden;
  }
  .app.is-sidebar-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .app.is-sidebar-collapsed .brand__text,
  .app.is-sidebar-collapsed .nav__section,
  .app.is-sidebar-collapsed .nav-link > span,
  .app.is-sidebar-collapsed .nav-sub,
  .app.is-sidebar-collapsed .sidebar__company,
  .app.is-sidebar-collapsed .sidebar__user-text { display: none; }
  .app.is-sidebar-collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
  .app.is-sidebar-collapsed .nav-link.is-active::before { margin-left: -8px; }
  .app.is-sidebar-collapsed .sidebar__foot { padding-left: 0; padding-right: 0; }
  .app.is-sidebar-collapsed .sidebar__user { justify-content: center; padding: 8px; }
}

/* Сайдбар мониторинга не должен расширяться графиком */
.dash-grid > * { min-width: 0; }
.dash-side, .dash-side > .card { min-width: 0; }

/* Переверстка мониторинга телефонии */
.monitor-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}
.monitor-top-grid > .card { display: flex; flex-direction: column; min-width: 0; }
.monitor-top-grid > .card > .card__body { flex: 1; }
.operators-scroll { max-height: 360px; overflow-y: auto; }
.operators-table th, .operators-table td { padding-left: 9px; padding-right: 9px; }
.operator-person { display: flex; align-items: center; gap: 7px; min-width: 0; }
.operator-lamp { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #ef4444; }
.operator-lamp.is-online { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
.operator-person__text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.operator-person__text strong { font-size: 11.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.operator-person__text small { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1200px) {
  .monitor-top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-top-grid > #operators-card { grid-column: span 2; }
}
@media (max-width: 820px) {
  .monitor-top-grid { grid-template-columns: minmax(0, 1fr); }
  .monitor-top-grid > #operators-card { grid-column: span 1; }
  .operators-scroll { max-height: none; }
}

/* Операторы: без внутренней прокрутки, 6 строк на страницу */
.operators-scroll { max-height: none; overflow: visible; }

.operator-filter { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.operator-filter__lamp {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
  box-shadow: 0 0 0 3px transparent;
  transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
.operator-filter__lamp:hover { transform: scale(1.12); }
.operator-filter__lamp--online { background: #16a34a; }
.operator-filter__lamp--offline { background: #ef4444; }
.operator-filter__lamp.is-active { box-shadow: 0 0 0 3px rgba(47, 111, 237, .22); }
.operator-filter .card__sub { margin-left: 2px; font-size: 10px; white-space: nowrap; }

.operator-filter { flex-wrap: wrap; justify-content: flex-end; }
.operator-filter__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.operator-filter__btn:hover { border-color: var(--line-strong); color: var(--ink); }
.operator-filter__btn.is-active { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.operator-filter__btn--online.is-active { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.operator-filter__btn--offline.is-active { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.operator-filter__btn .operator-filter__lamp { width: 7px; height: 7px; flex: 0 0 7px; box-shadow: none; }

/* Верхний ряд графиков авторизации */
.authcall-charts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}
.authcall-charts-grid > .card { display: flex; flex-direction: column; min-width: 0; }
.authcall-charts-grid > .card > .card__body { flex: 1; }
.authcall-charts-grid .auth-hourly-axis { padding-left: 34px; }
.daily-cost-bar { background: #86efac; }
.daily-cost-dot { background: #16a34a; }
@media (max-width: 1400px) {
  .authcall-charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .authcall-charts-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Объявление под шапкой */
.announcement-wrap { padding: 14px clamp(16px, 2.6vw, 36px) 0; }
.announcement {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 11px 13px;
  border: 1px solid #f3c46d;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff8e7 0%, #fffdf5 70%);
  box-shadow: 0 4px 14px rgba(180, 120, 20, .08);
}
.announcement__icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #fef0c7;
  color: #b45309;
}
.announcement__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12.5px; color: #78350f; }
.announcement__text strong { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #92400e; }
.announcement__text span { line-height: 1.45; }
.announcement__close {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin: -3px -4px 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a16207;
  cursor: pointer;
}
.announcement__close:hover { background: rgba(180, 120, 20, .1); color: #854d0e; }
@media (max-width: 720px) {
  .announcement-wrap { padding-top: 10px; }
  .announcement { padding: 10px 11px; gap: 8px; }
  .announcement__text { font-size: 12px; }
}

/* Визуальный редактор вариантов товара */
.variant-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.variant-editor__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.variant-editor__columns {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(90px, .8fr) minmax(110px, 1fr) minmax(80px, .7fr) 34px;
  gap: 8px;
  padding: 0 4px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.variant-editor__rows { display: flex; flex-direction: column; gap: 6px; }
.variant-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(90px, .8fr) minmax(110px, 1fr) minmax(80px, .7fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}
.variant-row .input { min-width: 0; }
.variant-row .icon-btn { color: var(--danger, #dc2626); font-size: 19px; }
.variant-editor__empty {
  padding: 12px;
  border: 1px dashed var(--line-strong, #cbd5e1);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.variant-json { margin-top: 4px; }
.variant-json summary { color: var(--muted); font-size: 11.5px; cursor: pointer; }
.variant-json summary:hover { color: var(--brand); }
.variant-json textarea { margin-top: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
@media (max-width: 760px) {
  .variant-editor__head { flex-direction: column; }
  .variant-editor__columns { display: none; }
  .variant-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; padding: 9px; }
  .variant-row [data-variant-field="title"],
  .variant-row [data-variant-field="sku"] { grid-column: span 2; }
  .variant-row [data-variant-field="price"],
  .variant-row [data-variant-field="tare"] { grid-column: span 1; }
}

/* Изображение товара: превью вместо пути */
.product-image-editor { display: flex; align-items: flex-start; gap: 16px; }
.product-image-preview {
  display: grid;
  place-items: center;
  width: 148px;
  height: 112px;
  flex: 0 0 148px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}
.product-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.product-image-preview__empty { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted-2); font-size: 10.5px; }
.product-image-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.product-image-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 560px) {
  .product-image-editor { flex-direction: column; }
  .product-image-preview { width: 100%; height: 180px; flex-basis: auto; }
}

.inline-form { display: inline-flex; margin: 0; }

.btn--sync {
  gap: 7px;
  border-color: #d7dce5;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.btn--sync:hover { border-color: var(--brand); background: #f8fbff; color: var(--brand-700); }
.btn--sync__logo { width: 20px; height: 18px; object-fit: contain; flex: 0 0 20px; }

/* Отчёт синхронизации меню */
.sync-report { margin-bottom: 16px; scroll-margin-top: calc(var(--topbar-h) + 14px); }
.sync-report__controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sync-report__controls .search { min-width: 220px; flex: 1 1 260px; }
.sync-report__controls .select { max-width: 190px; }
.sync-report__table td { vertical-align: middle; }
.sync-report__thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 7px; display: block; }
.sync-report__descr { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .sync-report__controls .select { max-width: none; flex: 1 1 140px; }
  .sync-report__descr { max-width: 180px; }
}

.sync-report .table-wrap { max-height: 520px; overflow-y: auto; }
.sync-report [data-report-empty][hidden] { display: none !important; }

.btn--sync { height: 32px; min-height: 32px; padding-top: 5px; padding-bottom: 5px; }

/* Блокировка экрана во время синхронизации меню */
.sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 15, 30, .52);
  backdrop-filter: blur(3px);
}
.sync-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 230px;
  padding: 24px 28px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(8, 15, 30, .28);
  text-align: center;
}
.sync-overlay__card strong { font-size: 13.5px; color: var(--ink); }
.sync-overlay__card span:not(.sync-overlay__spinner) { font-size: 11.5px; color: var(--muted); }
.sync-overlay__spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 5px;
  border: 3px solid var(--brand-100, #dbeafe);
  border-top-color: var(--brand, #2f6fed);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
body.sync-busy { overflow: hidden; }

/* Сводка звонков + финансы в одном ряду */
.cdr-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}
.cdr-summary { display: flex; flex-direction: column; height: 100%; }
.cdr-summary__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; margin: 8px 0 2px; font-size: 11.5px; color: var(--muted); }
.cdr-summary__rows > div { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.cdr-summary__rows strong { color: var(--ink); font-size: 12px; }
.cdr-summary__dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--muted-2); }
.cdr-summary__dot--green { background: #16a34a; }
.cdr-summary__dot--red { background: #ef4444; }
.cdr-summary__dot--blue { background: #2f6fed; }
.cdr-summary__dot--muted { background: #98a2b3; }
.finance-summary { min-width: 0; }
.finance-summary .card__body { min-height: 0; }
@media (max-width: 980px) {
  .cdr-summary-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .cdr-summary__rows { grid-template-columns: 1fr; }
}

/* Улучшенная карточка сводки звонков */
.cdr-summary { gap: 0; }
.cdr-summary__head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cdr-summary__head .stat__label { font-size: 11.5px; }
.cdr-summary__period { margin-left: auto; color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.cdr-summary__hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.cdr-summary__total strong { display: block; font-family: var(--font-display); font-size: 36px; line-height: 1; letter-spacing: -.04em; color: var(--ink); }
.cdr-summary__total span { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.cdr-summary__donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  border-radius: 50%;
  background: conic-gradient(#16a34a calc(var(--rate, 0) * 1%), #eef2f7 0);
}
.cdr-summary__donut::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.cdr-summary__donut > div { position: relative; text-align: center; }
.cdr-summary__donut strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 17px; line-height: 1.1; }
.cdr-summary__donut span { display: block; color: var(--muted); font-size: 8.5px; }
.cdr-summary__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); }
.cdr-summary__metric { display: flex; align-items: center; gap: 5px; min-width: 0; }
.cdr-summary__metric-label { color: var(--muted); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdr-summary__metric strong { margin-left: auto; color: var(--ink); font-size: 11.5px; white-space: nowrap; }
.cdr-summary__dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--muted-2); }
.cdr-summary__dot--green { background: #16a34a; }
.cdr-summary__dot--red { background: #ef4444; }
.cdr-summary__dot--blue { background: #2f6fed; }
.cdr-summary__dot--muted { background: #98a2b3; }

/* Текст сообщения в таблице получателей */
.mailing-message {
  display: -webkit-box;
  max-width: 360px;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 11.5px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
@media (max-width: 720px) {
  .mailing-message { max-width: none; }
}

/* Кликабельные строки получателей рассылки */
.table tbody tr[data-mailing-recipient-url] { cursor: pointer; }
.table tbody tr[data-mailing-recipient-url]:hover > td { background: var(--surface-2); }
.table tbody tr[data-mailing-recipient-url]:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.recipient-modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.recipient-modal__field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recipient-modal__field > span { color: var(--muted); font-size: 10.5px; }
.recipient-modal__field > strong { color: var(--ink); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.recipient-modal__field--wide { grid-column: 1 / -1; }
.recipient-modal__message { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .recipient-modal__grid { grid-template-columns: 1fr; }
  .recipient-modal__field--wide { grid-column: auto; }
}

.table-sort { display: inline-flex; align-items: center; gap: 3px; color: inherit; }
.table-sort:hover { color: var(--brand); }

/* Планшеты: карточные таблицы раньше, чтобы не появлялся горизонтальный скролл */
@media (max-width: 900px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table--cards tbody tr:last-child { border-bottom: 0; }
  .table--cards td { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 5px 0; border: 0; text-align: right; }
  .table--cards td::before { content: attr(data-label); flex: 0 0 42%; color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left; }
  .table--cards td:first-child { padding-top: 0; }
  .table--cards td:last-child { padding-bottom: 0; }
  .table--cards .cell-person { justify-content: flex-end; text-align: right; }
  .table--cards .cell-person__text { align-items: flex-end; }
}

/* Фотографии в рассылке */
.mailing-images-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mailing-images__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mailing-images__preview { display: flex; flex-wrap: wrap; gap: 8px; }
.mailing-image-thumb {
  display: block;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.mailing-image-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Изображения из отправленной рассылки */
.recipient-modal__grid--with-image { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 190px; }
.recipient-modal__images {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-self: start;
}
.recipient-modal__images > span { color: var(--muted); font-size: 10.5px; }
.recipient-modal__image-list { display: flex; flex-wrap: wrap; gap: 7px; }
.recipient-modal__image-list a {
  display: block;
  width: 84px;
  height: 84px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.recipient-modal__image-list img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 760px) {
  .recipient-modal__grid--with-image { grid-template-columns: minmax(0, 1fr); }
  .recipient-modal__images { grid-column: auto; grid-row: auto; }
}

.field__label--required::after { content: " *"; color: #d92d20; }

.icon-btn--protected { color: #b8c0cc; opacity: .7; cursor: not-allowed; }
.icon-btn--protected:hover { background: transparent; color: #b8c0cc; }

/* Таблица рассылок: фиксированная раскладка без горизонтальной прокрутки */
.mailing-table-wrap { overflow-x: hidden; }
.mailing-table { table-layout: fixed; width: 100%; }
.mailing-table th:nth-child(1), .mailing-table td:nth-child(1) { width: auto; }
.mailing-table th:nth-child(2), .mailing-table td:nth-child(2) { width: 140px; }
.mailing-table th:nth-child(3), .mailing-table td:nth-child(3) { width: 92px; }
.mailing-table th:nth-child(4), .mailing-table td:nth-child(4) { width: 112px; }
.mailing-table th:nth-child(5), .mailing-table td:nth-child(5) { width: 190px; }
.mailing-table th:nth-child(6), .mailing-table td:nth-child(6) { width: 52px; }
.mailing-table td:nth-child(1) { overflow: hidden; }
.mailing-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }

/* Контент бота */
.bot-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.bot-stat { display: flex; flex-direction: column; gap: 2px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.bot-stat__label { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.bot-stat strong { font-size: 24px; line-height: 1.15; color: var(--text); }
.bot-stat__hint { color: var(--muted); font-size: 11px; }
.bot-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.bot-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 600; }
.bot-tab:hover { color: var(--text); border-color: #cbd5e1; }
.bot-tab.is-active { color: var(--brand-600); border-color: #c7d7fe; background: #eef4ff; }
.bot-filter { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.bot-category-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: thin; }
.bot-category { flex: 0 0 235px; display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.bot-category.is-active { border-color: #b9cdfb; box-shadow: 0 0 0 2px #eef4ff; }
.bot-category__main { flex: 1; display: flex; align-items: center; gap: 9px; padding: 10px 11px; min-width: 0; color: inherit; }
.bot-category__emoji { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; background: #f1f5f9; font-size: 17px; }
.bot-category__text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.bot-category__text strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-category__text small { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-category__actions { display: flex; align-items: center; gap: 1px; padding-right: 4px; }
.bot-category__actions .icon-btn { width: 26px; height: 26px; }
.bot-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 10px; }
.bot-product { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; }
.bot-product__media { position: relative; height: 112px; background: linear-gradient(145deg, #f1f5f9, #e8eef7); }
.bot-product__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bot-product__fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-size: 34px; font-weight: 700; }
.bot-product__media img + .bot-product__fallback { display: none; }
.bot-product__status { position: absolute; top: 7px; left: 7px; }
.bot-product__body { display: flex; flex-direction: column; gap: 4px; padding: 10px 11px 8px; }
.bot-product__title { font-size: 12.5px; font-weight: 700; color: var(--text); }
.bot-product__descr { color: var(--muted); font-size: 11px; line-height: 1.35; min-height: 29px; }
.bot-product__meta { display: flex; align-items: baseline; gap: 7px; margin-top: 2px; }
.bot-product__price { font-size: 13px; font-weight: 700; color: var(--brand-600); }
.bot-product__actions { display: flex; gap: 2px; justify-content: flex-end; padding: 0 8px 7px; }
.bot-product__actions .icon-btn { width: 27px; height: 27px; }
.bot-inline-empty { padding: 15px 4px; color: var(--muted); font-size: 12px; }
.bot-empty { padding: 34px 16px; }
.bot-response-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bot-response-head strong { display: block; font-size: 12.5px; }
.bot-response-head .muted { display: block; margin-top: 2px; font-size: 10.5px; }
@media (max-width: 900px) {
  .bot-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-products { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .bot-category { flex-basis: 210px; }
}
@media (max-width: 560px) {
  .bot-stats { gap: 7px; }
  .bot-stat { padding: 10px 11px; }
  .bot-stat strong { font-size: 20px; }
  .bot-filter { align-items: stretch; }
  .bot-filter .field, .bot-filter .search { width: 100%; }
  .bot-products { grid-template-columns: 1fr 1fr; gap: 7px; }
  .bot-product__media { height: 90px; }
  .bot-product__body { padding: 8px; }
}

/* Контент бота: таблица */
.bot-product-table { table-layout: fixed; width: 100%; }
.bot-product-table th:nth-child(1), .bot-product-table td:nth-child(1) { width: auto; }
.bot-product-table th:nth-child(2), .bot-product-table td:nth-child(2) { width: 170px; }
.bot-product-table th:nth-child(3), .bot-product-table td:nth-child(3) { width: 100px; }
.bot-product-table th:nth-child(4), .bot-product-table td:nth-child(4) { width: 100px; }
.bot-product-table th:nth-child(5), .bot-product-table td:nth-child(5) { width: 82px; }
.bot-product-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bot-product-cell__media { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 9px; overflow: hidden; background: linear-gradient(145deg, #f1f5f9, #e8eef7); color: #94a3b8; font-size: 16px; font-weight: 700; }
.bot-product-cell__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bot-product-cell__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-product-cell__text strong { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-product-cell__text small { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-product-cell__text em { color: var(--muted); font-size: 10px; font-style: normal; }
.bot-product-table__price { font-weight: 700; color: var(--brand-600); }
@media (max-width: 900px) {
  .bot-product-table { table-layout: auto; }
  .bot-product-cell__text strong, .bot-product-cell__text small { white-space: normal; }
}

/* Разделы бота: сетка вместо горизонтальной прокрутки */
.bot-category-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  overflow: visible;
  padding: 2px 0 12px;
}
.bot-category-strip .bot-category { flex: none; width: auto; min-width: 0; }
@media (max-width: 560px) {
  .bot-category-strip { grid-template-columns: 1fr; }
}

.bot-product-row { cursor: pointer; }
.bot-product-row:hover > td { background: var(--surface-2); }

.bot-category__status { font-weight: 600; }
.bot-category__status.is-active { color: #067647; }
.bot-category__status.is-hidden { color: #98a2b3; }

/* Представление меню бота */
.bot-preview-card .card__body { padding: 16px 18px 22px; }
.bot-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.bot-preview-head h3 { margin: 0 0 3px; font-size: 14px; }
.bot-preview-head p { margin: 0; color: var(--muted); font-size: 11.5px; }
.bot-phones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; max-width: 760px; margin: 0 auto; }
.bot-phone-wrap { min-width: 0; }
.bot-phone-label { text-align: center; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; }
.bot-phone { width: 100%; max-width: 340px; margin: 0 auto; overflow: hidden; border: 5px solid #111827; border-radius: 28px; background: #17202b; box-shadow: 0 18px 40px rgba(16, 24, 40, .22); color: #eef2f8; }
.bot-phone__top { display: flex; align-items: center; gap: 7px; padding: 9px 10px; background: #1f2937; }
.bot-phone__back, .bot-phone__menu { color: #94a3b8; font-size: 18px; line-height: 1; }
.bot-phone__avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #334155; color: #fff; font-size: 11px; font-weight: 700; }
.bot-phone__title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bot-phone__title strong { font-size: 11.5px; line-height: 1.2; }
.bot-phone__title small { color: #94a3b8; font-size: 9px; }
.bot-phone__chat { position: relative; padding: 14px 10px 10px; min-height: 430px; background-color: #111a24; background-image: radial-gradient(circle at 12px 12px, rgba(148, 163, 184, .16) 1.3px, transparent 1.3px), radial-gradient(circle at 40px 34px, rgba(148, 163, 184, .09) 1px, transparent 1px); background-size: 56px 56px; }
.bot-phone--telegram .bot-phone__chat { background-color: #0e1621; background-image: radial-gradient(circle at 12px 12px, rgba(125, 177, 255, .15) 1.3px, transparent 1.3px), radial-gradient(circle at 40px 34px, rgba(125, 177, 255, .08) 1px, transparent 1px); }
.bot-phone__time { text-align: center; color: #93a4b8; font-size: 9px; margin-bottom: 8px; }
.bot-phone__bubble { width: fit-content; margin-left: auto; padding: 7px 10px; border-radius: 12px 12px 3px 12px; background: #374151; color: #f8fafc; font-size: 11px; }
.bot-phone__keyboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 9px; }
.bot-phone__key { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 31px; padding: 5px 6px; border: 1px solid #3b4351; border-radius: 8px; background: #323b4b; color: #f1f5f9; font-size: 9.5px; line-height: 1.2; text-align: center; }
.bot-phone__key.is-wide { grid-column: span 2; }
.bot-phone--max .bot-phone__key { background: #3b2a56; border-color: #5b3f7d; }
.bot-phone--telegram .bot-phone__key { background: #223a55; border-color: #355578; }
.bot-phone__input { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: #1f2937; color: #94a3b8; font-size: 10px; }
.bot-phone__send { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #3b82f6; color: #fff; font-size: 10px; }
@media (max-width: 900px) {
  .bot-phones { gap: 12px; max-width: none; }
  .bot-phone { border-width: 4px; border-radius: 22px; }
  .bot-phone__chat { min-height: 360px; }
}
@media (max-width: 620px) {
  .bot-phones { grid-template-columns: 1fr; }
  .bot-phone { max-width: 330px; }
  .bot-phone__chat { min-height: 330px; }
}

/* Telegram: меню в нижней клавиатуре */
.bot-phone { display: flex; flex-direction: column; }
.bot-phone--telegram .bot-phone__chat { min-height: 268px; }
.bot-phone__reply-keyboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 7px 8px;
  border-top: 1px solid #334155;
  background: #1b2531;
}
.bot-phone--telegram .bot-phone__reply-keyboard .bot-phone__key {
  min-height: 29px;
  border-color: #3b4d63;
  background: #24384f;
}
@media (max-width: 900px) {
  .bot-phone--telegram .bot-phone__chat { min-height: 240px; }
}
@media (max-width: 620px) {
  .bot-phone--telegram .bot-phone__chat { min-height: 220px; }
}

/* Одинаковая высота макетов MAX и Telegram */
@media (min-width: 621px) {
  .bot-phones { align-items: stretch; }
  .bot-phone-wrap { display: flex; flex-direction: column; }
  .bot-phone { height: 100%; }
  .bot-phone .bot-phone__chat { flex: 1 1 auto; }
}

/* Представление бота + редактор контента */
.bot-preview-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 22px; align-items: stretch; }
.bot-preview-layout .bot-phone-wrap { display: flex; justify-content: center; align-items: flex-start; }
.bot-preview-layout .bot-phone { width: 100%; max-width: 310px; }
.bot-phone__key { text-decoration: none; cursor: pointer; }
.bot-phone__key.is-selected { border-color: #7dd3fc; box-shadow: 0 0 0 1px #7dd3fc inset; background: #2d4d68; }
.bot-phone__key.is-selected.is-wide { border-color: #7dd3fc; }
.bot-editor { display: flex; flex-direction: column; min-width: 0; min-height: 100%; padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.bot-editor__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bot-editor__eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.bot-editor__head h3 { margin: 3px 0 4px; font-size: 17px; letter-spacing: -.01em; }
.bot-editor__status { margin: 0; font-size: 11px; font-weight: 600; }
.bot-editor__status.is-active { color: #067647; }
.bot-editor__status.is-hidden { color: #98a2b3; }
.bot-editor__tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; }
.bot-editor__list { display: flex; flex-direction: column; gap: 6px; }
.bot-editor__item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.bot-editor__item:hover { border-color: #cbd5e1; background: var(--surface-2); }
.bot-editor__thumb { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border-radius: 8px; background: linear-gradient(145deg, #f1f5f9, #e8eef7); color: #94a3b8; font-size: 15px; font-weight: 700; }
.bot-editor__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bot-editor__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-editor__text strong { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-editor__text small { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-editor__empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; }
@media (max-width: 900px) {
  .bot-preview-layout { grid-template-columns: 1fr; gap: 14px; }
  .bot-preview-layout .bot-phone-wrap { justify-content: flex-start; }
  .bot-editor { min-height: 0; }
}
@media (max-width: 620px) {
  .bot-preview-layout .bot-phone-wrap { justify-content: center; }
  .bot-editor__item { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .bot-editor__item .badge { display: none; }
}

/* Экран бота не растягивается по высоте редактора */
.bot-preview-layout { align-items: start; }
.bot-preview-layout .bot-phone-wrap { align-self: start; }
.bot-preview-layout .bot-phone { height: auto; }
.bot-preview-layout .bot-phone .bot-phone__chat { flex: 0 0 auto; }

.bot-editor__filters { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 11px 0 4px; }
.bot-editor__filters .field { margin: 0; }
.bot-editor__filters .search { min-width: 160px; }
@media (max-width: 620px) {
  .bot-editor__filters { align-items: stretch; }
  .bot-editor__filters .field, .bot-editor__filters .search { width: 100%; }
}

/* Заявка на помощь с настройкой */
.help-request-btn { color: #b54708; border-color: #fedf89; background: #fffaeb; }
.help-request-btn:hover { color: #93370d; border-color: #fec84b; background: #fef0c7; }
@media (max-width: 700px) {
  .help-request-btn span { display: none; }
  .help-request-btn { padding: 5px 8px; }
}

.modal-backdrop[hidden] { display: none !important; }

.help-request-btn { height: 38px; padding: 0 12px; }
@media (max-width: 700px) {
  .help-request-btn { height: 32px; padding: 0 8px; }
}

/* Телефония: сводка клиента */
.telephony-client-card { margin-bottom: 14px; }
.telephony-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.telephony-overview__item { display: flex; flex-direction: column; gap: 3px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.telephony-overview__item > span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.telephony-overview__item strong { color: var(--ink); font-size: 13px; }
.telephony-overview__item small { color: var(--muted); font-size: 10.5px; }
.telephony-client-card + .card { margin-bottom: 14px; }
@media (max-width: 900px) {
  .telephony-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .telephony-overview { grid-template-columns: 1fr; }
}

.product-image-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.order-check-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.order-check-cell .icon-btn { width: 26px; height: 26px; }

/* Балансы operatorов: каждая строка отдельно */
.operator-balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin-top: 10px; }
.operator-balance { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2, #f8fafc); }
.operator-balance__name { color: var(--muted); font-size: 10px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operator-balance__amount { color: var(--ink); font-size: 11.5px; font-weight: 800; white-space: nowrap; text-align: right; }
.operator-balance__phone { grid-column: 1 / -1; color: var(--muted-2); font-size: 9.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .operator-balance-grid { grid-template-columns: 1fr; }
}
