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

/* Prevent layout shifts when scrollbars appear/disappear (supported in Chromium/Firefox). */
html {
  scrollbar-gutter: stable;
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  html {
    overflow-x: clip;
  }
}

/* Overlay + close button styles (used by warehouse sidebars/modals, and global live feed) */
.remain-edit-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  /* Base overlay z-index must stay below sidebars (z=1000) and modals (z~10050+) */
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.remain-edit-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Live feed overlay should be above the whole admin UI */
#barcodeLiveOverlay {
  z-index: 10079;
}

.remain-edit-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: color 0.2s;
}
.remain-edit-close:hover {
  color: #1f2937;
}
[data-theme="dark"] .remain-edit-close {
  color: #94a3b8;
}
[data-theme="dark"] .remain-edit-close:hover {
  color: #e2e8f0;
}

/* Avoid UI "jitter" during full page reload navigation:
   we keep CRM pages invisible until sidebar/layout JS finishes initial sync tweaks. */
html.crm-ui-loading body.crm-page {
  opacity: 0;
}

/* Full-page loader while CRM UI is initializing (during navigation + reload). */
html::before {
  content: "Красотуля собирается";
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 88px; /* put the text below the spinner */
  box-sizing: border-box;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  /* Text style like `.logo-text` (gradient text via background-clip)
       + logo above spinner as a separate background layer (not clipped to text). */
  color: transparent;
  background-image:
    linear-gradient(
      90deg,
      var(--k-sky-600, #0284c7),
      var(--k-cyan-500, #06b6d4)
    ),
    url("krasotulya-crm.jpg");
  background-repeat: repeat, no-repeat;
  background-size:
    auto,
    64px 64px;
  background-position:
    0 0,
    center calc(50% - 92px);
  -webkit-background-clip: text, border-box;
  background-clip: text, border-box;
}

html::after {
  content: "";
  position: fixed;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 999px;
  border: 4px solid color-mix(in srgb, var(--k-sky-500) 18%, transparent);
  border-top-color: color-mix(in srgb, var(--k-sky-500) 95%, transparent);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--k-sky-600) 18%, transparent);
  z-index: 1000000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
  animation: crmLoaderSpin 0.8s linear infinite;
  transform: translate(-50%, -50%) translateY(-18px);
}

html.crm-ui-loading::before,
html.crm-ui-loading::after {
  opacity: 1;
}

html.crm-ui-loading::before {
  pointer-events: all;
  cursor: progress;
}

@keyframes crmLoaderSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

html.crm-ui-ready body.crm-page {
  opacity: 1;
  transition: opacity 120ms ease-out;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

/* =========================
   Dropdown (Export/Import menus)
   ========================= */
.k-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.k-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 260px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 50;
  display: none;
}

.k-dropdown.k-open .k-dropdown-menu {
  display: block;
}

.k-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
}

.k-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.k-dropdown-item:active {
  background: rgba(0, 0, 0, 0.1);
}

/* =========================
   Users: Import/Export buttons (same style as Warehouse)
   ========================= */
.users-page .btn-import-label,
.users-page .btn-export-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.users-page .btn-import-label {
  background: linear-gradient(135deg, var(--k-sky-500) 0%, var(--k-sky-400) 100%);
  color: white;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

.users-page .btn-import-label:hover {
  background: linear-gradient(135deg, var(--k-sky-600) 0%, var(--k-sky-500) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

.users-page .btn-export-label {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.users-page .btn-export-label:hover {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.users-page .btn-import-label:active,
.users-page .btn-export-label:active {
  transform: translateY(0);
}

.users-page .btn-import-label span[data-lucide],
.users-page .btn-export-label span[data-lucide] {
  flex-shrink: 0;
}

[data-theme="dark"] .users-page .btn-import-label {
  background: linear-gradient(135deg, var(--k-sky-600) 0%, var(--k-sky-500) 100%);
}

[data-theme="dark"] .users-page .btn-import-label:hover {
  background: linear-gradient(135deg, var(--k-sky-700) 0%, var(--k-sky-600) 100%);
}

[data-theme="dark"] .users-page .btn-export-label {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

[data-theme="dark"] .users-page .btn-export-label:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

/* =========================
   Dropdown MultiSelect (Settings: visibility)
   ========================= */
.k-multiselect {
  position: relative;
  width: 100%;
  max-width: 520px;
}

.k-multiselect-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.k-multiselect-btn .k-ms-summary {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.k-multiselect-btn .k-ms-count {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: color-mix(in srgb, var(--k-sky-500) 12%, transparent);
  color: var(--k-sky-600);
}

.k-multiselect-btn .k-ms-chevron {
  opacity: 0.7;
}

.k-multiselect-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: 100%;
  background: var(--card, #fff);
  color: var(--card-foreground, #111);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
  /* Поверх вкладок/карточек настроек */
  z-index: 5000;
  display: none;
  overflow: hidden;
}

.k-multiselect.k-open .k-multiselect-panel {
  display: block;
}

.k-ms-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  background: var(--secondary, #f7f7f8);
}

.k-ms-search {
  flex: 1;
  min-width: 140px;
}

.k-ms-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.k-ms-list {
  max-height: 320px;
  overflow: auto;
  padding: 8px;
}

.k-ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.k-ms-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.k-ms-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.k-ms-empty {
  padding: 12px;
  color: #666;
  font-size: 13px;
}

/* =========================
   Чат: фиксируем layout на высоту экрана (composer всегда снизу)
   ========================= */
body.chat-page {
  height: 100dvh; /* корректнее на мобилках (адресная строка) */
  min-height: 100vh; /* fallback */
  overflow: hidden; /* чтобы страница не скроллилась, скролл только внутри диалогов/переписки */
}

.chat-page .container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-page main {
  flex: 1;
  overflow: hidden;
  display: block;
  margin-bottom: 0; /* важно: у main по умолчанию есть margin-bottom, он ломает “composer всегда снизу” */
}

.chat-page .messenger {
  height: 100%;
}

.chat-page .messenger-layout {
  height: 100%;
  min-height: 0; /* важно для корректного overflow в flex/grid */
}

.chat-page .messenger-thread {
  min-height: 0;
}

.chat-page .thread-messages {
  min-height: 0;
  overflow-y: auto;
}

.chat-page .thread-composer {
  flex: 0 0 auto;
  position: sticky; /* держим composer внизу даже при нестабильном vh на мобилках */
  bottom: 0;
  z-index: 5;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* База знаний (и страницы, которые хотят такой же стиль контейнера/секций) */
.knowledge-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.knowledge-section {
  scroll-margin-top: 100px;
  background: white;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Рассылки: layout управляется общим `main` (2 колонки на десктопе, 1 на мобилке) */

/* =========================
   Семинары
   ========================= */

.seminars-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1200px) {
  .seminars-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .promotions-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.seminar-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
  /* Фиксируем высоту карточки на десктопе: не зависит от высоты картинки */
  height: 210px;
}

.seminar-card:hover {
  transform: translateY(-1px);
  border-color: #d1d5db;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.seminar-card-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  height: 100%;
}

.seminar-thumb {
  background: #f1f5f9;
  border-right: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 100%;
}

.seminar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.seminar-thumb-placeholder {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  padding: 10px;
  text-align: center;
}

.seminar-card-content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.seminar-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

.seminar-section {
  margin-bottom: 18px;
}

.seminar-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  margin: 6px 0 10px 0;
}

.seminar-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}

.badge-scheduled {
  background: #e8f5e9;
  color: #1b5e20;
}

.badge-cancelled {
  background: #ffebee;
  color: #b71c1c;
}

.badge-upcoming {
  background: #e3f2fd;
  color: #0d47a1;
}

.badge-past {
  background: #f3e5f5;
  color: #4a148c;
}

.seminars-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 14px 0;
}

/* Вкладки для раздела семинаров */
.seminars-tab-btn {
  padding: 10px 20px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.seminars-tab-btn:hover {
  background: #f5f7fa;
  color: #333;
}

.seminars-tab-btn.active {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border-color: var(--k-sky-500, #0ea5e9);
  border-bottom-color: var(--k-sky-600, #0284c7);
}

.seminars-tab-content {
  display: none;
}

.seminars-tab-content.active {
  display: block;
}

.promotions-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 14px 0;
}

.promotions-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Компактные фильтры (2 селекта вместо табов) */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin: 12px 0 14px 0;
  flex-wrap: wrap;
}

.filters-bar .filter-item {
  flex: 1 1 220px;
  min-width: 200px;
}

.filters-bar .filter-label {
  display: block;
  margin-bottom: 6px;
  color: #555;
  font-weight: 500;
  font-size: 13px;
}

/* Настройки → Пользователи: инвайт в одну строку */
.filters-bar .filter-item--wide {
  flex: 2 1 360px;
  min-width: 260px;
}

.filters-bar .filter-item--actions {
  flex: 0 0 auto;
  min-width: auto;
}

.filters-bar .filter-item--actions .btn-primary {
  white-space: nowrap;
}

/* Семинары: быстрые фильтры-кнопки */
.seminars-quick-filters {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 14px 0;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
}

.seminars-quick-filters .seminars-filter-btn {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.08s ease,
    color 0.08s ease,
    box-shadow 0.08s ease,
    border-color 0.08s ease;
}

.seminars-quick-filters .seminars-filter-btn:hover {
  background: #f1f5f9;
}

.seminars-quick-filters .seminars-filter-btn.active {
  background: var(--k-sky-100, #e0f2fe); /* нежный голубой */
  color: var(--k-sky-700, #0369a1); /* спокойный синий текст */
  border-color: var(--k-sky-200, #bae6fd);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--k-sky-500) 14%, transparent);
}

/* Акции: быстрые фильтры-кнопки */
.promotions-quick-filters {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 14px 0;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
}

.promotions-quick-filters .promotions-filter-btn {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.08s ease,
    color 0.08s ease,
    box-shadow 0.08s ease,
    border-color 0.08s ease;
}

.promotions-quick-filters .promotions-filter-btn:hover {
  background: #f1f5f9;
}

.promotions-quick-filters .promotions-filter-btn.active {
  background: var(--k-sky-100, #e0f2fe); /* нежный голубой */
  color: var(--k-sky-700, #0369a1);
  border-color: var(--k-sky-200, #bae6fd);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--k-sky-500) 14%, transparent);
}

/* =========================
   Доска руководителя (главная)
   ========================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
  margin-top: 12px;
}

.dashboard-grid-2 {
  grid-template-columns: 2fr 1fr;
}

.dashboard-card {
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid var(--k-sky-500, #0ea5e9);
  padding: 16px;
}

.dash-title {
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}

.dash-value {
  font-size: 22px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
}

.dash-sub {
  margin-top: 8px;
  color: #666;
  font-size: 13px;
  line-height: 1.4;
}

.dash-bars {
  height: 120px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 10px;
}

.dash-bar {
  flex: 1 1 0;
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  border-radius: 4px 4px 0 0;
  min-width: 6px;
  opacity: 0.9;
}

.dash-bar:hover {
  opacity: 1;
}

.dash-list {
  margin: 0;
  padding-left: 18px;
  color: #333;
}

.dash-list li {
  margin: 6px 0;
  line-height: 1.35;
}

.promotions-tab.active {
  background: #4caf50;
  color: white;
  border: none;
}

.seminars-tab.active {
  background: #4caf50;
  color: white;
  border: none;
}

.seminar-title {
  font-weight: 600;
  color: #2c3e50;
  /* чтобы длинный текст не растягивал карточку */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.seminar-date {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

.seminar-meta {
  font-size: 14px;
  color: #333;
  margin-bottom: 10px;
}

.seminar-cancel-reason {
  margin-top: 6px;
  color: #b71c1c;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.seminar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
}

/* Прижимаем кнопки к низу карточки, чтобы они не прыгали по высоте */
.seminar-card .seminar-actions {
  margin-top: auto;
}

/* Семинары: красивые кнопки внутри карточки (скоуп только для карточек) */
.seminar-card .seminar-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.06s ease;
}

.seminar-card .seminar-actions svg {
  width: 18px;
  height: 18px;
}

.seminar-card .seminar-actions span[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seminar-card .seminar-actions button:active {
  transform: translateY(1px);
}

.seminar-card .seminar-actions button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-sky-500, #0ea5e9) 25%, transparent);
}

/* Редактировать */
.seminar-card .seminar-actions .btn-edit {
  background: var(--k-sky-50, #f0f9ff);
  color: var(--k-sky-700, #0369a1);
  border-color: var(--k-sky-200, #bae6fd);
}
.seminar-card .seminar-actions .btn-edit:hover {
  background: var(--k-sky-100, #e0f2fe);
  border-color: var(--k-sky-400, #38bdf8);
}

/* Нейтральные (Списки / Отменить / Восстановить) */
.seminar-card .seminar-actions .btn-secondary {
  background: #f8fafc;
  color: #0f172a;
  border-color: #e5e7eb;
}
.seminar-card .seminar-actions .btn-secondary:hover {
  background: #eef2f7;
  border-color: #d1d5db;
}

/* Удалить */
.seminar-card .seminar-actions .btn-delete {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.seminar-card .seminar-actions .btn-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.seminar-card.is-cancelled {
  opacity: 0.92;
}

.seminar-card.is-past {
  opacity: 0.96;
}

/* (дубликат ниже удалён — чтобы не переопределять flex-wrap:nowrap у карточек) */

/* Списки семинаров: вкладки (Зарегистрированные / Ожидание) */
.seminar-lists-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.seminar-lists-tabs .tab-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  font-weight: 600;
  line-height: 1;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.seminar-lists-tabs .tab-btn:hover {
  background: #eef2f7;
}

.seminar-lists-tabs .tab-btn.active {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.22);
}

/* Правое боковое меню для списков семинара */
.seminar-lists-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  /* шире, чтобы помещалась таблица (на узких экранах max-width ограничит) */
  width: 1100px;
  max-width: 98vw;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Customer 360 skin (optional): make seminar lists sidebar look like c360-modal */
.seminar-lists-sidebar.c360-modal {
  top: 18px;
  right: 18px;
  height: calc(100vh - 36px);
  width: min(560px, 96vw);
  max-width: 96vw;
  border-radius: 16px;
  border: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background:
    radial-gradient(
      900px 240px at 10% 0%,
      color-mix(in srgb, var(--k-sky-500) 12%, transparent),
      transparent 60%
    ),
    radial-gradient(
      900px 240px at 92% 0%,
      rgba(99, 102, 241, 0.1),
      transparent 60%
    ),
    var(--c360-card, #ffffff);
  box-shadow: 0 30px 70px rgba(2, 6, 23, 0.35);
  transform: translateX(105%);
}
@media (max-width: 720px) {
  .seminar-lists-sidebar.c360-modal {
    top: 0;
    right: 0;
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}

/* Таблица в списках: если экран меньше — дадим горизонтальный скролл как запасной вариант */
.seminar-registrations-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.seminar-form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 25px;
}

.seminar-form-grid .form-group {
  margin-bottom: 0;
}

/* Вкладка "Создать семинар": аккуратные инпуты для даты/времени, часового пояса и "Напоминания в" */
.seminars-page #seminarTabCreate .seminar-form-grid .form-group label {
  margin-bottom: 6px;
}

.seminars-page #seminarTabCreate .seminar-form-grid {
  /* Подсказка под часовым поясом не должна "раздвигать" ряд инпутов */
  padding-bottom: 22px;
}

.seminars-page #seminarTabCreate .seminar-timezone-group {
  position: relative;
}

.seminars-page #seminarTabCreate .seminar-timezone-group .hint {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin-top: 0;
}

.seminars-page #seminarTabCreate .seminar-input {
  height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.seminars-page #seminarTabCreate .seminar-input:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-sky-500) 12%, transparent);
}

.seminars-page #seminarTabCreate select.seminar-input {
  padding-right: 40px;
}

.seminars-page #seminarTabCreate input[type="datetime-local"].seminar-input,
.seminars-page #seminarTabCreate input[type="time"].seminar-input {
  line-height: 20px;
}

.seminars-page #seminarTabCreate .seminar-form-grid .hint {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

/* Напоминания семинара: строки правил */
.seminar-reminder-row {
  display: grid;
  grid-template-columns: 160px 1fr 120px;
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

/* Напоминания семинара: компактный блок */
.seminar-reminder-compact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.seminar-reminder-days-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.seminar-reminder-day-add {
  flex: 1 1 280px;
  min-width: 260px;
}

.seminar-reminder-intraday {
  min-width: 260px;
}

.seminar-reminder-day-add .k-multiselect {
  max-width: none;
}

.seminar-reminder-times-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.seminar-reminder-times-row .form-input {
  width: 160px;
}

.seminar-reminder-ask {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 13px;
  color: #334155;
  margin: 0;
}

.seminar-reminder-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.seminar-reminder-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 12px;
  color: #334155;
}

.seminar-reminder-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  color: #64748b;
}

.seminar-reminder-chip button:hover {
  color: #b91c1c;
}

@media (max-width: 900px) {
  .seminar-form-grid {
    grid-template-columns: 1fr;
    margin-bottom: 15px;
  }
  .seminars-page #seminarTabCreate .seminar-form-grid {
    padding-bottom: 0;
  }
  .seminars-page #seminarTabCreate .seminar-timezone-group .hint {
    position: static;
    margin-top: 6px;
  }
  .seminar-reminder-row {
    grid-template-columns: 1fr;
  }
  .seminar-reminder-days-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .seminar-reg-cards {
    grid-template-columns: 1fr;
  }
}

.seminar-lists-sidebar.open {
  transform: translateX(0);
}

.seminar-lists-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px solid color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
}

.seminar-lists-sidebar.c360-modal .seminar-lists-sidebar-header {
  padding: 14px 14px 12px 14px;
  border-bottom: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background: transparent;
  color: var(--c360-text, #0f172a);
}

.seminar-lists-sidebar-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.seminar-lists-sidebar.c360-modal .seminar-lists-sidebar-header h2 {
  font-size: 14px;
  font-weight: 1000;
  color: var(--c360-text, #0f172a);
}

.seminar-lists-sidebar-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
  width: 32px;
  height: 32px;
}

.seminar-lists-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.seminar-lists-sidebar.c360-modal .seminar-lists-sidebar-close {
  border: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background: transparent;
  color: var(--c360-muted, rgba(15, 23, 42, 0.62));
  border-radius: 12px;
  width: 38px;
  height: 34px;
  padding: 0;
}
.seminar-lists-sidebar.c360-modal .seminar-lists-sidebar-close:hover {
  color: var(--c360-text, #0f172a);
  background: color-mix(in srgb, var(--k-sky-500) 8%, transparent);
}

.seminar-lists-sidebar-close svg {
  width: 20px;
  height: 20px;
}

.seminar-lists-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.seminar-lists-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.seminar-lists-sidebar-overlay.c360-modal-overlay {
  display: none; /* важно: перекрываем .c360-modal-overlay из customers360.css, иначе оверлей блокирует всё */
  z-index: 999; /* ниже .seminar-lists-sidebar (1000), чтобы оверлей был под сайдбаром, а не поверх */
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px) saturate(1.05);
}
[data-theme="dark"] .seminar-lists-sidebar-overlay.c360-modal-overlay {
  background: rgba(0, 0, 0, 0.66);
}

.seminar-lists-sidebar-overlay.open {
  display: block;
  opacity: 1;
}

.seminar-list-tab {
  margin-top: 20px;
}

.seminar-registrations-table {
  overflow-x: auto;
}

.seminar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.seminar-table th,
.seminar-table td {
  padding: 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
}

.seminar-table th {
  background: #f7f7f7;
  color: #444;
  font-weight: 600;
}

.seminar-table .actions-cell {
  white-space: nowrap;
}

/* =========================
   Семинары — списки (карточки вместо строк)
   ========================= */
.seminar-reg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.seminar-reg-card {
  background: var(--card, #fff);
  color: var(--card-foreground, #0f172a);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.seminar-reg-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.1);
  border-color: color-mix(in srgb, var(--k-sky-500) 35%, transparent);
}

.seminar-reg-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.seminar-reg-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  margin-bottom: 6px;
  word-break: break-word;
}

.seminar-reg-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted-foreground, #64748b);
}

.seminar-reg-dot {
  opacity: 0.6;
}

.seminar-reg-counts {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.seminar-reg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  background: color-mix(in srgb, var(--k-sky-600) 8%, transparent);
  color: color-mix(in srgb, var(--k-sky-600) 100%, transparent);
}

.seminar-reg-chip-yes {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.2);
}

.seminar-reg-chip-no {
  background: rgba(225, 29, 72, 0.1);
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.2);
}

.seminar-reg-contacts {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seminar-reg-line {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
}

.seminar-reg-label {
  font-size: 12px;
  color: var(--muted-foreground, #64748b);
  flex: 0 0 auto;
}

.seminar-reg-value {
  font-size: 13px;
  color: var(--card-foreground, #0f172a);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.seminar-reg-empty {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  font-size: 12px;
  color: var(--muted-foreground, #64748b);
}

.seminar-reg-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.seminar-reg-actions button {
  flex: 1 1 auto;
  min-width: 140px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  text-align: center;
}

header h1 {
  color: #2c3e50;
  font-size: 28px;
  font-weight: 300;
  margin-bottom: 15px;
}

.main-nav {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 15px;
}

.nav-link {
  padding: 8px 16px;
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
  font-size: 14px;
}

.nav-link:hover {
  background: var(--k-sky-600, #0284c7);
}

.nav-link.active {
  background: #4caf50;
}

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

/* Утилита: принудительно одна колонка */
main.single-column {
  grid-template-columns: 1fr;
}

/* CRM: основной main работает как колонка, чтобы шапка была сверху, а блоки занимали всю ширину */
body.crm-page main.main-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Для страницы чата - одна колонка на всю ширину */
.chat-page main {
  grid-template-columns: 1fr;
  max-width: 100%;
}

.chat-page .messages-section {
  width: 100%;
  max-width: 100%;
}

section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

section h2 {
  color: #2c3e50;
  margin-bottom: 25px;
  font-size: 22px;
  font-weight: 400;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
  font-size: 14px;
}

/* Редактор текста */
.editor-toolbar {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}

.editor-toolbar button {
  padding: 6px 12px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.editor-toolbar button:hover {
  background: #e0e0e0;
}

.editor-toolbar button#aiGenerateBtn {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  border: none;
  font-weight: 600;
}

.editor-toolbar button#aiGenerateBtn:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    var(--k-sky-600, #0284c7) 0%,
    var(--k-cyan-500, #06b6d4) 100%
  );
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

.editor-toolbar button#aiGenerateBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.editor-toolbar button#aiCheckErrorsBtn,
.editor-toolbar button#aiAnalyzeBtn,
.editor-toolbar button#publishAllAiCheckErrorsBtn {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  border: none;
  font-weight: 600;
  font-size: 13px;
}

.editor-toolbar button#aiPromoCheckErrorsBtn,
.editor-toolbar button#aiPromoAnalyzeBtn {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  border: none;
  font-weight: 600;
  font-size: 13px;
}

.editor-toolbar button#aiCheckErrorsBtn:hover:not(:disabled),
.editor-toolbar button#aiAnalyzeBtn:hover:not(:disabled),
.editor-toolbar button#publishAllAiCheckErrorsBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.editor-toolbar button#aiPromoCheckErrorsBtn:hover:not(:disabled),
.editor-toolbar button#aiPromoAnalyzeBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.editor-toolbar button#aiCheckErrorsBtn:disabled,
.editor-toolbar button#aiAnalyzeBtn:disabled,
.editor-toolbar button#publishAllAiCheckErrorsBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.editor-toolbar button#aiPromoCheckErrorsBtn:disabled,
.editor-toolbar button#aiPromoAnalyzeBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.message-editor {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  transition: border-color 0.2s;
}

.message-editor:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
}

/* WYSIWYG editor (contenteditable) */
.wysiwyg-editor {
  resize: none; /* for div it's irrelevant, but prevents inherited expectations */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.wysiwyg-editor:empty:before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
}

.wysiwyg-editor a {
  color: var(--k-sky-600, #0284c7);
  text-decoration: underline;
}

.text-analysis-display {
  width: 100%;
  min-height: 450px;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: #f8f9fa;
  overflow-y: auto;
  line-height: 1.6;
  color: #333;
}

.text-analysis-display p {
  margin: 0 0 12px 0;
}

.text-analysis-display b {
  font-weight: 600;
  color: #2c3e50;
}

/* Загрузка изображения */
#imageUpload {
  width: 100%;
  padding: 8px;
  border: 2px dashed #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
}

.image-preview {
  margin-top: 15px;
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.preview-item {
  position: relative;
  display: inline-block;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: block;
}

.remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(231, 76, 60, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.remove-image:hover {
  background: rgba(231, 76, 60, 1);
}

/* Выбор пользователей */
.user-select-container {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
}

.user-select-header {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.filter-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
}

.user-select {
  width: 100%;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
}

.user-select option {
  padding: 8px;
}

.selected-count {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
  font-style: italic;
}

/* Broadcast recipients: checkbox list (instead of <select multiple>) */
.user-select.user-select-checkboxes {
  display: block;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

/* IMPORTANT: rows are <label> inside .form-group, so override `.form-group label { display:block; ... }` */
.user-select.user-select-checkboxes label.user-checkbox-row {
  display: flex;
  position: relative;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  min-height: 40px;
  margin: 0; /* override form label margin-bottom */
  font-weight: 400; /* override form label weight */
  color: #334155; /* readable default */
  box-sizing: border-box;
}

.user-select.user-select-checkboxes label.user-checkbox-row:hover {
  background: #f8fafc;
}

.user-select.user-select-checkboxes input.user-checkbox-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  left: 0;
  top: 0;
  pointer-events: none;
}

.user-select.user-select-checkboxes .user-checkbox-box {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  flex: 0 0 18px;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.user-select.user-select-checkboxes
  input.user-checkbox-input:focus
  + .user-checkbox-box {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-sky-500) 15%, transparent);
  border-color: var(--k-sky-500, #0ea5e9);
}

.user-select.user-select-checkboxes
  input.user-checkbox-input:checked
  + .user-checkbox-box {
  background: var(--k-sky-500, #0ea5e9);
  border-color: var(--k-sky-500, #0ea5e9);
}

.user-select.user-select-checkboxes
  input.user-checkbox-input:checked
  + .user-checkbox-box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  margin-top: -1px;
}

.user-select.user-select-checkboxes .user-checkbox-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.35;
  overflow-wrap: anywhere;
  user-select: none;
}

/* Кнопки */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  width: 100%;
}

.btn-primary:disabled,
.btn-primary[disabled] {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 1;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

.btn-primary:disabled:hover,
.btn-primary[disabled]:hover {
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

/* Стили для кнопок Google Calendar */
#disconnectGoogleCalendar {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

#disconnectGoogleCalendar:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

#disconnectGoogleCalendar:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

#disconnectGoogleCalendar span[data-lucide] {
  width: 16px;
  height: 16px;
}

#refreshCalendars {
  background: linear-gradient(135deg, var(--k-sky-500) 0%, var(--k-sky-600) 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
  white-space: nowrap;
}

#refreshCalendars:hover {
  background: linear-gradient(135deg, var(--k-sky-600) 0%, var(--k-sky-700) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

#refreshCalendars:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

#refreshCalendars:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#refreshCalendars span[data-lucide] {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

#refreshCalendars:hover span[data-lucide] {
  transform: rotate(180deg);
}

.btn-select-all {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.btn-select-all:hover {
  background: var(--k-sky-600);
}

.result-message {
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
  display: none;
}

.result-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.result-message.info {
  background: #e0f2fe;
  color: #0c4a6e;
  border: 1px solid #bae6fd;
}

.result-message.warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.result-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Список пользователей */
.users-header {
  margin-bottom: 20px;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--k-sky-500, #0ea5e9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.user-card:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-info {
  flex: 1;
}

.user-info strong {
  color: #2c3e50;
  display: block;
  margin-bottom: 5px;
}

.user-info span {
  color: #666;
  font-size: 13px;
  display: block;
  margin-top: 3px;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.btn-edit,
.btn-delete {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: opacity 0.2s;
}

.btn-edit {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
}

.btn-delete {
  background: #e74c3c;
  color: white;
}

.btn-edit:hover,
.btn-delete:hover {
  opacity: 0.8;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #999;
}

/* Спиннер загрузки */
.loading-spinner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 10;
  border-radius: 8px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top-color: var(--k-sky-500, #0ea5e9);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-text {
  margin-top: 12px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
}

/* Прогресс загрузки (проценты) внутри оверлея .loading-spinner */
.loading-spinner .upload-progress {
  margin-top: 10px;
  width: min(280px, 80%);
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.loading-spinner .upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--k-sky-500, #0ea5e9);
  transition: width 0.12s linear;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* Контекстное меню */
.context-menu {
  position: fixed;
  z-index: 2000;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  min-width: 180px;
  padding: 4px 0;
  display: none;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: #374151;
  font-size: 14px;
  transition: background-color 0.15s ease;
}

.context-menu-item:hover {
  background-color: #f3f4f6;
}

.context-menu-item:active {
  background-color: #e5e7eb;
}

.context-menu-item span[data-lucide] {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  /* важно: длинные формы (товары/семинары) должны прокручиваться */
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* =========================
   Онлайн-запись: модалка "Выполнить запись" (списание материалов)
   ========================= */
#bookingCompleteModal .modal-content {
  padding: 20px;
}

#bookingCompleteModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

#bookingCompleteModal .modal-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

#bookingCompleteModal .booking-complete-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
  flex: 0 0 auto;
}

#bookingCompleteModal .booking-complete-close:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

#bookingCompleteModal .booking-complete-close span[data-lucide] {
  width: 18px;
  height: 18px;
}

#bookingCompleteModal .booking-complete-item-card {
  padding: 12px;
  margin-bottom: 10px;
}

#bookingCompleteModal .booking-complete-item-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

#bookingCompleteModal .booking-complete-control {
  height: 34px;
  padding: 6px 10px;
}

#bookingCompleteModal .booking-complete-qty {
  width: 96px;
}

#bookingCompleteModal .booking-complete-delete {
  margin-left: auto;
}

@media (max-width: 520px) {
  #bookingCompleteModal .modal-content {
    padding: 16px;
  }
  #bookingCompleteModal .booking-complete-item-row {
    gap: 8px;
  }
}

/* =========================
   История обновлений (карточки)
   ========================= */
.updates-history-grid {
  display: grid;
  /* Важно: карточка не должна растягиваться на всю ширину, если она одна */
  grid-template-columns: repeat(auto-fill, minmax(340px, 420px));
  gap: 18px;
  align-items: start;
  justify-content: start;
}

@media (max-width: 420px) {
  .updates-history-grid {
    grid-template-columns: 1fr;
  }
}

.updates-history-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--k-sky-600) 3%, transparent), color-mix(in srgb, var(--k-sky-600) 0%, transparent) 60%),
    var(--card, #ffffff);
  color: var(--card-foreground, #111);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 12%, transparent);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--k-sky-600) 10%, transparent);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
  cursor: pointer;
  position: relative;
}

.updates-history-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 54px color-mix(in srgb, var(--k-sky-600) 16%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-500) 55%, transparent);
}

.updates-history-card:active {
  transform: translateY(-1px);
}

.updates-history-card .updates-history-card-actions button,
.updates-history-card .uh-checkbox-label {
  cursor: pointer;
}

.updates-history-card.selected {
  border-color: var(--k-sky-500);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--k-sky-500) 25%, transparent);
  background: color-mix(in srgb, var(--k-sky-500) 3%, transparent);
}

