/* Стиль Битрикс24 */
:root {
  --b24-blue: #2FC6F6;
  --b24-blue-dark: #1A9ED0;
  --b24-green: #7CC576;
  --b24-orange: #F9A21B;
  --b24-red: #F3423F;
  --b24-gray: #A8ADB4;
  --b24-bg: #F4F5F7;
  --b24-white: #FFFFFF;
  --b24-text: #333333;
  --b24-text-light: #828B95;
  --b24-border: #DFE1E6;
  --b24-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
  /* Семантические (унификация) */
  --b24-primary: #1A9ED0;          /* основной акцент — читаемый синий (= blue-dark) */
  --b24-primary-soft: #E8F6FD;     /* мягкий фон акцента */
  --b24-card: #FFFFFF;             /* фон карточек */
  --text-muted: #828B95;           /* псевдоним --b24-text-light (сводим дубли серого) */
  --b24-success: #3AA757;          /* единый зелёный для статусов «успех/дошёл/прошёл» */
  --b24-danger: #E0524C;           /* единый красный для статусов «ошибка/не дошёл» */
  --b24-warning: #F9A21B;          /* = --b24-orange */
  --b24-hover: rgba(0,0,0,0.035);  /* фон при наведении */
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--b24-bg);
  color: var(--b24-text);
  font-size: 14px;
  line-height: 1.5;
}

/* HEADER */
.header {
  background: var(--b24-white);
  border-bottom: 1px solid var(--b24-border);
  border-top: 3px solid var(--b24-blue);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__inner { display: flex; align-items: center; gap: 12px; }

.header__icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--b24-blue) 0%, var(--b24-blue-dark) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.header__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--b24-text);
}

.header__subtitle {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-top: 1px;
}

.header__controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--b24-text-light);
  cursor: pointer;
  user-select: none;
}

.toggle-label input { cursor: pointer; }

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn--refresh {
  background: var(--b24-blue);
  color: white;
}
.btn--refresh:hover { background: var(--b24-blue-dark); }

.btn--save {
  background: var(--b24-green);
  color: white;
  padding: 4px 12px;
  font-size: 12px;
}
.btn--save:hover { opacity: 0.85; }

/* LOADING */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--b24-text-light);
}

.loading__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--b24-border);
  border-top-color: var(--b24-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card { animation: fadeInUp 0.25s ease both; }
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.16s; }
.card:nth-child(n+6) { animation-delay: 0.2s; }

/* ERROR */
.error {
  text-align: center;
  padding: 60px 24px;
  color: var(--b24-red);
}
.error__icon { font-size: 32px; margin-bottom: 12px; }

/* GRID */
.seminars {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);   /* 4 крупные плашки в ширину страницы */
  gap: 18px;
  align-items: stretch;     /* карточки одной строки одинаковой высоты */
  grid-auto-rows: 1fr;
}
@media (max-width: 1280px) { .seminars { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 980px)  { .seminars { grid-template-columns: repeat(2, 1fr); } }

/* CARD */
.card {
  background: var(--b24-white);
  border-radius: var(--radius);
  box-shadow: var(--b24-shadow);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  height: 100%;             /* заполняет ячейку grid → единая высота */
}

.card { cursor: pointer; }
.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.13); transform: translateY(-1px); }

.card--past { opacity: 0.6; }

/* Цветная полоска сверху карточки */
.card__accent {
  height: 4px;
  background: var(--b24-border);
}
.card__accent--green  { background: linear-gradient(90deg, #66bb6a, #43a047); }
.card__accent--orange { background: linear-gradient(90deg, #ffa726, #fb8c00); }
.card__accent--red    { background: linear-gradient(90deg, #ef5350, var(--b24-danger)); }

.card--urgent {
  border: 2px solid #e53935;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.12), var(--b24-shadow);
}

.card--urgent:hover {
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2), 0 4px 16px rgba(0,0,0,0.12);
}

.card__priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--b24-danger);
  background: rgba(229, 57, 53, 0.1);
  border-radius: 4px;
  padding: 3px 8px;
  margin-bottom: 8px;
}

.card__header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--b24-border);
}

.card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--b24-text);
  margin-bottom: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;          /* ровно 2 строки, длинное — с многоточием */
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;              /* фиксируем высоту заголовка под 2 строки */
}

.card__date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__date {
  font-size: 13px;
  color: var(--b24-text-light);
}

.badge {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--soon    { background: #FFF3CD; color: #856404; }
.badge--today   { background: #D4EDDA; color: #155724; }
.badge--past    { background: var(--b24-border); color: var(--b24-text-light); }
.badge--days    { background: #CCE5FF; color: #004085; }

/* STATS — сетка 3 в ряд, чтобы счётчики не накладывались */
.card__stats {
  padding: 14px 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 6px;
  margin-top: auto;          /* прижимаем блок статов к низу — единое выравнивание */
}

.stat {
  min-width: 0;
  text-align: center;
  padding: 4px 2px;
}

.stat__value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 3px;
}

.stat__label {
  font-size: 11px;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;       /* подпись не переносится */
}

.stat--total  .stat__value { color: var(--b24-text); }
.stat--paid   .stat__value { color: var(--b24-green); }
.stat--seats  .stat__value { color: var(--b24-blue-dark); }
.stat--free   .stat__value { color: var(--b24-danger); }

/* PROGRESS */
.card__progress {
  padding: 0 16px 14px;
}

.progress-bar {
  height: 8px;
  background: var(--b24-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-bar__fill--low    { background: var(--b24-green); }
.progress-bar__fill--mid    { background: var(--b24-orange); }
.progress-bar__fill--high   { background: var(--b24-red); }
.progress-bar__fill--full   { background: var(--b24-red); }

.progress-label {
  font-size: 11px;
  color: var(--b24-text-light);
  text-align: right;
}

/* SEATS EDITOR */
.card__seats {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--b24-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.seats-label {
  font-size: 12px;
  color: var(--b24-text-light);
  flex: 1;
}

.seats-input {
  width: 64px;
  padding: 4px 8px;
  border: 1px solid var(--b24-border);
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  outline: none;
}

.seats-input:focus { border-color: var(--b24-blue); }
.seats-input { cursor: text; }

/* EMPTY */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--b24-text-light);
}

/* TABS */
.tabs {
  display: flex;
  gap: 0;
  background: var(--b24-white);
  border-bottom: 1px solid var(--b24-border);
  padding: 0 16px;
}

.tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--b24-text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab:hover { color: var(--b24-text); background: var(--b24-bg); }

.tab--active {
  color: var(--b24-blue-dark);
  border-bottom-color: var(--b24-blue);
  background: #f0faff;
}

/* ПОВТОРНЫЕ ПРОДАЖИ */
.rs-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 24px 0;
  flex-wrap: wrap;
}

.rs-toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.rs-toolbar__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.rs-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--b24-text);
  background: var(--b24-white);
  outline: none;
  cursor: pointer;
}

.rs-select:focus { border-color: var(--b24-blue); }
.rs-select:disabled { opacity: 0.5; cursor: not-allowed; }

.rs-info {
  padding: 16px 24px 8px;
  font-size: 13px;
  color: var(--b24-text-light);
  font-weight: 600;
}

.rs-table-wrap {
  padding: 0 24px 24px;
  overflow-x: auto;
}

.rs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--b24-white);
  border-radius: var(--radius);
  box-shadow: var(--b24-shadow);
  overflow: hidden;
  font-size: 13px;
}

.rs-table thead tr {
  background: var(--b24-bg);
  border-bottom: 2px solid var(--b24-border);
}

.rs-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--b24-text-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.rs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--b24-border);
  color: var(--b24-text);
  vertical-align: middle;
}

.rs-table tbody tr:last-child td { border-bottom: none; }
.rs-table tbody tr:hover { background: var(--b24-bg); }

.rs-num  { color: var(--b24-text-light); width: 40px; text-align: center; }
.rs-name { font-weight: 600; }
.rs-phone, .rs-email { font-family: monospace; font-size: 12px; }
.rs-date { color: var(--b24-text-light); white-space: nowrap; }

.rs-empty {
  text-align: center;
  padding: 40px;
  color: var(--b24-text-light);
}

/* ФИЛЬТР ПО ДАТЕ */
.rs-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px 0;
  flex-wrap: wrap;
}

.rs-filter-label {
  font-size: 13px;
  color: var(--b24-text-light);
  font-weight: 600;
}

.rs-filter-sep {
  color: var(--b24-text-light);
}

.rs-date-input {
  padding: 6px 10px;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--b24-text);
  background: var(--b24-white);
  outline: none;
  cursor: pointer;
}

.rs-date-input:focus { border-color: var(--b24-blue); }

.btn--clear {
  background: var(--b24-bg);
  color: var(--b24-text-light);
  border: 1px solid var(--b24-border);
  padding: 6px 12px;
  font-size: 12px;
}
.btn--clear:hover { background: var(--b24-border); }

/* СЕКЦИЯ ПОВТОРНИКИ */
.rs-section {
  margin-top: 8px;
  border-top: 2px solid var(--b24-border);
  padding-top: 4px;
}

.rs-section__header {
  padding: 16px 24px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--b24-text);
  letter-spacing: 0.2px;
}

/* КЛИКАБЕЛЬНЫЕ СТРОКИ */
.rs-row-clickable {
  cursor: pointer;
  transition: background 0.1s;
}
.rs-row-clickable:hover { background: #EAF6FF !important; }

/* МОДАЛЬНОЕ ОКНО */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--b24-white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--b24-border);
  flex-shrink: 0;
}

.modal__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--b24-text);
}

.modal__close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--b24-text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.modal__close:hover { background: var(--b24-bg); color: var(--b24-text); }

.modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 15px;
}

.modal__count {
  font-size: 13px;
  color: var(--b24-text-light);
  margin-bottom: 12px;
  font-weight: 600;
}

.modal__empty {
  text-align: center;
  padding: 24px;
  color: var(--b24-text-light);
}

.seminar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seminar-list__item {
  padding: 8px 12px;
  background: var(--b24-bg);
  border-radius: 6px;
  font-size: 13px;
  color: var(--b24-text);
  border-left: 3px solid var(--b24-green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.seminar-list__name {
  flex: 1;
}

.seminar-list__date {
  color: var(--b24-text-light);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ПРОГРЕСС В МОДАЛЕ */
.progress-section {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-bottom: 4px;
}

.progress-chart-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.progress-chart-wrap canvas {
  width: 140px !important;
  height: 140px !important;
}

.progress-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.progress-center-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--b24-text);
  line-height: 1;
}

.progress-center-label {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-top: 2px;
}

.progress-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--b24-text);
}

.progress-legend__item--pct {
  font-size: 13px;
  color: var(--b24-text-light);
  margin-top: 4px;
}

.progress-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.progress-legend__dot--done { background: var(--b24-green); }
.progress-legend__dot--left { background: var(--b24-border); }

.modal__divider {
  height: 1px;
  background: var(--b24-border);
  margin: 16px 0;
}

/* ─── АНАЛИТИКА ─────────────────────────────────────────────────────────── */

.analytics-wrap { padding: 24px; display: flex; flex-direction: column; gap: 24px; }

/* KPI */
.kpi-section {
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--b24-shadow);
}
.kpi-section__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--b24-text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kpi-loading { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--b24-text-light); }
.kpi-cards   { display: flex; gap: 16px; flex-wrap: wrap; }

.kpi-card {
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 18px 24px;
  min-width: 180px;
  flex: 1;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--b24-shadow); }
