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

/* ─── Elevation system (dark theme) ──────────────────────────────────────────
   Чёрные тени на тёмном фоне почти не видны, поэтому стек теней такой:
   1) tonkий 1px white inset сверху — имитирует свет;
   2) ближняя контактная тень — отделяет от подложки;
   3) дальняя ambient — даёт мягкую глубину.
   Hover на kpi-cards добавляет тёплый «подъём» через увеличение тени и
   transform: translateY(-2px) (анимируется через transform — не reflow). */
:root {
  --shadow-elev-1:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 1px 2px rgba(0,0,0,0.45),
    0 6px 16px -2px rgba(0,0,0,0.28);
  --shadow-elev-2:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 1px 3px rgba(0,0,0,0.5),
    0 8px 22px -4px rgba(0,0,0,0.42),
    0 4px 8px -2px rgba(0,0,0,0.28);
  --shadow-elev-2-hover:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 14px 32px -6px rgba(0,0,0,0.55),
    0 6px 12px -3px rgba(0,0,0,0.36);
  --shadow-elev-3:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 24px 56px -10px rgba(0,0,0,0.65),
    0 12px 24px -6px rgba(0,0,0,0.45);
  --surface-card-gradient: linear-gradient(180deg, #1e293b 0%, #1a2336 100%);
  --surface-block-gradient: linear-gradient(180deg, #1e293b 0%, #1b2435 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  height: 100vh;
  overflow: hidden;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px 20px;
  border-bottom: 1px solid #334155;
}

.logo-img { height: 28px; width: auto; margin: 0 auto; padding-right: 20px; }
.logo-text { font-size: 18px; font-weight: 700; color: #f1f5f9; }

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
.nav::-webkit-scrollbar-track { background: transparent; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-item:hover { background: #334155; color: #e2e8f0; }
.nav-item.active { background: rgba(14,165,233,0.5); color: #e2e8f0; }
.nav-svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover .nav-svg { opacity: 1; }
.nav-item.active .nav-svg { opacity: 1; }

.nav-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
  padding: 16px 12px 4px;
}
.nav-section:first-child {
  padding-top: 0;
}

/* Source badges in nav */
.src-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: auto;
  vertical-align: middle;
  opacity: 0.7;
  flex-shrink: 0;
}
.src-sql { background: #1e3a5f; color: #38bdf8; }
.src-gs  { background: #14532d; color: #4ade80; }
.src-mix { background: #3b1f5e; color: #c084fc; }

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid #334155;
}

.logout-btn {
  width: 100%;
  padding: 9px;
  background: transparent;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.logout-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ─── Бейдж версии в футере ──────────────────────────────────────────────── */
.version-badge {
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: #64748b;            /* серый — prod, ненавязчиво */
  text-align: center;
  cursor: default;
  word-break: break-all;
}
.version-badge--dev {
  background: #422006;       /* тёмно-жёлтая подложка под тёмную тему */
  color: #fbbf24;            /* янтарный текст — это dev */
  font-weight: 600;
}

/* ─── Main ───────────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid #334155;
  background: #1e293b;
}

.topbar h2 { font-size: 20px; font-weight: 700; color: #94a3b8; }

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

.date-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 4px 12px;
}

.date-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
}

.date-icon { color: #64748b; flex-shrink: 0; }

.date-input {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  padding: 4px 2px;
  cursor: pointer;
  width: auto;
  field-sizing: content;
  text-align: center;
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.refresh-btn {
  padding: 7px 16px;
  background: rgba(14,165,233,0.5);
  border: none;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.refresh-btn:hover { background: rgba(14,165,233,0.7); color: #e2e8f0; }

.date-presets { display: flex; gap: 6px; align-items: center; }
.month-nav { display: flex; align-items: center; gap: 0; }
.month-arrow {
  width: 24px; height: 32px;
  background: rgba(71,85,105,0.4);
  border: 1px solid rgba(71,85,105,0.6);
  color: #94a3b8;
  font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.month-arrow:first-child { border-radius: 8px 0 0 8px; border-right: none; }
.month-arrow:last-child  { border-radius: 0 8px 8px 0; border-left: none; }
.month-arrow:hover { background: rgba(14,165,233,0.5); color: #e2e8f0; }
.month-arrow.is-disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.month-nav .preset-btn { border-radius: 0; border-left: none; border-right: none; }
/* Фикс. ширина лейблов: текст внутри меняет длину (Сегодня ↔ 30 сен 2025,
   Неделя ↔ 28 сен – 4 окт, Май 2026 ↔ Сентябрь 2026) — без width бокс «прыгал»
   и стрелка уезжала из-под курсора. Центрируем + ellipsis на всякий случай. */
.month-label {
  width: 130px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-btn {
  padding: 7px 12px;
  background: rgba(71,85,105,0.4);
  border: 1px solid rgba(71,85,105,0.6);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.preset-btn:hover { background: rgba(14,165,233,0.5); color: #e2e8f0; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface-card-gradient);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow-elev-2);
  transition: transform 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out;
}
@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-2px);
    border-color: #475569;
    box-shadow: var(--shadow-elev-2-hover);
  }
}

.card-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: #94a3b8;
}

.card-value.green { color: rgba(52,211,153,0.6); }
.card-value.blue  { color: rgba(56,189,248,0.6); }
.card-value.purple{ color: rgba(167,139,250,0.6); }
.card-value.orange{ color: rgba(245,158,11,0.6); }

.card-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}

/* KPI cards (leads page) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface-card-gradient);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 20px 24px;
  text-align: center;
  box-shadow: var(--shadow-elev-2);
  transition: transform 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out;
}
@media (prefers-reduced-motion: no-preference) {
  .kpi-card:hover {
    transform: translateY(-2px);
    border-color: #475569;
    box-shadow: var(--shadow-elev-2-hover);
  }
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #94a3b8;
}

.kpi-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

.kpi-card.kpi-blue   .kpi-value { color: rgba(56,189,248,0.6); }
.kpi-card.kpi-green  .kpi-value { color: rgba(52,211,153,0.6); }
.kpi-card.kpi-orange .kpi-value { color: rgba(245,158,11,0.6); }
.kpi-card.kpi-purple .kpi-value { color: rgba(167,139,250,0.6); }

.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  white-space: nowrap;
}

/* Flatpickr: год в виде dropdown вместо numeric input */
.flatpickr-year-select {
  background: transparent;
  color: #e2e8f0;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 4px;
  appearance: none;
  -webkit-appearance: none;
}
.flatpickr-year-select:hover { color: #38bdf8; }
.flatpickr-year-select option { background: #1e293b; color: #e2e8f0; }

/* ── Единый стиль выпадающих списков портала (#287) ────────────────────── */
.portal-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255,255,255,0.04);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 30px 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.portal-select:hover { border-color: rgba(255,255,255,0.25); }
.portal-select:focus { outline: none; border-color: #38bdf8; }
.portal-select option { background: #1e293b; color: #e2e8f0; }

@supports (appearance: base-select) {
  .portal-select, .portal-select::picker(select) { appearance: base-select; }
  /* base-select несёт собственную стрелку ::picker-icon — прячем, стрелка у нас
     своя (SVG в background), иначе двойная + перенос строки в узких контролах. */
  .portal-select::picker-icon { display: none; }
  .portal-select::picker(select) {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  }
  .portal-select option { padding: 6px 10px; border-radius: 6px; }
  .portal-select option:hover { background: rgba(56,189,248,0.12); }
  .portal-select option:checked { color: #38bdf8; }
}

.sortable:hover { color: #38bdf8; }

.table-paging-btn {
  background: rgba(56,189,248,0.1);
  color: #38bdf8;
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: 8px;
  padding: 6px 18px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.table-paging-btn:hover { background: rgba(56,189,248,0.2); }

.badge-gray { background: rgba(100,116,139,0.2); color: #94a3b8; }

tbody tr td strong { color: #94a3b8; }

.amount-red { color: rgba(252,165,165,0.6) !important; }
.amount-orange { color: rgba(251,191,36,0.6) !important; }
.amount-green { color: rgba(52,211,153,0.6) !important; }

.thresh-btn {
  background: #1e293b; color: #94a3b8; border: 1px solid #334155;
  padding: 6px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.thresh-btn:hover { background: #334155; color: #e2e8f0; }
.thresh-btn.active {
  background: rgba(14,165,233,0.5); color: #e2e8f0; border-color: rgba(14,165,233,0.5);
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface-card-gradient); border-radius: 12px; padding: 20px;
  max-width: 1000px; width: 100%; max-height: 90vh; overflow-y: auto;
  border: 1px solid #334155;
  box-shadow: var(--shadow-elev-3);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #334155;
}
.modal-header h3 { margin: 0; color: #e2e8f0; }
.modal-close {
  background: transparent; border: none; color: #94a3b8;
  font-size: 28px; cursor: pointer; line-height: 1; padding: 0 8px;
}
.modal-close:hover { color: #e2e8f0; }

.table-fixed { table-layout: fixed; }
.table-fixed td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── .table-smart ──────────────────────────────────────────────────────────
   Универсальный шаблон для таблиц: ширина колонок подстраивается под
   содержимое, ничего не обрезается, числовые колонки центрированы.
   Таблица НЕ растягивается на всю ширину родителя — её ширина равна сумме
   колонок, но не больше контейнера (max-width:100%). Это убирает пустое
   место в маленьких таблицах на широких экранах.
   Конвенция разметки:
     <table class="table-smart">
       <th class="col-name">Врач</th>   ← left-align (текстовая колонка)
       <th>Пациентов</th>                ← числовая, центрирована
       ...
     </table>
     <td class="col-name">ФИО</td>       ← та же колонка в tbody
   ──────────────────────────────────────────────────────────────────────── */
.table-smart {
  table-layout: auto;
  width: auto;        /* по содержимому */
  max-width: 100%;    /* но не шире контейнера */
}
.table-smart th,
.table-smart td {
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 10px;
  text-align: center;
}
.table-smart th.col-name,
.table-smart td.col-name {
  text-align: left;
  padding-left: 24px;
}

/* ─── Charts row ─────────────────────────────────────────────────────────── */

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.charts-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

/* Источники пациентов — большой пирог слева на 2 ряда, 2 мелких справа */
.charts-grid-sources {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-bottom: 24px;
}
.charts-grid-sources .chart-sources-big {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
}

.chart-card {
  background: var(--surface-block-gradient);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 20px 24px;
  min-width: 0;
  box-shadow: var(--shadow-elev-1);
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-wrap { position: relative; height: 220px; }
.chart-wrap[style*="flex"] { height: auto; }

/* ─── Table ──────────────────────────────────────────────────────────────── */

.table-card {
  background: var(--surface-block-gradient);
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
  box-shadow: var(--shadow-elev-1);
}

/* Все .table-card сжимаются до ширины содержимого, но не шире контейнера.
   На широких экранах хедер с фильтрами остаётся над таблицей, а не
   уезжает на весь экран. max-width:100% — адаптивность на узких экранах. */
.table-card {
  width: fit-content;
  max-width: 100%;
}
/* Вертикальный скроллбар внутри table-card не должен съедать горизонтальное
   место и вызывать ложный горизонтальный скролл. */
.table-card > div[style*="overflow"] {
  scrollbar-gutter: stable;
}

/* Ряд карточек одного уровня: складываются бок о бок если помещаются,
   переносятся на следующую строку если нет. Каждая карточка — естественной
   ширины, а не 50/50 как в .charts-row. */
.cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;   /* карточки одной высоты */
  margin-bottom: 24px;
}
.cards-row > .table-card {
  display: flex;
  flex-direction: column;
}
/* Scroll-wrapper внутри cards-row: растёт до высоты карточки,
   скроллит только если реально не помещается */
.cards-row > .table-card > div[style*="overflow"] {
  flex: 1;
}

.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.table-card-header h3,
.table-card > h3 {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Fallback: голый h3 внутри table-card (без обёртки .table-card-header)
   получает те же отступы. Закрывает #100 + предотвращает повтор. */
.table-card > h3 {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  margin: 0;
}

.search-input {
  padding: 7px 12px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
  width: 220px;
}
.search-input:focus { border-color: #38bdf8; }

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

thead th {
  padding: 12px 16px;
  text-align: left;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #334155;
  background: #1e293b;
  position: sticky;
  top: 0;
}

tbody tr { border-bottom: 1px solid #1e293b; }
tbody tr:hover { background: #334155; }
tbody td { padding: 11px 16px; color: #cbd5e1; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-blue { background: rgba(56,189,248,0.15); color: #38bdf8; }
.badge-green { background: rgba(52,211,153,0.15); color: #34d399; }

.loading {
  text-align: center;
  color: #64748b;
  padding: 60px;
  font-size: 16px;
}

.empty {
  text-align: center;
  color: #64748b;
  padding: 40px;
  font-size: 14px;
}

.amount { font-weight: 600; color: #34d399; }

/* ─── Patient accordion ─────────────────────────────────────────────────── */

.patient-row {
  cursor: pointer;
  transition: background 0.15s;
}

.patient-row:hover { background: #334155; }

.patient-row.expanded {
  background: #334155;
  border-bottom: none;
}

.patient-row .arrow {
  display: inline-block;
  width: 16px;
  font-size: 11px;
  color: #64748b;
  transition: color 0.15s;
}

.patient-row:hover .arrow { color: #38bdf8; }

.detail-header-row td {
  padding: 6px 16px !important;
  color: #475569 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #283548 !important;
}

.detail-label {
  font-weight: 600 !important;
}

.detail-row {
  background: #162032;
}

.detail-row td {
  padding: 8px 16px !important;
  color: #94a3b8 !important;
  font-size: 12px !important;
  border-bottom: 1px solid #1c2b3f !important;
}

.detail-row .amount {
  color: #6ee7b7 !important;
  font-weight: 500;
}

.detail-row:last-child td {
  border-bottom: 2px solid #334155 !important;
}

/* ─── SQL Console ────────────────────────────────────────────────────────── */

.sql-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 120px);
}

.schema-panel {
  width: 240px;
  min-width: 240px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.schema-panel-title {
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #334155;
}

.schema-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.schema-item {
  padding: 6px 10px;
  font-size: 12px;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.12s;
}

.schema-item:hover { background: #334155; color: #e2e8f0; }
.schema-item.active { background: rgba(14,165,233,0.5); color: #e2e8f0; }

.schema-columns {
  border-top: 1px solid #334155;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
}

.schema-columns-title {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
}

.schema-col {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
}

.schema-col:hover { background: #334155; }
.schema-col-name { color: #cbd5e1; }
.schema-col-type { color: #475569; font-size: 10px; }

.sql-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sql-editor-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
}

.sql-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 200px;
  padding: 16px;
  background: #0f172a;
  border: none;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.sql-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid #334155;
}

.sql-run-btn {
  padding: 7px 20px;
  background: rgba(14,165,233,0.5);
  border: none;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.sql-run-btn:hover { opacity: 0.9; }
.sql-run-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sql-hint {
  font-size: 11px;
  color: #475569;
}

.sql-result-card {
  flex: 1;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
}

.sql-result-info {
  padding: 10px 16px;
  font-size: 12px;
  color: #64748b;
  border-bottom: 1px solid #334155;
}

.sql-error {
  padding: 16px;
  color: #fca5a5;
  background: rgba(239,68,68,0.1);
  font-size: 13px;
}

/* ─── Deploy page ───────────────────────────────────────────────────────── */

.deploy-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 700px;
}

.deploy-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 28px;
}

.deploy-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 12px;
}

.deploy-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 20px;
}

.deploy-branch-label {
  display: block;
  margin: 0 0 14px;
  font-size: 13px;
  color: #94a3b8;
}
/* Селектор веток + быстрая кнопка «Деплой main» в одну строку (#264) */
.deploy-branch-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 14px;
}
.deploy-branch-row .deploy-branch-label { flex: 1; margin: 0; }
/* Визуальный стиль — .portal-select (#287); здесь только layout. */
.deploy-branch-select {
  display: block;
  margin-top: 6px;
  width: 100%;
  max-width: 360px;
}

.deploy-btn {
  padding: 12px 32px;
  background: rgba(14,165,233,0.5);
  border: none;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.deploy-btn:hover { opacity: 0.9; }
.deploy-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Компактная кнопка «Деплой main» рядом с селектором веток (#264).
   Идёт ПОСЛЕ .deploy-btn — иначе при равной специфичности padding/font не перебить. */
.deploy-btn-main {
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
}

.deploy-log-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 20px;
}

.deploy-log-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.deploy-log {
  background: #0f172a;
  border-radius: 8px;
  padding: 12px 16px;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
}

.deploy-line {
  padding: 4px 0;
  line-height: 1.5;
}

.deploy-time {
  color: #475569;
  margin-right: 8px;
}

.deploy-info { color: #94a3b8; }
.deploy-success { color: #34d399; }
.deploy-error { color: #fca5a5; }

/* ─── Wiki (база знаний) ─────────────────────────────────────────────────── */

.wiki { max-width: 980px; margin: 0 auto; color: #cbd5e1; line-height: 1.55; }
.wiki a { color: #38bdf8; text-decoration: none; }
.wiki a:hover { text-decoration: underline; }
.wiki code {
  font-family: "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(14,165,233,0.1);
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: 4px;
}
.wiki kbd {
  font-family: inherit;
  font-size: 0.85em;
  background: #0b1220;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 4px;
  padding: 1px 6px;
  color: #e2e8f0;
}

.wiki-intro {
  background: linear-gradient(135deg, rgba(14,165,233,0.1), rgba(139,92,246,0.08));
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 32px;
}
.wiki-intro h1 {
  margin: 0 0 10px;
  font-size: 26px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.wiki-intro p { margin: 0 0 18px; color: #94a3b8; }

.wiki-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wiki-toc a {
  background: rgba(71,85,105,0.4);
  border: 1px solid rgba(71,85,105,0.6);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}
.wiki-toc a:hover { background: rgba(14,165,233,0.25); color: #e2e8f0; text-decoration: none; }

.wiki-section {
  margin-bottom: 40px;
  scroll-margin-top: 20px;
}
.wiki-section h2 {
  font-size: 22px;
  margin: 0 0 8px;
  color: #e2e8f0;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148,163,184,0.18);
}
.wiki-section h3 {
  font-size: 16px;
  color: #e2e8f0;
  margin: 20px 0 8px;
}

.wiki-tracks {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.wiki-track-btn {
  flex: 1;
  min-width: 220px;
  background: rgba(14,165,233,0.12);
  border: 1px solid rgba(14,165,233,0.4);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: center;
  color: #e2e8f0 !important;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.wiki-track-btn:hover {
  background: rgba(14,165,233,0.25);
  border-color: rgba(14,165,233,0.7);
  transform: translateY(-1px);
  text-decoration: none !important;
}
.wiki-section ul { padding-left: 22px; margin: 10px 0; }
.wiki-section ul li { margin-bottom: 4px; }
.wiki-lead { color: #94a3b8; margin: 8px 0 18px; }
.wiki-note {
  background: rgba(14,165,233,0.08);
  border-left: 3px solid #0ea5e9;
  padding: 10px 14px;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 14px;
  margin: 12px 0;
}

.wiki-code {
  font-family: "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: #0b1220;
  border: 1px solid rgba(148,163,184,0.15);
  border-left: 3px solid #0ea5e9;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 10px 0;
  white-space: pre-wrap;
  color: #cbd5e1;
  overflow-x: auto;
}

/* Пронумерованные шаги */
.wiki-steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 14px;
}
.wiki-steps > li {
  counter-increment: step;
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 10px;
  padding: 16px 20px 16px 62px;
  position: relative;
}
.wiki-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px; top: 16px;
  width: 32px; height: 32px;
  background: #0ea5e9;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.wiki-steps > li h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #e2e8f0;
}
.wiki-steps > li p { margin: 4px 0; color: #cbd5e1; font-size: 14px; }
.wiki-steps > li p:last-child { margin-bottom: 0; }

/* Карточная сетка для Git-терминов */
.wiki-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.wiki-card {
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 10px;
  padding: 14px 16px;
}
.wiki-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #38bdf8;
}
.wiki-card p { margin: 0; font-size: 13px; color: #cbd5e1; }

/* Архитектурный стек */
.wiki-arch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px 0;
}
.wiki-arch-block {
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 12px;
  padding: 14px 20px;
  width: 100%;
  max-width: 520px;
  text-align: center;
}
.wiki-arch-block.highlight {
  border-color: rgba(14,165,233,0.5);
  background: rgba(14,165,233,0.08);
}
.wiki-arch-block h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #e2e8f0;
}
.wiki-arch-block h3 small { color: #64748b; font-weight: 400; font-size: 12px; }
.wiki-arch-block p { margin: 0; font-size: 13px; color: #94a3b8; }
.wiki-arch-arrow { color: #64748b; font-size: 12px; }

/* Ссылки-плитки */
.wiki-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.wiki-link {
  display: block;
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 10px;
  padding: 14px 16px;
  color: #cbd5e1;
  transition: border-color 0.15s, background 0.15s;
}
.wiki-link:hover {
  border-color: rgba(14,165,233,0.5);
  background: rgba(14,165,233,0.08);
  text-decoration: none;
}
.wiki-link h3 { margin: 0 0 4px; font-size: 14px; color: #e2e8f0; }
.wiki-link p { margin: 0; font-size: 12px; color: #94a3b8; }

.wiki-footer {
  text-align: center;
  color: #64748b;
  font-size: 13px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(148,163,184,0.15);
}

/* Кнопка «наверх» — плавающая, появляется после скролла */
.wiki-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 46px;
  height: 46px;
  background: rgba(14,165,233,0.9);
  border: 1px solid rgba(14,165,233,0.6);
  border-radius: 50%;
  color: white;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  z-index: 100;
}
.wiki-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.wiki-to-top:hover {
  background: #0ea5e9;
  transform: translateY(-2px);
}

/* ─── Reviews (страница «Отзывы») ─────────────────────────────────────────── */

.card-value.red { color: rgba(248,113,113,0.7); }

.src-rep { background: #4a2a0a; color: #fbbf24; }

.reviews-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.review-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 16px;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.review-author {
  font-weight: 600;
  font-size: 14px;
  color: #f1f5f9;
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-stars {
  display: inline-flex;
  gap: 1px;
  font-size: 14px;
  letter-spacing: 1px;
}
.review-stars .star { color: #475569; }
.review-stars .star.on { color: #fbbf24; }

.review-source {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.review-date {
  font-size: 12px;
  color: #64748b;
}

.review-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.review-tag-ok   { background: rgba(34,197,94,0.15);  color: #4ade80; }
.review-tag-warn { background: rgba(245,158,11,0.15); color: #fbbf24; }

.review-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.review-answer {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(14,165,233,0.07);
  border-left: 3px solid rgba(14,165,233,0.5);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
}

.review-answer-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #38bdf8;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.review-footer {
  margin-top: 10px;
  font-size: 12px;
}
.review-footer a {
  color: #38bdf8;
  text-decoration: none;
}
.review-footer a:hover { text-decoration: underline; }

.reviews-empty {
  padding: 40px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

/* Toolbar (фильтры площадка/статус) */
.reviews-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
/* Визуальный стиль — .portal-select (#287); здесь только layout. */
.reviews-toolbar select { min-width: 160px; }
.reviews-toolbar .reviews-summary {
  margin-left: auto;
  color: #64748b;
  font-size: 12px;
}

/* 2-колоночный layout: узкий sidebar + широкая центральная колонка */
.reviews-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 3fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.reviews-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.reviews-block {
  background: var(--surface-block-gradient);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 0;
  box-shadow: var(--shadow-elev-1);
}
.reviews-block-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin-bottom: 12px;
}

/* Платформы — общий grid 2 колонки (название | оценка+числа). Каждая
   .platform-row — subgrid, наследует колонки родителя, поэтому
   .platform-right у всех строк имеет одинаковую ширину и стартует на
   одной вертикали — оценки и числа не уходят «лесенкой». */
.platforms-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  row-gap: 2px;
}
.platform-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  align-items: center;
  column-gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.platform-row:hover { background: #273449; }
.platform-row.active { background: rgba(14,165,233,0.18); }
.platform-name { color: #e2e8f0; font-weight: 500; min-width: 0; }
.platform-right {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.platform-rate {
  color: #fbbf24;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  /* Фиксированный слот под "X.XX ★" — даже у площадки без оценки слева
     остаётся пустое место, числа справа стартуют на одной вертикали. */
  min-width: 56px;
  text-align: left;
}
.platform-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Топ врачей */
.placeholder-soft {
  color: #64748b;
  font-size: 12px;
  text-align: center;
  padding: 22px 8px;
}

/* Ряд из 6 KPI-плашек на странице «Отзывы».
   Используем minmax(0, 1fr) — иначе содержимое плашек (большие числа,
   звёзды, padding) не даёт 1fr сжиматься, и ряд переполняется по
   горизонтали. Дополнительно даём всем дочерним .card min-width:0,
   чтобы их собственные flex/grid внутри тоже корректно сжимались. */
.reviews-kpi-row {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.reviews-kpi-row > .card { min-width: 0; text-align: center; }

/* «Героические» KPI: заголовок сверху по центру, крупная цифра по центру,
   доп-инфо (sub-текст, progress, sparkline, delta) поднята вплотную к цифре.
   Размер чисел подобран под визуальный вес лидера (аватар 140px). */
.reviews-kpi-row .card-label { margin-bottom: 6px; }
.reviews-kpi-row .card-value { font-size: 52px; line-height: 1; margin: 4px 0; }
.reviews-kpi-row .card-rating .rating-row { justify-content: center; margin: 4px 0; }
.reviews-kpi-row .card-rating .rating-num { font-size: 52px; line-height: 1; }
.reviews-kpi-row .card-sub { margin-top: 4px; }
.reviews-kpi-row .kpi-delta { justify-content: center; margin-top: 4px; }
.reviews-kpi-row .card-spark .spark-wrap { margin-top: 4px; height: 30px; }
.reviews-kpi-row .card-progress .progress-bar { margin: 4px 0; }

/* Адаптив для KPI-ряда: на узких — 3, потом 2, потом 1 */
@media (max-width: 1480px) {
  .reviews-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .reviews-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .reviews-kpi-row { grid-template-columns: 1fr; }
}

/* KPI-карточка лидера (6-я в ряду наверху) */
.card.card-leader {
  background: linear-gradient(135deg, rgba(251,191,36,0.10), rgba(14,165,233,0.10));
  border: 1px solid rgba(251,191,36,0.30);
  display: flex;
  flex-direction: column;
}
.card.card-leader .card-label { color: #fbbf24; }
.leader-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 6px;
  min-width: 0;
  text-align: center;
  flex: 1;
}
.card-leader .avatar-lg { width: 140px; height: 140px; font-size: 52px; }
.leader-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(251,191,36,0.25);
  color: #fbbf24;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.leader-name-sm {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: normal;
  line-height: 1.25;
  word-break: break-word;
}

/* Топ врачей — узкая таблица в боковой колонке: разрешён перенос ФИО */
.top-doctors-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}
.top-doctors-table th, .top-doctors-table td {
  font-size: 12px;
  padding: 6px 6px;
}
.top-doctors-table th.col-name, .top-doctors-table td.col-name {
  white-space: normal;
  word-break: break-word;
  padding-left: 8px;
}
.top-doctors-table th:first-child, .top-doctors-table td:first-child { width: 24px; padding-left: 4px; padding-right: 4px; }
.top-doctors-table th:nth-child(3), .top-doctors-table td:nth-child(3),
.top-doctors-table th:nth-child(4), .top-doctors-table td:nth-child(4) { width: 44px; }
.top-doctors-table tbody tr:hover { background: #273449; }

/* Графики */
.review-chart-wrap {
  position: relative;
  height: 240px;
}
.review-chart-wrap.dist { height: 200px; }

/* Два графика в ряд внутри центральной колонки */
.reviews-charts-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
}
.reviews-charts-row > .reviews-block { min-width: 0; }

/* KPI: средний рейтинг с большими звёздами */
.card-rating .rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 4px;
}
.card-rating .rating-num {
  font-size: 30px;
  font-weight: 700;
  color: #fbbf24;
  line-height: 1;
  letter-spacing: -0.5px;
}
.stars-big { display: inline-flex; gap: 1px; font-size: 16px; line-height: 1; }
.stars-big .sb { color: #334155; }
.stars-big .sb.on { color: #fbbf24; }
.stars-big .sb.half {
  background: linear-gradient(90deg, #fbbf24 50%, #334155 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* KPI: спарклайн под цифрой */
.card-spark { position: relative; padding-bottom: 6px; }
.card-spark .spark-wrap {
  position: relative;
  height: 36px;
  margin-top: 6px;
}

/* Аватары сотрудников. Squircle вместо круга (border-radius: 22% — стиль iOS-иконки).
   Буква-фолбэк рисуется через ::before из data-initial, <img> оверлеит её.
   Если фото не загрузилось (onerror скрывает img), буква снова видна.
   CSS-переменные --face-x/--face-y/--face-zoom настраивают центрирование и зум
   по координатам лица (проставляются скриптом detect_faces.py в team_photos.json). */
.avatar {
  position: relative;
  border-radius: 22%;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}
/* object-position смещает кроп <img> внутри бокса, transform-origin задаёт точку,
   вокруг которой scale() увеличивает <img>. Они намеренно используют ОДНИ И ТЕ ЖЕ
   --face-x/--face-y, чтобы при zoom > 1 центр лица оставался в той же точке аватара. */
.avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--face-x, 50%) var(--face-y, 50%);
  transform: scale(var(--face-zoom, 1));
  transform-origin: var(--face-x, 50%) var(--face-y, 50%);
  display: block;
}
.avatar-xs { width: 24px; height: 24px; font-size: 11px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 38px; height: 38px; font-size: 15px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-popup { width: 170px; height: 170px; font-size: 56px; }

/* Объём/тень для крупных аватаров (lg + popup). На мелких (xs/sm/md) не применяем —
   тень там визуально не считывается, только шум. */
.avatar-elevated {
  box-shadow:
    0 14px 32px rgba(0,0,0,0.55),
    0 6px 12px rgba(0,0,0,0.35),
    0 1px 2px rgba(0,0,0,0.4);
}
.avatar-elevated::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 35%, rgba(0,0,0,0.18) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.06);
}

/* Аватар + текст в одной строке (списки, ячейки таблиц) */
.name-with-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.name-with-avatar .name-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doctor-position {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
  white-space: normal;
}

/* «Доля врача» у имени — виден только при включённом пороге (#199, #201).
   Сам чип = бар: ширина задаётся инлайн как calc(% × 3px), шкала 0–100
   (100% = 300px, 50% = 150px — у разных врачей одинаково). Рядом — число. */
.share-chip {
  display: inline-block;
  height: 7px;
  min-width: 2px;
  margin-left: 8px;
  background: #38bdf8;
  border-radius: 4px;
  vertical-align: middle;
}
.share-num {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  vertical-align: middle;
  white-space: nowrap;
}

/* В KPI-плашке «Лидер» — старый класс leader-avatar-sm стал не нужен,
   но оставляем стиль на случай если где-то ещё используется. */

/* Иконки площадок отзывов (favicon через Google API) */
.platform-ico {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.platform-name { display: inline-flex; align-items: center; }
.platform-ico-all {
  display: inline-block;
  width: 16px; height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  flex-shrink: 0;
}
.review-source { display: inline-flex; align-items: center; gap: 4px; }
.review-source .platform-ico { margin-right: 0; }

/* Кликабельные строки и плашки */
.card-clickable { cursor: pointer; }
.top-doctor-row { cursor: pointer; transition: background 0.15s; }
.top-doctor-row:hover { background: #273449; }
.top-doctor-row:active { background: #2d3a52; }

/* Шапка модалки с отзывами врача */
.doctor-modal-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 4px 0 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #334155;
}
.doctor-modal-info { flex: 1; min-width: 0; }
.doctor-modal-name {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
}
.doctor-modal-position {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 10px;
}
.doctor-modal-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.doctor-modal-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dms-num { font-size: 18px; font-weight: 700; color: #e2e8f0; line-height: 1; }
.dms-label { font-size: 10.5px; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }


/* YoY-дельта в KPI-плашках («▲ +12%   было 50»). */
.kpi-delta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.2;
  flex-wrap: wrap;
}
.kpi-delta-arrow { font-size: 9px; }
.kpi-delta-pct { font-weight: 600; }
.kpi-delta-prev { color: #64748b; font-size: 10.5px; }
.kpi-delta-good { color: #4ade80; }
.kpi-delta-bad  { color: #f87171; }
.kpi-delta-flat { color: #64748b; }
/* display:flex перебивает UA-правило [hidden]{display:none} — фиксируем явно (#245) */
.kpi-delta[hidden] { display: none; }

/* ─── Smooth-апдейт дашборда (#245) ──────────────────────────────────────────
   .swapping — фаза «исчез» текстовой подмены (значение/дельта меняются под
   opacity-fade). .dash-loading — фетч в полёте: контролы приглушены, старые
   цифры остаются видимыми. .funnel-bar — статика баров воронки (была inline),
   width остаётся inline и анимируется transition'ом.
   Длительности — var(--anim-*): app.js зеркалит их из реестра ANIM
   (dash-model.js) при старте; fallback'и совпадают со значениями ANIM. */
[data-cell], .kpi-delta { transition: opacity var(--anim-swap, 150ms) ease; }
.swapping { opacity: 0; }
.dash-loading .dashboard-controls { opacity: 0.55; }
/* Smooth-страницы (#325): на время фетча приглушаем скелет вместо блэнка.
   Осознанное затемнение на смену данных (#340): асимметричный transition.
   Базовое правило на скелете задаёт fade-in по --anim-fadein (медленнее —
   мягкий приход данных при снятии .page-loading). Правило с классом — fade-out
   по --anim-fadeout (быстрее — «началась загрузка»). .page-loading всегда
   вешается на элемент <page>Skeleton (core/api.js, pages/*.js). */
#pageContent [id$="Skeleton"] { transition: opacity var(--anim-fadein, 250ms) ease; }
#pageContent .page-loading { opacity: .55; transition: opacity var(--anim-fadeout, 150ms) ease; }
.funnel-bar {
  display: block; height: 28px; border-radius: 6px;
  margin-bottom: 5px; line-height: 28px; padding: 0 10px;
  font-size: 12px; font-weight: 600; color: #cbd5e1; white-space: nowrap;
  transition: width var(--anim-bar, 600ms) ease;
}
.dash-error {
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5; border-radius: 8px; padding: 8px 14px;
  font-size: 13px; margin-bottom: 14px;
}
@media (prefers-reduced-motion: reduce) {
  [data-cell], .kpi-delta, .funnel-bar { transition: none; }
  /* Затемнение/проявление скелета — мгновенно, без opacity-перехода (#340).
     Дополняет PAGE_REDUCED в core/paint.js, который гасит JS-твины/морфы. */
  #pageContent [id$="Skeleton"], #pageContent .page-loading { transition: none; }
}

/* KPI: progress bar для % ответов */
.card-progress .progress-bar {
  position: relative;
  height: 6px;
  background: rgba(34,197,94,0.12);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.35) inset;
}
.card-progress .progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Лента отзывов: блок целиком */
.reviews-feed-block { padding: 14px 16px; }
.reviews-feed-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

/* Поиск */
.reviews-search input {
  width: 100%;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reviews-search input:focus {
  outline: none;
  border-color: rgba(14,165,233,0.6);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.reviews-search input::placeholder { color: #64748b; }

/* Табы по рейтингу */
.rating-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.rt-btn:hover { border-color: #475569; background: #273449; }
.rt-btn .rt-count {
  font-weight: 700;
  background: #0f172a;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  color: #94a3b8;
}
.rt-btn.active {
  background: rgba(14,165,233,0.18);
  border-color: rgba(14,165,233,0.7);
  color: #e2e8f0;
}
.rt-btn.active .rt-count { background: rgba(14,165,233,0.35); color: #f1f5f9; }

/* Цвета табов по рейтингу */
.rt-btn.tab-warn { border-color: rgba(245,158,11,0.45); color: #fbbf24; }
.rt-btn.tab-warn .rt-count { color: #fbbf24; }
.rt-btn.tab-warn.active { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.7); }

.rt-btn.tab-5 { border-color: rgba(34,197,94,0.35); color: #4ade80; }
.rt-btn.tab-5.active { background: rgba(34,197,94,0.18); border-color: rgba(34,197,94,0.6); }

.rt-btn.tab-4 { border-color: rgba(132,204,22,0.35); color: #a3e635; }
.rt-btn.tab-4.active { background: rgba(132,204,22,0.18); border-color: rgba(132,204,22,0.6); }

.rt-btn.tab-3 { border-color: rgba(251,191,36,0.35); color: #fbbf24; }
.rt-btn.tab-3.active { background: rgba(251,191,36,0.18); border-color: rgba(251,191,36,0.6); }

.rt-btn.tab-2 { border-color: rgba(249,115,22,0.4); color: #fb923c; }
.rt-btn.tab-2.active { background: rgba(249,115,22,0.18); border-color: rgba(249,115,22,0.65); }

.rt-btn.tab-1 { border-color: rgba(239,68,68,0.4); color: #f87171; }
.rt-btn.tab-1.active { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.65); }

/* Адаптив */
@media (max-width: 1280px) {
  .reviews-charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .reviews-grid { grid-template-columns: 1fr; }
}

/* Скроллбар в палитре портала (вместо системного серого).
   Цвета: трек = фон карточек #0f172a, ползунок = граница #334155,
   hover ползунка = #475569. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 5px;
  border: 2px solid #0f172a;
}
::-webkit-scrollbar-thumb:hover { background: #475569; }
::-webkit-scrollbar-corner { background: #0f172a; }

/* Firefox */
* { scrollbar-color: #334155 #0f172a; scrollbar-width: thin; }

/* Блок «Распределение оценок»: бары слева, SVG-кольцо справа */
.dist-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 30px;
  align-items: center;
  padding: 14px 18px;
}
.dist-bars { min-width: 0; }
.bar-row {
  display: grid;
  grid-template-columns: 36px 1fr 110px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.bar-star {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
  text-align: right;
}
.bar-track {
  position: relative;
  height: 20px;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}
.bar-meta {
  font-size: 13px;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar-meta .pct { color: #64748b; margin-left: 4px; }
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Info-tooltip — иконка «i» с подсказкой при наведении.
   Используется через helper infoIcon(text) в renderLeads и др.
   data-tip атрибут содержит текст подсказки. CSS показывает его сверху
   иконки при hover, без задержки и без зависимостей. */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.18);
  color: #94a3b8;
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  cursor: help;
  margin-left: 6px;
  vertical-align: middle;
  user-select: none;
  top: -1px;
}
.info-tip:hover {
  background: rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
}
.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  white-space: pre-wrap;
  width: max-content;
  max-width: 360px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.info-tip:hover::after {
  opacity: 1;
  visibility: visible;
}
/* Привязка к левому краю иконки (для крайних слева позиций — например первой ступени) */
.info-tip[data-align="left"]::after {
  left: 0;
  transform: none;
}
/* Привязка к правому краю (для крайних справа — например последней ступени) */
.info-tip[data-align="right"]::after {
  left: auto;
  right: 0;
  transform: none;
}
/* Открытие вниз — для иконок у верхней кромки скролл-контейнера (#99):
   тултип вверх срезается overflow'ом контентной области. */
.info-tip[data-dir="down"]::after {
  bottom: auto;
  top: calc(100% + 8px);
}
/* Dashboard compare controls (toggle + threshold input) */
.dashboard-controls {
  background: #1e293b;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  /* на базовом правиле, а не на .dash-loading: иначе возврат из затемнения — снэп (#245) */
  transition: opacity var(--anim-fadein, 250ms) ease;
}
.dashboard-controls .label-text { font-size: 13px; color: #94a3b8; }
.seg {
  display: inline-flex;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #334155;
}
.seg button {
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #94a3b8;
}
.seg button.active {
  background: #334155;
  color: #f1f5f9;
  font-weight: 600;
}
/* Лок «vs прошлый месяц» на периоде длиннее месяца (#261): кнопка задизейблена,
   подсказка — в title. */
.seg button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.threshold-input {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  width: 110px;
  font-size: 13px;
}

/* ─── Diagnocat tab (issue #84) ───────────────────────────────────────────────
   Стили для вкладки Diagnocat. Цвета подогнаны под тёмную тему портала.
   .modal-* классы НЕ дублируем — берём из общего блока выше. */
#tab-diagnocat { padding: 4px 0 24px; }

.diagnocat-filters {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--surface-card-gradient, #1e293b);
  border: 1px solid #334155; border-radius: 10px;
  color: #cbd5e1; font-size: 13px;
}
/* Селект врача — .portal-select (#287); правило только для input[type="date"]. */
.diagnocat-filters input[type="date"] {
  background: #0f172a; border: 1px solid #334155; color: #f1f5f9;
  padding: 4px 8px; border-radius: 6px; font-size: 13px;
}
.diagnocat-filters button#diag-apply {
  background: rgba(14,165,233,0.5); color: #e2e8f0;
  border: 1px solid rgba(14,165,233,0.5); border-radius: 6px;
  padding: 6px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.diagnocat-filters button#diag-apply:hover { background: rgba(14,165,233,0.7); }

.diagnocat-summary { display: flex; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.diagnocat-summary .card {
  flex: 1; min-width: 180px; padding: 16px 20px; border-radius: 10px;
  background: var(--surface-card-gradient, #1e293b);
  border: 1px solid #334155;
  box-shadow: var(--shadow-elev-1);
}
.diagnocat-summary .card-label { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; }
.diagnocat-summary .card-value { font-size: 28px; font-weight: 700; color: #f1f5f9; }

.diagnocat-chart {
  margin: 20px 0; padding: 16px 20px; border-radius: 10px;
  background: var(--surface-card-gradient, #1e293b);
  border: 1px solid #334155;
}
.diagnocat-chart h3 { margin: 0 0 12px; color: #e2e8f0; font-size: 15px; }

.diagnocat-table { margin-top: 20px; }
.diagnocat-table #diag-toggle-table {
  background: #0f172a; color: #cbd5e1; border: 1px solid #334155;
  border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 13px;
}
.diagnocat-table #diag-toggle-table:hover { background: #1e293b; color: #f1f5f9; }
.diagnocat-table table {
  width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px;
  background: var(--surface-card-gradient, #1e293b);
  border: 1px solid #334155; border-radius: 10px; overflow: hidden;
}
.diagnocat-table th, .diagnocat-table td {
  padding: 8px 12px; border-bottom: 1px solid #334155; text-align: left;
  color: #e2e8f0;
}
.diagnocat-table th { background: #0f172a; color: #94a3b8; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.diagnocat-table tr:last-child td { border-bottom: none; }
.diagnocat-table tr.row-implant { background: rgba(227, 168, 87, 0.10); }
.diagnocat-table .diag-detail-btn {
  background: transparent; border: 1px solid #334155; color: #cbd5e1;
  border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 13px;
}
.diagnocat-table .diag-detail-btn:hover { background: #334155; color: #f1f5f9; }

.error-banner {
  padding: 8px 14px; border: 1px solid #7f1d1d; background: rgba(127, 29, 29, 0.25);
  color: #fecaca; border-radius: 6px; margin-top: 12px; font-size: 13px;
}

.hidden { display: none !important; }

/* ─── Журнал звонков: «карточка» при раскрытии звонка ──────────────────────
   Каждая «карточка» = пара tr (summary + detail). При раскрытии:
   - summary получает тот же тёмный фон #0f172a что и detail (одно целое)
   - скругление сверху summary и снизу detail (визуально — карточка)
   - между двумя соседними раскрытыми — «зазор» цвета плитки журнала
     (#1e293b — тот же, что и фон карточки журнала, .chart-card)
   - если самый первый звонок в журнале раскрыт — убираем нижнюю границу
     thead'а и верхнее скругление, чтобы карточка лежала вплотную к хедеру */

/* Таблица журнала: border-collapse: separate, чтобы не было проблем с радиусами */
#ai-call-log table {
  border-collapse: separate;
  border-spacing: 0;
}
/* Журналу даём собственный скролл-контейнер — это гарантирует, что
   sticky-шапка прилипает (sticky внутри явного overflow-y:auto контейнера
   работает железно во всех браузерах, никаких details/flex/contained-blocks
   не мешают). */
/* Журналу нужен собственный скролл-контейнер — для sticky-шапки.
   Скроллбар полностью скрыт: прокрутка работает колесом/тачпадом,
   но визуально его не видно. overscroll-behavior: auto — позволяет
   скроллу переключиться на основную страницу, когда внутри долистал
   до конца (или поднялся до начала). */
#ai-call-log .ai-log-body {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge legacy */
  overscroll-behavior: auto;
}
#ai-call-log .ai-log-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;                  /* Chrome/Safari */
}
/* Sticky-шапка колонок — отдельный flex-div НАД таблицей.
   Ширины колонок синхронизированы с <colgroup> в таблице. */
#ai-call-log .calls-sticky-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  background: #1e293b;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #334155;
}
#ai-call-log .calls-sticky-head > span {
  padding: 12px 16px;
  white-space: nowrap;
}

/* Hover ТОЛЬКО на свёрнутой summary (раскрытая уже подсвечена тёмным фоном).
   Скругление углов 10px — чтобы ховерная подсветка не выглядела прямоугольной. */
#ai-call-log tbody tr[data-call-result]:not([data-detail-row]):not(:has(+ tr[data-detail-row]:not(.hidden))):hover > td {
  background: rgba(96, 165, 250, 0.05);
}
#ai-call-log tbody tr[data-call-result]:not([data-detail-row]):not(:has(+ tr[data-detail-row]:not(.hidden))):hover > td:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}
#ai-call-log tbody tr[data-call-result]:not([data-detail-row]):not(:has(+ tr[data-detail-row]:not(.hidden))):hover > td:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* Раскрытая summary — тёмный фон + скругление верхних углов (всегда, включая первую) */
#ai-call-log tbody tr[data-call-result]:not([data-detail-row]):has(+ tr[data-detail-row]:not(.hidden)) > td {
  background: #0f172a;
}
#ai-call-log tbody tr[data-call-result]:not([data-detail-row]):has(+ tr[data-detail-row]:not(.hidden)) > td:first-child {
  border-top-left-radius: 10px;
}
#ai-call-log tbody tr[data-call-result]:not([data-detail-row]):has(+ tr[data-detail-row]:not(.hidden)) > td:last-child {
  border-top-right-radius: 10px;
}

/* Раскрытая detail — скругление нижних углов */
#ai-call-log tbody tr[data-detail-row]:not(.hidden) > td {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* Между двумя соседними раскрытыми — зазор цвета плитки */
#ai-call-log tbody tr[data-detail-row]:not(.hidden) + tr[data-call-result]:not([data-detail-row]):has(+ tr[data-detail-row]:not(.hidden)) > td {
  border-top: 3px solid #1e293b;
}

/* ═══ NPS / Лояльность (страница loyalty) ═══════════════════════════════════
   Бенто-дашборд лояльности. Тёмная тема портала, зелёный NPS-акцент.
   Сетка 4 колонки с grid-template-areas; на узких экранах схлопывается. */

.nps-page { padding: 4px 2px 24px; }

.nps-mock-note {
  font-size: 12px;
  color: #f59e0b;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 14px;
  display: inline-block;
}

.nps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(0, auto);
  gap: 14px;
  grid-template-areas:
    "summary  dynamics  distribution doctors"
    "periods  periods   critcomments critcomments"
    "topstaff loyalty   loyalty      critscores"
    "topstaff actions   actions      critscores";
}
.a-summary      { grid-area: summary; }
.a-dynamics     { grid-area: dynamics; }
.a-distribution { grid-area: distribution; }
.a-doctors      { grid-area: doctors; }
.a-periods      { grid-area: periods; }
.a-critcomments { grid-area: critcomments; }
.a-topstaff     { grid-area: topstaff; }
.a-loyalty      { grid-area: loyalty; }
.a-actions      { grid-area: actions; }
.a-critscores   { grid-area: critscores; }

.nps-card {
  background: var(--surface-card-gradient);
  border: 1px solid #2d3a52;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-elev-1);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.nps-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
}
.nps-card-title .muted { color: #64748b; font-weight: 600; }
.nps-card-sub { font-size: 12px; color: #64748b; margin: -6px 0 10px; }
.nps-page .muted { color: #64748b; }

.nps-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: auto;
}

/* — Дельта-бейдж (↑+6 / ↓4%) — */
.nps-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.nps-delta.up   { color: #a3e635; background: rgba(163,230,53,0.12); }
.nps-delta.down { color: #f87171; background: rgba(248,113,113,0.12); }

/* — Кнопки/ссылки внизу карточек — */
.nps-more {
  margin-top: auto;
  width: 100%;
  background: rgba(148,163,184,0.06);
  border: 1px solid #2d3a52;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nps-more:hover { background: rgba(148,163,184,0.12); color: #cbd5e1; }
.nps-link {
  margin-top: 12px;
  background: none;
  border: none;
  color: #60a5fa;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.nps-link:hover { color: #93c5fd; }
.nps-foot-note { font-size: 11px; color: #475569; margin-top: 8px; }

/* — Карточка NPS (за период) — */
.nps-score-row { display: flex; align-items: center; gap: 12px; }
.nps-score {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: #a3e635;
  letter-spacing: -1px;
}
.nps-score-sub { font-size: 11px; color: #64748b; margin: 8px 0 14px; }
.nps-gradient-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  gap: 2px;
}
.nps-gradient-bar span { display: block; }
.nps-gradient-bar .seg-prom { background: linear-gradient(90deg,#65a30d,#a3e635); border-radius: 7px 0 0 7px; }
.nps-gradient-bar .seg-neu  { background: #facc15; }
.nps-gradient-bar .seg-crit { background: linear-gradient(90deg,#f59e0b,#ef4444); border-radius: 0 7px 7px 0; }
.nps-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  text-align: center;
}
.nps-legend .lg-label { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.nps-legend .lg-val { font-size: 18px; font-weight: 700; }
.nps-legend .lg-val.prom { color: #a3e635; }
.nps-legend .lg-val.neu  { color: #facc15; }
.nps-legend .lg-val.crit { color: #f87171; }

/* — Графики — */
.nps-chart-wrap { position: relative; flex: 1; min-height: 160px; }

/* — Таблицы (врачи, сотрудники) — */
.nps-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nps-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  padding: 4px 6px 8px;
  border-bottom: 1px solid #2d3a52;
}
.nps-table th.col-name, .nps-table td.col-name { text-align: left; }
.nps-table td {
  padding: 7px 6px;
  border-bottom: 1px solid rgba(45,58,82,0.5);
  color: #cbd5e1;
  text-align: center;
  white-space: nowrap;
}
.nps-table tr:last-child td { border-bottom: none; }
.nps-table td.rank { color: #64748b; width: 18px; }
.nps-table td.col-name { font-weight: 600; color: #e2e8f0; width: 100%; }
.nps-table td.num { text-align: center; }
.nps-table td.num.strong { font-weight: 700; color: #f1f5f9; }
.nps-table td.bar-cell { width: 90px; }
.mini-bar {
  display: block;
  height: 7px;
  background: rgba(148,163,184,0.12);
  border-radius: 4px;
  overflow: hidden;
}
.mini-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg,#65a30d,#a3e635);
  border-radius: 4px;
}

/* — NPS по периодам — */
.nps-periods-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.nps-period {
  background: rgba(15,23,42,0.4);
  border: 1px solid #2d3a52;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.nps-period .np-label { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.nps-period .np-value { font-size: 30px; font-weight: 800; color: #a3e635; line-height: 1; }
.nps-period .np-sub { font-size: 11px; color: #64748b; margin: 6px 0 8px; }

/* — Комментарии критиков — */
.cc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(45,58,82,0.5);
  font-size: 13px;
}
.cc-chevron { color: #64748b; }
.cc-label { color: #cbd5e1; }
.cc-pct { margin-left: auto; font-weight: 700; color: #f1f5f9; }

/* — Ключевые показатели лояльности — */
.lk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.lk-tile { display: flex; align-items: center; gap: 10px; }
.lk-icon, .act-icon {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.lk-icon svg, .act-icon svg { width: 20px; height: 20px; }
.ic-users  { background: rgba(99,102,241,0.15);  color: #818cf8; }
.ic-coin   { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.ic-gift   { background: rgba(236,72,153,0.15);   color: #f472b6; }
.ic-star   { background: rgba(34,197,94,0.15);    color: #4ade80; }
.ic-calendar { background: rgba(56,189,248,0.15); color: #38bdf8; }
.ic-bolt   { background: rgba(239,68,68,0.15);    color: #f87171; }
.ic-move   { background: rgba(249,115,22,0.15);   color: #fb923c; }
.ic-cancel { background: rgba(148,163,184,0.12);  color: #94a3b8; }
.ic-phone  { background: rgba(20,184,166,0.15);   color: #2dd4bf; }
.lk-label { font-size: 11px; color: #94a3b8; line-height: 1.3; margin-bottom: 3px; }
.lk-value-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.lk-value { font-size: 18px; font-weight: 700; color: #f1f5f9; }

/* — Действия клиентов — */
.act-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.act-tile {
  background: rgba(15,23,42,0.35);
  border: 1px solid #2d3a52;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.act-tile .act-icon { margin: 0 auto 8px; }
.act-label { font-size: 11px; color: #94a3b8; line-height: 1.25; min-height: 28px; }
.act-value { font-size: 20px; font-weight: 700; color: #f1f5f9; margin-top: 4px; }

/* — Последние критические оценки — */
.cs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(45,58,82,0.5);
}
.cs-dot {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%;
  background: rgba(239,68,68,0.12);
  color: #f87171;
  display: flex; align-items: center; justify-content: center;
}
.cs-dot svg { width: 16px; height: 16px; }
.cs-body { min-width: 0; flex: 1; }
.cs-patient { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.cs-reason { font-size: 12px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-meta { text-align: right; display: flex; align-items: center; gap: 10px; }
.cs-when { font-size: 11px; color: #64748b; white-space: nowrap; }
.cs-score {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* — Адаптив — */
@media (max-width: 1200px) {
  .nps-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas:
      "summary      dynamics"
      "distribution doctors"
      "periods      periods"
      "critcomments critscores"
      "topstaff     loyalty"
      "topstaff     actions";
  }
  .lk-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .nps-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "summary" "dynamics" "distribution" "doctors"
      "periods" "critcomments" "loyalty" "actions"
      "topstaff" "critscores";
  }
  .nps-periods-grid { grid-template-columns: repeat(2, 1fr); }
  .act-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Доп. элементы реальных данных лояльности */
.lk-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.st-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; display: inline-block; }

/* Пустое состояние карточки лояльности (нет данных в выгрузке LoyalMed) */
.nps-empty {
  flex: 1;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #64748b;
  text-align: center;
}
.nps-empty .nps-empty-ic {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px dashed #475569;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #475569;
  margin-bottom: 6px;
}
.nps-empty div:not(.nps-empty-ic) { font-size: 13px; font-weight: 600; color: #94a3b8; }
.nps-empty span { font-size: 11px; color: #475569; max-width: 80%; }

/* — Комментарии критиков: кликабельные строки → модалка — */
.cc-comment {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: rgba(15,23,42,0.35);
  border: 1px solid #2d3a52;
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.cc-comment:hover { background: rgba(148,163,184,0.10); border-color: #3b4a63; }
.cc-comment-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cc-comment-head { font-size: 12px; font-weight: 600; color: #e2e8f0; }
.cc-comment-text {
  font-size: 12px; color: #94a3b8; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cc-comment .cs-score { flex: 0 0 24px; }
.cc-comment .cc-chevron { color: #64748b; font-size: 18px; flex: 0 0 auto; }

/* — Процент отклика под значением NPS-периода (мягкий цвет) — */
.np-response { font-size: 11px; color: #5b87b8; margin-top: 6px; opacity: 0.85; }

/* — Модалка критика: затемнение + блюр заднего фона — */
.nps-modal-backdrop { background: rgba(8,12,22,0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.nps-crit-modal { max-width: 620px; width: 100%; }
.nps-crit-modal .modal-header h3 { display: flex; align-items: center; }
.crit-chat { display: flex; flex-direction: column; gap: 8px; }
.crit-chat .chat-line {
  font-size: 13px; line-height: 1.45; padding: 9px 12px; border-radius: 10px; max-width: 88%;
  white-space: pre-wrap; word-break: break-word;
}
.crit-chat .chat-line.clinic  { background: #1e293b; border: 1px solid #2d3a52; color: #cbd5e1; align-self: flex-start; border-bottom-left-radius: 3px; }
.crit-chat .chat-line.patient { background: rgba(163,230,53,0.10); border: 1px solid rgba(163,230,53,0.25); color: #e8f5cf; align-self: flex-end; border-bottom-right-radius: 3px; }
.crit-chat .chat-line.note    { background: none; border: none; color: #64748b; font-size: 12px; align-self: center; padding: 2px; max-width: 100%; }

/* — Импорт LoyalMed: шапка страницы + кнопка — */
.nps-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.nps-head .nps-mock-note { margin-bottom: 0; }
.nps-import-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(180deg,#84cc16,#65a30d);
  color: #0f172a; font-size: 13px; font-weight: 700;
  border: none; border-radius: 9px; padding: 9px 16px; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.nps-import-btn:hover { filter: brightness(1.08); }
.nps-import-btn:active { transform: translateY(1px); }
.nps-import-btn:disabled { opacity: .6; cursor: default; }

/* — Модалка импорта — */
.nps-import-modal { max-width: 560px; width: 100%; }
.li-label { display: block; font-size: 12px; color: #94a3b8; margin: 12px 0 6px; font-weight: 600; }
.li-label:first-child { margin-top: 0; }
.li-textarea {
  width: 100%; min-height: 150px; resize: vertical;
  background: rgba(15,23,42,0.55); border: 1px solid #2d3a52; border-radius: 10px;
  color: #e2e8f0; font-size: 13px; line-height: 1.4; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.li-textarea:focus { outline: none; border-color: #84cc16; }
.li-file { display: block; width: 100%; font-size: 13px; color: #94a3b8; }
.li-file::file-selector-button {
  background: rgba(148,163,184,0.1); color: #cbd5e1; border: 1px solid #2d3a52;
  border-radius: 8px; padding: 7px 12px; margin-right: 10px; cursor: pointer; font-weight: 600;
}
.li-status { font-size: 13px; min-height: 18px; margin: 12px 0 4px; color: #94a3b8; }
.li-status.ok { color: #a3e635; }
.li-status.err { color: #f87171; }
.li-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.li-actions .nps-more { width: auto; margin-top: 0; }

/* Кастомные чек-боксы/радио в окне выбора метрик (вкладка «Динамика», #241):
   квадрат со скруглением, фон чуть темнее модалки, рамка светлее, аккуратная галочка. */
.dyn-check {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.dyn-check:hover { border-color: rgba(255, 255, 255, 0.4); }
.dyn-check:focus-visible { outline: 2px solid rgba(56, 189, 248, 0.5); outline-offset: 1px; }
.dyn-check:checked {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.65);
}
/* Fade-смена графиков «Динамики»: при перестроении контейнер плавно проявляется,
   перед перестроением — гасится (см. dynamicsFadeRerender в app.js). */
.dyn-chart-wrap { animation: dynFadeIn .28s ease-out; }
@keyframes dynFadeIn { from { opacity: 0; } to { opacity: 1; } }

.dyn-check:checked::after {
  content: '';
  position: absolute;
  left: 4.5px; top: 1px;
  width: 4px; height: 8px;
  border: solid #38bdf8;
  border-width: 0 2px 2px 0;
  border-radius: 1px;
  transform: rotate(45deg);
}

/* Демо-режим (#118): прячем служебные пункты и брендинг, бейдж в шапке */
body.is-demo .nav-item[data-page="sql"],
body.is-demo .nav-item[data-page="deploy"],
body.is-demo .nav-item[data-page="wiki"],
body.is-demo .nav-item[data-page="settings"] { display: none; }
/* #120: брендинг шапки Dentus → 🦷 ClinicOS. Вордмарк вшит в HTML и скрыт по
   умолчанию; .is-demo ставится на <html> ещё до отрисовки (inline-скрипт в head),
   поэтому подмена без мелькания. Прячем только Dentus-img, не весь контейнер. */
.demo-wordmark { display: none; }
.is-demo #sidebarLogo img { display: none; }
.is-demo .demo-wordmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.3px;
}
/* Заголовки секций, у которых в демо скрыты ВСЕ пункты («Команда» = wiki,
   «Система» = sql/deploy/settings) — иначе висят сиротами */
body.is-demo .nav-section:has(+ .nav-item[data-page="wiki"]),
body.is-demo .nav-section:has(+ .nav-item[data-page="sql"]) { display: none; }
.demo-badge {
  display: inline-block; margin-left: 12px; padding: 2px 10px;
  background: linear-gradient(135deg, #f59e0b, #fb923c); color: #1e293b;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  border-radius: 6px; vertical-align: middle;
}

/* ─── Тепловая карта загрузки (#108) ─────────────────────────────────────────── */
.heatmap-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.hm-mode-tabs { display: flex; gap: 4px; }
.hm-mode-tabs button { background: #1e293b; color: #94a3b8; border: 1px solid #334155; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.hm-mode-tabs button.active { background: rgba(14,165,233,0.5); color: #fff; }
.hm-period { display: flex; align-items: center; gap: 6px; }
.hm-target { display: flex; align-items: center; gap: 6px; }
/* визуальный стиль селекта — общий .portal-select (#287); здесь только спутники */
.hm-target input { width: 64px; background-color: rgba(255,255,255,0.04); color: #cbd5e1; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; }
.hm-target input:focus { outline: none; border-color: #38bdf8; }
.hm-updated { color: #64748b; font-size: 12px; margin-left: auto; }

.heatmap-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.hm-kpi-card { background: var(--surface-card-gradient); border: 1px solid #334155; border-radius: 12px; padding: 16px; box-shadow: var(--shadow-elev-1); }
.hm-kpi-card .hm-kpi-title { color: #94a3b8; font-size: 13px; display: block; margin-bottom: 8px; }
.hm-kpi-card .hm-kpi-value { font-size: 24px; font-weight: 700; display: block; }
.hm-kpi-card .hm-kpi-delta { font-size: 12px; margin-top: 6px; display: block; }
.hm-kpi-delta.up { color: rgba(52,211,153,0.8); }
.hm-kpi-delta.down { color: rgba(248,113,113,0.8); }

/* overflow visible (не auto): auto по X навязывает клип по Y и режет тултип верхних рядов.
   Сетка при min-width:760 помещается на десктопе; на узких экранах — скролл страницы. */
.heatmap-grid-wrap { overflow: visible; margin: 16px 0; max-width: 100%; }
.heatmap-grid { display: grid; grid-template-columns: 64px repeat(7, minmax(96px, 1fr)); gap: 3px; min-width: 760px; }
.heatmap-grid .hm-corner, .heatmap-grid .hm-dayhead { color: #94a3b8; font-size: 12px; text-align: center; padding: 6px 0; }
.heatmap-grid .hm-hourhead { color: #94a3b8; font-size: 12px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.hm-cell { position: relative; height: 40px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,0.6); cursor: default; }
.hm-cell.lv0 { background: rgba(96,165,250,0.28); }
.hm-cell.lv1 { background: rgba(45,166,120,0.65); }
.hm-cell.lv2 { background: rgba(74,179,90,0.8); }
.hm-cell.lv3 { background: rgba(234,179,8,0.85); }
.hm-cell.lv4 { background: rgba(249,115,22,0.88); }
.hm-cell.lv5 { background: rgba(239,68,68,0.9); }
.hm-cell.lv6 { background: repeating-linear-gradient(45deg, rgba(239,68,68,0.95), rgba(239,68,68,0.95) 6px, rgba(120,0,0,0.95) 6px, rgba(120,0,0,0.95) 12px);
  box-shadow: 0 0 10px rgba(239,68,68,0.8); }
.hm-tooltip { position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); z-index: 50;
  background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 8px 10px; font-weight: 400;
  font-size: 12px; color: #e2e8f0; white-space: nowrap; text-shadow: none; display: none; box-shadow: var(--shadow-elev-2); }
/* наведённая плитка и её тултип поверх соседних рядов */
.hm-cell:hover { z-index: 50; }
.hm-cell:hover .hm-tooltip { display: block; }
/* тултип не выходит за края: крайние столбцы выравниваем по краю */
.hm-cell.edge-left .hm-tooltip { left: 0; transform: none; }
.hm-cell.edge-right .hm-tooltip { left: auto; right: 0; transform: none; }

.heatmap-tops { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.hm-top-card { background: var(--surface-block-gradient); border: 1px solid #334155; border-radius: 12px; padding: 16px; }
.hm-top-card h3 { font-size: 14px; margin: 0 0 12px; color: #e2e8f0; }
.hm-top-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* глобальный thead th — sticky; в компактных карточках это даёт «зависающую» шапку и зазор при скролле → static */
.hm-top-card th { color: #64748b; text-align: left; font-weight: 500; padding: 4px 6px; position: static; background: transparent; text-transform: none; letter-spacing: normal; border-bottom: none; font-size: 13px; }
.hm-top-card td { padding: 4px 6px; border-top: 1px solid #1e293b; }
.hm-risk-high { color: rgba(248,113,113,0.9); }
.hm-risk-mid { color: rgba(245,158,11,0.9); }

.heatmap-analysis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.hm-analysis-card { background: var(--surface-block-gradient); border: 1px solid #334155; border-radius: 12px; padding: 16px; }
.hm-analysis-card h3 { font-size: 14px; margin: 0 0 12px; }
.hm-analysis-card .chart-box { height: 240px; }
.hm-hr-note { color: #94a3b8; font-size: 12px; margin-top: 8px; }