.updates-history-unread-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #ffffff;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.updates-history-card.read .updates-history-unread-badge {
  display: none;
}

/* Фильтр для супер-админа */
.filter-btn.active {
  background: var(--k-sky-500);
  color: white;
  border-color: var(--k-sky-500);
}

.filter-btn.active:hover {
  background: var(--k-sky-600);
  border-color: var(--k-sky-600);
}

.updates-history-card.selected:hover {
  transform: translateY(-1px);
}

.updates-history-cover {
  position: relative;
  height: 170px;
  overflow: hidden;
  background: color-mix(in srgb, var(--k-sky-600) 6%, transparent);
}

.updates-history-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05) contrast(1.02);
}

.updates-history-cover-empty {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--k-sky-600) 90%, transparent);
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(34, 211, 238, 0.25),
      transparent 55%
    ),
    radial-gradient(
      circle at 70% 60%,
      color-mix(in srgb, var(--k-sky-500) 22%, transparent),
      transparent 60%
    ),
    color-mix(in srgb, var(--k-sky-600) 4%, transparent);
}

.updates-history-cover-empty span[data-lucide] {
  width: 26px;
  height: 26px;
}

.updates-history-cover-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0) 35%,
    rgba(15, 23, 42, 0.22) 100%
  );
  pointer-events: none;
}

.updates-history-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 2;
}

.updates-history-badge-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 7px 10px;
  border-radius: 999px;
  line-height: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.updates-history-badge-status {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  line-height: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
}

.updates-history-badge-status.published {
  background: rgba(16, 185, 129, 0.55);
}

.updates-history-badge-status.draft {
  background: rgba(245, 158, 11, 0.55);
}

.updates-history-content {
  padding: 14px 14px 16px 14px;
}

.updates-history-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.uh-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.uh-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.uh-checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.uh-checkbox:checked + .uh-checkbox-custom {
  background: var(--k-sky-500);
  border-color: var(--k-sky-500);
}

.uh-checkbox:checked + .uh-checkbox-custom::after {
  content: "✓";
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}

.uh-checkbox-label:hover .uh-checkbox-custom {
  border-color: var(--k-sky-500);
}

[data-theme="dark"] .uh-checkbox-custom {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(148, 163, 184, 0.5);
}

[data-theme="dark"] .uh-checkbox:checked + .uh-checkbox-custom {
  background: var(--k-sky-500);
  border-color: var(--k-sky-500);
}

.updates-history-card-date {
  /* overridden выше, оставлено для совместимости */
}

[data-theme="dark"] .updates-history-card-date {
  /* overridden выше, оставлено для совместимости */
}

.updates-history-card-title {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

[data-theme="dark"] .updates-history-card-title {
  color: rgba(248, 250, 252, 0.92);
}

.updates-history-card-text {
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}

[data-theme="dark"] .updates-history-card-text {
  color: rgba(226, 232, 240, 0.86);
}

.updates-history-card-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.updates-history-card-actions .btn-secondary {
  width: auto;
  padding: 10px 12px;
  border-radius: 12px;
}

.updates-history-card-actions .btn-secondary:hover {
  border-color: color-mix(in srgb, var(--k-sky-500) 55%, transparent);
}

.updates-history-card-actions .btn-secondary {
  width: auto;
  padding: 10px 12px;
}

.updates-history-card-actions .btn-secondary span[data-lucide] {
  width: 16px;
  height: 16px;
}

.updates-history-modal {
  max-width: 720px;
}

.updates-history-view-modal {
  max-width: 820px;
}

.updates-history-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9998;
}

.updates-history-drawer-backdrop.c360-modal-overlay {
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}
[data-theme="dark"] .updates-history-drawer-backdrop.c360-modal-overlay {
  background: rgba(0, 0, 0, 0.66);
}

.updates-history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(520px, 92vw);
  background: var(--card, #fff);
  border-left: 1px solid color-mix(in srgb, var(--k-sky-600) 14%, transparent);
  box-shadow: -20px 0 60px color-mix(in srgb, var(--k-sky-600) 18%, transparent);
  z-index: 9999;
  transform: translateX(102%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 18px 14px;
  overflow: hidden;
}

.updates-history-drawer.c360-modal {
  top: 18px;
  right: 18px;
  height: calc(100vh - 36px);
  width: min(560px, 96vw);
  border-radius: 16px;
  border: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background:
    radial-gradient(
      900px 240px at 10% 0%,
      color-mix(in srgb, var(--k-sky-500) 12%, transparent),
      transparent 60%
    ),
    radial-gradient(
      900px 240px at 92% 0%,
      rgba(99, 102, 241, 0.1),
      transparent 60%
    ),
    var(--c360-card, #ffffff);
  box-shadow: 0 30px 70px rgba(2, 6, 23, 0.35);
  padding: 0;
}
@media (max-width: 720px) {
  .updates-history-drawer.c360-modal {
    top: 0;
    right: 0;
    height: 100vh;
    width: 100vw;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}

.updates-history-drawer.open {
  transform: translateX(0);
}

.updates-history-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--k-sky-600) 12%, transparent);
  margin-bottom: 12px;
}

.updates-history-drawer.c360-modal
  .updates-history-drawer-header.c360-modal-head {
  padding: 14px 14px 12px 14px;
  margin: 0;
  border-bottom: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
}

.updates-history-drawer-title {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.15;
}

.updates-history-drawer.c360-modal
  .updates-history-drawer-title.c360-modal-title {
  font-size: 14px;
  font-weight: 1000;
  color: var(--c360-text, #0f172a);
}

[data-theme="dark"] .updates-history-drawer-title {
  color: rgba(248, 250, 252, 0.92);
}

.updates-history-drawer-date {
  font-size: 12px;
  color: #64748b;
  background: color-mix(in srgb, var(--k-sky-600) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 10%, transparent);
  padding: 6px 10px;
  border-radius: 999px;
  width: fit-content;
}

[data-theme="dark"] .updates-history-drawer-date {
  color: rgba(226, 232, 240, 0.8);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.18);
}

.updates-history-drawer-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.updates-history-drawer-close span[data-lucide] {
  width: 18px;
  height: 18px;
}

.updates-history-drawer-image img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 14%, transparent);
  background: color-mix(in srgb, var(--k-sky-600) 4%, transparent);
  display: block;
  margin-bottom: 14px;
}

.updates-history-drawer-text {
  overflow: auto;
  padding-right: 6px;
  font-size: 16px;
  line-height: 1.75;
  color: #334155;
}

[data-theme="dark"] .updates-history-drawer-text {
  color: rgba(226, 232, 240, 0.86);
}

.updates-history-drawer-text p {
  margin: 10px 0;
}

.updates-history-drawer-text .updates-history-section {
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--k-sky-600) 4%, transparent);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 12%, transparent);
}

[data-theme="dark"] .updates-history-drawer-text .updates-history-section {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.18);
}

.updates-history-drawer-text .updates-history-section-title {
  font-size: 14px;
  margin-bottom: 8px;
}

.updates-history-drawer-text h1,
.updates-history-drawer-text h2,
.updates-history-drawer-text h3 {
  margin: 14px 0 10px 0;
  line-height: 1.25;
  color: #0f172a;
  font-weight: 900;
}

[data-theme="dark"] .updates-history-drawer-text h1,
[data-theme="dark"] .updates-history-drawer-text h2,
[data-theme="dark"] .updates-history-drawer-text h3 {
  color: rgba(248, 250, 252, 0.92);
}

.updates-history-drawer-text h2 {
  font-size: 20px;
}
.updates-history-drawer-text h3 {
  font-size: 18px;
}

.updates-history-drawer-text h1 {
  font-size: 22px;
}

.updates-history-drawer-text ul,
.updates-history-drawer-text ol {
  margin: 10px 0 10px 18px;
  padding: 0;
}