.kpi-card--blue         { border-color: #90caf9; background: #e3f2fd; }
.kpi-card--green        { border-color: #a5d6a7; background: #e8f5e9; }
.kpi-card--red          { border-color: #ef9a9a; background: #ffebee; }
.kpi-card--red-light    { border-color: #ffcdd2; background: #fff5f5; }
.kpi-card--orange       { border-color: #ffcc80; background: #fff8e1; }
.kpi-card--orange-light { border-color: #ffe0b2; background: #fffde7; }

.kpi-card__num {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--b24-text);
}
.kpi-card--blue         .kpi-card__num { color: #1565c0; }
.kpi-card--green        .kpi-card__num { color: var(--b24-success); }
.kpi-card--red          .kpi-card__num { color: #c62828; }
.kpi-card--red-light    .kpi-card__num { color: #e53935; }
.kpi-card--orange       .kpi-card__num { color: #e65100; }
.kpi-card--orange-light .kpi-card__num { color: #f57c00; }

#fail-top-reason {
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
  hyphens: auto;
}

.kpi-card__label {
  font-size: 11px;
  color: var(--b24-text-light);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.4;
}

/* ВОРОНКА */
.funnel-section { background: var(--b24-white); border: 1px solid var(--b24-border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--b24-shadow); }

/* ─── Провалы и отменённые ──────────────────────────────────────────────────── */
.charts-row { display: flex; gap: 16px; align-items: flex-start; margin-top: 16px; }
.charts-row .chart-box { margin-top: 0; }

.fail-funnels { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.fail-funnel-card {
  flex: 1; min-width: 140px;
  background: var(--b24-bg); border: 1px solid var(--b24-border);
  border-radius: var(--radius); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.fail-funnel-card__name { font-size: 11px; color: var(--b24-text-light); text-transform: uppercase; letter-spacing: 0.3px; }
.fail-funnel-card__num  { font-size: 24px; font-weight: 800; color: #c62828; }

/* ФИЛЬТР-БАР ─────────────────────────────────────────────────────────────── */
.fail-filters {
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fail-filter-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.fail-preset-btn {
  padding: 5px 14px;
  border: 1px solid var(--b24-border);
  border-radius: 20px;
  background: var(--b24-white);
  font-size: 12px;
  font-weight: 600;
  color: var(--b24-text-light);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.fail-preset-btn:hover { border-color: var(--b24-blue); color: var(--b24-blue); }
.fail-preset-btn--active { background: var(--b24-blue); border-color: var(--b24-blue); color: #fff; }

.fail-filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.fail-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fail-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fail-filter-dates {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fail-date-input {
  padding: 6px 8px;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--b24-text);
  background: var(--b24-white);
  outline: none;
  cursor: pointer;
  width: 128px;
}
.fail-date-input:focus { border-color: var(--b24-blue); }

.fail-date-sep { color: var(--b24-text-light); font-size: 13px; }

.fail-select {
  padding: 7px 10px;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--b24-text);
  background: var(--b24-white);
  outline: none;
  cursor: pointer;
  min-width: 160px;
  max-width: 240px;
}
.fail-select:focus { border-color: var(--b24-blue); }

.fail-filter-reset-btn {
  padding: 7px 14px;
  font-size: 12px;
  align-self: flex-end;
}

.fail-filter-summary {
  font-size: 12px;
  color: var(--b24-text-light);
  padding: 2px 0;
}
.fail-filter-summary b { color: var(--b24-blue-dark); font-weight: 700; }

/* ОТМЕНЁННЫЕ СЕМИНАРЫ — плашки 4 в ряд, одинаковый размер ─────────────── */
.canceled-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 310px;   /* фиксированная высота строки = все одинаковые */
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .canceled-tiles { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 290px; }
}
@media (max-width: 640px) {
  .canceled-tiles { grid-template-columns: 1fr; grid-auto-rows: auto; }
}

.ctile {
  background: #fff5f5;
  border: 1px solid #ffcdd2;
  border-top: 4px solid #e53935;
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;          /* растягивается на всю высоту ячейки грида */
  box-sizing: border-box;
  overflow: hidden;      /* контент не выходит за фиксированную высоту */
  box-shadow: 0 2px 8px rgba(229,57,53,0.08);
  transition: box-shadow 0.15s, transform 0.15s;
}
.ctile:hover { box-shadow: 0 4px 16px rgba(229,57,53,0.14); transform: translateY(-2px); }

.ctile__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.ctile__name {
  font-weight: 700;
  font-size: 15px;
  color: #b71c1c;
  line-height: 1.5;
  flex: 1;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;   /* максимум 3 строки, хватит для любого названия */
  -webkit-box-orient: vertical;
}

.ctile__source {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 2px;
}
.ctile__source--pult { background: #e3f2fd; color: #1565c0; }
.ctile__source--hist { background: var(--b24-bg); color: var(--b24-text-light); border: 1px solid var(--b24-border); }

.ctile__dates {
  background: #fff0f0;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.ctile__date-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctile__date-label {
  font-size: 11px;
  color: var(--b24-text-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: 72px;
  flex-shrink: 0;
}

.ctile__date-val {
  font-size: 15px;
  font-weight: 700;
  color: #b71c1c;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.ctile__venue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--b24-text-light);
  background: var(--b24-bg);
  border-radius: 6px;
  padding: 4px 10px;
  border: 1px solid var(--b24-border);
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ctile__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #ffcdd2;
  flex-shrink: 0;
}

.ctile__deals {
  font-size: 13px;
  font-weight: 700;
  color: #c62828;
  background: #ffebee;
  border: 1px solid #ef9a9a;
  border-radius: 6px;
  padding: 4px 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ctile__cancel-date {
  font-size: 12px;
  color: var(--b24-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* БЕНЧМАРК ──────────────────────────────────────────────────────────────── */
.bench-box {
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--b24-shadow);
  margin-top: 0;
}

.bench-box__header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--b24-border);
}

.bench-box__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--b24-text);
}

.bench-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.bench-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bench-group__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.bench-group--reasons { flex: 1; min-width: 240px; }

.bench-periods {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.bench-period-btn {
  padding: 5px 14px;
  border: 1px solid var(--b24-border);
  border-radius: 20px;
  background: var(--b24-white);
  font-size: 12px;
  font-weight: 600;
  color: var(--b24-text-light);
  cursor: pointer;
  transition: all 0.15s;
}
.bench-period-btn:hover { border-color: var(--b24-blue); color: var(--b24-blue); }
.bench-period-btn--active { background: var(--b24-blue); border-color: var(--b24-blue); color: #fff; }
.bench-period-btn--disabled { opacity: 0.35; pointer-events: none; }

.bench-filter-select {
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  background: var(--b24-white);
  font-size: 12px;
  color: var(--b24-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  max-width: 260px;
  min-width: 160px;
}
.bench-filter-select:focus { outline: none; border-color: var(--b24-blue); }

.bench-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bench-date-input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  background: var(--b24-white);
  font-size: 12px;
  color: var(--b24-text);
  width: 130px;
}
.bench-date-input:focus { outline: none; border-color: var(--b24-blue); }

.bench-date-sep {
  color: var(--b24-text-light);
  font-size: 13px;
  font-weight: 600;
}

.bench-date-clear {
  height: 28px;
  width: 28px;
  border: 1px solid var(--b24-border);
  border-radius: 50%;
  background: var(--b24-bg);
  color: var(--b24-text-light);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.bench-date-clear:hover { background: #ffebee; border-color: #ef9a9a; color: #c62828; }

.bench-compare-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--b24-text);
  font-weight: 600;
  cursor: pointer;
  padding: 5px 0;
}

.bench-reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bench-reason-chip {
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--bc, #e53935);
  color: var(--bc, #e53935);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.bench-reason-chip:hover { background: color-mix(in srgb, var(--bc, #e53935) 10%, transparent); }
.bench-chip--off { opacity: 0.3; }

.bench-chart-wrap {
  position: relative;
  height: 300px;
  margin-bottom: 20px;
}

.bench-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--b24-border);
}

.bench-card {
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.bench-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.bench-card__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--b24-text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

.bench-card__trend {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.bench-card__trend--up   { background: #fff3e0; color: #e65100; }
.bench-card__trend--down { background: #e8f5e9; color: #2e7d32; }
.bench-card__trend--flat { background: var(--b24-bg); color: var(--b24-text-light); border: 1px solid var(--b24-border); }

.bench-card__current {
  font-size: 28px;
  font-weight: 800;
  color: var(--b24-text);
  line-height: 1;
  flex-shrink: 0;
}
.bench-card__unit { font-size: 12px; font-weight: 400; color: var(--b24-text-light); }

.bench-card__prev {
  font-size: 12px;
  color: var(--b24-text-light);
  flex-shrink: 0;
}

.bench-card__change {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.bench-card__change--worse  { color: #c62828; }
.bench-card__change--better { color: #2e7d32; }
.bench-card__change--same   { color: var(--b24-text-light); font-weight: 400; }

.bench-card > svg { flex-shrink: 0; margin-left: auto; }

/* КАРТОЧКИ ПРИЧИН */
.fail-reasons-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 16px 0 10px;
}

/* Детализация по причинам — полная ширина, стек */
.reason-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
}

.reason-card {
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-top: 3px solid var(--rc, #e53935);
  border-radius: var(--radius);
  box-shadow: var(--b24-shadow);
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: stretch;
  overflow: hidden;
}

.reason-card__summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 20px 20px 20px;
  border-right: 1px solid var(--b24-border);
}

.reason-card__sems-section {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reason-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.reason-card__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--b24-text);
  line-height: 1.35;
}

.reason-card__pct {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.reason-card__count {
  font-size: 20px;
  font-weight: 800;
  color: var(--b24-text);
  line-height: 1;
}

.reason-card__of {
  font-size: 12px;
  font-weight: 400;
  color: var(--b24-text-light);
  margin-left: 4px;
}

.reason-card__spark { line-height: 0; }

.reason-card__funnels { display: flex; flex-wrap: wrap; gap: 4px; }

.reason-pill {
  font-size: 11px;
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--b24-text-light);
  white-space: nowrap;
}
.reason-pill b { color: var(--b24-text); font-weight: 700; }

.reason-card__none { color: var(--b24-text-light); font-size: 12px; }

.reason-card__sems-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.reason-card__sems { display: flex; flex-direction: column; gap: 6px; }

/* Строка семинара в карточке причины */
.reason-sem {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--b24-bg);
  border-radius: 6px;
  border: 1px solid var(--b24-border);
}

.reason-sem__rank {
  width: 20px; height: 20px;
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: var(--b24-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.reason-sem__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reason-sem__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--b24-text);
  line-height: 1.4;
}

.reason-sem__dates {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reason-sem__date-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--b24-text);
}

.reason-sem__date-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.reason-sem__date-sep {
  color: var(--b24-text-light);
  font-size: 12px;
}

.reason-sem__venue {
  font-size: 12px;
  color: var(--b24-text-light);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

.reason-sem__count {
  font-size: 13px;
  font-weight: 700;
  color: #c62828;
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .reason-card { grid-template-columns: 1fr; }
  .reason-card__summary { border-right: none; border-bottom: 1px solid var(--b24-border); }
}

/* ТАБЛИЦА СЕМИНАРОВ — расширенная */
.fail-seminar-table .funnel-name { max-width: 220px; }
.fail-seminar-table th:nth-child(4),
.fail-seminar-table td:nth-child(4) { min-width: 150px; }
.fail-seminar-table th:nth-child(5),
.fail-seminar-table td:nth-child(5) { min-width: 180px; }

.reason-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.4;
}
.reason-badge--none {
  background: var(--b24-bg);
  color: var(--b24-text-light);
  border-color: var(--b24-border);
}

.reason-mini-col { min-width: 160px; }

.reason-mini-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  font-size: 11px;
}

.reason-mini-name {
  width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--b24-text-light);
  flex-shrink: 0;
}

.reason-mini-bar {
  flex: 1;
  height: 4px;
  background: var(--b24-border);
  border-radius: 2px;
  overflow: hidden;
}

.reason-mini-fill {
  height: 100%;
  border-radius: 2px;
}

.reason-mini-num {
  font-weight: 700;
  color: #c62828;
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
}

.fail-funnel-card__pct {
  font-size: 11px;
  color: var(--b24-text-light);
  margin-top: 2px;
}

.fail-bar { height: 6px; background: var(--b24-border); border-radius: 3px; margin-top: 4px; }
.fail-bar__fill { height: 100%; border-radius: 3px; background: #e53935; }

.funnel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.funnel-title { font-size: 16px; font-weight: 700; color: var(--b24-text); }

.funnel-note { font-size: 13px; color: var(--b24-text-light); margin-bottom: 12px; }

.funnel-table-wrap { overflow-x: auto; }

.funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.funnel-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--b24-bg);
  border-bottom: 2px solid var(--b24-border);
  font-weight: 600;
  color: var(--b24-text-light);
  font-size: 12px;
  text-transform: uppercase;
}
.funnel-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--b24-border);
  vertical-align: middle;
}
.funnel-table tr:last-child td { border-bottom: none; }
.funnel-table tr:hover td { background: var(--b24-bg); }

.funnel-num      { width: 36px; color: var(--b24-text-light); text-align: center; }
.funnel-name     { max-width: 340px; font-weight: 500; }
.funnel-attended { width: 80px; text-align: right; font-weight: 700; color: var(--b24-green); }
.funnel-not      { width: 80px; text-align: right; color: var(--b24-text-light); }

.funnel-pct      { width: 70px; text-align: center; font-weight: 700; border-radius: 4px; padding: 3px 8px; }
.funnel-pct--high { color: var(--b24-success); background: #e8f5e9; }
.funnel-pct--mid  { color: #e65100; background: #fff3e0; }
.funnel-pct--low  { color: var(--b24-danger); background: #ffebee; }

.funnel-bar-cell { width: 160px; }
.funnel-bar {
  height: 8px;
  background: var(--b24-border);
  border-radius: 4px;
  overflow: hidden;
}
.funnel-bar__fill {
  height: 100%;
  background: var(--b24-blue);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ─── ИСТОРИЯ ЛИДОВ В МОДАЛКЕ ───────────────────────────────────────────── */

.lead-hist { margin-top: 4px; }
.lead-hist__header {
  font-size: 13px;
  font-weight: 700;
  color: var(--b24-text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.lead-hist__list { list-style: none; padding: 0; margin: 0; }
.lead-hist__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 0;
  border-bottom: 1px solid var(--b24-border);
}
.lead-hist__item:last-child { border-bottom: none; }
.lead-hist__title { font-size: 13px; color: var(--b24-text); font-weight: 500; }
.lead-hist__meta  { font-size: 11px; color: var(--b24-text-light); }

/* ─── МОДАЛКА ДУБЛЕЙ ────────────────────────────────────────────────────── */

.dup-desc { font-size: 14px; color: var(--b24-text); margin-bottom: 12px; }

.dup-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
  background: #fff8f0;
}
.dup-item { padding: 6px 0; border-bottom: 1px solid var(--b24-border); }
.dup-item:last-child { border-bottom: none; }
.dup-item__name  { font-weight: 600; font-size: 13px; color: var(--b24-text); }
.dup-item__lead  { font-size: 12px; color: var(--b24-text-light); margin-top: 2px; }

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

/* CHECKBOX COLUMN */
.rs-th-check, .rs-td-check {
  width: 36px;
  text-align: center;
  padding: 0 4px;
}
.rs-td-check { cursor: default; }

.rs-row-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--b24-blue);
}

/* FLOATING SELECTION BAR */
.selection-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--b24-white);
  color: var(--b24-text);
  border: 1px solid var(--b24-border);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.16);
  z-index: 200;
  white-space: nowrap;
}
.selection-bar__count {
  font-size: 14px;
  font-weight: 500;
  color: var(--b24-text);
  white-space: nowrap;
}

.selection-bar__seminar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.selection-bar__label {
  font-size: 13px;
  color: var(--b24-text-light);
  white-space: nowrap;
}
.selection-bar__select {
  background: var(--b24-bg);
  color: var(--b24-text);
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  max-width: 220px;
}
.selection-bar__select:focus { outline: 2px solid var(--b24-blue); }

.btn--primary {
  background: var(--b24-blue);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn--primary:hover:not(:disabled) { background: var(--b24-blue-dark); }
.btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  color: var(--b24-text-light);
  border: 1px solid var(--b24-border);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn--ghost:hover { color: #fff; border-color: #6070a0; }

/* LEADS RESULT MODAL */
.modal--narrow { max-width: 560px; }

.leads-result-ok {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
}
.leads-result-ok__item {
  padding: 5px 0;
  color: var(--b24-text);
  font-size: 14px;
  border-bottom: 1px solid var(--b24-border);
}
.leads-result-ok__item:last-child { border-bottom: none; }

.leads-result-err {
  margin-top: 12px;
  background: #ffebee;
  border-radius: 6px;
  padding: 10px 14px;
}
.leads-result-err__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--b24-red);
  margin-bottom: 6px;
}
.leads-result-err__item {
  font-size: 12px;
  color: var(--b24-danger);
  padding: 2px 0;
}

/* STATS BAR */
.rs-stats-bar {
  display: none;
  gap: 12px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 12px 20px;
  min-width: 120px;
  text-align: center;
  box-shadow: var(--b24-shadow);
}
.stat-card--hot { border-color: #ffcc80; background: #fff8f0; }

.stat-card__num {
  font-size: 26px;
  font-weight: 800;
  color: var(--b24-text);
  line-height: 1.1;
}
.stat-card--hot .stat-card__num { color: #e65100; }

.stat-card__label {
  font-size: 11px;
  color: var(--b24-text-light);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* EXPORT BUTTON */
.btn--export {
  background: var(--b24-white);
  color: var(--b24-text);
  border: 1px solid var(--b24-border);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn--export:hover { background: var(--b24-bg); border-color: var(--b24-gray); }

.rs-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* PROGRESS BAR IN TABLE */
.rs-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rs-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rs-progress-bar {
  height: 4px;
  background: var(--b24-border);
  border-radius: 2px;
  overflow: hidden;
  width: 100%;
  max-width: 140px;
}
.rs-progress-bar__fill {
  height: 100%;
  background: var(--b24-green);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* HOT BADGE */
.rs-hot-badge {
  font-size: 10px;
  font-weight: 700;
  background: #ffcc80;
  color: #bf360c;
  padding: 1px 6px;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* HOT ROW HIGHLIGHT */
.rs-row--hot {
  background: #fff8f0;
}
.rs-row--hot:hover { background: #fff3e0; }

/* RS RESULT HEADER: info + search */
.rs-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 8px;
  flex-wrap: wrap;
}

.rs-search {
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--b24-text);
  background: var(--b24-white);
  outline: none;
  width: 220px;
  transition: border-color 0.15s;
}
.rs-search:focus { border-color: var(--b24-blue); }

/* SORTABLE TABLE HEADERS */
.rs-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.rs-table th.sortable:hover { background: var(--b24-bg); }

.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  color: var(--b24-text-light);
  transition: color 0.15s;
}
.rs-table th.sortable:hover .sort-icon { color: var(--b24-blue); }

/* NAME CELL WITH AVATAR */
.rs-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rs-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* COPYABLE CELLS */
.copyable {
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}
.copyable:hover { color: var(--b24-blue); text-decoration: underline dotted; }
.copyable.copied { color: var(--b24-green); }

/* DATE BADGES */
.date-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #e8f5e9;
  color: #388e3c;
}
.date-badge--yellow {
  background: #fff8e1;
  color: #f57f17;
}
.date-badge--orange {
  background: #fff3e0;
  color: #e65100;
}
.date-badge--red {
  background: #ffebee;
  color: var(--b24-danger);
}

/* ─── МОДАЛКА СДЕЛОК СЕМИНАРА ─────────────────────────────────────────────── */

.modal--deals {
  max-width: 900px;
  max-height: 85vh;
}

.modal__meta {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-top: 2px;
}

.deals-filter-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--b24-border);
  flex-shrink: 0;
}

.deals-search {
  width: 100%;
  padding: 7px 14px;
  border: 1px solid var(--b24-border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--b24-text);
  outline: none;
  transition: border-color 0.15s;
}
.deals-search:focus { border-color: var(--b24-blue); }

.deals-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.deal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--b24-border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}
.deal-item:last-child { border-bottom: none; }
.deal-item:hover { background: #f0faff; }

.deal-item__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--b24-blue) 0%, var(--b24-blue-dark) 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.deal-item__info {
  flex: 1;
  min-width: 0;
}

.deal-item__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--b24-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-item__sub {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-item--done { opacity: 0.7; }
.deal-item--done:hover { opacity: 1; }

.deal-item__avatar--done {
  background: linear-gradient(135deg, var(--b24-gray) 0%, #828b95 100%);
}

.deal-item__stage {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.deal-item__stage--active { background: #e3f2fd; color: #1565c0; }
.deal-item__stage--won    { background: #e8f5e9; color: var(--b24-success); }
.deal-item__stage--lost   { background: #ffebee; color: var(--b24-danger); }

.deal-item__paid {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius);
}
.deal-item__paid--yes { background: #e8f5e9; color: var(--b24-success); }
.deal-item__paid--no  { background: var(--b24-bg); color: var(--b24-text-light); }

.deal-item__arrow {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--b24-text-light);
  transition: color 0.15s, transform 0.15s;
}
.deal-item:hover .deal-item__arrow { color: var(--b24-blue); transform: translateX(3px); }

.deals-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--b24-text-light);
  font-size: 14px;
}

.deals-stats {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  background: var(--b24-bg);
  border-bottom: 1px solid var(--b24-border);
  font-size: 13px;
  flex-shrink: 0;
}

.deals-stat { display: flex; align-items: center; gap: 6px; }
.deals-stat__num { font-weight: 700; font-size: 19px; }
.deals-stat__num--green { color: var(--b24-green); }
.deals-stat__num--blue  { color: var(--b24-blue-dark); }
.deals-stat__label { color: var(--b24-text-light); font-size: 13px; }

/* ══════════════════════════════════════════════════════════════
   Вкладка «Выездные семинары» — гео-аналитика
   ══════════════════════════════════════════════════════════════ */

.geo-wrap {
  padding: 16px 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Тулбар */
.geo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--b24-card);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
}
.geo-toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.geo-toolbar__label {
  font-size: 12px;
  color: var(--b24-text-light);
  font-weight: 500;
}
.geo-cost-input {
  width: 140px;
  padding: 6px 10px;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--b24-bg);
  color: var(--b24-text);
}
.geo-cost-input:focus {
  outline: none;
  border-color: var(--b24-blue);
}

/* Сводка */
.geo-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.geo-summary__card {
  flex: 1;
  min-width: 120px;
  background: var(--b24-card);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: center;
}
.geo-summary__card--won  { border-top: 3px solid var(--b24-green); }
.geo-summary__card--lost { border-top: 3px solid #e74c3c; }
.geo-summary__num {
  font-size: 28px;
  font-weight: 700;
  color: var(--b24-text);
  line-height: 1.1;
}
.geo-summary__label {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-top: 4px;
}

/* Таблица городов */
.geo-table-hint {
  font-size: 13px;
  color: var(--b24-text-light);
  margin-bottom: 8px;
}
.geo-th-hint {
  font-size: 11px;
  color: var(--b24-text-light);
  font-weight: 400;
}
.geo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.geo-table thead th {
  background: var(--b24-bg);
  border-bottom: 2px solid var(--b24-border);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--b24-text-light);
  white-space: nowrap;
}
.geo-td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--b24-border);
  vertical-align: middle;
}
.geo-td--num { color: var(--b24-text-light); width: 40px; }
.geo-td--center { text-align: center; }
.geo-td--won  { color: var(--b24-green); font-weight: 600; }
.geo-td--lost { color: #e74c3c; font-weight: 600; }
.geo-td--barrier {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.geo-row:hover { background: var(--b24-hover); }

/* Название города — кликабельное */
.geo-city-link {
  color: var(--b24-blue);
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.geo-city-link:hover { color: var(--b24-blue-dark); }

/* % доходимости */
.geo-rate {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
}
.geo-rate--low  { background: #fde8e8; color: #c0392b; }
.geo-rate--mid  { background: #fef3cd; color: #856404; }
.geo-rate--high { background: #d4edda; color: #155724; }

/* Барьер */
.geo-barrier-val   { font-weight: 600; color: var(--b24-text); }
.geo-barrier-empty { color: var(--b24-text-light); }
.geo-calc-btn {
  background: none;
  border: 1px solid var(--b24-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  color: var(--b24-text-light);
  transition: all 0.15s;
}
.geo-calc-btn:hover {
  border-color: var(--b24-blue);
  color: var(--b24-blue);
  background: var(--b24-hover);
}

/* Приоритет */
.geo-priority {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.geo-priority--high { background: #fde8e8; color: #c0392b; }
.geo-priority--mid  { background: #fef3cd; color: #856404; }
.geo-priority--low  { background: #e8f5e9; color: var(--b24-success); }

/* ─── Модалка студентов ─── */
.geo-student-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--b24-border);
  text-decoration: none;
  color: var(--b24-text);
  transition: background 0.12s;
}
.geo-student-row:hover { background: var(--b24-hover); }
.geo-student-row--won  .geo-student-icon { color: var(--b24-green); font-weight: 700; }
.geo-student-row--lost .geo-student-icon { color: #e74c3c; font-weight: 700; }
.geo-student-icon { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }
.geo-student-name { flex: 1; font-size: 14px; }
.geo-student-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.geo-student-row--won  .geo-student-status { background: #d4edda; color: #155724; }
.geo-student-row--lost .geo-student-status { background: #fde8e8; color: #c0392b; }
.geo-student-arrow { color: var(--b24-text-light); font-size: 14px; flex-shrink: 0; }
.geo-students-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--b24-text-light);
  font-size: 14px;
}

/* ─── Калькулятор ─── */
.geo-calc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 16px;
}
.geo-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.geo-calc-row--result {
  padding-top: 4px;
}
.geo-calc-label {
  font-size: 14px;
  color: var(--b24-text);
  flex: 1;
}
.geo-calc-label small {
  font-size: 12px;
  color: var(--b24-text-light);
}
.geo-calc-input {
  width: 140px;
  padding: 7px 10px;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--b24-bg);
  color: var(--b24-text);
  text-align: right;
  flex-shrink: 0;
}
.geo-calc-input:focus {
  outline: none;
  border-color: var(--b24-blue);
}
.geo-calc-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--b24-text);
  min-width: 140px;
  text-align: right;
  flex-shrink: 0;
}
.geo-calc-total--full { color: #c0392b; font-size: 18px; }
.geo-calc-divider {
  border-top: 1px solid var(--b24-border);
  margin: 2px 0;
}
.geo-calc-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   Кнопка «Окупаемость» в тулбаре гео
   ══════════════════════════════════════════════════════════════ */

.btn--roi {
  background: var(--b24-white);
  color: var(--b24-text);
  border: 1px solid var(--b24-border);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn--roi:hover {
  background: var(--b24-bg);
  border-color: var(--b24-blue);
  color: var(--b24-blue-dark);
}

/* ══════════════════════════════════════════════════════════════
   Модалка ROI — расчёт окупаемости семинара
   ══════════════════════════════════════════════════════════════ */

.modal--roi {
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.roi-body {
  padding: 0 !important;
  overflow-y: auto;
  flex: 1;
}

/* Секции формы */
.roi-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--b24-border);
}
.roi-section:last-child { border-bottom: none; }

.roi-section__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.roi-section__sub {
  font-weight: 400;
  text-transform: none;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--b24-text-light);
}

/* Строка поля */
.roi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 8px;
}
.roi-row:last-child { margin-bottom: 0; }

.roi-row--auto {
  background: var(--b24-bg);
  border-radius: 6px;
  padding: 6px 10px;
  margin-left: -10px;
  margin-right: -10px;
}

.roi-label {
  font-size: 14px;
  color: var(--b24-text);
  flex: 1;
  line-height: 1.3;
}

.roi-hint {
  font-size: 11px;
  color: var(--b24-text-light);
  font-weight: 400;
  background: var(--b24-border);
  padding: 1px 6px;
  border-radius: var(--radius);
  margin-left: 4px;
}

.roi-value-auto {
  font-size: 16px;
  font-weight: 700;
  color: var(--b24-blue-dark);
  min-width: 60px;
  text-align: right;
}

/* Поле ввода */
.roi-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.roi-input {
  width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--b24-bg);
  color: var(--b24-text);
  text-align: right;
}
.roi-input:focus {
  outline: none;
  border-color: var(--b24-blue);
  background: var(--b24-white);
}
.roi-input--sm { width: 90px; }

.roi-unit {
  font-size: 13px;
  color: var(--b24-text-light);
  white-space: nowrap;
  min-width: 44px;
}

/* Составные поля (ночи × цена) */
.roi-row--compound { align-items: flex-start; flex-wrap: wrap; }

.roi-compound {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.roi-sep {
  font-size: 14px;
  color: var(--b24-text-light);
}

.roi-compound-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--b24-text);
  min-width: 80px;
  text-align: right;
}

/* Итоговые карточки (прилеплены снизу) */
.roi-summary {
  border-top: 2px solid var(--b24-border);
  background: var(--b24-bg);
  flex-shrink: 0;
}

.roi-summary__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--b24-border);
}

.roi-sum-card {
  padding: 12px 14px;
  text-align: center;
  border-right: 1px solid var(--b24-border);
}
.roi-sum-card:last-child { border-right: none; }

.roi-sum-card__label {
  font-size: 11px;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.roi-sum-card__val {
  font-size: 17px;
  font-weight: 700;
  color: var(--b24-text);
  line-height: 1.2;
}

.roi-sum-card--expense  .roi-sum-card__val { color: #c0392b; }
.roi-sum-card--revenue  .roi-sum-card__val { color: var(--b24-blue-dark); }
.roi-sum-card--profit   .roi-sum-card__val { color: #27ae60; }
.roi-sum-card--loss     .roi-sum-card__val { color: #c0392b; }
.roi-sum-card--breakeven .roi-sum-card__val { font-size: 14px; }
.roi-sum-card--student  .roi-sum-card__val { color: #7b1fa2; }

/* Разбивка расходов по категориям */
.roi-breakdown {
  padding: 10px 16px 4px;
  border-bottom: 1px solid var(--b24-border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.roi-breakdown__row {
  display: grid;
  grid-template-columns: 1fr 120px 80px 36px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.roi-breakdown__label {
  color: var(--b24-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roi-breakdown__bar-wrap {
  height: 6px;
  background: var(--b24-border);
  border-radius: 3px;
  overflow: hidden;
}
.roi-breakdown__bar {
  height: 100%;
  background: var(--b24-blue);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.roi-breakdown__val {
  text-align: right;
  font-weight: 600;
  color: var(--b24-text);
}
.roi-breakdown__pct {
  text-align: right;
  color: var(--b24-text-light);
}

/* ROI строка */
.roi-summary__footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}

.roi-roi-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roi-roi-label {
  font-size: 14px;
  color: var(--b24-text-light);
  font-weight: 600;
}

.roi-roi-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--b24-text);
}
.roi-roi-val--pos { color: #27ae60; }
.roi-roi-val--neg { color: #c0392b; }

.roi-summary__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Группа поля с переключателем режима */
.roi-field-group {
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafbfc;
}
.roi-field-group:last-child { margin-bottom: 0; }

.roi-row--group-header {
  margin-bottom: 6px;
}

.roi-row--sub {
  padding-left: 8px;
  margin-bottom: 6px;
}
.roi-row--sub:last-child { margin-bottom: 0; }

.roi-label--sub {
  font-size: 13px;
  color: var(--b24-text-light);
}

/* Переключатель режима (фиксированная/%) */
.roi-mode-toggle {
  display: flex;
  gap: 8px;
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  padding: 4px 8px;
  flex-shrink: 0;
}
.roi-mode-toggle--3 {
  flex-wrap: wrap;
  gap: 4px 10px;
}

.roi-mode-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--b24-text);
  font-weight: 500;
  user-select: none;
  white-space: nowrap;
}

.roi-mode-opt input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--b24-blue);
  cursor: pointer;
}

.roi-input--xs { width: 60px; }

/* Переключатель источника участников */
.roi-source-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f0f4ff;
  border: 1px solid #d0d8f0;
  border-radius: var(--radius);
  align-items: center;
}

.roi-source-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--b24-text);
  font-weight: 500;
  user-select: none;
}

.roi-source-opt input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--b24-blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   PIN-модалка
   ══════════════════════════════════════════════════════════════ */

.modal--pin {
  max-width: 300px;
}

.geo-pin-body {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 28px 0 12px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--b24-border);
  background: transparent;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
}

.pin-dot--filled {
  background: var(--b24-blue);
  border-color: var(--b24-blue);
  transform: scale(1.15);
}

.pin-error {
  font-size: 13px;
  color: var(--b24-red);
  text-align: center;
  min-height: 18px;
  padding: 0 16px 8px;
}

.pin-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 20px 24px;
  width: 100%;
}

.pin-btn {
  aspect-ratio: 1;
  border: 1px solid var(--b24-border);
  border-radius: 50%;
  background: var(--b24-white);
  font-size: 22px;
  font-weight: 500;
  color: var(--b24-text);
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.pin-btn:hover { background: var(--b24-bg); }
.pin-btn:active { background: var(--b24-border); transform: scale(0.93); }

.pin-btn--empty {
  border: none;
  background: none;
  cursor: default;
  pointer-events: none;
}

.pin-btn--del {
  font-size: 18px;
  color: var(--b24-text-light);
  border-color: transparent;
  background: var(--b24-bg);
}

/* ══════════════════════════════════════════════════════════════
   Переключатель вида (список / календарь)
   ══════════════════════════════════════════════════════════════ */

.view-toggle {
  display: flex;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.view-btn {
  padding: 5px 14px;
  border: none;
  background: var(--b24-white);
  color: var(--b24-text-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.view-btn + .view-btn { border-left: 1px solid var(--b24-border); }
.view-btn:hover { background: var(--b24-bg); color: var(--b24-text); }
.view-btn--active { background: var(--b24-blue) !important; color: #fff !important; }

/* ══════════════════════════════════════════════════════════════
   Сортировка и скрытие карточек
   ══════════════════════════════════════════════════════════════ */

.sort-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn--sort {
  background: var(--b24-white);
  color: var(--b24-text);
  border: 1px solid var(--b24-border);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn--sort:hover { background: var(--b24-bg); border-color: var(--b24-blue); color: var(--b24-blue-dark); }

.btn--sort-reset {
  background: none;
  border: 1px solid var(--b24-border);
  color: var(--b24-text-light);
  padding: 5px 10px;
  font-size: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn--sort-reset:hover { color: var(--b24-blue); border-color: var(--b24-blue); }

/* Бейдж количества скрытых */
.hidden-badge {
  display: inline-block;
  background: var(--b24-gray);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius);
  margin-left: 2px;
}

/* ── Кнопка скрытия на карточке ── */

.card { position: relative; }

.card__hide-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.08);
  color: var(--b24-text-light);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;              /* видна всегда, чтобы было понятно — можно скрыть */
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  z-index: 3;
  line-height: 1;
}
.card:hover .card__hide-btn { opacity: 1; }
.card__hide-btn:hover { background: rgba(0,0,0,0.18); color: var(--b24-text); }

/* ── Drag handle ── */

.card__drag-handle {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 14px;
  color: var(--b24-gray);
  cursor: grab;
  opacity: 0.7;              /* видна всегда — подсказка, что плашку можно перетащить */
  transition: opacity 0.15s, color 0.15s;
  z-index: 3;
  user-select: none;
  line-height: 1;
}
.card:hover .card__drag-handle { opacity: 1; }
.card__drag-handle:hover { color: var(--b24-text); }

/* ── Drag состояния ── */

.card[draggable="true"] { cursor: default; }

.card--dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

.card--drag-over {
  outline: 2px solid var(--b24-blue);
  outline-offset: 2px;
  transform: scale(1.02);
  transition: transform 0.1s;
}

/* ── Скрытые карточки ── */

.card--hidden {
  opacity: 0.45;
  filter: grayscale(40%);
}
.card--hidden .card__hide-btn {
  opacity: 1;
  color: var(--b24-blue);
  background: rgba(47, 198, 246, 0.12);
}

/* ══════════════════════════════════════════════════════════════
   Календарный вид
   ══════════════════════════════════════════════════════════════ */

.calendar-wrap {
  padding: 16px 16px 40px;
}

/* ── Сетка месяцев ── */
.cal-grid {
  display: grid;
  gap: 12px;
  align-items: start;
}
.cal-grid--2col { grid-template-columns: repeat(2, 1fr); }
.cal-grid--3col { grid-template-columns: repeat(3, 1fr); }

/* ── Блок одного месяца ── */
.cal-month {
  background: var(--b24-white);
  border-radius: var(--radius);
  box-shadow: var(--b24-shadow);
  overflow: hidden;
  min-width: 0; /* не распирать колонку */
}

.cal-month__header {
  background: var(--b24-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  letter-spacing: 0.3px;
}

/* ── Сетка дней ── */
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--b24-border);
  border-top: 1px solid var(--b24-border);
}

.cal-weekday {
  background: var(--b24-bg);
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--b24-text-light);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0;
  aspect-ratio: auto; /* заголовки не квадратные */
}

.cal-day {
  background: var(--b24-white);
  aspect-ratio: 1;
  overflow: hidden;
  padding: 4px;
  position: relative;
  box-sizing: border-box;
}
.cal-day--empty {
  background: #f5f6f8;
  aspect-ratio: 1;
}
.cal-day--past   { background: #fafafa; }
.cal-day--today  { background: #e8f5ff; }

.cal-day--today .cal-day__num {
  background: var(--b24-blue);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cal-day--has-seminar { background: #f4fff8; }

.cal-day__num {
  display: block;
  font-size: 10px;
  color: var(--b24-text-light);
  font-weight: 500;
  line-height: 18px;
  padding: 0 1px;
}

/* ── Виджет семинара ── */
.cal-widget {
  background: var(--b24-white);
  border-left: 3px solid var(--b24-green);
  border-radius: 3px;
  padding: 2px 4px;
  margin-top: 2px;
  cursor: pointer;
  transition: box-shadow 0.12s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.07);
  overflow: hidden;
}
.cal-widget:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.14); }
.cal-widget--past { opacity: 0.5; }

.cal-widget__name {
  font-size: 10px;
  font-weight: 600;
  color: var(--b24-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-widget__stats {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.cal-widget__stat {
  font-size: 9px;
  color: var(--b24-text-light);
  white-space: nowrap;
}

.cal-widget__paid {
  font-size: 9px;
  color: var(--b24-green);
  font-weight: 700;
  white-space: nowrap;
}

/* ── Навигация календаря ── */

.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 12px;
}

.cal-nav-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--b24-text);
}

.cal-nav-btn {
  padding: 6px 14px;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  background: var(--b24-white);
  color: var(--b24-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.cal-nav-btn:hover { background: var(--b24-bg); border-color: var(--b24-blue); color: var(--b24-blue-dark); }
.cal-nav-btn--today {
  background: var(--b24-blue);
  color: #fff;
  border-color: var(--b24-blue);
}
.cal-nav-btn--today:hover { background: var(--b24-blue-dark); border-color: var(--b24-blue-dark); color: #fff; }

/* ── Легенда ── */

.cal-legend {
  display: flex;
  gap: 16px;
  padding: 0 0 14px;
  flex-wrap: wrap;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--b24-text-light);
}

.cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Плашки-чипы (режим год) ── */

.cal-chip {
  display: block;
  border-left: 2px solid #7CC576;
  border-radius: 2px;
  padding: 1px 3px;
  font-size: 9px;
  font-weight: 600;
  color: var(--b24-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  margin-top: 1px;
  line-height: 1.4;
  transition: filter 0.1s;
}
.cal-chip:hover { filter: brightness(0.92); }
.cal-chip--past { opacity: 0.55; }

/* ── Popover ── */

.cal-popover {
  position: absolute;
  z-index: 9999;
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  padding: 14px 16px;
  width: 240px;
  pointer-events: none;
}

.cal-pop__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--b24-text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.cal-pop__date {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-bottom: 10px;
}

.cal-pop__row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.cal-pop__stat {
  font-size: 13px;
  color: var(--b24-text-light);
}
.cal-pop__stat b { color: var(--b24-text); font-size: 15px; }
.cal-pop__stat--green b { color: var(--b24-green); }

.cal-pop__bar-wrap {
  height: 6px;
  background: var(--b24-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.cal-pop__bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.cal-pop__pct {
  font-size: 11px;
  color: var(--b24-text-light);
  text-align: right;
  margin-bottom: 8px;
}

.cal-pop__hint {
  font-size: 11px;
  color: var(--b24-text-light);
  border-top: 1px solid var(--b24-border);
  padding-top: 6px;
  margin-top: 2px;
  font-style: italic;
}

/* ─── Кнопка "Задача" в шапке модалки сделок ─────────────────────────────── */
.modal__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn--task {
  padding: 6px 14px;
  background: var(--b24-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn--task:hover { background: #1a6cba; }

/* ─── Кнопки действий на строке сделки ───────────────────────────────────── */
.deal-item__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.deal-item:hover .deal-item__actions { opacity: 1; }
.deal-item__btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.deal-item__btn--task {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #90caf9;
}
.deal-item__btn--task:hover {
  background: var(--b24-blue);
  color: #fff;
  border-color: var(--b24-blue);
}
.deal-item__btn--delete {
  background: #ffebee;
  color: var(--b24-danger);
  border-color: #ef9a9a;
}
.deal-item__btn--delete:hover {
  background: var(--b24-danger);
  color: #fff;
  border-color: var(--b24-danger);
}
.deal-item__open {
  font-size: 16px;
  color: var(--b24-text-light);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.deal-item__open:hover { color: var(--b24-blue); background: #e3f2fd; }

/* ─── Модалка создания задачи ─────────────────────────────────────────────── */
.modal--task { max-width: 580px; width: 100%; }
.task-form { display: flex; flex-direction: column; gap: 16px; }
.task-form__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--b24-text);
}
.task-form__input,
.task-form__select,
.task-form__textarea {
  padding: 8px 12px;
  border: 1px solid var(--b24-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--b24-text);
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.task-form__input:focus,
.task-form__select:focus,
.task-form__textarea:focus {
  outline: none;
  border-color: var(--b24-blue);
}
.task-form__textarea { resize: vertical; min-height: 80px; }
.task-form__footer { display: flex; gap: 10px; }
.task-result--success {
  padding: 10px 14px;
  background: #e8f5e9;
  color: var(--b24-success);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.task-result--success a { color: #1b5e20; font-weight: 700; }
.task-result--error {
  padding: 10px 14px;
  background: #ffebee;
  color: var(--b24-danger);
  border-radius: 6px;
  font-size: 13px;
}

/* readonly-поля в форме выглядят как информационные */
.task-form__input[readonly] {
  background: var(--b24-bg);
  color: var(--b24-text);
  cursor: default;
}

/* ─── Список семинаров в заголовке месяца календаря ──────────────────────── */
.cal-month__semlist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--b24-border);
  background: var(--b24-bg);
  height: 88px; /* ~4 строки — одинаково для всех месяцев */
  overflow-y: auto;
  overflow-x: hidden;
}
.cal-semlist__empty {
  font-size: 12px;
  color: var(--b24-text-light);
  padding: 4px 6px;
  font-style: italic;
}
.cal-semlist__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
}
.cal-semlist__item:hover { background: #e8f4fd; }
.cal-semlist__item--past { opacity: 0.55; }
.cal-semlist__item--past:hover { opacity: 0.85; }
.cal-semlist__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-semlist__day {
  font-size: 11px;
  font-weight: 700;
  color: var(--b24-text-light);
  min-width: 16px;
  text-align: right;
  flex-shrink: 0;
}
.cal-semlist__name {
  font-size: 12px;
  color: var(--b24-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.cal-semlist__count {
  font-size: 11px;
  font-weight: 600;
  color: var(--b24-text-light);
  background: var(--b24-border);
  border-radius: var(--radius);
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Переключатель режимов гео */
.geo-mode-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.geo-mode-btn {
  padding: 8px 16px; border: 1px solid var(--b24-border); border-radius: 6px;
  background: var(--b24-bg); color: var(--b24-text); cursor: pointer; font-size: 14px;
}
.geo-mode-btn--active { background: var(--b24-primary); color: #fff; border-color: transparent; }
/* Дерево плотности */
.geo-region { border: 1px solid var(--b24-border); border-radius: 6px; margin-bottom: 6px; overflow: hidden; }
.geo-region__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; cursor: pointer; background: var(--b24-bg);
}
.geo-region__head:hover { background: rgba(0,0,0,0.03); }
.geo-region__name { font-weight: 600; }
.geo-region__count { color: var(--text-muted); }
.geo-region__cities { display: none; padding: 4px 14px 10px; }
.geo-region--open .geo-region__cities { display: block; }
.geo-region--open .geo-region__arrow { transform: rotate(90deg); }
.geo-region__arrow { display: inline-block; transition: transform .15s; margin-right: 8px; }
.geo-city-row { display: flex; justify-content: space-between; padding: 4px 0 4px 24px; font-size: 14px; }
.geo-city-row__count { color: var(--text-muted); }

/* Конструктор рассылки */
.modal--wide { max-width: 860px; width: 92%; }
.bc-hint { font-size: 13px; color: var(--text-muted); margin: 0 0 10px; line-height: 1.5; }
.bc-hint code { background: var(--b24-bg, #f0f2f5); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.bc-template {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--b24-border, #d5dce3); border-radius: 6px; resize: vertical; font-family: inherit;
}
.bc-actions { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.bc-status { font-size: 13px; color: var(--text-muted); }
.bc-preview { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.bc-row { border: 1px solid var(--b24-border, #d5dce3); border-radius: 6px; padding: 8px 12px; }
.bc-row__name { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.bc-row__text { font-size: 14px; color: var(--b24-text, #2d2d2d); white-space: pre-wrap; }
.bc-footer { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.bc-note { font-size: 12px; color: var(--text-muted); }

/* Конструктор рассылки — счётчик и лимит */
.bc-counter { font-size: 12px; color: var(--text-muted); margin: 4px 2px 0; }
.bc-warn {
  margin: 10px 0; padding: 10px 12px; border-radius: 6px; font-size: 13px;
  background: #fdecea; color: #b3261e; border: 1px solid #f5c2c0;
}
.bc-len { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.bc-len--over { color: #b3261e; font-weight: 600; }
.bc-row--over { border-color: #f5c2c0; background: #fdecea; }

/* Конструктор рассылки — выбор семинара/менеджера внутри модалки */
.bc-leadcfg { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.bc-leadcfg__label { font-size: 13px; color: var(--b24-text, #2d2d2d); }
.bc-leadcfg .rs-select { min-width: 180px; }

/* Вход в «Окупаемость» — модалка по центру экрана */
.roi-pin-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45); padding: 16px;
}
.roi-pin-overlay .modal--pin { margin: 0; }
.roi-step { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.roi-pin-label { font-size: 14px; color: var(--b24-text, #2d2d2d); align-self: flex-start; }
#roi-user-select { min-width: 240px; width: 100%; }
#roi-user-next { width: 100%; }
.roi-pin-who { font-size: 14px; font-weight: 600; color: var(--b24-text, #2d2d2d); margin-bottom: 4px; }
#roi-pin-back { margin-top: 4px; }

/* Окупаемость — журнал последних входов */
.roi-recent { width: 100%; margin-top: 8px; }
.roi-recent__title { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.roi-recent__row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 3px 0; border-top: 1px solid var(--b24-border, #eef1f4);
}
.roi-recent__when { color: var(--text-muted); white-space: nowrap; }

/* Отчёт по окупаемости */
.rr-section { margin-bottom: 18px; }
.rr-section__title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--b24-text, #2d2d2d); }
.rr-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rr-send { display: flex; gap: 8px; align-items: center; }
.rr-send .rs-select { flex: 1; min-width: 180px; }
.rr-status { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* Рассылка — тайминг создания */
.bc-timing { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; }
.bc-timing__label { font-weight: 600; }
.bc-timing__inp { width: 64px; padding: 6px 8px; border: 1px solid var(--b24-border, #d5dce3); border-radius: 6px; }

/* Рассылка — плавающий прогресс */
.bc-progress {
  position: fixed; right: 20px; bottom: 20px; width: 300px; z-index: 1100;
  background: #fff; border: 1px solid var(--b24-border, #d5dce3); border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.18); overflow: hidden;
}
.bc-progress__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--b24-primary); color: #fff;
}
.bc-progress__title { font-weight: 600; font-size: 14px; }
.bc-progress__btns { display: flex; gap: 4px; }
.bc-progress__btn {
  background: rgba(255,255,255,.2); border: 0; color: #fff; width: 24px; height: 24px;
  border-radius: 5px; cursor: pointer; font-size: 14px; line-height: 1;
}
.bc-progress__btn:hover { background: rgba(255,255,255,.35); }
.bc-progress__body { padding: 12px; }
.bc-progress--min .bc-progress__body { display: none; }
.bc-progress__count { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.bc-progress__bar { height: 8px; background: var(--b24-bg, #eef1f4); border-radius: 4px; overflow: hidden; }
.bc-progress__fill { height: 100%; background: var(--b24-primary); width: 0; transition: width .3s; }
.bc-progress__status { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ════════════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ (мобильные / планшеты)
   ════════════════════════════════════════════════════════════════ */

/* ─── A1: Шапка, вкладки, контейнер ─── */
@media (max-width: 768px) {
  .header { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .header__controls { flex-wrap: wrap; gap: 8px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; flex: 0 0 auto; }
  .app { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 480px) {
  .header__title { font-size: 18px; }
  .header__controls .btn, .header__controls .view-btn { font-size: 12px; padding: 6px 10px; }
  .tab { font-size: 13px; padding: 8px 12px; }
}

/* ─── A2: Таблицы ─── */
@media (max-width: 768px) {
  .rs-table-wrap, .funnel-table-wrap, .geo-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rs-table, .funnel-table, .geo-table { min-width: 560px; }
  .rs-table th, .rs-table td, .geo-table th, .geo-table td, .funnel-table th, .funnel-table td {
    padding: 8px 10px; font-size: 13px;
  }
  .rs-table-wrap::after, .geo-table-wrap::after {
    content: "← таблицу можно листать вбок →"; display: block;
    font-size: 11px; color: var(--b24-text-light); text-align: center; padding: 4px 0;
  }
}

/* ─── A3: Модалки ─── */
@media (max-width: 768px) {
  .modal-overlay { padding: 10px; align-items: flex-start; }
  .modal, .modal--narrow, .modal--wide, .modal--pin { max-width: 100%; width: 100%; max-height: 92vh; }
  .modal__body { padding: 16px; }
  .modal__header { padding: 12px 16px; }
}
@media (max-width: 480px) {
  .pin-numpad { gap: 8px; }
  .pin-btn { width: 56px; height: 56px; font-size: 20px; }
  #roi-report-overlay .rr-btns { flex-direction: column; }
  .rr-btns .btn { width: 100%; }
}

/* ─── A4: Плавающие панели ─── */
@media (max-width: 768px) {
  .selection-bar {
    left: 8px; right: 8px; transform: none; width: auto;
    flex-wrap: wrap; gap: 8px; bottom: 8px; padding: 10px 12px;
  }
  .selection-bar__select { flex: 1 1 140px; min-width: 120px; }
  .selection-bar .btn { flex: 1 1 auto; }
  .bc-progress { right: 8px; left: 8px; bottom: 8px; width: auto; }
}

/* ─── A5: Формы и сетки ─── */
@media (max-width: 768px) {
  .geo-toolbar, .geo-mode-switch { flex-wrap: wrap; gap: 8px; }
  .geo-toolbar__group { flex: 1 1 100%; }
  .roi-summary__cards { grid-template-columns: repeat(2, 1fr) !important; }
  .roi-row { flex-wrap: wrap; }
  .bc-leadcfg { flex-direction: column; align-items: stretch; }
  .bc-leadcfg .rs-select { width: 100%; }
}
@media (max-width: 480px) {
  .roi-summary__cards { grid-template-columns: 1fr !important; }
  .kpi-cards { flex-direction: column; }
  .geo-summary { flex-direction: column; }
}

/* Графики аналитики */
.chart-box { background: var(--b24-white, #fff); border: 1px solid var(--b24-border, #e3e8ef); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.chart-box__title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--b24-text, #2d2d2d); }
.chart-box canvas { max-height: 280px; }

/* Карта плотности */
.geo-subview-switch { display: flex; gap: 8px; margin: 12px 0; }
.geo-subview-btn {
  padding: 6px 14px; border: 1px solid var(--b24-border); border-radius: var(--radius);
  background: var(--b24-bg); color: var(--b24-text); cursor: pointer; font-size: 13px;
}
.geo-subview-btn--active { background: var(--b24-primary); color: #fff; border-color: transparent; }
.geo-map-note { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
/* Гео-вкладка: полноэкранный режим — высота задаётся через JS */
#tab-geo {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
}
#tab-geo .geo-wrap {
  max-width: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 20px 0;
  min-height: 0;
  box-sizing: border-box;
}
#geo-mode-switch {
  flex-shrink: 0;
}
#geo-mode-density,
#geo-mode-cities {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#geo-density-result {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.geo-summary { flex-shrink: 0; }
.geo-subview-switch { flex-shrink: 0; }
#geo-density-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 16px;
}
#geo-density-mapwrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 8px;
}
#geo-density-map {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
}

/* Рентабельность выезда */
.trip-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.trip-toolbar__label { font-size: 14px; color: var(--b24-text); }
.trip-toolbar__hint { font-size: 12px; color: var(--text-muted); }
#trip-table .geo-td--center { text-align: center; }

.trip-inp { width: 90px; padding: 4px 6px; border: 1px solid var(--b24-border); border-radius: 6px; font-size: 13px; text-align: right; }

/* Смета выезда */
.estimate-summary { font-size: 16px; font-weight: 700; color: var(--b24-primary); margin-bottom: 12px; }
.estimate-params { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ─── Мастер выезда ─────────────────────────────────────────────────────────── */
.trip-gate { display: flex; justify-content: center; padding: 48px 16px; }
.trip-gate__card {
  max-width: 440px; text-align: center; padding: 28px 24px;
  border: 1px solid var(--b24-border); border-radius: var(--radius);
  background: var(--b24-card); box-shadow: var(--b24-shadow);
}
.trip-gate__title { font-size: 18px; font-weight: 600; margin-bottom: 10px; color: var(--b24-text); }
.trip-gate__card p { color: var(--text-muted); margin-bottom: 18px; line-height: 1.6; }

.trip-pick { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.trip-pick label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--b24-text); }

.trip-inputs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.trip-inputs label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--b24-text); }
.trip-inputs input {
  padding: 7px 9px; border: 1px solid var(--b24-border); border-radius: 6px;
  font-size: 14px; background: var(--b24-white);
}
.trip-inputs input:focus { outline: none; border-color: var(--b24-primary); }

.trip-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.trip-panel { padding: 18px; border-radius: var(--radius); background: var(--b24-bg); line-height: 1.9; }
.trip-panel--org { background: var(--b24-primary-soft); }
.trip-panel__title { font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.trip-panel b { color: var(--b24-text); }
.trip-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }

.trip-verdict {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 18px;
  border-radius: var(--radius); background: var(--b24-card); border: 1px solid var(--b24-border);
}
.trip-light { font-size: 34px; line-height: 1; }
.trip-verdict__text { flex: 1; min-width: 220px; font-size: 15px; color: var(--b24-text); }
.trip-light--green ~ .trip-verdict__text { color: var(--b24-success); }
.trip-light--red   ~ .trip-verdict__text { color: var(--b24-danger); }

@media (max-width: 720px) { .trip-panels { grid-template-columns: 1fr; } }

.sem-cal { font-size: 13px; }

/* Многодневный семинар — непрерывная полоса на фиксированной дорожке (абсолютная) */
.cal-bar {
  position: absolute;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid;
  border-bottom: 1px solid;
  color: #2a2a2a;
  cursor: pointer;
  box-sizing: border-box;
  z-index: 2;
}
.cal-bar--start {
  border-left: 1px solid;
  border-top-left-radius: 9px;
  border-bottom-left-radius: 9px;
  font-weight: 600;
}
.cal-bar--end {
  border-right: 1px solid;
  border-top-right-radius: 9px;
  border-bottom-right-radius: 9px;
}
.cal-bar--past { opacity: 0.5; }
.cal-bar:hover { filter: brightness(0.95); }

/* ─── Хаб действий над семинаром ─── */
.modal--hub { max-width: 520px; }
.hub-meta { margin-bottom: 18px; }
.hub-dates { font-size: 15px; font-weight: 600; color: var(--b24-text); margin-bottom: 6px; }
.hub-stats { color: var(--text-muted); font-size: 14px; }
.hub-actions { display: flex; flex-direction: column; gap: 10px; }
.btn--danger { background: var(--b24-danger); color: #fff; border-color: var(--b24-danger); }
.btn--danger:hover { filter: brightness(0.95); }

.sem-form-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sem-form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; flex: 1; min-width: 140px; }
.sem-form-row input, .sem-form-row select { padding: 7px 9px; border: 1px solid var(--b24-border); border-radius: 6px; font-size: 14px; }
.sem-form-err { color: var(--b24-danger); font-size: 13px; margin-bottom: 10px; }
#semFormSubmit { width: 100%; }

/* Место проведения семинара */
.card__venue { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.hub-venue { font-size: 14px; color: var(--b24-text); margin: 4px 0; }

/* События из заявок */
.modal--cand { max-width: 720px; }
.cand-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.cand-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.cand-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--b24-border); border-radius: 8px; }
.cand-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--b24-border); cursor: pointer; }
.cand-item:last-child { border-bottom: none; }
.cand-item:hover { background: var(--b24-hover); }
.cand-name { flex: 1; font-size: 13px; font-weight: 600; }
.cand-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cand-empty { padding: 24px; text-align: center; color: var(--text-muted); }
#candSubmit { width: 100%; margin-top: 12px; }

/* Воронка/стадия сделки в списке участников */
.deal-item__funnel { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.deal-item__funnel-name { font-weight: 600; color: var(--b24-primary); }

/* Строка клиента — кликабельна (открывает сделку в Б24) */
.deal-item--clickable { cursor: pointer; }
.deal-item--clickable:hover { background: var(--b24-hover); }

/* PIN-окно строго по центру экрана (создание событий из заявок) */
.pin-center-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
}
.modal--pin-center {
  max-width: 340px;
  width: 90%;
  margin: 0;
}
.pin-center-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; line-height: 1.5; text-align: center; }
.pin-center-input {
  width: 100%;
  text-align: center;
  font-size: 28px;
  letter-spacing: 12px;
  padding: 10px 8px;
  border: 1px solid var(--b24-border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.pin-center-input:focus { outline: none; border-color: var(--b24-primary); }
.pin-center-err { color: var(--b24-danger); font-size: 13px; text-align: center; margin-bottom: 10px; }
#eventsPinSubmit { width: 100%; }

/* Выбор года в календаре */
.calyear-select { padding: 5px 8px; font-size: 13px; border-radius: var(--radius); border: 1px solid var(--b24-border); background: var(--b24-white); cursor: pointer; }

/* Ячейка дня кликабельна — создать семинар */
.cal-day--add { cursor: pointer; }
.cal-day--add:hover { box-shadow: inset 0 0 0 2px var(--b24-primary); }

/* Пройденная плашка с проблемными сделками — требует внимания */
.card--attention { box-shadow: 0 0 0 2px var(--b24-danger), var(--b24-shadow); }
.card__attention {
  display: inline-block;
  background: var(--b24-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}

/* Модалка подтверждения (дубликат семинара) */
.confirm-text { font-size: 14px; line-height: 1.5; color: var(--b24-text); margin-bottom: 18px; text-align: center; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

/* Донабор: зелёный значок на плашке */
.card__donabor {
  display: inline-block;
  background: var(--b24-success);
  color: #fff;
  border: 1px solid #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}
/* Бездатная сделка в списке участников — подсветка красным */
.deal-item--undated { background: #fdecec; }
.deal-item--undated:hover { background: #fbdede; }
.deal-item__undated {
  display: inline-block;
  margin-left: 8px;
  background: var(--b24-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  vertical-align: middle;
}

/* Стат «В резерве» (донабор) */
.stat--reserve .stat__value { color: var(--b24-success); }

/* Статус «В резерве» (бездатные кандидаты) — красный */
.deal-item__stage--reserve { background: var(--b24-danger); color: #fff; }

/* ════════════════════════════════════════════════════════════════
   МОБИЛЬНАЯ АДАПТАЦИЯ (телефоны) — добавлено отдельным слоем,
   только переопределения, существующие десктоп-стили не трогаем.
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

  /* ─── Шапка ─── */
  .header__inner { flex-wrap: wrap; gap: 8px; }
  .header__title { font-size: 18px; }
  .header__subtitle { font-size: 11px; }
  .header__controls { flex-wrap: wrap; gap: 6px; align-items: stretch; }
  .toggle-label { font-size: 12px; }

  /* Кнопки шапки/сортировки/вида — компактнее, текст целиком */
  .header__controls .btn,
  .header__controls .btn--sort,
  .header__controls .view-btn {
    font-size: 12px;
    padding: 7px 10px;
    white-space: nowrap;
  }
  /* Важные кнопки с текстом не обрезаем */
  #newSeminarBtn, #fillFromDealsBtn { font-size: 12px; padding: 7px 10px; white-space: nowrap; }
  .view-toggle { flex-wrap: wrap; }
  .sort-group { flex-wrap: wrap; gap: 6px; }
  .calyear-select { font-size: 12px; padding: 5px 6px; }

  /* ─── Вкладки ─── */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; flex: 0 0 auto; font-size: 13px; padding: 9px 12px; }

  /* ─── Набор семинаров: одна колонка ─── */
  .seminars { grid-template-columns: 1fr; padding: 12px; gap: 12px; }

  /* Статы: 5 в ряд тесно — разрешаем перенос по 3 и уменьшаем шрифт */
  .card__stats { flex-wrap: wrap; padding: 12px 8px; }
  .stat { flex: 1 1 33%; padding: 4px 2px; border-right: none; }
  .stat__value { font-size: 16px; }
  .stat__label { font-size: 9px; white-space: nowrap; }

  /* ─── Календарь ─── */
  .cal-grid--2col, .cal-grid--3col { grid-template-columns: 1fr; }
  .cal-nav { flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
  .cal-nav-title { flex: 1 1 100%; order: -1; font-size: 14px; }
  .cal-nav-btn { padding: 6px 10px; font-size: 12px; }
  .cal-month__header { font-size: 12px; padding: 7px 10px; }
  .cal-day { padding: 2px; }
  .cal-day__num { font-size: 9px; line-height: 16px; }
  .cal-widget { padding: 1px 3px; }
  .cal-widget__name { font-size: 9px; }
  .cal-widget__stat, .cal-widget__paid { font-size: 8px; }
  .cal-bar { font-size: 10px; padding: 0 3px; }
  .cal-chip { font-size: 8px; }
  .cal-legend { gap: 10px; }
  .cal-legend-item { font-size: 11px; }

  /* ─── Модалки (универсально) ─── */
  .modal-overlay { padding: 12px; }
  .modal,
  .modal--hub, .modal--cand, .modal--deals, .modal--task,
  .modal--narrow, .modal--wide, .modal--pin {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal--pin-center { width: 100%; max-width: 100%; }

  /* Сделки в модалке */
  .deals-stats { flex-wrap: wrap; gap: 10px 16px; }
  .deal-item { padding: 10px 12px; gap: 10px; }
  .deal-item__info { min-width: 0; }
  .deal-item__name, .deal-item__sub { overflow: hidden; text-overflow: ellipsis; }
  .modal__header-actions { flex-wrap: wrap; gap: 6px; }

  /* Форма семинара */
  .sem-form-row { flex-direction: column; gap: 10px; }
  .sem-form-row label { min-width: 0; width: 100%; }

  /* Кандидаты */
  .cand-item { flex-wrap: wrap; }
  .cand-meta { white-space: normal; }
  .cand-toolbar { flex-wrap: wrap; gap: 6px; }

  /* ─── Аналитика ─── */
  .kpi-cards { flex-direction: column; }
  .chart-box canvas { max-width: 100%; }

  /* Таблицы — горизонтальный скролл */
  .funnel-table-wrap, .rs-table-wrap, .geo-table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }

  /* ─── Повторные продажи ─── */
  .rs-toolbar { flex-wrap: wrap; gap: 8px; }
  .rs-toolbar__group { flex: 1 1 100%; }
  .rs-select { width: 100%; }
  .rs-result-actions { flex-wrap: wrap; gap: 8px; }
  .rs-filters { flex-wrap: wrap; gap: 8px; }

  /* ─── Гео ─── */
  .geo-summary { flex-wrap: wrap; }
  .geo-toolbar { flex-wrap: wrap; gap: 8px; }
  .geo-toolbar__group { flex: 1 1 100%; }
  .geo-mode-switch { flex-wrap: wrap; }

  /* ─── Окупаемость ─── */
  .roi-row { flex-wrap: wrap; }
  .roi-input-wrap { flex: 1 1 100%; }
  .roi-compound { flex-wrap: wrap; }
  .roi-summary__cards { grid-template-columns: repeat(2, 1fr) !important; }
  .roi-summary__footer { flex-wrap: wrap; gap: 12px; }
  .roi-mode-toggle { flex-wrap: wrap; }

  /* ─── Мастер выезда ─── */
  .trip-pick { flex-direction: column; gap: 12px; }
  .trip-pick label { width: 100%; }
  .trip-inputs { grid-template-columns: 1fr; }
  .trip-panels { grid-template-columns: 1fr; }
  .trip-verdict { flex-wrap: wrap; gap: 12px; }
  .trip-toolbar { flex-wrap: wrap; }
  .estimate-params { flex-wrap: wrap; }
}

@media (max-width: 400px) {

  .header__title { font-size: 17px; }
  .header__controls .btn,
  .header__controls .btn--sort,
  .header__controls .view-btn,
  #newSeminarBtn, #fillFromDealsBtn { font-size: 11px; padding: 6px 8px; }

  .tab { font-size: 12px; padding: 8px 10px; }

  /* Статы ещё мельче, чтобы цифры не наезжали */
  .stat__value { font-size: 15px; }
  .stat__label { font-size: 8px; }

  /* Календарь — самые узкие экраны */
  .cal-day__num { font-size: 8px; }
  .cal-widget__name { font-size: 8px; }
  .cal-weekday { font-size: 8px; }

  .roi-summary__cards { grid-template-columns: 1fr !important; }
  .kpi-cards { flex-direction: column; }
}

/* Лиды: счётчик и пометка */
.stat--leads .stat__value { color: var(--b24-blue-dark); }
.deals-stat__num--lead { color: var(--b24-blue-dark); }
.deal-item--lead { background: #eef6ff; }
.deal-item--lead:hover { background: #e3f0fd; }
.deal-item__lead {
  display: inline-block;
  margin-left: 8px;
  background: var(--b24-blue-dark);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  vertical-align: middle;
}

/* Лиды: счётчик на плашке, строка и тег в списке */
.stat--leads .stat__value { color: #8e44ad; }
.deals-stat__num--lead { color: #8e44ad; }
.deal-item--lead { background: #f5eefb; }
.deal-item--lead:hover { background: #efe3f9; }
.deal-item__lead {
  display: inline-block;
  margin-left: 8px;
  background: #8e44ad;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  vertical-align: middle;
}

/* ─── Бенчмарк лидов: тулбар над графиком ──────────────────────────────── */
.lb-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 14px;
}
.lb-toolbar__presets { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-btn {
  padding: 5px 14px;
  border: 1px solid var(--b24-border);
  border-radius: 20px;
  background: var(--b24-white);
  font-size: 12px;
  font-weight: 600;
  color: var(--b24-text-light);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.lb-btn:hover { border-color: var(--b24-blue-dark); color: var(--b24-blue-dark); }
.lb-btn--active { background: var(--b24-blue-dark); border-color: var(--b24-blue-dark); color: #fff; }

/* ─── Сводка под графиком ───────────────────────────────────────────────── */
.lb-summary { padding-top: 14px; border-top: 1px solid var(--b24-border); margin-top: 14px; }
.lb-summary-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.lb-sum-card {
  flex: 1;
  min-width: 140px;
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lb-sum-card--prev { border-style: dashed; opacity: 0.82; }
.lb-sum-label { font-size: 10px; font-weight: 700; color: var(--b24-text-light); text-transform: uppercase; letter-spacing: .5px; }
.lb-sum-num { font-size: 26px; font-weight: 800; color: var(--b24-text); line-height: 1.2; }
.lb-sum-num--blue { color: #1aa3e0; }
.lb-sum-num--green { color: #27ae60; }
.lb-sum-nums { font-size: 13px; font-weight: 600; color: var(--b24-text); }
.lb-sum-change { font-size: 12px; font-weight: 700; }
.lb-sum-change--up { color: #27ae60; }
.lb-sum-change--down { color: #e53935; }

/* ─── Заголовок "Список клиентов для продаж" в повторных продажах ────────── */
.rs-list-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--b24-primary-soft);
  border: 1px solid rgba(26,158,208,0.25);
  border-left: 4px solid var(--b24-primary);
  border-radius: var(--radius);
}
.rs-list-title:empty { display: none; }
.rs-list-title__label {
  font-size: 13px;
  font-weight: 800;
  color: var(--b24-primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.rs-list-title__seminar,
.rs-list-title__filter {
  font-size: 13px;
  color: var(--b24-text);
  white-space: nowrap;
}
.rs-list-title__filter { color: var(--b24-text-light); }
.rs-list-title b { color: var(--b24-text); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════════
   ВКЛАДКА «ЗВОНКИ»
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── PIN-модалка ─────────────────────────────────────────────────────────── */
.calls-pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calls-pin-box {
  position: relative;
  background: var(--b24-white);
  border-radius: 12px;
  padding: 40px 36px 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
}

.calls-pin-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--b24-text-light);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.calls-pin-close:hover { background: var(--b24-bg); color: var(--b24-text); }

.calls-pin-icon { font-size: 40px; line-height: 1; }
.calls-pin-title { font-size: 18px; font-weight: 700; color: var(--b24-text); }
.calls-pin-hint  { font-size: 13px; color: var(--b24-text-light); text-align: center; }

.calls-pin-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  border: 2px solid var(--b24-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.calls-pin-input:focus { border-color: var(--b24-primary); }

.calls-pin-error {
  color: var(--b24-danger);
  font-size: 13px;
  font-weight: 600;
}

.calls-pin-submit { width: 100%; margin-top: 4px; }

@keyframes calls-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}
.calls-pin-shake { animation: calls-shake 0.4s ease; }

/* ─── Обёртка вкладки ─────────────────────────────────────────────────────── */
.calls-wrap {
  padding: 16px 20px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  gap: 0;
  align-items: flex-start;
}

/* ─── Шапка периодов ──────────────────────────────────────────────────────── */
.calls-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.calls-periods {
  display: flex;
  gap: 0;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calls-period-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: var(--b24-white);
  color: var(--b24-text);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.calls-period-btn + .calls-period-btn { border-left: 1px solid var(--b24-border); }
.calls-period-btn:hover { background: var(--b24-bg); }
.calls-period-btn--active {
  background: var(--b24-primary);
  color: #fff;
  font-weight: 700;
}

.calls-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.calls-date-input {
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  color: var(--b24-text);
  background: var(--b24-white);
  cursor: pointer;
  outline: none;
}
.calls-date-input:focus {
  border-color: var(--b24-primary);
}
.calls-date-sep {
  color: var(--b24-muted);
  font-size: 13px;
}
.calls-date-apply {
  padding: 6px 14px;
  font-size: 13px;
}

/* ─── KPI-ряд ─────────────────────────────────────────────────────────────── */
.calls-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .calls-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .calls-kpi-row { grid-template-columns: 1fr; } }

.calls-kpi-card {
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--b24-shadow);
}
.calls-kpi-card--warn { border-top: 3px solid var(--b24-warning); }
.calls-kpi-card--ok   { border-top: 3px solid var(--b24-success); }

.calls-kpi-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--b24-text);
  line-height: 1.1;
}
.calls-kpi-label {
  font-size: 12px;
  color: var(--b24-text-light);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.calls-kpi-sub {
  font-size: 11px;
  color: var(--b24-text-light);
  margin-top: 3px;
}

/* ─── Секции ──────────────────────────────────────────────────────────────── */
.calls-section {
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--b24-shadow);
}

.calls-section__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--b24-text);
  margin-bottom: 14px;
}
.calls-section__title--red    { color: var(--b24-danger); }
.calls-section__title--green  { color: var(--b24-success); }
.calls-section__title--yellow { color: #F57F17; }

/* ─── Таблица менеджеров ──────────────────────────────────────────────────── */
.calls-table-wrap { overflow-x: auto; }

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

.calls-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--b24-text-light);
  border-bottom: 1px solid var(--b24-border);
  white-space: nowrap;
}

.calls-manager-row {
  cursor: pointer;
  transition: background 0.1s;
}
.calls-manager-row:hover { background: var(--b24-hover); }

.calls-td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--b24-border);
  vertical-align: middle;
}
.calls-td--name { font-weight: 600; }
.calls-manager-phone { font-size: 12px; font-weight: 400; color: var(--b24-text-light); margin-top: 2px; }

/* ─── KPI плоский ряд (8 плашек) ────────────────────────────────────────── */
.calls-kpi-groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr) repeat(4, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0;
  background: var(--b24-white);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--b24-shadow);
  margin-bottom: 20px;
}

.calls-kpi-group-hdr {
  grid-column: span 4;
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--b24-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--b24-bg);
  border-bottom: 1px solid var(--b24-border);
}
.calls-kpi-group-hdr--ol {
  border-left: 2px solid var(--b24-border);
}

/* Карточки внутри плоского ряда */
.calls-kpi-groups .calls-kpi-card {
  border: none;
  border-right: 1px solid var(--b24-border);
  border-radius: 0;
  box-shadow: none;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.calls-kpi-groups .calls-kpi-card:last-child { border-right: none; }
/* Первая карточка OL — добавляем левую черту-разделитель */
.calls-kpi-groups .calls-kpi-card:nth-child(7) { border-left: 2px solid var(--b24-border); }

@media (max-width: 900px) {
  .calls-kpi-groups { grid-template-columns: repeat(2, 1fr) repeat(2, 1fr); }
  .calls-kpi-group-hdr { grid-column: span 2; }
  .calls-kpi-groups .calls-kpi-card:nth-child(7) { border-left: none; }
}
@media (max-width: 500px) {
  .calls-kpi-groups { grid-template-columns: 1fr 1fr; }
}

/* ─── Таблицы рядом ──────────────────────────────────────────────────────── */
.calls-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.calls-tables-row .calls-section { margin-bottom: 0; }
@media (max-width: 900px) { .calls-tables-row { grid-template-columns: 1fr; } }

/* ─── Нижняя строка: Не перезвонили + Ждут ─────────────────────────────── */
.calls-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .calls-bottom-row { grid-template-columns: 1fr; } }

/* ─── CRM-ссылка ─────────────────────────────────────────────────────────── */
.crm-link {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--b24-primary);
  background: rgba(82, 130, 255, 0.08);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.crm-link:hover { background: rgba(82, 130, 255, 0.18); }
.calls-td--num  { text-align: center; }

.calls-expand-icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  color: var(--b24-text-light);
  transition: transform 0.15s;
}

/* ─── Бейджи ──────────────────────────────────────────────────────────────── */
.calls-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.calls-badge--red    { background: #FDECEA; color: var(--b24-danger); }
.calls-badge--orange { background: #FFF3E0; color: #E65100; }
.calls-badge--yellow { background: #FFFDE7; color: #F57F17; }
.calls-badge--green  { background: #E8F5E9; color: var(--b24-success); }

/* ─── Раскрытые строки ────────────────────────────────────────────────────── */
.calls-detail-cell {
  padding: 0 12px 12px 32px;
  background: var(--b24-bg);
}

.calls-inner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}
.calls-inner-table th {
  padding: 6px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--b24-text-light);
  border-bottom: 1px solid var(--b24-border);
}
.calls-detail-inner td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--b24-border);
  vertical-align: middle;
}

/* ─── Счётчик в заголовке секции ──────────────────────────────────────────── */
.calls-count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  margin-left: 6px;
}
.calls-section__title--red    .calls-count-chip { background: #FDECEA; color: var(--b24-danger); }
.calls-section__title--yellow .calls-count-chip { background: #FFFDE7; color: #F57F17; }
.calls-section__title--green  .calls-count-chip { background: #E8F5E9; color: var(--b24-success); }

.calls-period-label { font-size: 12px; font-weight: 400; opacity: 0.7; margin-left: 8px; }

/* ─── Карточки инцидентов (Без реакции / В работе / Обработано) ──────────── */
.calls-incidents-list { display: flex; flex-direction: column; gap: 6px; }

.calls-incident {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--b24-bg);
  border: 1px solid var(--b24-border);
  border-radius: var(--radius);
  transition: background .15s;
}
.calls-incident:hover { background: var(--b24-hover); }

.calls-incident__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.calls-incident__phone {
  font-size: 14px;
  font-weight: 700;
  color: var(--b24-text);
  white-space: nowrap;
}
.calls-incident__mid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}
.calls-incident__manager { font-size: 12px; color: var(--b24-text-light); }
.calls-incident__time    { font-size: 12px; color: var(--b24-text-light); }
.calls-incident__crm     { display: flex; flex-direction: column; gap: 1px; align-items: flex-end; }
.calls-incident__ename   { font-size: 11px; color: var(--b24-text-light); font-style: italic; }
.calls-incident__right   { white-space: nowrap; }

/* ─── Не перезвонили (legacy, для обратной совместимости) ─────────────────── */
.calls-nc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.calls-nc-item {
  background: var(--b24-bg);
  border: 1px solid #FDECEA;
  border-left: 4px solid var(--b24-danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calls-nc-phone   { font-size: 15px; font-weight: 700; color: var(--b24-text); }
.calls-nc-manager { font-size: 12px; color: var(--b24-text-light); }
.calls-nc-time    { font-size: 12px; color: var(--b24-text-light); }
.calls-nc-since   { align-self: flex-start; margin-top: 2px; }

.calls-muted { color: var(--b24-text-light); font-style: italic; }
.calls-empty {
  text-align: center;
  padding: 24px;
  color: var(--b24-text-light);
}
.calls-error {
  padding: 16px 20px;
  color: var(--b24-danger);
  background: #FDECEA;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

/* ─── Плашка «Загрузить данные» (Набор на семинары) ─────────────────────── */
.seminars-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--b24-text-light);
}
.seminars-placeholder__icon { font-size: 48px; line-height: 1; }
.seminars-placeholder__text { font-size: 16px; font-weight: 500; }
.seminars-placeholder__btn  { font-size: 15px; padding: 12px 32px; }

/* ─── Блоки звонков и открытых линий ─────────────────────────────────────── */
.calls-block {
  flex: 1;
  min-width: 0;
  padding: 0 20px;
  border-right: 1px solid var(--b24-border);
}
.calls-block:first-child {
  padding-left: 0;
}
.calls-block:last-child {
  border-right: none;
  padding-right: 0;
}
.calls-block__header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.calls-block__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--b24-text);
  white-space: nowrap;
}

/* Кнопки периода для открытых линий */
.ol-period-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: var(--b24-white);
  color: var(--b24-text);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ol-period-btn + .ol-period-btn { border-left: 1px solid var(--b24-border); }
.ol-period-btn:hover:not(:disabled) { background: var(--b24-bg); }
.ol-period-btn--active {
  background: var(--b24-primary);
  color: #fff;
  font-weight: 700;
}
.ol-period-btn:disabled,
.calls-period-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