.updates-history-drawer.c360-modal
  .updates-history-drawer-close.c360-modal-close {
  width: 38px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background: transparent;
  color: var(--c360-muted, rgba(15, 23, 42, 0.62));
  font-weight: 1000;
}
.updates-history-drawer.c360-modal
  .updates-history-drawer-close.c360-modal-close:hover {
  color: var(--c360-text, #0f172a);
  background: color-mix(in srgb, var(--k-sky-500) 8%, transparent);
}

.updates-history-drawer-text li {
  margin: 6px 0;
}

.updates-history-drawer-text hr {
  border: 0;
  height: 1px;
  background: color-mix(in srgb, var(--k-sky-600) 18%, transparent);
  margin: 14px 0;
}

[data-theme="dark"] .updates-history-drawer-text hr {
  background: rgba(34, 211, 238, 0.22);
}

.updates-history-drawer-text a {
  color: var(--k-sky-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

[data-theme="dark"] .updates-history-drawer-text a {
  color: var(--k-cyan-400, #22d3ee);
}

.updates-history-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.updates-history-view-date {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  margin-top: 6px;
  background: color-mix(in srgb, var(--k-sky-600) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 10%, transparent);
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
}

[data-theme="dark"] .updates-history-view-date {
  color: rgba(226, 232, 240, 0.75);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.18);
}

.updates-history-view-image img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  background: color-mix(in srgb, var(--k-sky-600) 4%, transparent);
  display: block;
  margin-bottom: 14px;
}

.updates-history-view-text {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
  word-break: break-word;
}

[data-theme="dark"] .updates-history-view-text {
  color: rgba(226, 232, 240, 0.86);
}

.updates-history-view-text h1,
.updates-history-view-text h2,
.updates-history-view-text h3,
.updates-history-editor-preview h1,
.updates-history-editor-preview h2,
.updates-history-editor-preview h3 {
  margin: 14px 0 10px 0;
  line-height: 1.25;
  color: #0f172a;
  font-weight: 800;
}

[data-theme="dark"] .updates-history-view-text h1,
[data-theme="dark"] .updates-history-view-text h2,
[data-theme="dark"] .updates-history-view-text h3,
[data-theme="dark"] .updates-history-editor-preview h1,
[data-theme="dark"] .updates-history-editor-preview h2,
[data-theme="dark"] .updates-history-editor-preview h3 {
  color: rgba(248, 250, 252, 0.92);
}

.updates-history-view-text h1,
.updates-history-editor-preview h1 {
  font-size: 20px;
}
.updates-history-view-text h2,
.updates-history-editor-preview h2 {
  font-size: 18px;
}
.updates-history-view-text h3,
.updates-history-editor-preview h3 {
  font-size: 16px;
}

.updates-history-view-text p,
.updates-history-editor-preview p {
  margin: 10px 0;
}

.updates-history-view-text ul,
.updates-history-view-text ol,
.updates-history-editor-preview ul,
.updates-history-editor-preview ol {
  margin: 10px 0 10px 18px;
  padding: 0;
}

.updates-history-view-text li,
.updates-history-editor-preview li {
  margin: 6px 0;
}

.updates-history-view-text hr,
.updates-history-editor-preview hr {
  border: 0;
  height: 1px;
  background: color-mix(in srgb, var(--k-sky-600) 18%, transparent);
  margin: 14px 0;
}

[data-theme="dark"] .updates-history-view-text hr,
[data-theme="dark"] .updates-history-editor-preview hr {
  background: rgba(34, 211, 238, 0.22);
}

.updates-history-view-text strong,
.updates-history-editor-preview strong {
  font-weight: 800;
}

.updates-history-view-text em,
.updates-history-editor-preview em {
  font-style: italic;
}

.updates-history-view-text a,
.updates-history-editor-preview a {
  color: var(--k-sky-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

[data-theme="dark"] .updates-history-view-text a,
[data-theme="dark"] .updates-history-editor-preview a {
  color: var(--k-cyan-400, #22d3ee);
}

/* Иконки-only кнопки (История обновлений) */
.btn-secondary.icon-only,
.btn-primary.icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.btn-secondary.icon-only span[data-lucide],
.btn-primary.icon-only span[data-lucide] {
  width: 18px;
  height: 18px;
}

.uh-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

[data-theme="dark"] .uh-icon-badge {
  background: rgba(2, 6, 23, 0.62);
  border-color: rgba(148, 163, 184, 0.22);
}

.updates-history-editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.updates-history-editor-toolbar .btn-secondary {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.updates-history-editor-toolbar .btn-secondary span[data-lucide] {
  width: 18px;
  height: 18px;
}

.updates-history-editor-preview-wrap {
  margin-top: 12px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 12px;
  background: color-mix(in srgb, var(--k-sky-600) 3%, transparent);
  padding: 12px;
}

.updates-history-editor-preview-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--k-sky-600);
  margin-bottom: 8px;
}

.updates-history-editor-preview {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

[data-theme="dark"] .updates-history-editor-preview {
  color: rgba(226, 232, 240, 0.86);
}

.updates-history-image-preview {
  margin-top: 10px;
}

.updates-history-image-preview img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  display: block;
}

.updates-history-section {
  margin-top: 16px;
  padding: 12px;
  background: color-mix(in srgb, var(--k-sky-500) 4%, transparent);
  border-left: 3px solid var(--k-sky-500);
  border-radius: 6px;
}

.updates-history-section:first-child {
  margin-top: 0;
}

[data-theme="dark"] .updates-history-section {
  background: color-mix(in srgb, var(--k-sky-500) 12%, transparent);
  border-left-color: var(--k-cyan-400, #22d3ee);
}

.updates-history-section-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--k-sky-600);
  margin-bottom: 8px;
}

[data-theme="dark"] .updates-history-section-title {
  color: var(--k-cyan-400, #22d3ee);
}

.updates-history-remove-image {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: #475569;
}

[data-theme="dark"] .updates-history-remove-image {
  color: rgba(226, 232, 240, 0.82);
}

/* Модальное окно для просмотра изображения товара */
.product-image-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.product-image-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Стили для миниатюр товаров в таблице */
.product-image-cell {
  width: 80px;
  text-align: center;
}

.product-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
}

.product-thumbnail:hover {
  opacity: 0.8;
  border-color: var(--k-sky-500, #0ea5e9);
}

.no-image-placeholder {
  display: inline-block;
  width: 60px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  background: #f3f4f6;
  border-radius: 4px;
  color: #9ca3af;
  font-size: 11px;
  border: 1px solid #e5e7eb;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 20px;
}

.close:hover,
.close-reply:hover {
  color: #333;
}

.close-reply {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 20px;
}

#userForm input {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
}

#userForm input:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.form-actions button {
  flex: 1;
}

/* Секция сообщений */
.messages-section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 30px;
}

.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.user-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-tab {
  padding: 10px 20px;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-tab:hover {
  background: #e9ecef;
  border-color: var(--k-sky-500, #0ea5e9);
}

.user-tab.active {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border-color: var(--k-sky-500, #0ea5e9);
}

.user-tab .unread-count {
  background: #ff4444;
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.messages-header h2 {
  color: #2c3e50;
  font-size: 22px;
  font-weight: 400;
  margin: 0;
}

.btn-refresh {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-refresh:hover {
  background: var(--k-sky-600);
}

.btn-refresh:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.25);
}

/* Заголовки секций со значком обновления (семинары/акции) */
.seminars-header,
.promotions-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 10px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 600px;
  overflow-y: auto;
}

/* =========================
   Мессенджер (как Telegram/VK)
   ========================= */
.messenger {
  /* Контейнер без общей “коробки”: обе колонки будут отдельными карточками */
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.messenger-layout {
  display: grid;
  /* Колонка 2 — разделитель (ширина задаётся в .messenger-resizer); список чатов можно менять перетаскиванием */
  grid-template-columns: var(--chat-dialogs-width, 420px) 6px minmax(0, 1fr);
  min-height: 70vh;
  gap: 0;
  align-items: stretch;
}

.messenger-resizer {
  position: relative;
  z-index: 2;
  width: 6px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  touch-action: none;
  cursor: col-resize;
  background: transparent;
  box-sizing: border-box;
  align-self: stretch;
}

.messenger-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.45);
  opacity: 0.75;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.messenger-resizer:hover::before,
.messenger-resizer:focus-visible::before,
.messenger-resizer.is-dragging::before {
  opacity: 1;
  background: color-mix(in srgb, var(--k-sky-500, #0ea5e9) 55%, rgba(148, 163, 184, 0.5));
}

.messenger-resizer:focus-visible {
  outline: none;
}

.messenger-resizer:focus-visible::before {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--k-sky-500, #0ea5e9) 35%, transparent);
}

.messenger-sidebar {
  background: #fff;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.dialogs-rail-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 72px 1fr;
  grid-template-rows: 1fr;
}

.dialogs-rail-layout.dialogs-rail-layout--no-rail {
  grid-template-columns: 1fr;
}

.dialogs-rail-layout.dialogs-rail-layout--no-rail .dialogs-rail {
  display: none;
}

.dialogs-rail-layout.dialogs-rail-layout--no-rail .dialogs-main {
  grid-column: 1 / -1;
}

.dialogs-rail {
  border-right: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(248, 250, 252, 0.85);
  padding: 6px 4px;
  /* Колонка фикс. ширины: папки должны скроллиться внутри, иначе нижняя кнопка «+» обрезается */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.dialogs-rail::before {
  content: "";
  display: block;
  height: 6px;
}

.dialogs-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.messenger-sidebar-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.9);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "top top"
    "search search"
    "hint hint";
  align-items: center;
  gap: 6px 8px;
  min-height: 0;
}

.tg-sidebar-top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.messenger-title {
  font-weight: 700;
  color: #2c3e50;
  margin: 0;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialogs-search-panel {
  grid-area: search;
  min-width: 0;
}

.dialogs-search-panel .messenger-search {
  width: 100%;
  box-sizing: border-box;
}

/* Shown only on narrow screens via crm_design / chat-page mobile rules */
.dialogs-search-toggle {
  display: none;
}

.messenger-search {
  height: 34px;
  border-radius: 10px;
}

.dialogs-folders {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.dialogs-folder-btn {
  flex: 0 0 auto;
  min-height: 30px;
  width: 100%;
  padding: 4px 5px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(15, 23, 42, 0.8);
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
  white-space: normal;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  line-height: 1.15;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.dialogs-folder-btn:not(.active) {
  border-color: rgba(148, 163, 184, 0.25);
}

.dialogs-folder-btn:hover {
  background: rgba(241, 245, 249, 0.95);
  color: #0f172a;
}

.dialogs-folder-btn.active {
  background: color-mix(in srgb, var(--k-sky-500) 14%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  color: #0f172a;
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.04), 0 6px 14px rgba(2, 6, 23, 0.06);
}

.dialogs-folder-btn.dialogs-folder-btn-add {
  font-weight: 900;
  padding: 0;
  background: color-mix(in srgb, var(--k-sky-600) 6%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-600) 18%, transparent);
  justify-content: center;
  text-align: center;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  min-width: 32px;
  min-height: 32px;
}

#dialogsFiltersHint {
  grid-area: hint;
  margin-top: 2px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 420px) {
  .messenger-sidebar-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "search"
      "hint";
  }
}

/* Mobile: keep folders as a horizontal row (like tabs) */
@media (max-width: 520px) {
  .dialogs-rail-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .dialogs-rail {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    padding: 6px 8px;
  }
  .dialogs-folders {
    flex: 0 0 auto;
    min-height: 0;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .dialogs-folder-btn {
    min-height: 32px;
    width: auto;
    padding: 0 10px;
    border-radius: 999px;
    white-space: nowrap;
  }
}

.dialogs-list {
  overflow-y: auto;
  padding: 6px;
  flex: 1;
  scrollbar-gutter: stable;
}

.dialog-item {
  width: 100%;
  display: flex;
  gap: 10px;
  padding: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-radius: 10px;
}

.dialog-item:hover {
  background: #f5f7ff;
}

.dialog-item.active {
  background: #e8f0ff;
}

.dialog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  flex-shrink: 1;
  max-width: none;
}

.dialog-responsible {
  margin-top: 4px;
  color: var(--k-muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--k-sky-500, #0ea5e9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 auto;
}

.dialog-avatar-wrap {
  position: relative;
  width: 48px;
  min-width: 48px;
  height: 44px;
  flex: 0 0 48px;
}

.dialog-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.dialog-main {
  min-width: 0;
  flex: 1;
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.dialog-top-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.dialog-via {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(2, 6, 23, 0.62);
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.22);
  white-space: nowrap;
}

.dialog-channel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.72);
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.22);
  white-space: nowrap;
}

.dialog-channel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  background: rgba(15, 23, 42, 0.62);
  overflow: hidden;
}

.dialog-channel-icon::before,
.dialog-channel-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.dialog-channel-icon--telegram {
  background: #3390ec;
}

.dialog-channel-icon--telegram::before {
  left: 3px;
  top: 4px;
  width: 10px;
  height: 8px;
  background: #fff;
  clip-path: polygon(0 42%, 100% 0, 72% 100%, 45% 63%, 26% 80%, 32% 59%);
}

.dialog-channel-icon--max {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.dialog-channel-icon--max::before {
  content: "M";
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.dialog-channel-icon--vk {
  background: #2787f5;
}

.dialog-channel-icon--vk::before {
  content: "vk";
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: -0.2px;
}

.dialog-channel-icon--avito {
  background:
    radial-gradient(circle at 5px 5px, #00aaff 0 3px, transparent 3.2px),
    radial-gradient(circle at 11px 5px, #ff6163 0 3px, transparent 3.2px),
    radial-gradient(circle at 5px 11px, #97cf26 0 3px, transparent 3.2px),
    radial-gradient(circle at 11px 11px, #a169f7 0 3px, transparent 3.2px);
}

.dialog-channel-icon--team {
  background: #f97316;
}

.dialog-channel-icon--team::before {
  left: 4px;
  top: 3px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 4px 1px 0 -1px rgba(255, 255, 255, 0.88);
}

.dialog-channel-icon--team::after {
  left: 3px;
  top: 9px;
  width: 10px;
  height: 5px;
  border-radius: 999px 999px 4px 4px;
  background: #fff;
}

.dialog-channel-icon--booking {
  background: #6366f1;
}

.dialog-channel-icon--booking::before {
  left: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
}

.dialog-channel-icon--booking::after {
  left: 5px;
  top: 6px;
  width: 6px;
  height: 1px;
  background: #6366f1;
  box-shadow: 0 3px 0 #6366f1;
}

.dialog-channel-icon--favorites {
  background: #ca8a04;
}

.dialog-channel-icon--favorites::before {
  content: "★";
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.dialog-channel--telegram_personal,
.dialog-channel--telegram_bot,
.dialog-channel--telegram_group {
  color: #0f65a7;
  background: rgba(51, 144, 236, 0.1);
  border-color: rgba(51, 144, 236, 0.24);
}

.dialog-channel--max_bot {
  color: #5b21b6;
  background: rgba(139, 92, 246, 0.11);
  border-color: rgba(139, 92, 246, 0.25);
}

.dialog-channel--vk {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.24);
}

.dialog-channel--avito {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.26);
}

.dialog-channel--team {
  color: #9a3412;
  background: rgba(249, 115, 22, 0.11);
  border-color: rgba(249, 115, 22, 0.26);
}

.dialog-channel--public_booking {
  color: #3730a3;
  background: #eef2ff;
  border-color: rgba(99, 102, 241, 0.24);
}

.dialog-channel--favorites {
  color: #854d0e;
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.3);
}

.dialog-channel.dialog-channel--avatar {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  gap: 0;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
  z-index: 2;
}

.dialog-channel--avatar .dialog-channel-icon {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
}

.dialog-channel--avatar .dialog-channel-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dialog-folder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: rgba(2, 6, 23, 0.72);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.22);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-via-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-top: 4px;
  width: fit-content;
  color: rgba(2, 6, 23, 0.7);
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.thread-via-badge.is-personal {
  color: color-mix(in srgb, var(--k-sky-600) 85%, transparent);
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-600) 18%, transparent);
}

.thread-via-badge.is-bot {
  color: rgba(2, 6, 23, 0.65);
}

.dialog-name {
  font-weight: 600;
  color: #2c3e50;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.dialog-time {
  font-size: 12px;
  color: #999;
  flex: 0 0 auto;
  white-space: nowrap;
}

.dialog-bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.dialog-preview {
  color: #666;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.dialog-badge {
  background: var(--k-sky-500, #0ea5e9);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.dialog-item-more {
  opacity: 0.92;
}

.dialog-item-more .dialog-name {
  color: rgba(2, 6, 23, 0.78);
}

.dialog-item-more .dialog-preview {
  color: rgba(2, 6, 23, 0.48);
}

.messenger-thread {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.thread-header {
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 84px; /* одинаково с шапкой диалогов */
}

.thread-back {
  display: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
}

.thread-back:hover {
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.thread-peer {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.thread-peer-name {
  font-weight: 700;
  color: #2c3e50;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-peer-meta {
  color: #888;
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-gutter: stable;
  background: #f7f8fa;
}

.thread-load-older {
  display: block;
  width: 100%;
  border: 1px dashed #d0d7e2;
  background: #ffffff;
  color: #2c3e50;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px 0;
  cursor: pointer;
  font-size: 13px;
}

.thread-load-older:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.msg-row {
  display: flex;
  margin: 6px 0;
}

.msg-date-sep {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.msg-date-sep > span {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.msg-row.in {
  justify-content: flex-start;
}

.msg-row.out {
  justify-content: flex-end;
}

.msg-row.system {
  justify-content: center;
}

.msg-system-bubble {
  max-width: min(720px, 92%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.msg-row.system.error .msg-system-bubble {
  background: rgba(254, 242, 242, 0.92);
  border-color: rgba(239, 68, 68, 0.22);
}

.msg-row.system.info .msg-system-bubble {
  background: rgba(239, 246, 255, 0.92);
  border-color: rgba(37, 99, 235, 0.18);
}

.msg-row.system.msg-delivery-audit .msg-system-bubble {
  border-style: dashed;
}

.msg-row.system.msg-delivery-audit .msg-text {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.88);
}

.msg-row.system .msg-text {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.35;
}

.msg-row.system .msg-meta {
  justify-content: center;
  color: rgba(71, 85, 105, 0.95);
}

.msg-bubble {
  max-width: min(720px, 85%);
  min-width: 0;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.msg-row.out .msg-bubble {
  background: #e8f0ff;
  border-color: #d8e5ff;
}

.msg-text {
  font-size: 14px;
  color: #2c3e50;
  line-height: 1.35;
  word-break: break-word;
}

.msg-text .chat-safe-link {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.msg-row.out .msg-text .chat-safe-link {
  color: #1d4ed8;
}

.chat-link-warning-modal.c360-modal-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.chat-link-warning-modal .c360-modal {
  width: min(460px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100vh - 32px);
  border-radius: 14px;
}

.chat-link-warning-text {
  margin: 0 0 12px;
  color: #334155;
  line-height: 1.5;
}

.chat-link-warning-url {
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.chat-link-warning-actions {
  gap: 10px;
  justify-content: flex-end;
}

.chat-link-warning-actions .btn-primary,
.chat-link-warning-actions .btn-secondary {
  width: auto;
}

[data-theme="dark"] .chat-link-warning-text {
  color: #cbd5e1;
}

[data-theme="dark"] .chat-link-warning-url {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
}

/* Chat: allow selecting/copying message text */
body.crm-page.chat-page .thread-messages,
body.crm-page.chat-page .msg-bubble,
body.crm-page.chat-page .msg-system-bubble,
body.crm-page.chat-page .msg-text,
body.crm-page.chat-page .msg-text * {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
}

.msg-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
  max-width: 100%;
}

.msg-attachment-img-link {
  display: inline-block;
  text-decoration: none;
}

.msg-attachment-img {
  display: block;
  width: min(420px, 100%);
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.msg-attachment-audio {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  flex: 0 0 auto;
  width: 360px;
  max-width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 14px;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.96);
}

.msg-row.out .msg-attachment-audio {
  background: rgba(232, 240, 255, 0.92);
  border-color: rgba(147, 197, 253, 0.45);
}

.msg-audio {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 54px;
}

.msg-attachment-video,
.msg-attachment-videonote {
  max-width: 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.msg-attachment-videonote {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: flex-start;
}

.msg-attachment-video {
  display: block;
  align-self: stretch;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.92);
  line-height: 0;
  font-size: 0;
}

.msg-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(52vh, 390px);
  border-radius: 0;
  border: none;
  background: #0f172a;
  box-sizing: border-box;
  vertical-align: top;
  object-fit: contain;
}

.msg-video-note {
  display: block;
  width: min(260px, 100%);
  max-width: 100%;
  aspect-ratio: 1;
  height: auto;
  max-height: min(72vw, 320px);
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #0f172a;
  box-sizing: border-box;
}

.msg-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: #0f172a;
  font-size: 13px;
  text-decoration: none;
}

.msg-row.out .msg-attachment-file {
  background: rgba(232, 240, 255, 0.85);
}

.msg-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 6px;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  order: 1;
}

.msg-reaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  line-height: 1;
}

.msg-bubble .msg-footer .msg-meta {
  margin-left: auto;
  order: 2;
}

.msg-reaction-inline {
  display: inline;
  margin-right: 6px;
  font-size: 13px;
  line-height: 1;
  vertical-align: middle;
}

.msg-reaction-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  vertical-align: middle;
  line-height: 1;
}

.msg-edited-label {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.55;
  letter-spacing: 0.02em;
  margin-left: 1px;
  user-select: none;
}

.msg-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  color: #777;
  font-size: 11px;
}

.msg-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.msg-status-channel {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.55);
  color: rgba(2, 6, 23, 0.65);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.msg-status-channel.msg-via {
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15px;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.42);
  color: rgba(2, 6, 23, 0.55);
}

.msg-via.is-personal {
  color: color-mix(in srgb, var(--k-sky-600) 85%, transparent);
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-600) 18%, transparent);
}

.msg-status-text {
  font-size: 11px;
  color: color-mix(in srgb, var(--k-sky-600) 85%, transparent);
}

.msg-status-text {
  font-size: 11px;
  color: color-mix(in srgb, var(--k-sky-600) 85%, transparent);
}

.msg-status-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.55);
  color: rgba(2, 6, 23, 0.55);
}

.msg-status-sent {
  color: color-mix(in srgb, var(--k-sky-600) 85%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-600) 18%, transparent);
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

.msg-status-failed {
  color: rgba(220, 38, 38, 0.92);
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.1);
}

.msg-status-text {
  font-size: 11px;
  color: color-mix(in srgb, var(--k-sky-600) 85%, transparent);
}

.msg-spinner {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid rgba(2, 6, 23, 0.18);
  border-top-color: color-mix(in srgb, var(--k-sky-600) 70%, transparent);
  animation: msgSpin 700ms linear infinite;
}

.msg-checks {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(2, 6, 23, 0.35);
  user-select: none;
}

.msg-checks.is-read {
  color: color-mix(in srgb, var(--k-sky-600) 70%, transparent);
}

.msg-check {
  display: inline-block;
  line-height: 1;
}

@keyframes msgSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.msg-row.is-local-outgoing .msg-bubble {
  animation: msgLocalSendIn 180ms ease-out;
}

@keyframes msgLocalSendIn {
  from {
    opacity: 0.78;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Контекстное меню сообщения (как в Telegram) */
.msg-row[data-can-edit="1"] .msg-bubble {
  cursor: pointer;
}

.msg-context-menu {
  position: fixed;
  z-index: 10001;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px 0;
  min-width: 160px;
}

.composer-reply-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin: 6px 0;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f6f7fb;
}
.composer-reply-hint-text {
  font-size: 13px;
  color: #2b2b2b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.composer-reply-cancel {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
}

.msg-reply {
  width: 100%;
  text-align: left;
  display: block;
  border: 0;
  background: rgba(0, 0, 0, 0.04);
  padding: 6px 8px;
  border-radius: 10px;
  margin: 0 0 6px 0;
  cursor: pointer;
}
.out .msg-reply {
  background: rgba(255, 255, 255, 0.14);
}
.msg-reply-from {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 600;
}
.msg-reply-text {
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-row.is-selected .msg-bubble {
  outline: 2px solid rgba(0, 123, 255, 0.35);
  outline-offset: 2px;
}
.msg-row.flash .msg-bubble {
  animation: msgFlash 850ms ease;
}
@keyframes msgFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
  }
  35% {
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
  }
}

.chat-selection-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(20, 20, 24, 0.92);
  color: #fff;
  min-width: 280px;
  max-width: min(680px, calc(100vw - 24px));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26);
}
.chat-selection-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.chat-selection-count {
  font-weight: 700;
}
.chat-selection-actions {
  display: flex;
  gap: 8px;
}
.chat-selection-bar .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
}

.forward-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.forward-modal {
  width: min(680px, 100%);
  max-height: min(72vh, 700px);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
}
.forward-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.forward-modal-title {
  font-weight: 700;
}
.forward-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.forward-modal-search {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.forward-modal-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  outline: none;
}
.forward-modal-list {
  overflow: auto;
  padding: 6px;
}
.forward-modal-item {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}
.forward-modal-item:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}
.forward-modal-item-name {
  font-weight: 600;
}
.forward-modal-item-prev {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-task-create-modal {
  width: min(620px, calc(100vw - 28px));
  max-width: 620px;
}

.chat-task-create-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  background: rgba(254, 226, 226, 0.72);
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.4;
}

.chat-task-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chat-task-create-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: #334155;
  font-size: 13px;
}

.chat-task-create-field--wide {
  grid-column: 1 / -1;
}

.chat-task-create-field textarea.form-input {
  min-height: 116px;
  resize: vertical;
}

.chat-task-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .chat-task-create-grid {
    grid-template-columns: 1fr;
  }
}

/* Chat dialogs organization: filters + pin/archive */
.dialogs-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
.dialogs-filter-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: #111827;
}
.dialogs-filter-btn.is-active {
  background: color-mix(in srgb, var(--k-sky-500) 12%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-500) 25%, transparent);
  color: var(--k-sky-700);
  font-weight: 600;
}
.dialogs-filter-select {
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  padding: 0 10px;
  font-size: 12px;
  flex: 1 1 260px;
  min-width: 180px;
  max-width: 100%;
  overflow: hidden;
}

@media (max-width: 520px) {
  .dialogs-filter-select {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
}
.dialog-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 14px;
  opacity: 0.9;
}
.dialog-item.is-archived {
  opacity: 0.85;
}

.msg-context-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  color: #1e293b;
}

.msg-context-menu-item:hover {
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

.msg-context-menu-item--danger {
  color: #dc2626;
}

.msg-context-menu-item--danger:hover {
  background: color-mix(in srgb, #dc2626 10%, transparent);
}

.msg-context-menu-emojis {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 4px 8px;
  justify-content: center;
  align-items: center;
}

.msg-context-menu-separator {
  height: 1px;
  margin: 4px 8px;
  background: rgba(0, 0, 0, 0.08);
}

.msg-context-menu-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 6px 10px;
  font-size: 18px;
  line-height: 1;
  min-width: auto;
}

/* Подсказка редактирования над composer */
.composer-edit-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  border-radius: 10px;
  margin-bottom: 8px;
}

.composer-edit-hint-text {
  font-size: 13px;
  font-weight: 600;
  color: #0c4a6e;
}

.composer-edit-cancel {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
  color: #475569;
}

.composer-edit-cancel:hover {
  background: rgba(0, 0, 0, 0.04);
}

.thread-composer {
  background: rgba(248, 250, 252, 0.9);
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 170px 46px 130px;
  gap: 10px;
  align-items: end;
}

.composer-via-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.composer-via-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  padding: 0 10px;
}

.composer-via-btn.is-active {
  background: color-mix(in srgb, var(--k-sky-500) 14%, transparent);
  color: #0f172a;
}

.msg-row.out .composer-via-toggle {
  background: rgba(232, 240, 255, 0.85);
}

.composer-attach,
.composer-template-btn {
  width: 46px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.composer-file-hidden {
  display: none;
}

.composer-text {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.composer-send {
  margin: 0;
  width: 100%;
}

.composer-attachment-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--k-sky-500) 25%, transparent);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  margin-top: -2px;
}

/* Respect the HTML `hidden` attribute (our display:flex above would otherwise override it) */
.composer-attachment-preview[hidden] {
  display: none !important;
}

.composer-attachment-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  flex: 0 0 auto;
}

.composer-attachment-fileicon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
  font-size: 16px;
  flex: 0 0 auto;
}

.composer-attachment-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-attachment-name {
  font-size: 13px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-attachment-meta {
  font-size: 12px;
  color: #64748b;
}

.composer-attachment-remove {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.composer-attachment-remove:hover {
  border-color: color-mix(in srgb, var(--k-sky-500) 45%, transparent);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 12%, transparent);
}

.composer-upload {
  grid-column: 1 / -1;
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  margin-top: -2px;
}

.composer-upload[hidden] {
  display: none !important;
}

.composer-capability-hint {
  grid-column: 1 / -1;
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.08);
  color: rgba(15, 23, 42, 0.66);
  font-size: 12px;
  line-height: 1.35;
}

.composer-capability-hint[hidden] {
  display: none !important;
}

.composer-upload-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--k-sky-500) 0%, var(--k-cyan-400) 100%);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.composer-upload-text {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #0f172a;
  mix-blend-mode: multiply;
  user-select: none;
}

.message-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--k-sky-500, #0ea5e9);
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    background 0.2s;
  cursor: pointer;
}

.message-content-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message-avatar-container {
  flex-shrink: 0;
}

.message-avatar,
.message-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.message-avatar-placeholder {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-card.message-unread {
  background: #fff9e6;
  border-left: 4px solid #ff9800;
  font-weight: 500;
}

.message-card.message-read {
  background: #f8f9fa;
  border-left: 4px solid #4caf50;
  opacity: 0.9;
}

.message-card:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #f0f2f5;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.message-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.message-status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.message-status-badge.status-unread {
  background: #ff9800;
  color: white;
}

.message-status-badge.status-read {
  background: #4caf50;
  color: white;
}

.message-author {
  font-weight: 600;
  color: #2c3e50;
}

.message-author-link {
  color: var(--k-sky-500, #0ea5e9);
  text-decoration: none;
  transition: color 0.2s;
}

.message-author-link:hover {
  color: var(--k-sky-600);
  text-decoration: underline;
}

.message-time {
  color: #999;
  font-size: 12px;
  margin-left: auto;
}

.message-text {
  color: #333;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-meta {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.message-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-reply {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn-reply:hover {
  background: var(--k-sky-600, #0284c7);
}

.btn-delete-message {
  background: #f44336;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn-delete-message:hover {
  background: #d32f2f;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  body {
    padding: 10px;
    overflow-x: hidden; /* чтобы “скролл” не появлялся на формах/страницах */
  }

  .container {
    max-width: 100%;
    padding: 0;
    overflow-x: hidden;
  }

  header {
    padding: 15px;
    margin-bottom: 15px;
  }

  header h1 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  /* Навигация: горизонтальный скролл как “табы”, чтобы не занимать весь экран */
  .main-nav {
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
    width: auto;
    text-align: center;
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 999px;
    white-space: nowrap;
  }

  main {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
  }

  section {
    padding: 15px;
    overflow-x: hidden;
  }

  section h2 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
  }

  /* Формы */
  .form-group {
    margin-bottom: 15px;
  }

  .form-input,
  .message-editor,
  textarea {
    font-size: 16px; /* Предотвращает зум на iOS */
  }

  /* Фильтры (2 селекта): на мобилке в колонку */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filters-bar .filter-item {
    min-width: 0;
    width: 100%;
  }

  /* Доска руководителя */
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }

  .dash-bars {
    height: 110px;
  }

  .dashboard-card {
    padding: 14px;
  }

  .dash-value {
    font-size: 20px;
  }

  .editor-toolbar {
    flex-wrap: wrap;
    gap: 5px;
  }

  .editor-toolbar button {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* =========================
       Часы работы: мобильная адаптация
       ========================= */
  .working-hours-page .editor-toolbar button#aiCheckErrorsBtn,
  .working-hours-page .editor-toolbar button#aiAnalyzeBtn {
    width: 100%;
    text-align: center;
  }

  .working-hours-page .form-actions {
    margin-top: 10px;
  }

  /* Кнопки */
  .btn-primary,
  .btn-secondary,
  .btn-edit,
  .btn-delete {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    margin-bottom: 8px;
  }

  .btn-primary:last-child,
  .btn-secondary:last-child {
    margin-bottom: 0;
  }

  /* Семинары: карточки */
  .seminars-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  /* Акции: карточки */
  .promotions-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .seminar-card-grid {
    grid-template-columns: 1fr;
  }

  .seminar-thumb {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    height: 160px;
  }

  /* На мобилке не фиксируем общую высоту карточки, чтобы контент не обрезался */
  .seminar-card {
    height: auto;
  }

  .seminar-card-content {
    padding: 12px;
  }

  .seminar-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .seminar-actions {
    flex-direction: column;
    gap: 8px;
  }

  .seminar-actions button {
    width: 100%;
  }

  /* Табы семинаров: горизонтальный скролл вместо колонки */
  .seminars-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .seminars-tabs::-webkit-scrollbar {
    display: none;
  }

  .seminars-tab {
    width: auto;
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
  }

  /* Табы акций: горизонтальный скролл вместо “лесенки” */
  .promotions-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .promotions-tabs::-webkit-scrollbar {
    display: none;
  }

  .promotions-tab {
    width: auto;
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
  }

  /* Пользователи */
  .user-select-header {
    flex-direction: column;
    gap: 10px;
  }

  .btn-select-all {
    width: 100%;
  }

  .user-select {
    font-size: 16px; /* Предотвращает зум на iOS */
  }

  /* Сообщения */
  .messages-list {
    max-height: 400px;
  }

  .message-card {
    padding: 12px;
  }

  /* Сообщения: оставляем аватар + контент в строку, так читаемее */
  .message-content-wrapper {
    flex-direction: row;
    gap: 10px;
  }

  /* Чаты: длинные метаданные не должны ломать карточку */
  .message-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .message-meta span {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .message-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .message-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .message-actions button {
    width: 100%;
  }

  /* Табы пользователей в чате: горизонтальный скролл */
  .user-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    scrollbar-width: none;
  }
  .user-tabs::-webkit-scrollbar {
    display: none;
  }

  .user-tab {
    width: auto;
    text-align: center;
    flex: 0 0 auto;
  }

  /* Messenger mobile: sidebar <-> thread */
  .messenger-layout {
    grid-template-columns: 1fr;
  }

  .messenger-resizer {
    display: none !important;
  }

  .thread-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.messenger-thread-open .messenger-sidebar {
    display: none;
  }

  body:not(.messenger-thread-open) .messenger-thread {
    display: none;
  }

  .thread-composer {
    position: sticky;
    bottom: 0;
    grid-template-columns: 1fr;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 0 0 14px 14px;
    z-index: 5;
  }

  .composer-text {
    font-size: 16px; /* iOS */
  }

  .composer-attach,
  .composer-template-btn,
  .composer-send {
    width: 100%;
  }

  /* Мобильные высоты/отступы */
  .messenger-layout {
    gap: 8px;
  }

  .messenger-sidebar,
  .messenger-thread {
    border-radius: 12px;
  }

  .messenger-sidebar {
    height: calc(var(--chat-vh, 1vh) * 100 - 150px);
    overflow-y: auto;
  }

  .thread-header {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .thread-messages {
    padding: 12px;
    height: calc(var(--chat-vh, 1vh) * 100 - 240px);
  }

  /* Модальные окна */
  .modal-content {
    width: 95%;
    max-width: 95%;
    margin: 10px auto;
    padding: 15px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-large {
    width: 95%;
    max-width: 95%;
  }

  .reply-modal-content {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
  }

  /* Таблицы */
  table {
    font-size: 12px;
  }

  table th,
  table td {
    padding: 8px 4px;
  }

  /* Пагинация */
  .pagination-controls {
    flex-wrap: wrap;
    gap: 5px;
  }

  .pagination-btn {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 35px;
  }

  /* База знаний: табы тоже скроллятся горизонтально */
  .knowledge-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    scrollbar-width: none;
  }
  .knowledge-tabs::-webkit-scrollbar {
    display: none;
  }

  .knowledge-tab {
    width: auto;
    text-align: center;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .knowledge-section {
    padding: 15px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  /* Изображения */
  .image-preview {
    grid-template-columns: 1fr;
  }

  .preview-item {
    width: 100%;
  }

  /* Уведомления */
  .notification {
    width: 95%;
    max-width: 95%;
  }

  /* Таблицы семинаров: НЕ ломаем в блоки, а даём горизонтальный скролл */
  .seminar-registrations-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .seminar-table {
    min-width: 720px;
  }

  /* Форма семинара */
  .seminar-form-section {
    padding: 15px;
  }

  /* Списки регистраций */
  .seminar-lists-tabs {
    flex-direction: column;
  }

  .seminar-lists-tabs .tab-btn {
    width: 100%;
  }

  /* Правое боковое меню на мобильных устройствах */
  .seminar-lists-sidebar {
    width: 100vw;
    max-width: 100vw;
  }

  .seminar-lists-sidebar-overlay.open {
    display: block;
  }

  /* Заголовки сообщений */
  .messages-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .messages-header h2 {
    margin: 0;
  }

  /* Форма ответа */
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }

  .form-actions button {
    width: 100%;
  }

  /* История сообщений в модалке */
  .reply-messages-history {
    max-height: 200px;
  }

  /* Логин */
  .login-container {
    padding: 10px;
  }

  .login-box {
    padding: 20px;
  }

  /* База знаний */
  .knowledge-container {
    padding: 10px;
  }

  .step-box,
  .warning-box,
  .info-box {
    padding: 12px;
    font-size: 14px;
  }

  /* Пагинация информации */
  .pagination-info {
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
  }
}

/* Адаптивность для очень маленьких экранов */
@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  header {
    padding: 10px;
  }

  header h1 {
    font-size: 18px;
  }

  section {
    padding: 10px;
  }

  section h2 {
    font-size: 16px;
  }

  .seminar-card {
    padding: 10px;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    margin: 5px;
    padding: 10px;
  }

  .knowledge-section {
    padding: 10px;
  }

  .knowledge-section h2 {
    font-size: 18px;
  }

  .knowledge-section h3 {
    font-size: 16px;
  }

  .knowledge-section h4 {
    font-size: 14px;
  }

  .pagination-btn {
    padding: 5px 8px;
    font-size: 11px;
    min-width: 30px;
  }

  .editor-toolbar button {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Доска руководителя */
  .dashboard-grid {
    gap: 12px;
  }

  .dashboard-card {
    padding: 12px;
  }

  .dash-title {
    font-size: 13px;
  }

  .dash-value {
    font-size: 18px;
  }

  .dash-sub {
    font-size: 12px;
  }

  .dash-bars {
    height: 95px;
    padding: 8px;
    gap: 3px;
  }

  .dash-bar {
    min-width: 4px;
  }
}

/* Адаптивность для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 15px;
  }

  header {
    padding: 20px;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  main {
    gap: 20px;
  }

  section {
    padding: 20px;
  }

  .seminar-actions {
    flex-wrap: wrap;
  }

  .seminar-actions button {
    flex: 1;
    min-width: 120px;
  }
}

/* Стили для пагинации */
.pagination {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pagination-btn {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: white;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 40px;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border-color: var(--k-sky-500, #0ea5e9);
}

.pagination-btn.active {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border-color: var(--k-sky-500, #0ea5e9);
  font-weight: 600;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 8px 4px;
  color: #999;
}

.pagination-info {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-top: 10px;
}

/* Стили для страницы рассылок */
.broadcast-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 14px 0;
}

.broadcast-tab-btn {
  padding: 10px 20px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.broadcast-tab-btn:hover {
  background: #f5f7fa;
  color: #333;
}

.broadcast-tab-btn.active {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
  border-color: var(--k-sky-500, #0ea5e9);
  border-bottom-color: var(--k-sky-600, #0284c7);
}

.broadcast-tab-content {
  display: none;
}

.broadcast-tab-content.active {
  display: block;
}

/* =========================
   Bot automations (Bitrix-like cards)
   ========================= */
body.crm-page.bot-automations-page .bot-auto-warning {
  background: #fff3cd;
  border-left: 4px solid #f59e0b;
  padding: 12px 14px;
  border-radius: 10px;
  color: #6b4f00;
  font-size: 13px;
  margin-bottom: 14px;
}

body.crm-page.bot-automations-page .bot-auto-panel {
  background: var(--card, #fff);
  color: var(--card-foreground, #111);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 14px;
}

body.crm-page.bot-automations-page .bot-auto-panel-head {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

body.crm-page.bot-automations-page .bot-auto-scope {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(420px, 100%);
}

body.crm-page.bot-automations-page .bot-auto-scope-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body.crm-page.bot-automations-page .bot-auto-scope-title {
  font-weight: 800;
  color: inherit;
  min-width: 60px;
}

body.crm-page.bot-automations-page .bot-auto-scope-select {
  min-width: min(520px, 100%);
}

body.crm-page.bot-automations-page .bot-auto-main-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

body.crm-page.bot-automations-page .bot-auto-panel-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

body.crm-page.bot-automations-page .bot-auto-muted {
  color: #64748b;
  font-size: 13px;
}

body.crm-page.bot-automations-page .bot-auto-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}

/* Автопостинг: панель как в рассылках — форматирование и ИИ в одном ряду над редактором */
body.crm-page.bot-automations-page #botAutoTabPublishAll .editor-toolbar {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 6px;
}

body.crm-page.bot-automations-page .publish-all-tg-caption-hint.publish-all-tg-caption--warn {
  border-left: 3px solid #ca8a04;
  padding: 10px 12px 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, #ca8a04 12%, transparent);
}

/* Автопостинг: превью вложений перед отправкой */
body.crm-page.bot-automations-page .publish-all-files-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

body.crm-page.bot-automations-page .publish-all-file-thumb {
  position: relative;
  width: 104px;
  flex: 0 0 auto;
}

body.crm-page.bot-automations-page .publish-all-file-thumb__media {
  width: 104px;
  height: 104px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

body.crm-page.bot-automations-page .publish-all-file-thumb__img,
body.crm-page.bot-automations-page .publish-all-file-thumb__vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.crm-page.bot-automations-page .publish-all-file-thumb__placeholder {
  padding: 8px;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  color: #64748b;
  word-break: break-word;
}

body.crm-page.bot-automations-page .publish-all-file-thumb__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.crm-page.bot-automations-page .publish-all-file-thumb__remove:hover {
  background: rgba(220, 38, 38, 0.95);
}

body.crm-page.bot-automations-page .publish-all-file-thumb__remove:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

body.crm-page.bot-automations-page .publish-all-file-thumb__name {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.25;
  color: #64748b;
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Автопостинг: прогресс при «Отправить сейчас» */
body.crm-page.bot-automations-page .publish-all-send-progress-wrap {
  margin-top: 12px;
  max-width: 520px;
}

body.crm-page.bot-automations-page .publish-all-send-progress-status {
  font-size: 13px;
  color: #334155;
  margin-bottom: 8px;
  min-height: 1.35em;
}

body.crm-page.bot-automations-page .publish-all-send-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  overflow: hidden;
}

body.crm-page.bot-automations-page .publish-all-send-progress-fill {
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #6366f1, #3b82f6);
  background-size: 200% 100%;
  animation: publish-all-send-progress-slide 1.1s ease-in-out infinite;
}

@keyframes publish-all-send-progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

/* Вложенные ссылки автопостинг/кросспост под «Автоматические рассылки» (все CRM-страницы) */
body.crm-page .sidebar-nav-submenu .sidebar-nav-item.bot-auto-sidebar-link {
  padding-left: 62px;
  font-size: 13px;
}

body.crm-page.bot-automations-page .bot-auto-help {
  margin-top: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.5);
  padding: 10px 12px;
}

body.crm-page.bot-automations-page .bot-auto-help summary {
  cursor: pointer;
  user-select: none;
  font-weight: 800;
}

body.crm-page.bot-automations-page .bot-auto-help-body {
  margin-top: 10px;
}

body.crm-page.bot-automations-page .bot-auto-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

body.crm-page.bot-automations-page .bot-auto-help-card {
  background: var(--card, #fff);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 12px;
}

body.crm-page.bot-automations-page .bot-auto-help-title {
  font-weight: 900;
  margin-bottom: 6px;
}

body.crm-page.bot-automations-page .bot-auto-help-text {
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}

body.crm-page.bot-automations-page .bot-auto-help-text code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
}

body.crm-page.bot-automations-page .bot-auto-card {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--k-sky-500) 5%, transparent),
      color-mix(in srgb, var(--k-sky-500) 0%, transparent) 60%
    ),
    var(--card, #fff);
  color: var(--card-foreground, #0f172a);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 14px;
}

body.crm-page.bot-automations-page .bot-auto-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

body.crm-page.bot-automations-page .bot-auto-card-title {
  font-weight: 800;
  color: inherit;
}

body.crm-page.bot-automations-page .crosspost-max-head-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

body.crm-page.bot-automations-page .crosspost-max-api-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted-foreground, #64748b);
  white-space: nowrap;
}

body.crm-page.bot-automations-page .bot-auto-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
}

body.crm-page.bot-automations-page .bot-auto-varbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 8px 0;
}

body.crm-page.bot-automations-page .bot-auto-varbar-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
  margin-right: 2px;
}

body.crm-page.bot-automations-page .bot-auto-var-btn.btn-secondary {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

body.crm-page.bot-automations-page .bot-auto-preview-box {
  margin-top: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: var(--card, #fff);
  padding: 10px 12px;
}

body.crm-page.bot-automations-page .bot-auto-preview-box-title {
  font-weight: 900;
  font-size: 12px;
  color: #475569;
  margin-bottom: 8px;
}

body.crm-page.bot-automations-page .bot-auto-preview-box-body {
  min-height: 52px;
  white-space: pre-wrap;
  color: var(--card-foreground, #0f172a);
  font-size: 14px;
  line-height: 1.45;
}

body.crm-page.bot-automations-page .bot-auto-preview-box-body a {
  color: var(--k-sky-600, #0284c7);
  text-decoration: underline;
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-preview-box {
  background: var(--card);
  border-color: var(--border);
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-preview-box-title {
  color: var(--muted-foreground);
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-preview-box-body {
  color: var(--card-foreground);
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-preview-box-body a {
  color: var(--k-sky-400, #38bdf8);
}

body.crm-page.bot-automations-page .bot-auto-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Tabs: disabled state */
body.crm-page.bot-automations-page .broadcast-tab-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-warning {
  background: rgba(255, 193, 7, 0.15);
  border-left-color: #ffc107;
  color: var(--card-foreground, #e2e8f0);
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-help {
  background: rgba(30, 41, 59, 0.35);
  border-color: var(--border);
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-help-card {
  background: var(--card);
  border-color: var(--border);
}

[data-theme="dark"] body.crm-page.bot-automations-page .bot-auto-help-text {
  color: rgba(226, 232, 240, 0.86);
}

[data-theme="dark"]
  body.crm-page.bot-automations-page
  .bot-auto-help-text
  code {
  background: rgba(226, 232, 240, 0.12);
}

.broadcasts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.broadcast-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.broadcast-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  box-shadow: 0 12px 34px rgba(2, 8, 23, 0.08);
}

.broadcast-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--k-sky-500) 55%, transparent);
  outline-offset: 3px;
}

.broadcast-card-cover {
  position: relative;
  height: 132px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--k-sky-500) 16%, transparent),
    rgba(34, 211, 238, 0.12)
  );
}

.broadcast-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.broadcast-card-cover-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(2, 6, 23, 0.6);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.broadcast-card-cover-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0) 25%,
    rgba(15, 23, 42, 0.55) 100%
  );
}

.broadcast-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  z-index: 2;
}

.broadcast-badge-date {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.broadcast-card-badges .status-badge {
  margin-left: auto;
}

.broadcast-card-body {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.broadcast-card-title {
  font-size: 16px;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.92);
  margin-bottom: 8px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.broadcast-card-text {
  color: rgba(71, 85, 105, 0.95);
  margin-bottom: 12px;
  line-height: 1.45;
  min-height: 42px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.broadcast-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  margin-top: auto;
}

.broadcast-card-meta {
  font-size: 12px;
  color: rgba(71, 85, 105, 0.95);
}

.broadcast-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.broadcast-edit-icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.broadcast-edit-icon-btn span[data-lucide] {
  width: 18px;
  height: 18px;
}

.broadcast-images {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.broadcast-images a {
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.08);
}

.broadcast-images img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  display: block;
}

.broadcast-images video {
  width: 220px;
  height: 120px;
  object-fit: cover;
  display: block;
  background: #000;
}

.video-preview {
  display: grid;
  gap: 10px;
}

.video-note-preview-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.06);
}

.video-note-preview-media {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #000;
}

.video-note-preview-media.is-note::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  border: 2px solid rgba(34, 211, 238, 0.85);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 1;
}

.video-note-preview-media.is-note::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0) 0 49%,
    rgba(0, 0, 0, 0.55) 50% 100%
  );
  pointer-events: none;
  z-index: 1;
}

.video-note-preview-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  gap: 8px;
  z-index: 2;
}

.video-preview-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.35);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(248, 250, 252, 0.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.18s ease;
}

.video-preview-icon-btn [data-lucide] {
  width: 16px;
  height: 16px;
}

.video-preview-icon-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--k-sky-600) 55%, transparent);
  border-color: rgba(34, 211, 238, 0.42);
}

.video-preview-icon-btn--delete:hover {
  background: rgba(239, 68, 68, 0.55);
  border-color: rgba(239, 68, 68, 0.55);
}

.video-note-preview-media video {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #000;
  display: block;
}

.video-note-preview-media.is-note video {
  height: 100%;
  aspect-ratio: 1 / 1;
}

.video-note-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.video-note-preview-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.video-note-preview-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.video-note-preview-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.video-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.04);
  white-space: nowrap;
}

[data-theme="dark"] .video-badge {
  color: rgba(248, 250, 252, 0.9);
  background: rgba(2, 6, 23, 0.28);
  border-color: rgba(148, 163, 184, 0.22);
}

.video-note-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .video-note-preview-title {
  color: rgba(248, 250, 252, 0.92);
}

.video-note-preview-sub {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
}

[data-theme="dark"] .video-note-preview-sub {
  color: rgba(148, 163, 184, 0.9);
}

.video-note-preview-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
}

.video-note-preview-actions .btn-icon-action {
  padding: 6px 10px;
  border-radius: 10px;
}

@media (max-width: 520px) {
  .video-note-preview-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .video-note-preview-actions {
    justify-content: flex-start;
  }
}

/* Video attachment (upload + mode + record) */
.video-attach-card {
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.06);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 420px);
  align-items: start;
}

.video-attach-left {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.video-attach-right {
  min-width: 0;
}

.video-attach-right .video-preview {
  gap: 0;
}

.video-attach-right .video-note-preview-card {
  grid-template-columns: 1fr;
}

.video-attach-right .video-note-preview-media video {
  height: 240px;
}

.video-attach-right .video-note-preview-media.is-note {
  aspect-ratio: 1 / 1;
}

.video-attach-right .video-note-preview-media.is-note video {
  height: 100%;
}

.video-attach-right .video-note-preview-meta {
  gap: 6px;
}

.video-attach-right .video-note-preview-title-row {
  align-items: center;
}

.video-attach-right .video-note-preview-title {
  white-space: nowrap;
}

.video-attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.video-attach-row {
  align-items: center;
}

.video-attach-btn {
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.96);
  color: rgba(15, 23, 42, 0.88);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  margin: 0; /* override global label margins */
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

/* `.form-group label` has higher specificity; override its block layout/margins */
.form-group label.video-attach-btn {
  display: inline-flex;
  margin-bottom: 0;
  color: rgba(15, 23, 42, 0.88);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

[data-theme="dark"] .form-group label.video-attach-btn {
  color: rgba(248, 250, 252, 0.92);
}

.video-attach-btn > span {
  display: inline-flex;
  align-items: center;
}

.video-attach-btn [data-lucide] {
  width: 16px;
  height: 16px;
}

.video-attach-btn svg.lucide {
  display: block;
}

.video-attach-btn:hover {
  border-color: color-mix(in srgb, var(--k-sky-500) 55%, transparent);
  box-shadow: 0 10px 20px color-mix(in srgb, var(--k-sky-500) 12%, transparent);
  transform: translateY(-1px);
}

.video-attach-btn:active {
  transform: translateY(0);
}

[data-theme="dark"] .video-attach-btn {
  background: rgba(2, 6, 23, 0.24);
  color: rgba(248, 250, 252, 0.92);
  border-color: rgba(148, 163, 184, 0.22);
}

.video-mode-segment {
  display: inline-flex;
  align-items: stretch;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  overflow: hidden;
  background: rgba(2, 6, 23, 0.04);
  margin: 0; /* keep aligned with соседней кнопкой */
}

[data-theme="dark"] .video-mode-segment {
  background: rgba(2, 6, 23, 0.3);
  border-color: rgba(148, 163, 184, 0.22);
}

.video-mode-segment-btn {
  position: relative;
  display: inline-flex;
  height: 100%;
  align-items: stretch;
  cursor: pointer;
  margin: 0; /* override global label margins */
}

.form-group label.video-mode-segment-btn {
  display: inline-flex;
  margin-bottom: 0;
}

.video-mode-segment-btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-mode-segment-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.78);
  line-height: 1;
  box-sizing: border-box;
  transition:
    background 0.18s ease,
    color 0.18s ease;
  white-space: nowrap;
}

.video-mode-segment-inner::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.7);
  box-sizing: border-box;
  display: inline-block;
}

.video-mode-segment-btn input:checked + .video-mode-segment-inner::before {
  border-color: color-mix(in srgb, var(--k-sky-600) 95%, transparent);
  background: color-mix(in srgb, var(--k-sky-600) 95%, transparent);
}

[data-theme="dark"]
  .video-mode-segment-btn
  input:checked
  + .video-mode-segment-inner::before {
  border-color: rgba(34, 211, 238, 0.95);
  background: rgba(34, 211, 238, 0.95);
}

[data-theme="dark"] .video-mode-segment-inner {
  color: rgba(248, 250, 252, 0.82);
}

.video-mode-segment-inner [data-lucide] {
  width: 16px;
  height: 16px;
}

.broadcast-mode-count {
  font-size: 12px;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.9);
  margin-left: 2px;
}
[data-theme="dark"] .broadcast-mode-count {
  color: rgba(203, 213, 225, 0.85);
}

.video-mode-segment-btn input:checked + .video-mode-segment-inner {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--k-sky-500) 22%, transparent),
    rgba(34, 211, 238, 0.14)
  );
  color: color-mix(in srgb, var(--k-sky-600) 95%, transparent);
}

[data-theme="dark"]
  .video-mode-segment-btn
  input:checked
  + .video-mode-segment-inner {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--k-sky-500) 28%, transparent),
    rgba(34, 211, 238, 0.16)
  );
  color: rgba(34, 211, 238, 0.95);
}

.video-mode-segment-btn input:not(:checked) + .video-mode-segment-inner:hover {
  background: color-mix(in srgb, var(--k-sky-500) 8%, transparent);
}

[data-theme="dark"]
  .video-mode-segment-btn
  input:not(:checked)
  + .video-mode-segment-inner:hover {
  background: color-mix(in srgb, var(--k-sky-500) 14%, transparent);
}

.video-mode-segment-btn input:focus-visible + .video-mode-segment-inner {
  outline: 3px solid color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  outline-offset: -3px;
}

@media (max-width: 520px) {
  .video-attach-btn,
  .video-mode-segment {
    height: 38px;
  }
  .video-attach-btn {
    padding: 0 12px;
  }
  .video-mode-segment-inner {
    padding: 0 12px;
  }
}

.video-attach-row--secondary {
  align-items: flex-start;
}

.video-attach-card .btn-sm {
  height: 34px;
}

.video-attach-card #videoNoteStartBtn {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  border-color: rgba(220, 38, 38, 0.55);
}

.video-attach-card #videoNoteStartBtn:hover:not(:disabled) {
  filter: brightness(0.98);
}

.video-attach-card #videoNoteStartBtn:disabled {
  opacity: 0.6;
}

.video-attach-card #videoModeHint {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
}

.video-attach-card #videoNoteRecorderHint:empty {
  display: none;
}

.video-attach-card #videoNoteRecorderHint:not(:empty) {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: rgba(185, 28, 28, 0.95);
  font-size: 12px;
  line-height: 1.25;
}

.video-attach-choose {
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(15, 23, 42, 0.86);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

[data-theme="dark"] .video-attach-choose {
  background: rgba(2, 6, 23, 0.22);
  color: rgba(248, 250, 252, 0.9);
  border-color: rgba(148, 163, 184, 0.22);
}

.video-attach-choose:hover {
  border-color: color-mix(in srgb, var(--k-sky-500) 55%, transparent);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--k-sky-500) 12%, transparent);
  transform: translateY(-1px);
}

.video-attach-choose:active {
  transform: translateY(0);
}

/* Keep file input accessible but visually hidden */
.video-attach-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.video-attach-modes {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  overflow: hidden;
  background: rgba(2, 6, 23, 0.04);
}

[data-theme="dark"] .video-attach-modes {
  background: rgba(2, 6, 23, 0.28);
  border-color: rgba(148, 163, 184, 0.22);
}

.video-mode-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  color: rgba(15, 23, 42, 0.88);
  user-select: none;
}

[data-theme="dark"] .video-mode-pill {
  color: rgba(248, 250, 252, 0.9);
}

.video-mode-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-mode-pill span {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  border-radius: 0;
  font-weight: 600;
}

.video-mode-pill:first-child span {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.video-mode-pill:last-child span {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.video-mode-pill input:checked + span {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--k-sky-500) 20%, transparent),
    rgba(34, 211, 238, 0.12)
  );
  color: color-mix(in srgb, var(--k-sky-600) 95%, transparent);
}

[data-theme="dark"] .video-mode-pill input:checked + span {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--k-sky-500) 26%, transparent),
    rgba(34, 211, 238, 0.14)
  );
  color: rgba(34, 211, 238, 0.95);
}

.video-mode-pill input:not(:checked) + span:hover {
  background: color-mix(in srgb, var(--k-sky-500) 8%, transparent);
}

[data-theme="dark"] .video-mode-pill input:not(:checked) + span:hover {
  background: color-mix(in srgb, var(--k-sky-500) 14%, transparent);
}

.video-mode-pill input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  outline-offset: -3px;
}

.video-attach-card .hint {
  margin: 0;
}

@media (max-width: 520px) {
  .video-attach-card {
    grid-template-columns: 1fr;
  }
  .video-attach-right .video-note-preview-media video {
    height: 200px;
  }
}
.video-note-recorder {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.06);
  border-radius: 12px;
}

.video-note-recorder-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Make recorder buttons more expressive without affecting global buttons */
.video-note-recorder-row #videoNoteStartBtn {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  border-color: rgba(220, 38, 38, 0.55);
}

.video-note-recorder-row #videoNoteStartBtn:disabled {
  opacity: 0.55;
}

.video-note-recorder-row #videoNoteStopBtn {
  border-color: rgba(148, 163, 184, 0.35);
}

.video-note-recorder-preview {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #000;
  position: relative;
}

.video-note-recorder-preview video {
  width: 260px;
  height: 260px;
  object-fit: cover;
  display: block;
}

.video-note-overlay-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.35);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(248, 250, 252, 0.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.video-note-overlay-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.video-trim-controls {
  width: 100%;
  max-width: 420px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.06);
}

.video-trim-controls--modal {
  max-width: none;
}

.video-edit-modal-content {
  max-width: 1120px;
  width: min(1120px, 96vw);
  max-height: 90vh;
}

.video-edit-modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Make the video edit modal more compact (override base `.modal-content` padding) */
#videoEditModal .video-edit-modal-content {
  padding: 16px;
  margin: 3vh auto;
}

#videoEditModal .video-edit-modal-content h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

#videoEditModal .video-edit-modal-content .close {
  top: 12px;
  right: 12px;
}

#videoEditModal .video-edit-modal-content {
  gap: 10px;
}

#videoEditModal .video-edit-head {
  margin-bottom: 6px;
}

#videoEditModal .video-trim-meta--edit {
  margin-bottom: 8px;
}

#videoEditModal .video-edit-actions {
  margin-top: 8px;
}

@media (max-width: 520px) {
  #videoEditModal .video-edit-modal-content {
    padding: 12px;
    margin: 10px auto;
    width: min(1120px, 96vw);
  }
  #videoEditModal .video-edit-modal-content h2 {
    font-size: 18px;
    margin-bottom: 10px;
  }
  #videoEditModal .video-edit-modal-content .close {
    top: 10px;
    right: 10px;
  }
}

.video-edit-player-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #000;
}

.video-edit-player-wrap video {
  width: 100%;
  max-height: 52vh;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
}

/* Full-bleed video inside the edit modal (no white edges) */
#videoEditModal .video-edit-player-wrap {
  margin: -16px -16px 0;
  border-radius: 0;
  border: 0;
}

#videoEditModal .video-edit-player-wrap video {
  border-radius: 0;
}

@media (max-width: 520px) {
  #videoEditModal .video-edit-player-wrap {
    margin: -12px -12px 0;
  }
}

/* Note mode framing (circle) in edit modal */
#videoEditModal .video-edit-player-wrap {
  position: relative;
}

#videoEditModal .video-edit-player-wrap.is-note {
  aspect-ratio: 1 / 1;
  max-height: 70vh;
}

#videoEditModal .video-edit-player-wrap.is-note::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 999px;
  border: 2px solid rgba(34, 211, 238, 0.85);
  pointer-events: none;
  z-index: 3;
}

#videoEditModal .video-edit-player-wrap.is-note::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0) 0 49%,
    rgba(0, 0, 0, 0.55) 50% 100%
  );
  pointer-events: none;
  z-index: 2;
}

.video-edit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.video-edit-head-left {
  display: grid;
  gap: 4px;
}

.video-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.video-trim-meta--edit {
  margin-top: 0;
  margin-bottom: 12px;
}

/* GoPro-like range selection over storyboard */
.video-edit-timeline {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.85);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.video-edit-progress {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.32);
}

.video-edit-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.video-edit-progress-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.92);
}

.video-edit-progress-text {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.86);
}

.video-edit-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.video-edit-progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--k-sky-600, #0284c7), var(--k-cyan-500, #06b6d4));
  transition: width 0.12s linear;
}

.video-edit-timeline-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.video-edit-timeline-track {
  position: relative;
  height: 76px;
  min-width: 100%;
}

.video-edit-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0px;
  width: 2px;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 8; /* above thumbs */
}

.video-edit-playhead::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.95);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.video-edit-thumbs-strip {
  display: flex;
  height: 100%;
  width: 100%;
}

.video-edit-thumb {
  flex: 1 1 0;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.12), rgba(2, 6, 23, 0.12)),
    #000;
}

.video-edit-thumb:last-child {
  border-right: 0;
}

.video-edit-thumb--empty {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.14),
      rgba(148, 163, 184, 0.14) 8px,
      rgba(2, 6, 23, 0.12) 8px,
      rgba(2, 6, 23, 0.12) 16px
    ),
    #000;
}

.video-edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-edit-thumbs-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.62);
  pointer-events: none;
  z-index: 7;
}

.video-edit-thumbs-dim--left {
  left: 0;
  width: 0%;
}

.video-edit-thumbs-dim--right {
  right: 0;
  width: 0%;
}

.video-edit-thumbs-range {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0px;
  width: 0px;
  border: 2px solid rgba(34, 211, 238, 0.95);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.22) inset,
    0 16px 40px rgba(0, 0, 0, 0.25);
  background: color-mix(in srgb, var(--k-sky-600) 8%, transparent);
  cursor: grab;
  touch-action: none;
  z-index: 9; /* ensure it receives pointer events */
}

.video-edit-handle {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 14px;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.25);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  cursor: ew-resize;
  touch-action: none;
  z-index: 10;
}

.video-edit-handle--left {
  left: -7px;
}

.video-edit-handle--right {
  right: -7px;
}

.video-edit-thumbs-range:active {
  cursor: grabbing;
}

.video-edit-thumbs-loading {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
  padding: 8px 0;
}

[data-theme="dark"] .video-edit-thumbs-loading {
  color: rgba(148, 163, 184, 0.9);
}

.video-record-modal-content {
  max-width: 760px;
}

.video-record-modal-content {
  max-height: 96vh;
  margin: 2vh auto;
  display: flex;
  flex-direction: column;
}

/* Full-bleed live preview in record modal (like view/edit) */
#videoRecordModal .video-record-preview {
  margin: -15px -15px 0;
  border-radius: 0;
  border: 0;
}

#videoRecordModal .video-record-preview video {
  border-radius: 0;
}

#videoRecordModal .video-note-overlay-btn {
  top: 12px;
  right: 12px;
}

#videoRecordModal .video-record-badge {
  top: 12px;
  left: 12px;
}

@media (max-width: 520px) {
  #videoRecordModal .video-record-preview {
    margin: -15px -15px 0;
  }
}

/* Note mode framing (circle) in record modal */
#videoRecordModal .video-record-preview {
  position: relative;
}

#videoRecordModal .video-record-preview.is-note {
  aspect-ratio: 1 / 1;
}

#videoRecordModal .video-record-preview.is-note::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 999px;
  border: 2px solid rgba(34, 211, 238, 0.85);
  pointer-events: none;
  z-index: 3;
}

#videoRecordModal .video-record-preview.is-note::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0) 0 49%,
    rgba(0, 0, 0, 0.55) 50% 100%
  );
  pointer-events: none;
  z-index: 2;
}

.video-record-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.video-record-preview {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #000;
  flex: 1;
  min-height: 0;
}

.video-record-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mirror helper (front camera UX) */
video.is-mirrored {
  transform: scaleX(-1);
}

.video-record-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.92);
  color: rgba(248, 250, 252, 0.96);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.video-record-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.video-record-controls #videoRecordStartBtn.is-recording {
  background: linear-gradient(90deg, #0f172a, #334155);
  border-color: rgba(148, 163, 184, 0.35);
}

.video-trim-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.video-trim-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.95);
}

[data-theme="dark"] .video-trim-title {
  color: rgba(226, 232, 240, 0.86);
}

.video-trim-hint {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
}

[data-theme="dark"] .video-trim-hint {
  color: rgba(148, 163, 184, 0.9);
}

.video-trim-grid {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 8px 10px;
  align-items: center;
}

.video-trim-label {
  font-size: 12px;
  color: rgba(71, 85, 105, 0.95);
}

[data-theme="dark"] .video-trim-label {
  color: rgba(226, 232, 240, 0.86);
}

.video-trim-grid input[type="range"] {
  width: 100%;
}

.video-trim-meta {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(71, 85, 105, 0.95);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

[data-theme="dark"] .video-trim-meta {
  color: rgba(226, 232, 240, 0.86);
}

[data-theme="dark"] .broadcast-images a {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
}

[data-theme="dark"] .broadcast-card {
  background: rgba(2, 6, 23, 0.62);
  border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .broadcast-card:hover {
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .broadcast-card-title {
  color: rgba(248, 250, 252, 0.92);
}

[data-theme="dark"] .broadcast-card-text,
[data-theme="dark"] .broadcast-card-meta {
  color: rgba(226, 232, 240, 0.86);
}

.broadcasts-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  z-index: 10050; /* выше c360-modal-overlay (10000), чтобы drawer был поверх модального окна просмотра рассылки */
}

.broadcasts-drawer-backdrop.c360-modal-overlay {
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px) saturate(1.05);
}
[data-theme="dark"] .broadcasts-drawer-backdrop.c360-modal-overlay {
  background: rgba(0, 0, 0, 0.66);
}

.broadcasts-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 460px;
  max-width: 92vw;
  height: 100vh;
  background: #fff;
  border-left: 1px solid rgba(148, 163, 184, 0.24);
  z-index: 10051; /* выше backdrop (10050), поверх модального окна просмотра рассылки */
  transform: translateX(102%);
  transition: transform 0.22s ease;
  padding: 16px 16px 18px;
  box-sizing: border-box;
  overflow: auto;
}

.broadcasts-drawer.c360-modal {
  top: 18px;
  right: 18px;
  height: calc(100vh - 36px);
  width: min(560px, 96vw);
  max-width: 96vw;
  border-radius: 16px;
  border: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background:
    radial-gradient(
      900px 240px at 10% 0%,
      color-mix(in srgb, var(--k-sky-500) 12%, transparent),
      transparent 60%
    ),
    radial-gradient(
      900px 240px at 92% 0%,
      rgba(99, 102, 241, 0.1),
      transparent 60%
    ),
    var(--c360-card, #ffffff);
  box-shadow: 0 30px 70px rgba(2, 6, 23, 0.35);
  border-left: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(105%);
  transition: transform 0.22s ease;
}
.broadcasts-drawer.c360-modal .broadcasts-drawer-header {
  flex-shrink: 0;
}
.broadcasts-drawer.c360-modal #broadcastsDrawerResult {
  flex-shrink: 0;
}
.broadcasts-drawer.c360-modal #broadcastsDrawerForm {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.broadcasts-drawer.c360-modal.open {
  transform: translateX(0);
}
@media (max-width: 720px) {
  .broadcasts-drawer.c360-modal {
    top: 0;
    right: 0;
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}

.broadcasts-drawer.open {
  transform: translateX(0);
}

[data-theme="dark"] .broadcasts-drawer {
  background: rgba(2, 6, 23, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
}

.broadcasts-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.broadcasts-drawer.c360-modal .broadcasts-drawer-header.c360-modal-head {
  padding: 14px 14px 12px 14px;
  margin: 0;
  border-bottom: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
}

.broadcasts-drawer-title {
  font-size: 16px;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.92);
}

.broadcasts-drawer.c360-modal .broadcasts-drawer-title.c360-modal-title {
  font-size: 14px;
  font-weight: 1000;
  color: var(--c360-text, #0f172a);
}

[data-theme="dark"] .broadcasts-drawer-title {
  color: rgba(248, 250, 252, 0.92);
}

.broadcasts-drawer-meta {
  font-size: 12px;
  color: #64748b;
}

[data-theme="dark"] .broadcasts-drawer-meta {
  color: rgba(226, 232, 240, 0.8);
}

.broadcasts-drawer-close {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding: 0;
}

.broadcasts-drawer.c360-modal .broadcasts-drawer-close.c360-modal-close {
  width: 38px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--c360-border, rgba(15, 23, 42, 0.1));
  background: transparent;
  color: var(--c360-muted, rgba(15, 23, 42, 0.62));
  font-weight: 1000;
}
.broadcasts-drawer.c360-modal .broadcasts-drawer-close.c360-modal-close:hover {
  color: var(--c360-text, #0f172a);
  background: color-mix(in srgb, var(--k-sky-500) 8%, transparent);
}

.broadcasts-drawer-images {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.broadcasts-drawer-images--new {
  margin-top: 10px;
}

.broadcasts-drawer-images a {
  position: relative;
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.08);
}

.broadcasts-drawer-images .broadcasts-drawer-image-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.62);
  color: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  font-size: 16px;
}

.broadcasts-drawer-images .broadcasts-drawer-image-remove:hover {
  background: rgba(185, 28, 28, 0.82);
  border-color: rgba(255, 255, 255, 0.28);
}

.broadcasts-drawer-images .broadcasts-drawer-image-remove:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.broadcasts-drawer-images img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  display: block;
}

.broadcasts-drawer-images video {
  width: 220px;
  height: 92px;
  object-fit: cover;
  display: block;
  background: #000;
}

[data-theme="dark"] .broadcasts-drawer-images a {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
}

.broadcasts-drawer-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.modal-large {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.broadcast-info {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.info-item {
  margin-bottom: 10px;
}

.info-item strong {
  color: #2c3e50;
  margin-right: 10px;
}

.broadcast-text-container {
  margin-bottom: 20px;
}

.broadcast-text-container h3 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 18px;
}

.broadcast-text {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.readers-section {
  margin-top: 20px;
}

.readers-section h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 18px;
}

.readers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.reader-card {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #4caf50;
}

.reader-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.reader-link {
  color: var(--k-sky-500, #0ea5e9);
  text-decoration: none;
  font-weight: 600;
}

.reader-link:hover {
  text-decoration: underline;
}

.reader-chat-id {
  color: #999;
  font-size: 11px;
}

.reader-date {
  color: #666;
  font-size: 12px;
}

.form-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

/* Нормализация select (стрелка внутри поля, без “уезда” вправо) */
select.form-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #fff;
  padding-right: 38px; /* место под стрелку */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

select.form-input::-ms-expand {
  display: none;
}

/* =========================
   Bulk actions (selection mode)
   ========================= */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bulk-actions-bar .btn-primary,
.bulk-actions-bar .btn-secondary {
  width: auto;
  padding: 10px 12px;
  white-space: nowrap;
}

.bulk-actions-bar .form-input {
  width: auto;
}

.bulk-actions-bar select.form-input[data-variant="compact"] {
  min-width: 220px;
  max-width: 280px;
  padding-top: 9px;
  padding-bottom: 9px;
}

/* Стили для уведомлений */
.notifications-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none;
}

.notification {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 15px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  pointer-events: all;
  border-left: 4px solid var(--k-sky-500, #0ea5e9);
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.notification-avatar-container {
  flex-shrink: 0;
}

.notification-avatar,
.notification-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.notification-avatar-placeholder {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.notification-body {
  flex: 1;
  min-width: 0;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.notification-author {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.notification-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  line-height: 1;
  transition: color 0.2s;
}

.notification-close:hover {
  color: #333;
}

.notification-text {
  color: #333;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 6px;
  word-wrap: break-word;
}

.notification-time {
  color: #999;
  font-size: 11px;
  margin-bottom: 10px;
}

.notification-actions {
  display: flex;
  gap: 8px;
}

.btn-quick-reply,
.btn-view-chat {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-quick-reply {
  background: var(--k-sky-500, #0ea5e9);
  color: white;
}

.btn-quick-reply:hover {
  background: var(--k-sky-600, #0284c7);
  transform: translateY(-1px);
}

.btn-view-chat {
  background: #f0f0f0;
  color: #333;
}

.btn-view-chat:hover {
  background: #e0e0e0;
}

/* Стили для модального окна ответа с историей сообщений */
.reply-modal-content {
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.reply-messages-history {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
  background: #f8f9fa;
  margin-top: 8px;
}

.reply-message-item {
  background: white;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  border-left: 3px solid var(--k-sky-500, #0ea5e9);
  transition: box-shadow 0.2s;
}

.reply-message-content-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.reply-message-avatar-container {
  flex-shrink: 0;
}

.reply-message-avatar,
.reply-message-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.reply-message-avatar-placeholder {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.reply-message-content {
  flex: 1;
  min-width: 0;
}

.reply-message-item:last-child {
  margin-bottom: 0;
}

.reply-message-item:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reply-message-item.user-message {
  border-left-color: var(--k-sky-500, #0ea5e9);
  background: #f0f4ff;
}

.reply-message-item.bot-message {
  border-left-color: #4caf50;
  background: #f0f9f0;
}

.reply-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.reply-message-sender {
  font-weight: 600;
  font-size: 12px;
  color: #2c3e50;
}

.reply-message-item.user-message .reply-message-sender {
  color: var(--k-sky-500, #0ea5e9);
}

.reply-message-item.bot-message .reply-message-sender {
  color: #4caf50;
}

.reply-message-time {
  color: #999;
  font-size: 11px;
  font-style: italic;
}

.reply-message-text {
  color: #333;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14px;
}

/* =========================
   Супер админ: улучшенная верстка
   ========================= */
.super-admin-page {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  min-height: 100vh;
}

.super-admin-page .container {
  max-width: 1400px;
  margin: 0 auto;
}

.super-admin-page header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 20px 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.super-admin-page header h1 {
  color: #2c3e50;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.super-admin-page header h1::before {
  content: "👑";
  font-size: 32px;
}

.super-admin-page .main-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.super-admin-page .main-nav .nav-link {
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.super-admin-page .main-nav .nav-link.active {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
}

.super-admin-page .dashboard-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.super-admin-page .dashboard-section h2 {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  border-bottom: 3px solid var(--k-sky-500, #0ea5e9);
  padding-bottom: 15px;
}

.super-admin-page .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.super-admin-page .dashboard-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border: 1px solid color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

.super-admin-page .dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

.super-admin-page .dashboard-card .dash-title {
  color: #666;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.super-admin-page .dashboard-card .dash-value {
  color: #2c3e50;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
}

.super-admin-page .users-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.super-admin-page .section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.super-admin-page .section-header h2 {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  border: none;
  padding: 0;
}

.super-admin-page .section-header .subtext {
  color: #666;
  font-size: 14px;
  margin: 0;
}

.super-admin-page .filters-inline {
  display: flex;
  gap: 15px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.super-admin-page .filters-inline label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: #555;
  font-weight: 500;
}

.super-admin-page .filters-inline select,
.super-admin-page .filters-inline input {
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  min-width: 200px;
}

.super-admin-page .filters-inline select:focus,
.super-admin-page .filters-inline input:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
}

.super-admin-page .table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.super-admin-page .data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.super-admin-page .data-table thead {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
}

.super-admin-page .data-table th {
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.super-admin-page .data-table td {
  padding: 15px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #333;
}

.super-admin-page .data-table tbody tr {
  transition: background-color 0.2s ease;
}

.super-admin-page .data-table tbody tr:hover {
  background-color: #f8f9ff;
}

.super-admin-page .users-subscription-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.super-admin-page .users-subscription-cell .form-input {
  height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  background: #fff;
}

.super-admin-page .users-subscription-cell .btn-secondary.icon-only,
.super-admin-page .users-subscription-cell .btn-edit.icon-only {
  border-radius: 12px;
}

.super-admin-page .btn-edit.icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.super-admin-page .btn-edit.icon-only span[data-lucide] {
  width: 18px;
  height: 18px;
}

.super-admin-page .data-table tbody tr:last-child td {
  border-bottom: none;
}

.super-admin-page .data-table .loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-style: italic;
}

.super-admin-page .btn-edit {
  padding: 8px 16px;
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.super-admin-page .btn-edit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

/* Компактные действия для таблицы компаний */
.super-admin-page .company-actions-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.super-admin-page .company-actions-extend {
  display: flex;
  gap: 4px;
  align-items: center;
}

.super-admin-page .company-actions-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.super-admin-page .extend-months-select {
  padding: 6px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
  min-width: 85px;
  color: #333;
}

.super-admin-page .extend-months-select:hover {
  border-color: var(--k-sky-500);
}

.super-admin-page .extend-months-select:focus {
  outline: none;
  border-color: var(--k-sky-500);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--k-sky-500) 15%, transparent);
}

.super-admin-page .btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.super-admin-page .btn-icon span[data-lucide] {
  width: 16px;
  height: 16px;
}

.super-admin-page .btn-icon.btn-extend {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
}

.super-admin-page .btn-icon.btn-extend:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--k-sky-500) 35%, transparent);
}

.super-admin-page .btn-icon.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
}

.super-admin-page .btn-icon.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.35);
}

.super-admin-page .btn-icon.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.super-admin-page .btn-icon.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.35);
}

.super-admin-page .btn-icon.btn-edit-icon {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.super-admin-page .btn-icon.btn-edit-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(139, 92, 246, 0.35);
}

.super-admin-page .btn-icon.btn-primary-icon {
  background: linear-gradient(135deg, var(--k-sky-500) 0%, var(--k-sky-600) 100%);
  color: white;
}

.super-admin-page .btn-icon.btn-primary-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--k-sky-500) 35%, transparent);
}

.super-admin-page .btn-icon:disabled,
.super-admin-page .btn-icon[disabled] {
  background: #cbd5e1 !important;
  color: #64748b !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  opacity: 1;
}

.super-admin-page .btn-icon:disabled:hover,
.super-admin-page .btn-icon[disabled]:hover {
  transform: none;
  box-shadow: none;
}

/* Мобильная адаптация для действий компании */
@media (max-width: 1200px) {
  .super-admin-page .company-actions-cell {
    min-width: 140px;
  }

  .super-admin-page .extend-months-select {
    min-width: 70px;
    font-size: 11px;
  }

  .super-admin-page .btn-icon {
    width: 28px;
    height: 28px;
  }

  .super-admin-page .btn-icon span[data-lucide] {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 768px) {
  .super-admin-page .company-actions-cell {
    min-width: auto;
    gap: 6px;
  }

  .super-admin-page .company-actions-extend {
    flex-wrap: wrap;
  }

  .super-admin-page .company-actions-btns {
    gap: 3px;
  }
}

.super-admin-page .btn-secondary {
  padding: 10px 20px;
  background: #f0f0f0;
  color: #333;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.super-admin-page .btn-secondary:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

.super-admin-page .pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.super-admin-page .pagination-btn {
  padding: 8px 12px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  min-width: 40px;
}

.super-admin-page .pagination-btn:hover:not(:disabled) {
  background: #f8f9ff;
  border-color: var(--k-sky-500, #0ea5e9);
  color: var(--k-sky-500, #0ea5e9);
}

.super-admin-page .pagination-btn.active {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  border-color: transparent;
}

.super-admin-page .pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.super-admin-page .result-message.error {
  background: #fee;
  color: #c33;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #fcc;
  margin-bottom: 20px;
}

.super-admin-page h3 {
  color: #2c3e50;
  font-size: 20px;
  font-weight: 600;
  margin: 30px 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

.super-admin-page .filter-icon {
  cursor: pointer;
  font-size: 12px;
  margin-left: 6px;
  opacity: 0.6;
  transition: all 0.3s ease;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 4px;
}

.super-admin-page .filter-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.2);
}

.super-admin-page .filter-icon.filter-active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.3);
  color: #ffd700;
}

.super-admin-page .data-table th {
  position: relative;
  user-select: none;
}

.super-admin-page .filter-modal-content {
  max-width: 500px;
  width: 90%;
}

.super-admin-page .filter-modal-content .form-control {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  font-family: inherit;
}

.super-admin-page .filter-modal-content .form-control:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
}

.super-admin-page .filter-modal-content .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.super-admin-page .filter-modal-content .form-actions .btn-primary {
  padding: 10px 20px;
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.super-admin-page .filter-modal-content .form-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

@media (max-width: 768px) {
  .super-admin-page .section-header {
    flex-direction: column;
  }

  .super-admin-page .filters-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .super-admin-page .filters-inline select,
  .super-admin-page .filters-inline input {
    min-width: 100%;
  }

  .super-admin-page .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .super-admin-page .table-wrapper {
    overflow-x: scroll;
  }

  .super-admin-page .filter-modal-content {
    width: 95%;
    max-width: none;
  }
}

/* =========================
   CRM Красотуля: Боковое меню и современный дизайн
   ========================= */

/* Применяем CRM-стиль только там, где мы явно включили его классом crm-page */
body.crm-page {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  min-height: 100vh;
  padding: 0;
  margin: 0;
  color: #1f2937;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  body.crm-page {
    overflow-x: clip;
  }
}

body.crm-page .container {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

/* Боковое меню */
.sidebar {
  width: 252px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 10px;
  top: 10px;
  height: calc(100vh - 20px);
  z-index: 1000;
  transition:
    transform 0.3s ease,
    width 340ms cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 18px;
  overflow: hidden;
}

.sidebar-header {
  position: relative;
}

.sidebar-collapse {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--k-sky-400) 28%, transparent);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  color: color-mix(in srgb, var(--k-sky-600) 95%, transparent);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--k-sky-600) 55%, transparent);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
  z-index: 10;
}

.sidebar-collapse svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-collapse:hover {
  background: rgba(240, 249, 255, 0.92);
  border-color: color-mix(in srgb, var(--k-sky-400) 55%, transparent);
  transform: translateY(-50%) translateY(-1px);
  box-shadow: 0 14px 28px -16px color-mix(in srgb, var(--k-sky-600) 70%, transparent);
  opacity: 1;
}

.sidebar-collapse:active {
  transform: translateY(-50%) scale(0.96);
  box-shadow: 0 8px 18px -14px color-mix(in srgb, var(--k-sky-600) 55%, transparent);
}

.sidebar-collapse:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--k-sky-400) 45%, transparent);
  outline-offset: 2px;
}

.sidebar-header {
  padding: 25px 20px;
  border-bottom: 2px solid color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
}

.sidebar-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* removed: emoji logo marker (replaced by Lucide logo-mark in `sidebar.js` + `crm_design_krasotula.css`) */

.sidebar-header h1 .logo-text {
  display: inline-block;
  min-width: 0;
  max-width: 176px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 180ms ease,
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    max-width 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform, max-width;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  scrollbar-gutter: stable;
  margin: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 25px;
  color: #2c3e50;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    border-left-color 180ms ease,
    transform 180ms ease,
    opacity 180ms ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-nav-item .nav-icon {
  width: 24px;
  min-width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.sidebar-nav-item .nav-text {
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 176px;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 180ms ease,
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    max-width 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform, max-width;
}

.sidebar-nav-item:hover {
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  color: var(--k-sky-500, #0ea5e9);
  border-left-color: var(--k-sky-500, #0ea5e9);
}

.sidebar-nav-item:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  outline-offset: -3px;
  background: color-mix(in srgb, var(--k-sky-500) 12%, transparent);
}

.sidebar-nav-item.active {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--k-sky-500) 15%, transparent) 0%,
    rgba(34, 211, 238, 0.1) 100%
  );
  color: var(--k-sky-500, #0ea5e9);
  border-left-color: var(--k-sky-500, #0ea5e9);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
}

.sidebar-nav-item .orders-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  margin-right: 8px;
  line-height: 1;
}

/* Компактные кнопки с иконками для интернет-магазина */
.btn-icon-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #2c3e50;
  font-size: 0;
  line-height: 0;
}

.btn-icon-compact:hover {
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  border-color: var(--k-sky-500, #0ea5e9);
  color: var(--k-sky-500, #0ea5e9);
}

.btn-icon-compact:active {
  transform: scale(0.95);
  background: color-mix(in srgb, var(--k-sky-500) 15%, transparent);
}

.btn-icon-compact.btn-icon-primary {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  border-color: var(--k-sky-500, #0ea5e9);
  color: white;
}

.btn-icon-compact.btn-icon-primary:hover {
  background: linear-gradient(
    135deg,
    var(--k-sky-600, #0284c7) 0%,
    var(--k-sky-500, #0ea5e9) 100%
  );
  border-color: var(--k-sky-600, #0284c7);
  color: white;
}

.btn-icon-compact.btn-icon-primary:active {
  background: linear-gradient(
    135deg,
    var(--k-sky-600, #0284c7) 0%,
    var(--k-sky-500, #0ea5e9) 100%
  );
}

.btn-icon-compact span[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Подменю для раздела Бот */
.sidebar-nav-group {
  position: relative;
}

.sidebar-nav-group-toggle {
  cursor: pointer;
  user-select: none;
}

.sidebar-nav-group-toggle .nav-icon-chevron {
  margin-left: auto;
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-nav-group.expanded .sidebar-nav-group-toggle .nav-icon-chevron {
  transform: rotate(90deg);
}

.sidebar-nav-submenu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  padding: 0;
  transition:
    max-height 340ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease,
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: max-height, opacity, transform, padding;
  background: color-mix(in srgb, var(--k-sky-500) 3%, transparent);
  margin: 0 10px;
  border-radius: 8px;
}

.sidebar-nav-group.expanded .sidebar-nav-submenu {
  max-height: 1400px;
  padding: 4px 0;
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-nav-group-toggle .nav-icon-chevron,
  .sidebar-nav-submenu {
    transition: none !important;
  }

  .sidebar,
  .main-content,
  .sidebar-header h1 .logo-text,
  .sidebar-nav-item .nav-text,
  .sidebar-footer .btn-logout .btn-logout-text,
  .sidebar-overlay {
    transition: none !important;
  }
}

.sidebar-nav-submenu .sidebar-nav-item {
  padding-left: 50px;
  font-size: 14px;
  border-left: none;
}

.sidebar-nav-submenu .sidebar-nav-item.active {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--k-sky-500) 12%, transparent) 0%,
    rgba(34, 211, 238, 0.08) 100%
  );
}

/* Tasks submenu section label (e.g. "Доски") */
.sidebar-nav-submenu .tasks-submenu-label {
  padding: 6px 12px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
[data-theme="dark"] .sidebar-nav-submenu .tasks-submenu-label {
  color: rgba(226, 232, 240, 0.7);
}

/* Plans: progress bar */
.plan-progress {
  margin-top: 10px;
  max-width: 520px;
}
.plan-progress-text {
  font-size: 12px;
  color: #64748b;
}
[data-theme="dark"] .plan-progress-text {
  color: rgba(226, 232, 240, 0.7);
}
.plan-progress-bar {
  margin-top: 6px;
  height: 8px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.25);
}
[data-theme="dark"] .plan-progress-bar {
  background: rgba(148, 163, 184, 0.18);
}
.plan-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--k-sky-600, #0284c7) 0%, var(--k-cyan-500, #06b6d4) 100%);
  transition: width 220ms ease;
}

/* Бот: сделать подпункты визуально "подразделами" (компактнее + линия вложенности) */
.sidebar-bot-group .sidebar-nav-submenu {
  background: transparent;
  margin: 0 10px 0 16px;
  border-radius: 0;
  padding-left: 10px;
  border-left: 2px solid rgba(226, 232, 240, 0.9);
}

.sidebar-bot-group.expanded .sidebar-nav-submenu {
  padding-top: 6px;
  padding-bottom: 6px;
}

.sidebar-bot-group .sidebar-nav-submenu .sidebar-nav-item {
  padding: 10px 14px;
  padding-left: 14px; /* не делаем огромный отступ, у нас есть линия вложенности */
  font-size: 13px;
  border-left: none;
  border-radius: 10px;
  margin: 2px 6px 2px 0; /* вертикальный зазор между подпунктами */
}

.sidebar-bot-group .sidebar-nav-submenu .sidebar-nav-item .nav-icon {
  width: 16px;
  min-width: 16px;
  font-size: 14px;
  color: #64748b;
}

.sidebar-bot-group .sidebar-nav-submenu .sidebar-nav-item .nav-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Свернутый режим - скрываем подменю */
body.crm-page.sidebar-collapsed .sidebar-nav-submenu {
  display: none;
}

body.crm-page.sidebar-collapsed .sidebar-nav-group-toggle .nav-icon-chevron {
  display: none;
}

.tab-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}

.sidebar-footer {
  padding: 20px;
  border-top: 2px solid color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

.sidebar-footer .btn-logout {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  color: rgba(185, 28, 28, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 26px -18px rgba(239, 68, 68, 0.75);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.sidebar-footer .btn-logout:hover {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  border-color: rgba(239, 68, 68, 0.65);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 18px 32px -20px rgba(239, 68, 68, 0.85);
}

.sidebar-footer .btn-logout:active {
  transform: translateY(0) scale(0.98);
}

.sidebar-footer .btn-logout .btn-logout-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer .btn-logout .btn-logout-text {
  display: inline-block;
  min-width: 0;
  max-width: 144px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 180ms ease,
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    max-width 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform, max-width;
}

.sidebar-footer .btn-logout .btn-logout-icon svg.lucide {
  width: 18px;
  height: 18px;
  display: block;
}

/* Основной контент */
.main-content {
  flex: 1;
  margin-left: 273px; /* 252 sidebar + 21 (отступы слева/справа ~5% к прежним 10px) */
  /* Важно: шапка должна быть "у самого верха", поэтому убираем верхний padding */
  padding: 10px 30px 30px;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: none;
  width: calc(100% - 273px);
  /* isolation предотвращает «залипание» backdrop-filter при сворачивании сайдбара */
  isolation: isolate;
  transition:
    margin-left 340ms cubic-bezier(0.22, 1, 0.36, 1),
    width 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.main-content-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 10px; /* отступ сверху 10px */
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

.main-content-header h1 {
  color: #2c3e50;
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

/* (topbar-collapse removed) */

/* Свёрнутый сайдбар (desktop) */
body.crm-page.sidebar-collapsed .sidebar {
  width: 81px;
}

/* Collapsed + hover-expanded (Bitrix-like): expand over content, keep layout */
body.crm-page.sidebar-collapsed.sidebar-hover-expanded .sidebar {
  width: 252px;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded .sidebar {
  z-index: 10060;
  box-shadow:
    0 22px 60px color-mix(in srgb, var(--k-sky-600) 22%, transparent),
    0 12px 28px rgba(0, 0, 0, 0.12);
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded .sidebar-nav-item {
  justify-content: flex-start;
  padding-left: 25px;
  padding-right: 25px;
  gap: 12px;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded
  .sidebar-nav-item
  .nav-text {
  max-width: 185px;
  opacity: 1;
  transform: none;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded
  .sidebar-nav-item
  .orders-badge {
  position: static;
  right: auto;
  top: auto;
  margin-left: auto;
  margin-right: 8px;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded
  .sidebar-header
  h1
  .logo-text {
  max-width: 185px;
  opacity: 1;
  transform: none;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded
  .sidebar-footer
  .btn-logout
  .btn-logout-text {
  max-width: 144px;
  opacity: 1;
  transform: none;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded .sidebar-nav-submenu {
  display: block;
}

body.crm-page.sidebar-collapsed.sidebar-hover-expanded
  .sidebar-nav-group-toggle
  .nav-icon-chevron {
  display: inline-flex;
}

body.crm-page.sidebar-collapsed .sidebar-nav-item {
  justify-content: center;
  align-items: center;
  padding-left: 10px;
  padding-right: 10px;
  gap: 0;
}

body.crm-page.sidebar-collapsed .sidebar-nav-item .nav-icon {
  flex-shrink: 0;
  margin: 0;
}

body.crm-page.sidebar-collapsed .sidebar-nav-item .nav-text {
  display: block;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
}

/* Фиксируем бейдж, чтобы он не смещал иконку в свернутом меню */
body.crm-page.sidebar-collapsed .sidebar-nav-item .orders-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  transform: none;
  margin: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
}

/* Tooltip в свернутом режиме */
body.crm-page.sidebar-collapsed .sidebar-nav-item {
  position: relative;
}

body.crm-page.sidebar-collapsed .sidebar-nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-2px) scale(0.98);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 8px 10px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  max-width: min(273px, calc(100vw - 140px));
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.26s cubic-bezier(0.2, 0.9, 0.2, 1),
    transform 0.26s cubic-bezier(0.2, 0.9, 0.2, 1);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  z-index: 9999;
}

body.crm-page.sidebar-collapsed .sidebar-nav-item::before {
  content: "";
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid rgba(15, 23, 42, 0.9);
  opacity: 0;
  transition: opacity 0.26s cubic-bezier(0.2, 0.9, 0.2, 1);
  pointer-events: none;
  z-index: 9999;
}

body.crm-page.sidebar-collapsed .sidebar-nav-item:hover::after,
body.crm-page.sidebar-collapsed .sidebar-nav-item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px) scale(1);
}

body.crm-page.sidebar-collapsed .sidebar-nav-item:hover::before,
body.crm-page.sidebar-collapsed .sidebar-nav-item:focus-visible::before {
  opacity: 1;
}

/* `sidebar.js` already sets `title` for collapsed items.
   Pseudo-tooltips can cause horizontal overflow/scrollbars in some browsers. */
body.crm-page.sidebar-collapsed .sidebar-nav-item::before,
body.crm-page.sidebar-collapsed .sidebar-nav-item::after {
  content: none !important;
}

body.crm-page.sidebar-collapsed .sidebar-header {
  min-height: 56px;
  padding-top: 11px;
  padding-bottom: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.crm-page.sidebar-collapsed .sidebar-header h1 .logo-text {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
}

body.crm-page.sidebar-collapsed .sidebar-footer {
  padding-left: 12px;
  padding-right: 12px;
}

body.crm-page.sidebar-collapsed .sidebar-footer .btn-logout {
  padding: 10px;
}

body.crm-page.sidebar-collapsed .sidebar-footer .btn-logout::before {
  content: none;
}

body.crm-page.sidebar-collapsed .sidebar-footer .btn-logout .btn-logout-text {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(-6px);
  transition:
    opacity 180ms ease,
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    max-width 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform, max-width;
}

body.crm-page.sidebar-collapsed .main-content {
  margin-left: 102px; /* 81 + 21 */
  width: calc(100% - 102px);
}

/* Collapsed sidebar: hide company dropdown if present */
body.crm-page.sidebar-collapsed .sidebar-footer .company-switcher-select {
  display: none !important;
}

/* =========================
   Warehouse: Unlinked barcodes sidebar table
   ========================= */
#barcodeUnlinkedSidebar .remain-edit-sidebar-content {
  min-height: 0;
}

#barcodeUnlinkedSidebar.remain-edit-sidebar {
  width: 680px;
  right: -680px; /* match width (off-canvas position) */
  max-width: calc(100vw - 16px);
}

#barcodeUnlinkedSidebar.remain-edit-sidebar.open {
  right: 0;
}

@media (max-width: 768px) {
  #barcodeUnlinkedSidebar.remain-edit-sidebar {
    width: 100%;
    right: -100%;
    max-width: 100%;
  }
  #barcodeUnlinkedSidebar.remain-edit-sidebar.open {
    right: 0;
  }
}

#barcodeUnlinkedList {
  min-height: 0;
  overflow: auto !important; /* override inline overflow:hidden */
  background: rgba(249, 250, 251, 0.9);
}

.barcode-unlinked-state {
  padding: 14px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 10px;
}
.barcode-unlinked-empty {
  color: #065f46;
  background: rgba(16, 185, 129, 0.08);
}
.barcode-unlinked-error {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
}

.barcode-unlinked-table-wrap {
  height: 100%;
  overflow: auto;
}

.barcode-unlinked-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
  background: transparent;
}

.barcode-unlinked-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

.barcode-unlinked-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: middle;
  color: #0f172a;
}

.barcode-unlinked-td-code {
  width: auto;
}
.barcode-unlinked-code {
  display: block;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--k-sky-600) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 16%, transparent);
  color: rgba(15, 23, 42, 0.95);
  white-space: normal;
  word-break: break-all;
  line-height: 1.2;
}

.barcode-unlinked-td-seen {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(15, 23, 42, 0.8);
  width: 84px;
}
.barcode-unlinked-td-last {
  width: 140px;
  color: rgba(15, 23, 42, 0.72);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.barcode-unlinked-td-action {
  width: 168px;
  text-align: right;
}

/* Linked barcodes: icon actions, smaller actions column */
.barcode-linked-td-action {
  width: 92px;
}
.barcode-linked-edit-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.barcode-unlinked-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.barcode-unlinked-link-btn {
  flex: 1 1 auto;
  padding: 8px 10px !important;
  border-radius: 12px !important;
  font-size: 12.5px !important;
  white-space: nowrap;
}
.barcode-unlinked-delete-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(239, 68, 68, 0.28) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  color: rgba(185, 28, 28, 0.95) !important;
}
.barcode-unlinked-delete-btn:hover {
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.42) !important;
}
[data-theme="dark"] .barcode-unlinked-delete-btn {
  border-color: rgba(239, 68, 68, 0.22) !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: rgba(252, 165, 165, 0.95) !important;
}
[data-theme="dark"] .barcode-unlinked-delete-btn:hover {
  background: rgba(239, 68, 68, 0.16) !important;
}

[data-theme="dark"] #barcodeUnlinkedList {
  background: rgba(15, 23, 42, 0.55);
  border-color: color-mix(in srgb, var(--k-sky-400) 16%, transparent);
}
[data-theme="dark"] .barcode-unlinked-table thead th {
  background: rgba(15, 23, 42, 0.75);
  border-bottom-color: rgba(148, 163, 184, 0.18);
  color: rgba(226, 232, 240, 0.95);
}
[data-theme="dark"] .barcode-unlinked-table tbody td {
  border-bottom-color: rgba(148, 163, 184, 0.14);
  color: rgba(226, 232, 240, 0.92);
}
[data-theme="dark"] .barcode-unlinked-code {
  background: color-mix(in srgb, var(--k-sky-400) 10%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-400) 22%, transparent);
  color: rgba(226, 232, 240, 0.95);
}
[data-theme="dark"] .barcode-unlinked-td-seen,
[data-theme="dark"] .barcode-unlinked-td-last {
  color: rgba(226, 232, 240, 0.72);
}

@media (max-width: 520px) {
  /* In narrow screens keep table usable with horizontal scroll in the list */
  .barcode-unlinked-table {
    min-width: 520px;
  }
}

/* =========================
   Warehouse: Live barcode feed modal (SSE)
   ========================= */
.barcode-live-modal {
  position: fixed;
  inset: 0;
  z-index: 10080; /* above barcodeLinkModal (10060) */
  padding: 16px;
  box-sizing: border-box;
  display: none;
}

.barcode-live-card {
  max-width: 720px;
  width: 100%;
  height: min(70vh, 720px);
  margin: 6vh auto 0 auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.barcode-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(249, 250, 251, 0.92);
  backdrop-filter: blur(8px);
}

.barcode-live-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.barcode-live-list {
  display: flex;
  flex-direction: column;
}

.barcode-live-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  align-items: flex-start;
}

.barcode-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--k-sky-500) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}
.barcode-live-dot.ok {
  background: rgba(34, 197, 94, 0.75);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}
.barcode-live-dot.bad {
  background: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

.barcode-live-main {
  flex: 1;
  min-width: 0;
}

.barcode-live-title {
  font-weight: 900;
  color: #0f172a;
  line-height: 1.15;
}

.barcode-live-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.barcode-live-code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--k-sky-600) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 16%, transparent);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.barcode-live-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.barcode-live-open-btn {
  padding: 8px 10px !important;
  border-radius: 12px !important;
  font-size: 12.5px !important;
  white-space: nowrap;
}

[data-theme="dark"] .barcode-live-card {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.18);
}
[data-theme="dark"] .barcode-live-head {
  background: rgba(15, 23, 42, 0.65);
  border-bottom-color: rgba(148, 163, 184, 0.18);
}
[data-theme="dark"] .barcode-live-item {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}
[data-theme="dark"] .barcode-live-title {
  color: rgba(226, 232, 240, 0.95);
}
[data-theme="dark"] .barcode-live-meta {
  color: rgba(226, 232, 240, 0.7);
}
[data-theme="dark"] .barcode-live-code {
  background: color-mix(in srgb, var(--k-sky-400) 10%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-400) 22%, transparent);
  color: rgba(226, 232, 240, 0.95);
}

/* Секции с новым стилем */
body.crm-page section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.crm-page section h2 {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 3px solid var(--k-sky-500, #0ea5e9);
}

/* Карточки дашборда */
body.crm-page .dashboard-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border: 1px solid color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

body.crm-page .dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

/* Кнопки */
body.crm-page .btn-primary {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.crm-page .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

body.crm-page .btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #e0e0e0;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.crm-page .btn-secondary:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

body.crm-page input:focus,
body.crm-page textarea:focus,
body.crm-page select:focus {
  outline: none;
  border-color: var(--k-sky-500, #0ea5e9);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--k-sky-500) 18%, transparent);
}

/* Настройки: нормальная CRM-стилизация инпутов/селектов внутри страницы */
body.crm-page #companyInfo {
  font-size: 14px;
  color: #334155;
}

body.crm-page .filters-bar input,
body.crm-page .filters-bar select,
body.crm-page section input,
body.crm-page section select,
body.crm-page section textarea {
  font-family: inherit;
}

body.crm-page section input:not([type="checkbox"]):not([type="radio"]),
body.crm-page section select,
body.crm-page section textarea {
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

body.crm-page section input[readonly] {
  background: rgba(248, 250, 252, 0.9);
  color: #475569;
}

body.crm-page section input:not([type="checkbox"]):not([type="radio"]):focus,
body.crm-page section select:focus,
body.crm-page section textarea:focus {
  border-color: var(--k-sky-500, #0ea5e9);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--k-sky-500) 18%, transparent);
  background: #fff;
}

body.crm-page section label {
  color: #475569;
  font-weight: 600;
  font-size: 13px;
}

body.crm-page a:focus-visible,
body.crm-page button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  outline-offset: 2px;
}

/* Вкладки настроек */
.settings-tabs {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  /* ВАЖНО: не обрезаем выпадающие списки (например, "Видимость настроек") */
  overflow: visible;
}

.settings-tabs-nav {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: wrap;
}

.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.settings-tab-btn span[data-lucide] {
  width: 16px;
  height: 16px;
}

.settings-tab-btn:hover {
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  color: var(--k-sky-600, #0284c7);
}

.settings-tab-btn.active {
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: white;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

.settings-tab-btn.active:hover {
  background: linear-gradient(
    135deg,
    var(--k-sky-600, #0284c7) 0%,
    var(--k-cyan-500, #06b6d4) 100%
  );
  color: white;
}

.settings-tab-content {
  display: none;
  padding: 24px;
}

.settings-tab-content.active {
  display: block;
}

/* Компактные кнопки для страницы настроек */
body.crm-page section .btn-primary,
body.crm-page section .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: auto;
}

body.crm-page section .btn-primary {
  padding: 10px 20px;
}

body.crm-page section .btn-secondary {
  padding: 10px 20px;
}

/* Иконки-кнопки (в т.ч. для вкладки "Пользователи") */
.settings-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(255, 255, 255, 0.95);
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
}

.settings-icon-btn span[data-lucide] {
  width: 18px;
  height: 18px;
}

.settings-icon-btn:hover {
  background: color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-500) 45%, transparent);
  color: var(--k-sky-700, #0369a1);
}

.settings-icon-btn:active {
  transform: translateY(0.5px);
}

.settings-icon-btn:disabled,
.settings-icon-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-icon-btn--primary {
  border-color: transparent;
  background: linear-gradient(
    135deg,
    var(--k-sky-500, #0ea5e9) 0%,
    var(--k-cyan-400, #22d3ee) 100%
  );
  color: #fff;
}

.settings-icon-btn--primary:hover {
  background: linear-gradient(
    135deg,
    var(--k-sky-600, #0284c7) 0%,
    var(--k-cyan-500, #06b6d4) 100%
  );
  color: #fff;
}

.settings-icon-btn--danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.settings-icon-btn--danger:hover {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.16);
  color: #991b1b;
}

.settings-icon-btn--lg {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.settings-icon-btn--lg span[data-lucide] {
  width: 20px;
  height: 20px;
}

/* Список пользователей в настройках */
.settings-users-list {
  display: grid;
  gap: 12px;
}

.settings-user-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  overflow: visible;
}

.settings-user-main {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-user-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.settings-user-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.settings-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.settings-role-badge--manager {
  background: var(--k-sky-500, #0ea5e9);
}

.settings-role-badge--admin {
  background: #f59e0b;
}

.settings-role-badge--super-admin {
  background: #a855f7;
}

.settings-user-meta {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 13px;
}

.settings-user-meta-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.settings-user-meta-row--muted {
  color: #94a3b8;
}

.settings-user-meta-label {
  font-weight: 700;
  color: #64748b;
}

.settings-user-meta-value {
  font-weight: 500;
}

.settings-user-actions {
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: min(100%, 320px);
  max-width: 100%;
}

.settings-user-role {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 auto;
}

/* Глобально select.form-input { width:100% } — здесь даём комфортную ширину под длинные подписи ролей */
.settings-user-role-select.form-input {
  width: auto;
  min-width: 200px;
  max-width: none;
  flex: 1 1 220px;
  height: 36px;
  box-sizing: border-box;
}

.settings-user-role-select {
  min-width: 200px;
  height: 36px;
}

/* Слот под «Сохранить» фиксированной ширины — рядом селект и «Удалить» не двигаются по вертикали */
.settings-user-role-save-slot {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Кнопка «Сохранить» скрыта, но слот остаётся — сдвига нет */
.settings-user-role-save-btn.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.settings-user-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-user-actions-row--main {
  flex-wrap: nowrap;
  justify-content: flex-end;
  width: 100%;
  min-height: 36px;
}

.settings-user-actions-row--main > .settings-icon-btn {
  flex-shrink: 0;
}

/* Не обрезаем нативный список select у края карточки/details */
#usersListSection,
#usersListSection details,
#usersListContainer {
  overflow: visible;
}

.settings-user-self {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .settings-user-card {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-user-actions {
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
  }

  .settings-user-role {
    justify-content: flex-start;
  }

  .settings-user-actions-row--main {
    justify-content: flex-start;
  }

  .settings-user-role-select.form-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
}

/* Dark theme */
[data-theme="dark"] .settings-user-card {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.22);
}

[data-theme="dark"] .settings-user-name {
  color: #e2e8f0;
}

[data-theme="dark"] .settings-user-meta {
  color: rgba(226, 232, 240, 0.9);
}

[data-theme="dark"] .settings-user-meta-label {
  color: rgba(148, 163, 184, 0.95);
}

[data-theme="dark"] .settings-user-meta-row--muted {
  color: rgba(148, 163, 184, 0.85);
}

[data-theme="dark"] .settings-user-self {
  background: rgba(148, 163, 184, 0.14);
  color: rgba(226, 232, 240, 0.85);
}

[data-theme="dark"] .settings-icon-btn {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.7);
  color: rgba(226, 232, 240, 0.95);
}

[data-theme="dark"] .settings-icon-btn:hover {
  background: color-mix(in srgb, var(--k-sky-500) 14%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-500) 35%, transparent);
  color: rgba(125, 211, 252, 0.95);
}

[data-theme="dark"] .settings-icon-btn--danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.14);
  color: rgba(254, 202, 202, 0.95);
}

[data-theme="dark"] .settings-icon-btn--danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: rgba(254, 202, 202, 1);
}

/* Кнопки Google Calendar остаются с flex */
body.crm-page #connectGoogleCalendar,
body.crm-page #disconnectGoogleCalendar {
  display: inline-flex;
  width: auto;
}

/* Мобильное меню */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 20px;
}

@media (max-width: 768px) {
  .sidebar {
    width: 252px;
    max-width: 100vw;
    left: 0;
    top: 0;
    height: 100dvh;
    border-radius: 0;
    transform: translateX(-100%);
    box-sizing: border-box;
  }

  .sidebar.open {
    transform: translateX(0);
    touch-action: pan-y; /* свайп влево обрабатывает sidebar.js */
  }

  .sidebar-toggle {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
    padding-top: 70px;
    width: 100%;
  }

  .main-content-header {
    padding: 20px;
    top: 10px;
  }

  body.crm-page section {
    padding: 20px;
    margin-bottom: 14px;
  }

  /* Меньше воздуха в фильтрах/формах (Настройки/Логи и т.п.) */
  .filters-bar {
    gap: 6px;
    margin: 8px 0 10px 0;
  }

  .filters-bar .filter-label {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .filters-bar .filter-item {
    flex: 1 1 auto;
  }

  /* На мобилке кнопка инвайта — отдельной строкой */
  .filters-bar .filter-item--actions {
    flex: 1 1 100%;
  }

  /* Кнопки в фильтрах тоже в одну колонку и без лишних отступов */
  body.crm-page .filters-bar button,
  body.crm-page .filters-bar .nav-link {
    width: 100%;
    margin-bottom: 0;
    border-radius: 12px;
  }

  /* Уменьшаем общий gap между элементами внутри main-content (шапка/секции) */
  body.crm-page main.main-content {
    gap: 10px;
  }

  /* CRM: на мобилке не используем collapsed-состояние */
  body.crm-page.sidebar-collapsed .sidebar {
    width: 218px;
  }

  body.crm-page.sidebar-collapsed .sidebar-nav-item {
    justify-content: flex-start;
    padding-left: 18px;
    padding-right: 18px;
  }

  body.crm-page.sidebar-collapsed .sidebar-nav-item .nav-text {
    display: inline;
    max-width: none;
    opacity: 1;
    transform: none;
  }

  body.crm-page.sidebar-collapsed .sidebar-header h1 .logo-text {
    display: inline;
    max-width: none;
    opacity: 1;
    transform: none;
  }

  body.crm-page.sidebar-collapsed .sidebar-footer .btn-logout {
    font-size: 14px;
    line-height: 1.2;
    padding: 12px;
  }

  body.crm-page.sidebar-collapsed .sidebar-footer .btn-logout::before {
    content: none;
  }

  body.crm-page.sidebar-collapsed .sidebar-footer .btn-logout .btn-logout-text {
    display: inline;
    max-width: none;
    opacity: 1;
    transform: none;
  }

  body.crm-page.sidebar-collapsed .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* CRM: сайдбар внутри на мобилке без внутренних "карточек" и отступов */
  .sidebar-header {
    padding: 18px 16px;
  }

  .sidebar-header h1 {
    font-size: 20px;
  }

  .sidebar-nav {
    margin: 0;
    border-radius: 0;
    background: transparent;
    padding: 12px 0;
  }

  .sidebar-nav-item {
    padding: 12px 18px;
    gap: 10px;
  }

  .sidebar-footer {
    padding: 14px 16px;
  }

  /* CRM: компактнее контент и шапка */
  body.crm-page .main-content {
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 22px;
  }

  body.crm-page .main-content-header {
    margin-bottom: 12px;
    border-radius: 14px;
  }

  /* Таблицы/переполнение */
  body.crm-page .table-wrapper,
  body.crm-page table {
    max-width: 100%;
  }
}

/* Чат: делаем "как мессенджер" — секция занимает весь экран и нормально скроллится */
body.crm-page.chat-page main.main-content {
  flex: 1 1 auto;
  min-height: 0;
}

body.crm-page.chat-page .messenger {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 14px;
}

body.crm-page.chat-page .messenger-layout {
  height: 100%;
  min-height: 0;
}

body.crm-page.chat-page .messenger-thread {
  min-height: 0;
}

body.crm-page.chat-page .thread-messages {
  min-height: 0;
  overflow-y: auto;
}

/* Чат внутри CRM: делаем левое меню чуть уже, чтобы освободить ширину под чат */
body.crm-page.chat-page .sidebar {
  width: 218px;
}

body.crm-page.chat-page .main-content {
  margin-left: 239px; /* 218 sidebar + 21 */
  width: calc(100% - 239px);
  /* Нижний padding — в crm_design_krasotula (убирает полосу фона под мессенджером) */
  padding: 10px 22px 0;
}

body.crm-page.chat-page.sidebar-collapsed .sidebar {
  width: 81px;
}

body.crm-page.chat-page.sidebar-collapsed .main-content {
  margin-left: 102px; /* 81 + 21 */
  width: calc(100% - 102px);
}

body.crm-page.chat-page.sidebar-collapsed.sidebar-hover-expanded .sidebar {
  width: 218px;
}

@media (max-width: 768px) {
  /* Чат в CRM на телефоне: как Telegram — список или переписка на весь экран, без полей CRM */
  body.crm-page.chat-page main.main-content {
    gap: 0;
  }

  body.crm-page.chat-page .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    /* Только вырез экрана; гамбургер — fixed поверх шапки чата */
    padding-top: env(safe-area-inset-top, 0px) !important;
    box-sizing: border-box;
  }

  /* Меню CRM: угол под вырез, поверх чата, не съедая вертикаль main */
  body.crm-page.chat-page .sidebar-toggle {
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    z-index: 10050 !important;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.14) !important;
  }

  body.crm-page.chat-page.messenger-thread-open .thread-header {
    padding-left: calc(
      8px + env(safe-area-inset-left, 0px) + 46px
    ) !important;
  }

  body.crm-page.chat-page .main-content-header {
    margin-bottom: 10px;
  }

  body.crm-page.chat-page section.messenger {
    padding: 0 !important;
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.crm-page.chat-page .messenger {
    border-radius: 0 !important;
  }

  body.crm-page.chat-page .messenger-layout {
    gap: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    border: none !important;
  }

  body.crm-page.chat-page .messenger-resizer {
    display: none !important;
  }

  /* Один экран как в Telegram: сначала список, по тапу — чат (crm_design задаёт display:flex !important и ломал display:none) */
  body.crm-page.chat-page:not(.messenger-thread-open) .messenger-thread {
    display: none !important;
  }
  body.crm-page.chat-page.messenger-thread-open .messenger-sidebar {
    display: none !important;
  }

  body.crm-page.chat-page .messenger-sidebar,
  body.crm-page.chat-page .messenger-thread {
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }

  body.crm-page.chat-page .messenger-sidebar {
    overflow: hidden !important;
  }

  body.crm-page.chat-page .thread-messages {
    height: auto !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  /* Composer: safe-area снизу + горизонтальные отступы только у поля ввода (кнопки не на всю ширину экрана) */
  body.crm-page.chat-page .thread-composer {
    padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.crm-page.chat-page.messenger-thread-open .thread-composer {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Мобильный композер: крупнее зона ввода и кнопка отправки (touch) */
  body.crm-page.chat-page .composer-text {
    min-height: 48px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    font-size: 16px !important;
  }

  body.crm-page.chat-page .composer-send {
    min-width: 48px !important;
    min-height: 48px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    border-radius: 16px !important;
  }

  body.crm-page.chat-page .composer-attach,
  body.crm-page.chat-page .composer-emoji-btn,
  body.crm-page.chat-page .composer-template-btn,
  body.crm-page.chat-page .composer-mention-btn,
  body.crm-page.chat-page .composer-rec {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  body.crm-page.chat-page .composer-input {
    padding: 3px 6px 3px 7px !important;
    border-radius: 16px !important;
  }

  body.crm-page.chat-page .composer-row {
    gap: 8px !important;
  }
}

/* Десктоп: две колонки — кнопка «Назад» не нужна (есть список слева) */
@media (min-width: 769px) {
  body.crm-page.chat-page .thread-back {
    display: none !important;
  }
}

/* Очень маленькие экраны */
@media (max-width: 420px) {
  body.crm-page .main-content {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 66px;
  }

  body.crm-page.chat-page .main-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
  }

  .sidebar-toggle {
    top: 14px;
    left: 14px;
    padding: 10px;
    border-radius: 10px;
  }

  body.crm-page.chat-page .sidebar-toggle {
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    padding: 0 !important;
    width: 42px !important;
    height: 42px !important;
  }
}

/* На мобилке кнопку сворачивания не показываем (там гамбургер + выезжающее меню) */
@media (max-width: 768px) {
  .sidebar-collapse {
    display: none;
  }
}

/* Оверлей при открытом сайдбаре на мобилке */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 999;
}

@media (max-width: 768px) {
  .sidebar-overlay {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
      visibility 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    touch-action: none; /* свайп обрабатывает JS (sidebar.js) */
  }
}

/* Чат внутри CRM: отключаем старые правила chat-page, которые предполагали layout без сайдбара */
body.crm-page.chat-page {
  padding: 0;
  overflow: hidden;
  height: 100dvh;
}

body.crm-page.chat-page .container {
  display: flex;
  height: 100%;
}

body.crm-page.chat-page .main-content {
  height: 100%;
  overflow: hidden;
}

body.crm-page.chat-page main.main-content > section.messenger {
  height: calc(100% - 0px);
}

/* Полная страница чата: без CRM-бокового меню, весь viewport отдан мессенджеру */
body.crm-page.chat-page:not(.chat-embed) .sidebar,
body.crm-page.chat-page:not(.chat-embed) #sidebar,
body.crm-page.chat-page:not(.chat-embed) .sidebar-toggle,
body.crm-page.chat-page:not(.chat-embed) #sidebarToggle {
  display: none !important;
}

body.crm-page.chat-page:not(.chat-embed) .container {
  width: 100% !important;
  max-width: none !important;
  height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.crm-page.chat-page:not(.chat-embed) .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  padding: 0 !important;
}

body.crm-page.chat-page:not(.chat-embed) section.messenger,
body.crm-page.chat-page:not(.chat-embed) .messenger,
body.crm-page.chat-page:not(.chat-embed) .messenger-layout {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
}

body.crm-page.chat-page:not(.chat-embed).messenger-thread-open .thread-header {
  padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
}

.tg-sidebar-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-page-back-btn {
  flex: 0 0 auto;
}

body.chat-embed .chat-page-back-btn {
  display: none !important;
}

/* =========================
   Стили для админки магазина (shop_admin)
   ========================= */

/* Вкладки навигации */
.view-navigation-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: rgba(248, 250, 252, 0.6);
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.view-nav-tab {
  padding: 10px 20px;
  background: #f3f4f6;
  color: #374151;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

.view-nav-tab:hover {
  background: #e5e7eb;
  color: #1f2937;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.view-nav-tab.active {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
  border-color: var(--k-sky-500);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

.view-nav-tab.active:hover {
  background: linear-gradient(135deg, var(--k-sky-600, #0284c7) 0%, var(--k-cyan-500, #06b6d4) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

.tab-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  background: #ef4444;
  color: white;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.view-nav-tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--k-sky-500, #0ea5e9);
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Обертка таблиц */
.table-wrapper {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-top: 16px;
  background: white;
  border: 1px solid #e5e7eb;
}

/* Интернет-магазин → Товары: вертикальный скролл у страницы, горизонтальный у таблицы */
#productsPanel .table-wrapper {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  -webkit-overflow-scrolling: touch;
}

/* Цены по группам клиентов: заголовки и ячейки по центру (warehouse + shop_admin) */
#productsPanel .data-table thead th.product-group-price-header,
#productsPanel .data-table td.editable-group-price,
#productsPanel .data-table td.editable-customer-group {
  text-align: center !important;
}

/* Интернет-магазин → Товар (модалка): таблица "Цены по группам клиентов" */
#productModal #productGroupPricesContainer {
  /* В HTML стоит overflow:hidden; — переопределяем, чтобы колонки не "разъезжались"
     и таблица могла быть компактной/скроллиться при необходимости. */
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

#productModal #productGroupPricesContainer .product-group-prices-table {
  font-size: 14px;
  width: auto !important; /* override global .data-table { width:100% } */
}

#productModal #productGroupPricesContainer .product-group-prices-table th,
#productModal #productGroupPricesContainer .product-group-prices-table td {
  padding: 10px 12px;
}

/* Не подсвечиваем первую колонку как в общих data-table */
#productModal
  #productGroupPricesContainer
  .product-group-prices-table
  tbody
  tr
  td:first-child {
  color: #111827;
  font-weight: 600;
}

[data-theme="dark"]
  #productModal
  #productGroupPricesContainer
  .product-group-prices-table
  tbody
  tr
  td:first-child {
  color: #e5e7eb;
}

#productModal
  #productGroupPricesContainer
  .product-group-prices-table
  th:nth-child(2),
#productModal
  #productGroupPricesContainer
  .product-group-prices-table
  td:nth-child(2),
#productModal #productGroupPricesContainer .product-group-price-cell {
  text-align: left;
  white-space: nowrap;
}

#productModal #productGroupPricesContainer .product-group-price-input {
  width: 100%;
  max-width: 140px;
  text-align: left;
  font-size: 14px;
  padding: 7px 10px;
  height: 34px;
}

/* Склад → Товар (сайдбар): таблица "Цены по группам клиентов" */
body.crm-page.warehouse-page #productModal #productGroupPricesContainer {
  overflow-x: auto !important; /* inline HTML has overflow:hidden */
  overflow-y: hidden !important;
}

body.crm-page.warehouse-page
  #productModal
  #productGroupPricesContainer
  .product-group-prices-table {
  font-size: 14px;
  width: 100% !important;
  table-layout: fixed;
}

body.crm-page.warehouse-page
  #productModal
  #productGroupPricesContainer
  .product-group-prices-table
  th,
body.crm-page.warehouse-page
  #productModal
  #productGroupPricesContainer
  .product-group-prices-table
  td,
body.crm-page.warehouse-page
  #productModal
  #productGroupPricesContainer
  .product-group-price-cell {
  text-align: left !important;
  padding: 10px 12px;
}

body.crm-page.warehouse-page
  #productModal
  #productGroupPricesContainer
  .product-group-price-input {
  width: 100%;
  max-width: 160px;
  text-align: left;
  font-size: 14px;
  padding: 7px 10px;
  height: 34px;
}

/* Индикатор загрузки товаров (infinite scroll) */
.products-load-more-indicator td {
  padding: 30px 20px !important;
  text-align: center;
  background: #f8f9fa;
  border-bottom: none;
}

.products-load-more-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.products-load-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--k-sky-500, #0ea5e9);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.products-load-text {
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Индикатор окончания списка товаров */
.products-end-indicator td {
  padding: 24px 20px !important;
  text-align: center;
  background: #f0fdf4;
  border-bottom: none;
}

.products-end-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.products-end-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.products-end-text {
  color: #059669;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Таблицы */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 14px;
}

.data-table thead {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 16px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.data-table tbody tr:hover {
  background-color: #f8faff;
  border-left-color: var(--k-sky-500, #0ea5e9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .loading {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  font-style: italic;
  font-size: 14px;
}

/* Интернет-магазин → Заказы: делаем таблицу компактнее */
#ordersPanel .data-table {
  font-size: 12px;
}

#ordersPanel .data-table th {
  padding: 12px 10px;
  font-size: 11px;
}

#ordersPanel .data-table td {
  padding: 10px;
}

#ordersPanel .data-table .form-input {
  font-size: 12px;
  padding: 6px 8px;
}

#ordersPanel .filters-bar {
  align-items: flex-end;
}

#ordersPanel .orders-actions-group {
  flex: 0 0 auto;
  margin-left: auto; /* прижимаем в самый правый край */
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#ordersPanel .orders-actions-group .btn-secondary {
  height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
}

#ordersPanel #bulkOrdersActionsBar {
  gap: 10px;
}

/* Аккуратнее селекты статусов в Заказах */
#ordersPanel select.form-input {
  min-width: 140px;
  height: 34px;
  border-radius: 10px;
}

#ordersPanel select.form-input[data-variant="compact"] {
  min-width: 200px;
}

#ordersPanel .data-table .status-badge {
  font-size: 10px;
  padding: 3px 10px;
}

/* Интернет-магазин → Промокоды: делаем таблицу компактнее (по аналогии с Заказами) */
#promocodesPanel .data-table {
  font-size: 12px;
}

#promocodesPanel .data-table th {
  padding: 12px 10px;
  font-size: 11px;
}

#promocodesPanel .data-table td {
  padding: 10px;
}

#promocodesPanel .data-table .form-input {
  font-size: 12px;
  padding: 6px 8px;
}

#promocodesPanel .data-table .status-badge {
  font-size: 10px;
  padding: 3px 10px;
}

/* Интернет-магазин → Промокоды: сабвкладки (Список / Аналитика) */
#promocodesPanel .promocodes-subtabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

#promocodesPanel .promocodes-subtab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  box-shadow: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

#promocodesPanel .promocodes-subtab-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

#promocodesPanel .promocodes-subtab-btn.active {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--k-sky-500) 25%, transparent);
}

/* Кнопки действий */
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary.btn-sm {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

.btn-secondary.btn-sm:hover {
  background: linear-gradient(135deg, var(--k-sky-600, #0284c7) 0%, var(--k-cyan-500, #06b6d4) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

.btn-secondary.btn-sm.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-secondary.btn-sm.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Кнопки без класса btn-sm тоже стилизуем */
.btn-secondary:not(.btn-sm) {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

.btn-secondary:not(.btn-sm):hover {
  background: linear-gradient(135deg, var(--k-sky-600, #0284c7) 0%, var(--k-cyan-500, #06b6d4) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

/* Статусные бейджи */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.active {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.status-badge.inactive {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.status-badge.expired {
  background: #fff3cd;
  color: #92400e;
  border: 1px solid rgba(255, 193, 7, 0.35);
}

.status-badge.canceled {
  background: #ffebee;
  color: #b91c1c;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

/* Кнопки добавления */
.btn-icon-primary {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

.btn-icon-primary:hover {
  background: linear-gradient(135deg, var(--k-sky-600, #0284c7) 0%, var(--k-cyan-500, #06b6d4) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

.btn-icon-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

/* Заголовки панелей */
#promocodesPanel h3,
#discountsPanel h3,
#referralPanel h3,
#customersPanel h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Модальные окна */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 24px;
  color: #1f2937;
  font-size: 24px;
  font-weight: 600;
}

.close {
  color: #9ca3af;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
  position: absolute;
  top: 20px;
  right: 20px;
}

.close:hover,
.close:focus {
  color: #374151;
}

/* Формы в модальных окнах */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #374151;
  font-weight: 500;
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--k-sky-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.form-actions .btn-primary {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
}

.form-actions .btn-secondary {
  padding: 12px 24px;
  background: #f3f4f6;
  color: #374151;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-actions .btn-secondary:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* Поиск в клиентах */
#customersSearch {
  padding: 10px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

#customersSearch:focus {
  outline: none;
  border-color: var(--k-sky-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

/* Фильтр товаров в скидках */
#discountProductFilter {
  padding: 10px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
  cursor: pointer;
}

#discountProductFilter:focus {
  outline: none;
  border-color: var(--k-sky-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-sky-500) 10%, transparent);
}

/* Дополнительные стили для улучшения визуального восприятия */
.data-table tbody tr td:first-child {
  font-weight: 600;
  color: var(--k-sky-500, #0ea5e9);
}

.data-table tbody tr td strong {
  color: #1f2937;
  font-weight: 600;
}

/* Иконки в кнопках */
.btn-icon-primary svg,
.btn-icon-primary [data-lucide] {
  width: 18px;
  height: 18px;
}

/* Заголовки панелей с кнопками */
#promocodesPanel > div:first-child,
#discountsPanel > div:first-child,
#referralPanel > div:first-child,
#customersPanel > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Стили для пустых состояний */
.data-table .loading {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

/* Анимация появления строк таблицы */
@keyframes fadeInRow {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.data-table tbody tr {
  animation: fadeInRow 0.3s ease-out;
}

/* Стили для скроллбара таблицы */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Кликабельные строки */
.consultation-row:hover,
.customer-row:hover {
  background-color: var(--k-sky-50, #f0f9ff) !important;
  border-left-color: var(--k-sky-500, #0ea5e9) !important;
}

.consultation-row:active,
.customer-row:active {
  background-color: var(--k-sky-100, #e0f2fe) !important;
}

/* Кнопки с иконками */
.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  margin-right: 6px;
}

.btn-icon-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-icon-action:active {
  transform: translateY(0);
}

.btn-icon-action:last-child {
  margin-right: 0;
}

.btn-icon-action [data-lucide],
.btn-icon-action svg {
  width: 16px;
  height: 16px;
}

.btn-icon-action--edit {
  background: linear-gradient(135deg, var(--k-sky-500, #0ea5e9) 0%, var(--k-cyan-400, #22d3ee) 100%);
}

.btn-icon-action--edit:hover {
  background: linear-gradient(135deg, var(--k-sky-600, #0284c7) 0%, var(--k-cyan-500, #06b6d4) 100%);
}

.btn-icon-action--delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.btn-icon-action--delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Всплывающие уведомления (toast) для админки магазина */
.toast-notifications-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999; /* выше всех модальных окон и боковых панелей */
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
  /* Убеждаемся, что контейнер всегда в правом нижнем углу экрана */
  left: auto;
  top: auto;
}

.toast-notification {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 0;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  pointer-events: all;
  overflow: hidden;
  min-width: 300px;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  color: #1f2937;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  white-space: pre-line;
  word-wrap: break-word;
}

.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: #374151;
}

.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

/* Адаптивность */
@media (max-width: 768px) {
  .toast-notifications-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast-notification {
    min-width: auto;
    width: 100%;
  }

  .view-navigation-tabs {
    gap: 6px;
  }

  .view-nav-tab {
    padding: 8px 14px;
    font-size: 13px;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }

  .table-wrapper {
    border-radius: 8px;
  }

  .modal-content {
    margin: 10% auto;
    padding: 20px;
    width: 95%;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    width: 100%;
  }

  .data-table tbody tr td {
    white-space: normal;
    word-break: break-word;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Воронка продаж - конус */
.funnel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  margin: 20px 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.funnel-stage {
  width: 100%;
  position: relative;
  margin: 0;
  transition: all 0.3s ease;
  min-height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Переход между этапами воронки (клинья) */
.funnel-stage:not(:first-child)::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  z-index: 1;
}

.funnel-stage:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  z-index: 1;
}

.funnel-stage-content {
  width: 100%;
  background: linear-gradient(135deg, var(--k-sky-500) 0%, var(--k-sky-600) 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}

.funnel-stage-content:hover {
  background: linear-gradient(135deg, var(--k-sky-600) 0%, var(--k-sky-700) 100%);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 40%, transparent);
  transform: translateY(-1px);
}

.funnel-stage-label {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.funnel-stage-value {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 0;
  line-height: 1.2;
}

.funnel-stage-tooltip {
  font-size: 11px;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.funnel-stage-content:hover .funnel-stage-tooltip {
  opacity: 1;
}

.funnel-stage-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

/* =========================
   Analytics reset dropdown (Shop Admin)
   ========================= */
.analytics-reset-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.analytics-reset-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.analytics-reset-help-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  color: rgba(71, 85, 105, 0.95);
  background: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  cursor: help;
  user-select: none;
}

.analytics-reset-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 24px));
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.99);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  z-index: 9999;
}

.analytics-reset-tooltip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 10px;
  border: 7px solid transparent;
  border-bottom-color: rgba(15, 23, 42, 0.95);
}

.analytics-reset-help:hover .analytics-reset-tooltip,
.analytics-reset-help:focus-visible .analytics-reset-tooltip {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.analytics-reset-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 1);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  padding: 12px;
  z-index: 9998;
}

.analytics-reset-dropdown-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
}

.analytics-reset-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.analytics-reset-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.analytics-reset-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: #0f172a;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 1);
  background: rgba(248, 250, 252, 0.85);
}

.analytics-reset-item input {
  margin-top: 2px;
}

.analytics-reset-footer {
  margin-top: 12px;
}

/* Адаптивность для воронки */
@media (max-width: 768px) {
  .funnel-container {
    padding: 12px;
    gap: 2px;
    max-width: 100%;
  }

  .funnel-stage {
    min-height: 45px;
  }

  .funnel-stage-content {
    padding: 10px 16px;
  }

  .funnel-stage-label {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .funnel-stage-value {
    font-size: 18px;
    margin-bottom: 0;
  }

  .funnel-stage-tooltip {
    font-size: 10px;
    padding: 6px 10px;
    white-space: normal;
    max-width: 180px;
  }
}

/* =========================
   Стили для ИИ-анализа
   ========================= */
.ai-analysis-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  color: #333;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.ai-analysis-back-btn:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
  transform: translateX(-2px);
}

.ai-analysis-back-btn:active {
  transform: translateX(-2px) scale(0.98);
}

.ai-analysis-content,
.ai-analysis-comparison {
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-analysis-comparison {
  background: #f9fafb;
}

.ai-analysis-text {
  line-height: 1.8;
  font-size: 16px;
  color: #1f2937;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

.ai-analysis-text h4 {
  margin: 24px 0 12px 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.ai-analysis-text p {
  margin: 12px 0;
  line-height: 1.8;
}

.ai-analysis-text div {
  margin: 8px 0;
  padding-left: 24px;
  position: relative;
}

.ai-analysis-text div span:first-child {
  position: absolute;
  left: 0;
  color: var(--k-sky-500, #0ea5e9);
  font-weight: 700;
}

.ai-analysis-text strong {
  font-weight: 700;
  color: #000000;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.ai-analysis-create-tasks-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--k-sky-500);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-analysis-create-tasks-btn:hover {
  background: var(--k-sky-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--k-sky-500) 30%, transparent);
}

.ai-analysis-create-tasks-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--k-sky-500) 20%, transparent);
}

.ai-analysis-create-tasks-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* =========================
   Subscription lock (CRM)
   ========================= */

.subscription-locked-link {
  opacity: 0.45 !important;
  filter: grayscale(0.25);
  pointer-events: none !important;
  cursor: not-allowed !important;
}

.subscription-lock-banner {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 20%, transparent);
  border-radius: 14px;
  padding: 14px 14px;
  margin: 0 0 14px 0;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--k-sky-600) 8%, transparent);
}

[data-theme="dark"] .subscription-lock-banner {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(148, 163, 184, 0.22);
}

.subscription-lock-banner__title {
  font-weight: 800;
  font-size: 15px;
  color: #0f172a;
  margin-bottom: 6px;
}

[data-theme="dark"] .subscription-lock-banner__title {
  color: rgba(226, 232, 240, 0.96);
}

.subscription-lock-banner__text {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(15, 23, 42, 0.7);
}

[data-theme="dark"] .subscription-lock-banner__text {
  color: rgba(226, 232, 240, 0.7);
}

.subscription-lock-banner__actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.subscription-lock-banner--seat-limit {
  border-color: color-mix(in srgb, #ea580c 38%, transparent);
  box-shadow: 0 12px 32px color-mix(in srgb, #ea580c 12%, transparent);
}

.subscription-lock-banner__stats {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
  color: #9a3412;
  white-space: pre-line;
}

[data-theme="dark"] .subscription-lock-banner__stats {
  color: #fdba74;
}

.subscription-lock-banner__hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(15, 23, 42, 0.68);
}

[data-theme="dark"] .subscription-lock-banner__hint {
  color: rgba(226, 232, 240, 0.66);
}

body.subscription-locked .main-content,
body.subscription-locked main {
  position: relative;
}

.subscription-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(248, 250, 252, 0.74);
  backdrop-filter: blur(6px);
}

.subscription-lock-overlay--viewport {
  position: fixed;
  z-index: 10050;
}

[data-theme="dark"] .subscription-lock-overlay {
  background: rgba(2, 6, 23, 0.55);
}

.subscription-lock-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid color-mix(in srgb, var(--k-sky-600) 20%, transparent);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 18px 50px color-mix(in srgb, var(--k-sky-600) 14%, transparent);
}

[data-theme="dark"] .subscription-lock-card {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.24);
}

.subscription-lock-card__title {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 8px;
  color: #0f172a;
}

[data-theme="dark"] .subscription-lock-card__title {
  color: rgba(226, 232, 240, 0.96);
}

.subscription-lock-card__text {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(15, 23, 42, 0.7);
}

[data-theme="dark"] .subscription-lock-card__text {
  color: rgba(226, 232, 240, 0.72);
}

.subscription-lock-card__stats {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
  color: #9a3412;
  white-space: pre-line;
}

[data-theme="dark"] .subscription-lock-card__stats {
  color: #fdba74;
}

.subscription-lock-card__hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(15, 23, 42, 0.68);
}

[data-theme="dark"] .subscription-lock-card__hint {
  color: rgba(226, 232, 240, 0.66);
}

.subscription-lock-card__actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================
   Силуэт исполнителя на канбан-карточках
   ========================= */

/* Кликабельная область для назначения исполнителя */
.kanban-assignees-clickable {
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.kanban-assignees-clickable:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

/* Пустой силуэт исполнителя для назначения */
.kanban-assignees-empty .kanban-assignee-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  color: #64748b;
  transition: all 0.2s ease;
}

.kanban-assignees-empty:hover .kanban-assignee-placeholder {
  background: var(--k-sky-100, #e0f2fe);
  border-color: var(--k-sky-500, #0ea5e9);
  color: var(--k-sky-600, #0284c7);
  transform: scale(1.1);
}

.kanban-assignees-empty .kanban-assignee-placeholder svg {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

/* =========================
   Чек-листы на канбан-карточках
   ========================= */

/* Прогресс-бар чек-листа - менее яркий зеленый цвет */
.kanban-card-checklist-bar-fill {
  background: linear-gradient(135deg, #86efac 0%, #6ee7b7 100%) !important;
  transition: width 0.3s ease;
}

/* =========================
   Drag and Drop для стикеров задач
   ========================= */

/* Стикер в процессе перетаскивания */
.task-tag-placeholder.sticker-dragging {
  opacity: 0.5;
  transform: scale(0.95);
  cursor: grabbing !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Карточка задачи - зона для перетаскивания стикера */
.kanban-card.sticker-drop-zone,
.task-list-item.sticker-drop-zone {
  border: 2px dashed var(--k-sky-500, #0ea5e9);
  background-color: color-mix(in srgb, var(--k-sky-500) 5%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--k-sky-500) 10%, transparent);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* Делаем стикеры визуально перетаскиваемыми */
.task-tag-placeholder[draggable="true"] {
  cursor: grab;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.task-tag-placeholder[draggable="true"]:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.task-tag-placeholder[draggable="true"]:active {
  cursor: grabbing;
}

/* =========================
   Регулярные задачи: произвольное повторение (дни недели)
   ========================= */

.recurring-dow-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.recurring-dow-btn {
  min-width: 44px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color, #e5e7eb);
  background: color-mix(in srgb, var(--k-sky-600) 4%, transparent);
  color: var(--text-primary, #0f172a);
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.recurring-dow-btn:hover {
  background: color-mix(in srgb, var(--k-sky-600) 8%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-600) 35%, transparent);
  transform: translateY(-1px);
}

.recurring-dow-btn.is-active {
  background: color-mix(in srgb, var(--k-sky-500) 14%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-500) 65%, transparent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--k-sky-600) 12%, transparent);
}

[data-theme="dark"] .recurring-dow-btn {
  background: color-mix(in srgb, var(--k-sky-400) 8%, transparent);
  border-color: rgba(148, 163, 184, 0.24);
  color: rgba(226, 232, 240, 0.96);
}

[data-theme="dark"] .recurring-dow-btn:hover {
  background: color-mix(in srgb, var(--k-sky-400) 14%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-400) 38%, transparent);
}

[data-theme="dark"] .recurring-dow-btn.is-active {
  background: color-mix(in srgb, var(--k-sky-400) 18%, transparent);
  border-color: color-mix(in srgb, var(--k-sky-400) 62%, transparent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--k-sky-400) 10%, transparent);
}

/* =========================
   Склады (Настройки) + настройки склада (Мой склад)
   ========================= */
.warehouses-admin-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.warehouses-form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.warehouses-form-grid .form-group:nth-child(1) {
  grid-column: span 4;
}
.warehouses-form-grid .form-group:nth-child(2) {
  grid-column: span 2;
}
.warehouses-form-grid .form-group:nth-child(3) {
  grid-column: span 4;
}
.warehouses-form-grid .form-group:nth-child(4) {
  grid-column: span 2;
}
.warehouses-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.warehouses-table-wrap {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

table.data-table.warehouses-table td,
table.data-table.warehouses-table th {
  vertical-align: middle;
}

table.data-table.warehouses-table td:nth-child(5),
table.data-table.warehouses-table td:nth-child(6) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.warehouses-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.warehouse-bindings-card {
  margin: 0 0 14px 0;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.warehouse-bindings-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.warehouse-bindings-title {
  font-weight: 800;
  color: #0f172a;
}

.warehouse-bindings-subtitle {
  color: #6b7280;
  font-size: 12px;
}

.warehouse-bindings-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.warehouse-toggle-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
}

.warehouse-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.warehouse-bindings-hint {
  color: #6b7280;
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.warehouse-bindings-actions {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.warehouse-bindings-link {
  color: var(--k-sky-500, #0ea5e9);
  text-decoration: none;
  font-size: 13px;
}
.warehouse-bindings-link:hover {
  text-decoration: underline;
}

[data-theme="dark"] .warehouses-admin-card,
[data-theme="dark"] .warehouse-bindings-card {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.35);
}

[data-theme="dark"] .warehouses-table-wrap,
[data-theme="dark"] .warehouse-toggle-row {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.35);
}

[data-theme="dark"] .warehouse-bindings-title {
  color: rgba(248, 250, 252, 0.92);
}

[data-theme="dark"] .warehouse-bindings-subtitle,
[data-theme="dark"] .warehouse-bindings-hint {
  color: rgba(226, 232, 240, 0.75);
}

@media (max-width: 980px) {
  .warehouses-form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .warehouses-form-grid .form-group:nth-child(1),
  .warehouses-form-grid .form-group:nth-child(2),
  .warehouses-form-grid .form-group:nth-child(3),
  .warehouses-form-grid .form-group:nth-child(4) {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .warehouses-form-grid {
    grid-template-columns: 1fr;
  }
  .warehouses-edit-grid,
  .warehouse-bindings-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Яндекс Доставка (админка заказов) — компактный UI
   ========================= */
details.yd-details {
  margin-top: 14px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
  overflow: hidden;
}

details.yd-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.01em;
}

details.yd-details > summary::-webkit-details-marker {
  display: none;
}

details.yd-details[open] > summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(241, 245, 249, 0.9);
}

.yd-details > summary .yd-muted {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.yd-ui {
  padding: 12px 14px 14px 14px;
}

.yd-ui .yd-muted {
  color: #64748b;
  font-size: 12px;
}

.yd-ui .yd-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  padding: 12px;
}

.yd-ui .yd-card-title {
  font-size: 12px;
  font-weight: 900;
  color: #334155;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.yd-ui .yd-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.yd-ui .yd-grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.yd-ui .yd-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.yd-ui .yd-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.25);
  margin: 10px 0;
}

.yd-ui .yd-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Внутри блока ЯД: вторичные кнопки делаем нейтральными (не градиентными) */
details.yd-details .yd-ui .btn-secondary {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  border: 1px solid rgba(148, 163, 184, 0.45) !important;
  box-shadow: none !important;
  transform: none !important;
}

details.yd-details .yd-ui .btn-secondary:hover {
  background: rgba(241, 245, 249, 0.95) !important;
  border-color: rgba(148, 163, 184, 0.7) !important;
}

details.yd-details .yd-ui .btn-secondary:disabled,
details.yd-details .yd-ui .btn-secondary[disabled],
details.yd-details .yd-ui .btn-primary:disabled,
details.yd-details .yd-ui .btn-primary[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.yd-ui .yd-suggest {
  display: none;
  margin-top: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

@media (max-width: 900px) {
  .yd-ui .yd-grid-2 {
    grid-template-columns: 1fr;
  }
  .yd-ui .yd-fields-row {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Super-admin Marketing page: compact, readable UI
   ========================= */
body.super-admin-marketing-page .mk-calendar-head {
  margin-bottom: 10px;
}

body.super-admin-marketing-page .mk-month-title {
  font-size: 16px;
}

body.super-admin-marketing-page .mk-calendar-grid {
  gap: 8px;
}

body.super-admin-marketing-page .mk-day {
  min-height: 104px;
  padding: 10px;
}

body.super-admin-marketing-page .mk-dow {
  font-size: 11px;
  letter-spacing: 0.03em;
}

body.super-admin-marketing-page .mk-mini-item {
  padding: 6px 8px;
}

body.super-admin-marketing-page .mk-filters {
  gap: 8px;
  margin: 8px 0 12px;
}

body.super-admin-marketing-page .mk-filters .form-input,
body.super-admin-marketing-page .mk-filters select {
  min-width: 150px;
}

/* Compact controls on marketing page only */
body.super-admin-marketing-page .btn-primary,
body.super-admin-marketing-page .btn-secondary {
  padding: 8px 10px;
  font-size: 13px;
}

body.super-admin-marketing-page .btn-secondary.icon-only,
body.super-admin-marketing-page .btn-primary.icon-only {
  padding: 7px;
}

body.super-admin-marketing-page .form-input {
  padding: 8px 10px;
  min-height: 36px;
  height: 36px;
  font-size: 13px;
}

body.super-admin-marketing-page textarea.message-editor {
  min-height: 120px;
  font-size: 13px;
}

body.super-admin-marketing-page .data-table th,
body.super-admin-marketing-page .data-table td {
  padding: 10px 12px;
  font-size: 13px;
}

/* =========================
   Booking admin: specialist services per-service break UI
   ========================= */
.spec-svc-bulk {
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.spec-svc-bulk-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.spec-svc-bulk-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.spec-svc-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

/* Заголовок колонок над списком услуг мастера (совпадает с сеткой карточки) */
.spec-svc-list-head {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 10px;
  align-items: end;
  padding: 0 2px 4px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, 0.55);
}
.spec-svc-list-head span:last-child {
  justify-self: start;
  padding-left: 0;
}

.spec-svc-filter-empty {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.95);
  color: rgba(15, 23, 42, 0.72);
  font-size: 13px;
  text-align: center;
}

.spec-svc-card {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.spec-svc-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.spec-svc-card input[type="checkbox"][data-specialist-service-id] {
  margin-top: 3px;
}

.spec-svc-name {
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  cursor: pointer;
}

.spec-svc-meta {
  margin-top: 4px;
}

.spec-svc-break {
  display: grid;
  gap: 6px;
  align-content: start;
  justify-items: start;
}

.spec-svc-break-label {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.7);
}

/* “time-like” compact input */
.spec-svc-break-input {
  width: 140px;
  max-width: 100%;
  min-height: 36px;
  height: 36px;
  padding: 7px 10px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

.spec-svc-break-input::placeholder {
  color: rgba(15, 23, 42, 0.45);
}

/* Booking journal: buffer (break after service) overlay */
.booking-buffer-block {
  position: absolute;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background:
    repeating-linear-gradient(
      45deg,
      rgba(148, 163, 184, 0.22),
      rgba(148, 163, 184, 0.22) 6px,
      rgba(255, 255, 255, 0.7) 6px,
      rgba(255, 255, 255, 0.7) 12px
    );
  color: rgba(15, 23, 42, 0.75);
  pointer-events: auto;
  overflow: hidden;
}

.booking-buffer-block .booking-buffer-label {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.booking-buffer-legend {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.7);
  margin-left: 8px;
}

.booking-buffer-legend .swatch {
  width: 22px;
  height: 12px;
  border-radius: 6px;
  border: 1px dashed rgba(148, 163, 184, 0.8);
  background:
    repeating-linear-gradient(
      45deg,
      rgba(148, 163, 184, 0.22),
      rgba(148, 163, 184, 0.22) 6px,
      rgba(255, 255, 255, 0.7) 6px,
      rgba(255, 255, 255, 0.7) 12px
    );
}

@media (max-width: 720px) {
  .spec-svc-list-head {
    display: none;
  }
  .spec-svc-card {
    grid-template-columns: 1fr;
  }
  .spec-svc-break {
    grid-template-columns: 1fr;
  }
  .spec-svc-break-input {
    width: 100%;
  }
}
