/* ============================================================
   Liquid Glass Light — единая дизайн-система NeuroDent.
   Белый фон зафиксирован и не зависит от темы Telegram.
   ============================================================ */
:root {
  --bg:        #FFFFFF;
  --card:      rgba(255,255,255,0.78);
  --surface:   rgba(255,255,255,0.68);
  --text:      #16181D;   /* основной «чернильный» текст */
  --hint:      #5F6673;   /* приглушённый с контрастом AA */
  --accent:    #5B6BFF;   /* индиго — интерактив/графики */
  --accent-2:  #8E7CFF;   /* конец градиента */
  --accent-text:#FFFFFF;
  --up:        #17B978;
  --down:      #F4595B;
  --border:    rgba(46,54,78,0.12);
  --shadow:    inset 0 1px 0 rgba(255,255,255,0.96), 0 4px 8px rgba(35,43,68,0.06);
  --shadow-p:  inset 0 1px 0 rgba(255,255,255,0.98), 0 4px 8px rgba(35,43,68,0.07);
  --glass:     linear-gradient(145deg, rgba(255,255,255,0.94), rgba(255,255,255,0.66));
  --glass-blur: blur(18px) saturate(1.18);
  --space-1: 4px; --space-2: 8px; --space-3: 12px;
  --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --nav-space: calc(88px + env(safe-area-inset-bottom));
  --grad:      linear-gradient(90deg, #5B6BFF, #8E7CFF);
  /* пастельная палитра для KPI-блоков */
  --p1:#E9E5FF; --p2:#FFF0C8; --p3:#DFF3E4; --p4:#FFE1D6; --p5:#DDEBFF; --p6:#FCE0EC;
  /* насыщенные цвета рамок для белых KPI-плиток */
  --b1:#8E7CFF; --b2:#EBA31A; --b3:#17B978; --b4:#FF8557; --b5:#3E8DFF; --b6:#EC6AA0;
  /* скелетон-лоадеры */
  --sk-base:  #E9ECF3;
  --sk-shine: #F5F7FB;
  /* модалка drill-down */
  --scrim: rgba(20,24,40,0.42);
  /* сетка/подписи графиков */
  --chart-grid: rgba(22,24,29,0.07);
  /* нейтральная поверхность форм (инпуты/диалоги) */
  --panel: #FFFFFF;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: light; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 14px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Вход, регистрация и онбординг ---------- */
.auth-shell,
.onboarding-shell {
  position: fixed; inset: 0; z-index: 100;
  overflow-y: auto; overscroll-behavior: contain;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 16% 8%, rgba(142,124,255,0.18), transparent 32%),
    radial-gradient(circle at 88% 18%, rgba(62,141,255,0.14), transparent 28%),
    #f8f9ff;
}
.auth-shell { display: grid; place-items: center; }
.auth-shell.hidden,
.onboarding-shell.hidden { display: none; }
.auth-card,
.onboarding-card {
  width: min(100%, 560px); margin: auto;
  background: rgba(255,255,255,0.92); border: 1px solid rgba(91,107,255,0.14);
  border-radius: 28px; box-shadow: 0 18px 55px rgba(35,43,68,0.12);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.auth-card { padding: 22px; }

/* Первый экран (вход): убираем рамку карточки — чистый белый фон,
   без границы, тени, скругления и блюра. Онбординг не затрагивается. */
.auth-shell { background: var(--bg); }
.auth-shell .auth-card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; }
.auth-brand.compact { margin: 0; }
.auth-brand-mark {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 14px;
  display: grid; place-items: center;
  color: #fff; background: var(--grad); font-size: 19px; font-weight: 850;
  box-shadow: 0 8px 18px rgba(91,107,255,0.25);
}
.auth-brand div { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.auth-brand b { font-size: 15px; letter-spacing: -0.2px; }
.auth-brand span:last-child { color: var(--hint); font-size: 11px; }
.auth-view { display: none; }
.auth-view.active { display: block; animation: auth-in 240ms ease-out; }
@keyframes auth-in { from { opacity: 0; transform: translateY(7px); } }
.auth-hero { padding: 10px 0 24px; }
.auth-kicker {
  display: inline-flex; padding: 6px 10px; margin-bottom: 18px; border-radius: 999px;
  background: var(--p1); color: #493AA3; font-size: 11px; font-weight: 800;
}
.auth-hero h1, .auth-heading h1, .onboarding-step h1 {
  margin: 0; color: #121522; letter-spacing: -0.7px; text-wrap: balance;
}
.auth-hero h1 { font-size: clamp(30px, 8vw, 43px); line-height: 1.04; }
.auth-hero p, .auth-heading p, .onboarding-step > p {
  margin: 13px 0 0; color: var(--hint); line-height: 1.55;
}
.auth-actions { display: grid; gap: 10px; }
.primary-action, .secondary-action {
  width: 100%; min-height: 50px; padding: 12px 18px; border-radius: 15px;
  font: inherit; font-size: 14px; font-weight: 780; cursor: pointer;
}
.primary-action { border: 0; color: #fff; background: var(--grad); box-shadow: 0 9px 22px rgba(91,107,255,0.22); }
.secondary-action { border: 1px solid rgba(91,107,255,0.2); color: #3F4FCC; background: var(--panel); }
.auth-legal { margin: 17px 2px 0; color: #7b8290; font-size: 10.5px; line-height: 1.45; text-align: center; }
.auth-back {
  border: 0; padding: 4px 4px 4px 0; margin-bottom: 20px;
  color: #3F4FCC; background: transparent; font: inherit; font-size: 12px; font-weight: 750;
}
.auth-heading { margin-bottom: 22px; }
.auth-heading h1 { font-size: 28px; }
.auth-heading p { font-size: 12.5px; }
.auth-form label,
.onboarding-step label {
  display: flex; flex-direction: column; gap: 7px;
  color: #303644; font-size: 11.5px; font-weight: 720;
}
.auth-form > label { margin-bottom: 15px; }
.auth-form input, .auth-form select,
.onboarding-step input, .onboarding-step select {
  width: 100%; min-height: 48px; padding: 12px 13px; border: 1px solid rgba(46,54,78,0.14);
  border-radius: 13px; color: var(--text); background: var(--panel);
  font: inherit; font-size: 16px; font-weight: 500;
}
.auth-form input:focus, .auth-form select:focus,
.onboarding-step input:focus, .onboarding-step select:focus {
  border-color: var(--accent); outline: 3px solid rgba(91,107,255,0.12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.phone-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.phone-row button {
  border: 0; border-radius: 13px; padding: 0 13px;
  color: #3F4FCC; background: var(--p1); font: inherit; font-size: 11.5px; font-weight: 780;
}
.otp-field small { color: #3F4FCC; font-weight: 600; line-height: 1.4; }
.consent-row {
  flex-direction: row !important; align-items: flex-start; gap: 10px !important;
  margin: 20px 0 14px !important; color: var(--hint) !important; font-weight: 500 !important; line-height: 1.45;
}
.consent-row input { width: 19px; min-height: 19px; height: 19px; margin-top: 1px; accent-color: var(--accent); }
.consent-row button { border: 0; padding: 0; color: #3F4FCC; background: transparent; font: inherit; font-weight: 750; }
.form-error, .onboarding-error { min-height: 18px; margin: 7px 2px; color: #B42318; font-size: 11.5px; font-weight: 650; }
.demo-credentials {
  display: flex; flex-direction: column; gap: 3px; margin-top: 14px; padding: 11px 13px;
  border-radius: 12px; color: #5543B8; background: var(--p1); font-size: 11px;
}
.demo-credentials b { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }

.onboarding-shell { display: grid; place-items: center; }
.onboarding-card { padding: 22px; }
.onboarding-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.onboarding-top > button {
  border: 0; padding: 7px; color: var(--hint); background: transparent;
  font: inherit; font-size: 11.5px; font-weight: 700;
}
.onboarding-progress { height: 6px; margin: 24px 0 9px; overflow: hidden; border-radius: 999px; background: #eaecf4; }
.onboarding-progress span { display: block; width: 25%; height: 100%; border-radius: inherit; background: var(--grad); transition: width 240ms ease-out; }
.onboarding-step-label { color: #6b7280; font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; }
.onboarding-step { display: none; min-height: 360px; padding: 29px 2px 15px; }
.onboarding-step.active { display: block; animation: auth-in 220ms ease-out; }
.onboarding-icon {
  width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 24px;
  border-radius: 17px; color: #fff; background: var(--grad); font-size: 15px; font-weight: 850;
}
.onboarding-step h1 { font-size: 29px; line-height: 1.1; }
.onboarding-step > p { margin-bottom: 24px; }
.onboarding-step label { margin-top: 14px; }
.onboarding-step ul { display: grid; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.onboarding-step li {
  padding: 12px 14px 12px 40px; position: relative; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); font-weight: 650;
}
.onboarding-step li::before { content: "✓"; position: absolute; left: 14px; color: var(--up); font-weight: 900; }
.schedule-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.onboarding-actions { display: grid; grid-template-columns: 1fr 1.45fr; gap: 10px; }
.onboarding-actions .primary-action:only-child { grid-column: 1 / -1; }

.privacy-dialog {
  width: min(calc(100% - 32px), 480px); padding: 0; border: 0; border-radius: 22px;
  color: var(--text); background: var(--panel); box-shadow: 0 26px 80px rgba(15,23,42,0.22);
}
.privacy-dialog::backdrop { background: rgba(21,25,38,0.48); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.privacy-dialog form { padding: 22px; }
.privacy-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.privacy-dialog h2 { margin: 0; font-size: 20px; }
.privacy-dialog-head button { border: 0; padding: 0 4px; color: var(--hint); background: transparent; font-size: 26px; line-height: 1; }
.privacy-dialog p { margin: 14px 0 22px; color: var(--hint); line-height: 1.6; }
.settings-logout {
  width: 100%; margin-top: 10px; padding: 12px 14px; border: 1px solid rgba(244,89,91,0.18); border-radius: 13px;
  color: #B42318; background: #fff5f5; font: inherit; font-size: 12px; font-weight: 750;
}

@media (max-width: 480px) {
  .auth-shell, .onboarding-shell { padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)); }
  .auth-card, .onboarding-card { padding: 19px 17px; border-radius: 23px; }
  .auth-card:has(.register-form.active) { margin: 0 auto; }
  .auth-brand { margin-bottom: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .phone-row { grid-template-columns: 1fr; }
  .phone-row button { min-height: 44px; }
  .onboarding-step { min-height: 330px; }
}

/* ---------- Шапка ---------- */
.topbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 16px 16px 11px; position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,0.78); border-bottom: 1px solid rgba(46,54,78,0.08);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.brand { min-width: 0; }
.brand-title {
  font-weight: 800; font-size: 21px; letter-spacing: -0.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-sub {
  color: var(--hint); font-size: 12px; font-weight: 500; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.period-label {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  color: var(--text); font-size: 10.5px; font-weight: 700; text-align: right;
  font-family: inherit; line-height: 1;
  max-width: none; white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--glass); border: 1px solid var(--border); border-radius: 12px;
  padding: 7px 10px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: border-color 0.15s ease-out, transform 0.12s ease-out;
}
.period-label::before { content: "📅"; font-size: 12px; line-height: 1; }
.period-label:hover { border-color: var(--accent); }
.period-label:active { transform: scale(0.97); }

/* ---------- Период (пресеты) ---------- */
.controls { padding: 8px 16px 6px; display: flex; flex-direction: column; gap: 12px; }
.presets {
  display: flex; gap: 4px; overflow-x: auto; padding: 4px;
  background: var(--surface); border-radius: 16px; scrollbar-width: none;
}
.presets::-webkit-scrollbar { display: none; }
.presets button {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 12px; border: none;
  background: transparent; color: var(--hint); font-size: 12.5px; font-weight: 600;
  transition: all 0.15s;
}
.presets button.active {
  background: var(--grad); color: #fff; box-shadow: 0 3px 9px rgba(91,107,255,0.30);
}

.custom-range { display: none; }
.custom-range input[type=date] {
  flex: 1; background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 12px; font-size: 13px; min-width: 0;
}
.custom-range span { color: var(--hint); }
.custom-range .apply {
  padding: 9px 16px; border-radius: 12px; border: none; background: var(--accent);
  color: var(--accent-text); font-weight: 700;
}
.cmp-toggle { display: flex; align-items: center; gap: 8px; color: var(--hint); font-size: 13px; }
.cmp-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

main { padding: 16px 14px calc(112px + env(safe-area-inset-bottom)); position: relative; overflow-x: clip; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* уходящая панель ложится поверх на время анимации, чтобы не было прыжка раскладки */
.tab-panel.pg-leaving {
  position: absolute; top: 16px; left: 14px; right: 14px; z-index: 1;
  pointer-events: none;
}
/* направленные переходы между разделами (нативное ощущение «вперёд/назад») */
.tab-panel.pg-in-r  { animation: pgInR 0.30s cubic-bezier(0.22,0.61,0.36,1) both; }
.tab-panel.pg-in-l  { animation: pgInL 0.30s cubic-bezier(0.22,0.61,0.36,1) both; }
.tab-panel.pg-out-l { animation: pgOutL 0.30s cubic-bezier(0.22,0.61,0.36,1) both; }
.tab-panel.pg-out-r { animation: pgOutR 0.30s cubic-bezier(0.22,0.61,0.36,1) both; }
.tab-panel.pg-fade  { animation: pgFade 0.22s ease-out both; }
@keyframes pgInR  { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes pgInL  { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes pgOutL { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-26px); } }
@keyframes pgOutR { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(26px); } }
@keyframes pgFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tab-panel.pg-in-r, .tab-panel.pg-in-l, .tab-panel.pg-out-l,
  .tab-panel.pg-out-r, .tab-panel.pg-fade { animation: none; }
}

/* ---------- Скелетон-лоадеры ---------- */
.tab-panel.active { position: relative; }
.sk-overlay {
  position: absolute; inset: 0; z-index: 3; background: var(--bg);
  padding: 2px; opacity: 1; transition: opacity 0.28s ease-out;
}
.sk-overlay.sk-hide { opacity: 0; }
.sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.sk-stack { display: flex; flex-direction: column; gap: 12px; }
.sk-block { pointer-events: none; }
.sk-line {
  display: block; height: 12px; border-radius: 7px;
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-shine) 50%, var(--sk-base) 70%);
  background-size: 200% 100%; animation: skShimmer 1.2s ease-in-out infinite;
}
.sk-line.sk-xl { height: 22px; }
.sk-line.sk-bar { height: 9px; }
.sk-w40 { width: 40%; } .sk-w50 { width: 50%; } .sk-w60 { width: 60%; } .sk-w70 { width: 70%; }
.sk-mt { margin-top: 10px; }
.sk-figrow { display: flex; gap: 10px; }
.sk-figrow .sk-line { flex: 1; height: 14px; }
.sk-static .sk-line { animation: none; background: var(--sk-base); }
@keyframes skShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .sk-line { animation: none; background: var(--sk-base); }
  .sk-overlay { transition: none; }
}

/* ---------- Модалка drill-down ---------- */
body.modal-lock { overflow: hidden; }
.modal-scrim {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end;
  justify-content: center; background: var(--scrim); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.24s ease-out; padding: 0;
}
.modal-scrim.open { opacity: 1; }
.modal-card {
  position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--bg); color: var(--text); border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 60px rgba(15,23,42,0.28);
  transform: translateY(24px); transition: transform 0.28s cubic-bezier(0.22,0.61,0.36,1);
}
.modal-scrim.open .modal-card { transform: none; }
@media (min-width: 620px) {
  .modal-scrim { align-items: center; padding: 24px; }
  .modal-card { border-radius: 22px; }
}
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0;
  border-radius: 50%; background: var(--surface); color: var(--hint);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.dm-head { padding-right: 40px; }
.dm-title { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.dm-spec {
  display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 20px;
  background: var(--surface); color: var(--accent); font-size: 12px; font-weight: 700;
}
.dm-loadbar { height: 8px; border-radius: 6px; background: var(--surface); margin: 16px 0 18px; overflow: hidden; }
.dm-loadbar span { display: block; height: 100%; border-radius: 6px; background: var(--grad); }
.dm-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .dm-stats { grid-template-columns: 1fr; } }
.dm-stat {
  display: flex; flex-direction: column; gap: 3px; padding: 13px 14px;
  border-radius: 16px; background: var(--card); box-shadow: var(--shadow);
}
.dm-stat-label { color: var(--hint); font-size: 11px; font-weight: 600; }
.dm-stat-value { font-size: 18px; font-weight: 800; letter-spacing: -0.4px; }
.dm-stat-sub { color: var(--hint); font-size: 10.5px; }
.dm-note {
  margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 12.5px; line-height: 1.5;
  background: var(--surface); color: var(--text);
}
.dm-debt { border-left: 4px solid var(--down); }
.dm-services { margin-top: 16px; }
.dm-services .drill-title { margin-bottom: 8px; }

/* ---------- Экспорт: плавающая кнопка + меню ---------- */
.export-wrap {
  position: fixed; right: 14px; z-index: 40;
  bottom: calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.export-wrap.hidden { display: none; }
.export-fab {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  padding: 10px 15px; border-radius: 26px; background: var(--grad); color: #fff;
  font: inherit; font-size: 13px; font-weight: 750; cursor: pointer;
  box-shadow: 0 8px 22px rgba(91,107,255,0.32);
}
.export-fab:active { transform: scale(0.97); }
.export-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.export-menu {
  display: flex; flex-direction: column; min-width: 210px; padding: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 14px 44px rgba(15,23,42,0.22);
}
.export-menu.hidden { display: none; }
.export-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0;
  padding: 11px 12px; border-radius: 11px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 650; text-align: left; cursor: pointer;
}
.export-menu button:hover { background: var(--surface); }
.export-menu button svg { color: var(--accent); flex: 0 0 auto; }

@media (min-width: 769px) { .export-wrap { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---------- Печать / PDF: только контент активного раздела ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; }
  .controls, .mobile-nav, .app-toast, #loader, .analytics-back,
  .export-wrap, .modal-scrim, .sk-overlay, .nd-splash,
  .period-label, .spark { display: none !important; }
  main { padding: 0 !important; position: static !important; overflow: visible !important; }
  .tab-panel { display: none !important; }
  .tab-panel.active {
    display: block !important; position: static !important;
    animation: none !important; box-shadow: none !important;
  }
  .card, .kpi, .mkt-camp, .dm-stat, .ovw-stat {
    box-shadow: none !important; border: 1px solid #d7dbe6 !important;
    break-inside: avoid;
  }
  * { animation: none !important; transition: none !important; }
}

/* ---------- Нижняя навигация приложения ---------- */
.mobile-nav {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 640px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--border);
}
.mobile-nav button {
  min-width: 0; min-height: 54px; padding: 5px 2px; border: 0; border-radius: 12px;
  background: transparent; color: #667085;
  font: inherit; font-size: 10.5px; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: color 0.18s ease-out, background-color 0.18s ease-out, transform 0.18s ease-out;
}
.mobile-nav button.active { color: #3F4FCC; background: var(--p1); }
.mobile-nav button:active { background: var(--surface); }
.mobile-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mobile-nav svg { width: 21px; height: 21px; fill: currentColor; flex: 0 0 auto; }
.mobile-nav button > span:last-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.mobile-nav .ai-nav-button { color: #3F4FCC; background: transparent; }
.mobile-nav .ai-nav-button.active { background: transparent; }
.ai-nav-icon {
  width: 46px; height: 46px; margin-top: -23px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 3px 6px rgba(63,79,204,0.24);
  transition: transform 0.18s ease-out, background-color 0.18s ease-out;
}
.mobile-nav .ai-nav-icon svg { width: 23px; height: 23px; }
.mobile-nav .ai-nav-button.active .ai-nav-icon { background: #3F4FCC; transform: translateY(-2px); }
.mobile-nav .ai-nav-button:active .ai-nav-icon { transform: scale(0.96); }

@media (min-width: 769px) {
  .mobile-nav {
    bottom: 12px; border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 4px 12px rgba(24,26,44,0.10);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav button, .ai-nav-icon { transition: none; }
}

/* ---------- Хаб аналитики ---------- */
.screen-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 2px 2px 18px; }
.screen-head h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -0.4px; text-wrap: balance; }
.screen-head p { margin: 5px 0 0; color: #667085; font-size: 12.5px; line-height: 1.45; max-width: 62ch; }
.analytics-grid { display: flex; flex-direction: column; gap: 10px; }
.analytics-action {
  width: 100%; border: 0; border-radius: 16px; padding: 14px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; text-align: left; font: inherit;
  transition: background-color 0.18s ease-out, transform 0.18s ease-out;
}
.analytics-action:active { background: var(--surface); transform: scale(0.99); }
.analytics-action:focus-visible, .analytics-back:focus-visible,
.ai-prompts button:focus-visible, .integration-card button:focus-visible,
.ai-form input:focus-visible, .ai-form button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.analytics-icon {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.analytics-icon svg { width: 22px; height: 22px; fill: currentColor; }
.tone-violet { background: var(--p1); color: #5543B8; }
.tone-blue { background: var(--p5); color: #236FC2; }
.tone-green { background: var(--p3); color: #10734A; }
.tone-orange { background: var(--p4); color: #B94D27; }
.analytics-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.analytics-copy b { font-size: 14px; }
.analytics-copy small { color: #667085; font-size: 11.5px; }
.analytics-chev { color: #667085; font-size: 24px; line-height: 1; }
.analytics-back {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); padding: 9px 15px 9px 11px; margin: 0 0 16px;
  background: var(--card); color: var(--accent); font: inherit; font-size: 13px; font-weight: 700;
  border-radius: 999px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.12s ease-out, border-color 0.15s ease-out;
}
.analytics-back:hover { border-color: var(--accent); }
.analytics-back:active { transform: scale(0.97); }

/* ---------- Демо-ассистент ---------- */
.demo-badge {
  flex: 0 0 auto; padding: 4px 9px; border-radius: 999px;
  background: var(--p1); color: #493AA3; font-size: 10.5px; font-weight: 800;
}
body.ai-mode { overflow: hidden; }
body.ai-mode .topbar { display: none; }
#tab-ai.active {
  position: fixed; z-index: 15; inset: 0 0 var(--nav-space);
  width: min(100%, 720px); margin-inline: auto;
  display: flex; flex-direction: column; background: var(--bg);
}
.ai-chat {
  min-height: 0; flex: 1;
  display: flex; flex-direction: column;
  background: var(--bg); border: 0; border-radius: 0; box-shadow: none;
}
.ai-messages {
  min-height: 0; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); scrollbar-width: thin;
  overscroll-behavior: contain;
}
.ai-message { display: flex; align-items: flex-end; gap: var(--space-2); }
.ai-message.user { justify-content: flex-end; }
.ai-welcome { align-items: flex-start; }
.ai-welcome-content {
  min-width: 0; max-width: 84%;
  display: flex; flex-direction: column; gap: var(--space-3);
}
.ai-welcome .ai-bubble { max-width: 100%; }
.ai-suggestions {
  display: flex; flex-direction: column; gap: var(--space-2);
}
.ai-suggestions > span {
  color: var(--hint); font-size: 11px; font-weight: 700;
}
.ai-prompts {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
}
.ai-prompts button {
  min-height: 44px; padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(91,107,255,0.22); border-radius: 12px;
  background: rgba(91,107,255,0.07); color: #3F4FCC; box-shadow: none;
  font: inherit; font-size: 11px; font-weight: 700; text-align: left;
}
.ai-prompts button:active { background: var(--p1); }
.ai-avatar {
  width: 28px; height: 28px; flex: 0 0 auto; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--p1); color: #493AA3; font-size: 9px; font-weight: 850;
}
.ai-bubble {
  max-width: 84%; padding: 10px 12px; border-radius: 14px 14px 14px 4px;
  background: var(--surface); color: #2D3440; font-size: 12.5px; line-height: 1.48;
}
.ai-message.user .ai-bubble {
  border-radius: 14px 14px 4px 14px; background: var(--accent); color: #fff;
}
.ai-message.loading .ai-bubble { color: #667085; }
.ai-message.error .ai-bubble { background: #FCE3E3; color: #8E1F22; }
.ai-form {
  flex: 0 0 auto; display: flex; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border); background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.ai-form input,
.ai-form textarea {
  flex: 1; min-width: 0; height: 48px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); padding: 0 12px;
  font-family: inherit; font-size: 16px; line-height: 1.35;
}
.ai-form input::placeholder { color: #667085; }
.ai-form button {
  width: 48px; height: 48px; flex: 0 0 auto; border: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
}
.ai-form button svg { width: 19px; height: 19px; fill: currentColor; }
.ai-form button:disabled, .ai-form input:disabled { opacity: 0.55; cursor: not-allowed; }
.ai-status {
  flex: 0 0 auto; padding: var(--space-2) var(--space-4) 0;
  color: #667085; font-size: 10.5px;
}
.ai-status:empty { display: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Настройки ---------- */
.settings-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.settings-brand-logo {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; overflow: hidden;
  display: block; box-shadow: 0 8px 18px rgba(91,75,232,0.24);
}
.settings-brand-logo img { width: 100%; height: 100%; display: block; }
.settings-brand > div { min-width: 0; }
.settings-section { margin-bottom: 20px; }
.settings-section h2 { margin: 0 2px 9px; font-size: 13px; }
.account-card, .business-card, .integration-card {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
}
.account-card { display: flex; align-items: center; gap: 11px; padding: 14px; margin-bottom: 10px; }
.account-card > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.account-card b { font-size: 13.5px; }
.account-card span:not(.demo-badge) { color: #667085; font-size: 11.5px; }
.account-avatar {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--p1); color: #493AA3; font-size: 12px; font-weight: 850;
}
.business-card { padding: 4px 14px; }
.business-card > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.business-card > div + div { border-top: 1px solid var(--border); }
.business-card span { color: #667085; font-size: 11.5px; }
.business-card b { font-size: 12px; text-align: right; }
.integration-list { display: flex; flex-direction: column; gap: 9px; }
.integration-card { display: flex; align-items: center; gap: 10px; padding: 12px; }
.integration-mark {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 850;
}
.integration-mark.meta { background: var(--p5); color: #236FC2; }
.integration-mark.gis { background: var(--p3); color: #10734A; }
.integration-mark.mac { background: var(--p2); color: #8A5A00; }
.integration-mark.tg { background: var(--p1); color: #493AA3; }
.integration-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.integration-copy b { font-size: 12.5px; }
.integration-copy span { color: #667085; font-size: 10.5px; line-height: 1.3; }
.integration-copy small { color: #10734A; font-size: 10px; line-height: 1.3; }
.integration-card button {
  flex: 0 0 auto; border: 0; border-radius: 10px; padding: 7px 9px;
  background: var(--surface); color: #3F4FCC; font: inherit; font-size: 10.5px; font-weight: 750;
}
.integration-card button:active { background: var(--p1); }
.support-panel {
  padding: 14px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
}
.support-intro { display: flex; align-items: flex-start; gap: 11px; }
.support-icon {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--p1); color: #493AA3; font-size: 16px; font-weight: 850;
}
.support-intro b { display: block; font-size: 13.5px; }
.support-intro p {
  margin: 3px 0 0; color: #5F6673; font-size: 11.5px; line-height: 1.45;
}
.support-actions { display: flex; flex-direction: column; margin-top: 12px; }
.support-actions a {
  min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--text); text-decoration: none; font-size: 12.5px; font-weight: 750;
}
.support-actions a + a { border-top: 1px solid var(--border); }
.support-actions small {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #3F4FCC; font-size: 11px; font-weight: 650; text-align: right;
}
.support-actions a:active { color: #3F4FCC; }
.app-toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  width: min(calc(100% - 28px), 520px); transform: translate(-50%, 10px);
  padding: 10px 12px; border-radius: 12px; background: #252933; color: #fff;
  font-size: 11.5px; line-height: 1.4; text-align: center;
  opacity: 0; visibility: hidden; transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}
.app-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .analytics-action, .app-toast { transition: none; }
  .tab-panel.active, .cal-pop { animation: none; }
  .ai-messages { scroll-behavior: auto; }
}

/* ---------- Пастельные KPI-блоки ---------- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.kpi {
  background: var(--card); border-radius: 20px; padding: 15px 16px; border: none;
  box-shadow: var(--shadow-p); position: relative; overflow: hidden;
}
/* ротация мягких пастелей по позиции карточки */
.kpi-grid .kpi:nth-child(6n+1) { background: var(--card); border-left: 5px solid var(--b1); }
.kpi-grid .kpi:nth-child(6n+2) { background: var(--card); border-left: 5px solid var(--b2); }
.kpi-grid .kpi:nth-child(6n+3) { background: var(--card); border-left: 5px solid var(--b3); }
.kpi-grid .kpi:nth-child(6n+4) { background: var(--card); border-left: 5px solid var(--b4); }
.kpi-grid .kpi:nth-child(6n+5) { background: var(--card); border-left: 5px solid var(--b5); }
.kpi-grid .kpi:nth-child(6n+6) { background: var(--card); border-left: 5px solid var(--b6); }
.kpi-label { color: var(--text); opacity: 0.6; font-size: 11.5px; font-weight: 600; margin-bottom: 8px; }
.kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.1; }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 3px; margin-top: 8px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.kpi-delta.up   { color: #0E7A4E; background: rgba(23,185,120,0.18); }
.kpi-delta.down { color: #B4272A; background: rgba(244,89,91,0.18); }
.kpi-delta.flat { color: var(--hint); background: rgba(22,24,29,0.06); }
.kpi-delta-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.kpi-delta-cap { font-size: 9px; font-weight: 600; color: var(--hint); letter-spacing: 0.1px; }

/* ---------- Карточки ---------- */
.card {
  background: var(--card); border-radius: 20px; padding: 16px; margin-bottom: 14px; border: none;
  box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; letter-spacing: -0.2px; }
canvas { max-width: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--hint); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: right; padding: 9px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { color: var(--hint); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; }
td.pos { color: var(--up); }
td.neg { color: var(--down); }
.sub { color: var(--hint); font-size: 11px; }
.bar-cell { position: relative; }
.mini-bar { height: 5px; border-radius: 3px; background: var(--grad); margin-top: 4px; }

.loader, .error { text-align: center; padding: 30px; color: var(--hint); }
.error { color: var(--down); }
.hidden { display: none; }

/* ---------- Подсказки (инсайты) ---------- */
.insights { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.insights:empty { display: none; }
.insights-title { font-weight: 800; font-size: 16px; margin: 4px 2px 2px; letter-spacing: -0.3px; }
.insights-hint { color: var(--hint); font-size: 11.5px; margin: 0 2px 4px; }
.insight {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: 18px; padding: 14px 15px; border-left: 5px solid;
  box-shadow: var(--shadow);
}
.insight.good { background: #E4F6EA; border-left-color: #1FAF54; }
.insight.warn { background: #FFF1D6; border-left-color: #F5920B; }
.insight.info { background: #E5EFFF; border-left-color: #2E8BFF; }
.insight.diggable { cursor: pointer; }
.insight.diggable:active { filter: brightness(0.97); }
.insight-icon {
  font-size: 22px; line-height: 1.1; flex: 0 0 auto;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.7); border-radius: 12px;
}
.insight-body { min-width: 0; flex: 1; }
.insight-title { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.insight.good .insight-title { color: #0F5A2C; }
.insight.warn .insight-title { color: #7A4A00; }
.insight.info .insight-title { color: #0A3F80; }
.insight-detail { font-size: 12px; margin-top: 3px; line-height: 1.4; }
.insight.good .insight-detail { color: #245C39; }
.insight.warn .insight-detail { color: #6E4F18; }
.insight.info .insight-detail { color: #2B5590; }
.insight .chev { font-size: 12px; opacity: 0.7; transition: transform 0.15s; margin-left: auto; }
.insight.open .chev { transform: rotate(90deg); }
.insight-drill { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,0.12); }
.drill-title { font-weight: 700; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.3px; margin: 8px 0 4px; opacity: 0.85; }
.insight.good .insight-drill, .insight.good .drill-title { color: #245C39; }
.insight.warn .insight-drill, .insight.warn .drill-title { color: #6E4F18; }
.insight.info .insight-drill, .insight.info .drill-title { color: #2B5590; }
.insight-drill table { width: 100%; border-collapse: collapse; font-size: 12px; }
.insight-drill th, .insight-drill td {
  text-align: right; padding: 5px 6px; border-bottom: 1px solid rgba(0,0,0,0.10); white-space: nowrap;
}
.insight-drill th:first-child, .insight-drill td:first-child { text-align: left; white-space: normal; }
.insight-drill th { font-size: 10px; text-transform: uppercase; opacity: 0.75; }

/* ---------- Фильтр + аккордеон врачей ---------- */
.filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.filter-row label { color: var(--hint); font-size: 12px; flex: 0 0 auto; }
.filter-row select {
  flex: 1; min-width: 0; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; font-size: 13px;
}
#doctors-list { display: flex; flex-direction: column; gap: 12px; }
.doc-card {
  background: var(--card); border: none; border-left: 5px solid var(--accent);
  border-radius: 18px; padding: 13px 15px; box-shadow: var(--shadow);
}
.doc-card.expandable { cursor: pointer; }
.doc-card.expandable:active { filter: brightness(0.98); }
.doc-card-head { display: flex; align-items: flex-start; gap: 10px; }
.doc-rank {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 9px;
  background: rgba(22,24,29,0.06); color: var(--hint);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-weight: 700; font-size: 13.5px; }
.doc-spec { color: var(--hint); font-weight: 400; font-size: 11.5px; margin-left: 6px; }
.doc-rev { font-size: 18.5px; font-weight: 800; letter-spacing: -0.4px; margin-top: 2px; }
.doc-figures { color: var(--hint); font-size: 11.5px; margin-top: 1px; }
.doc-bar { height: 7px; border-radius: 4px; background: rgba(22,24,29,0.06); margin-top: 9px; overflow: hidden; }
.doc-bar-fill { height: 100%; border-radius: 4px; }
.doc-card .chev { color: var(--hint); flex: 0 0 auto; transition: transform 0.15s; }
.doc-card.open .chev { transform: rotate(90deg); }
.doc-card .doc-services { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.doc-card.other .doc-rev { color: var(--hint); }
.sub-table { width: 100%; margin-top: 2px; }
.sub-table th { font-size: 10px; }
.sub-table td, .sub-table th { padding: 6px 6px; }

/* ---------- «Общее» ---------- */
.general-note { color: var(--hint); font-size: 12px; margin: 2px 2px 14px; line-height: 1.4; }
.card-hint { color: var(--hint); font-size: 11.5px; margin: -4px 0 12px; line-height: 1.4; }
.cov-badge {
  font-weight: 600; font-size: 11px; color: var(--hint);
  background: rgba(22,24,29,0.06); border-radius: 8px; padding: 2px 7px; margin-left: 6px; white-space: nowrap;
}
.cov-badge.warn { color: #C77A0A; background: rgba(245,146,11,0.16); }
#gen-base.kpi-grid { grid-template-columns: 1fr 1fr; margin-bottom: 0; }
#tab-general .kpi-value { font-size: 18px; }

/* ---------- «Отзывы» ---------- */
#rev-kpi.kpi-grid { margin-bottom: 0; }
#tab-reviews .kpi-value { font-size: 18px; }
#rev-list { display: flex; flex-direction: column; gap: 12px; }
.review {
  background: var(--card); border: none; border-left: 4px solid #17B978;
  border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
}
.review.neg { border-left-color: var(--down); }
.neg-alert {
  border-radius: 18px; padding: 14px 15px; margin-bottom: 14px; font-size: 13px;
  line-height: 1.4; border-left: 5px solid; box-shadow: var(--shadow);
}
.neg-alert.warn { background: #FFE2E0; border-left-color: #E23B34; color: #7A1C17; }
.neg-alert.ok { background: #E4F6EA; border-left-color: #1FAF54; color: #14562C; }
.neg-alert b { font-weight: 700; }
.neg-alert-icon { margin-right: 4px; }
#rev-branch-filter {
  flex: 1; min-width: 0; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; font-size: 13px;
}
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.review-stars { font-size: 14px; letter-spacing: 1px; flex: 0 0 auto; }
.review-meta { color: var(--hint); font-size: 11.5px; text-align: right; }
.review-text { font-size: 13px; line-height: 1.4; }

/* ---------- Отзывы: «Проблемы и что делать» ---------- */
.rev-advice {
  background: #FFF1D6; color: #7A4A00; border-radius: 16px; padding: 12px 14px;
  font-size: 12.5px; line-height: 1.4; margin-bottom: 14px;
}
.rev-advice-icon { margin-right: 4px; }
#rev-problems { display: flex; flex-direction: column; gap: 12px; }
.problem { }
.problem-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.problem-name { font-weight: 700; font-size: 13px; }
.problem-count {
  flex: 0 0 auto; font-weight: 800; font-size: 12.5px; color: var(--down);
  background: rgba(244,89,91,0.16); border-radius: 8px; padding: 1px 8px;
}
.problem-bar { background: var(--down); margin: 6px 0 6px; }
.problem-rec { color: var(--hint); font-size: 12px; line-height: 1.4; }

/* ---------- «Обзор» (кокпит) ---------- */
#tab-overview .kpi-value { font-size: 19px; white-space: nowrap; }
.ovw-status { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.ovw-stat { border-radius: 20px; padding: 15px 16px; box-shadow: var(--shadow-p); }
.ovw-stat.debt { background: var(--card); border-left: 5px solid var(--b4); }
.ovw-stat.rating { background: var(--card); border-left: 5px solid var(--b2); }
.ovw-stat-label { color: var(--text); opacity: 0.6; font-size: 11.5px; font-weight: 600; margin-bottom: 8px; }
.ovw-stat-value { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; white-space: nowrap; }
.ovw-stat-value .kpi-delta { font-size: 11px; }
.ovw-stat-value .kpi-delta-wrap { flex-direction: row; align-items: center; }
.ovw-stat-value .kpi-delta-cap { display: none; }
.ovw-star { color: #E8A317; }
.ovw-stat-words { color: var(--text); opacity: 0.62; font-size: 11px; line-height: 1.4; margin-top: 8px; white-space: normal; }

/* ---------- «Отзывы» ---------- */
#tab-reviews .kpi-value { font-size: 19px; white-space: nowrap; }
#rev-branches { display: flex; gap: 12px; margin-bottom: 14px; }
.rev-branch { flex: 1; min-width: 0; background: var(--card); border-radius: 18px;
  padding: 14px 15px; box-shadow: var(--shadow-p); text-align: center; }
.rev-branch-name { font-size: 12px; color: var(--hint); font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.rev-branch-rating { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -0.5px; white-space: nowrap; }
.rev-branch-rating.good { color: #0E7A4E; }
.rev-branch-sub { font-size: 11px; color: var(--hint); margin-top: 4px; }

/* ---------- «Пациенты и записи» ---------- */
#tab-records .kpi-value { font-size: 19px; white-space: nowrap; }
#tab-records #gen-base .kpi-value { font-size: 18px; }
#rec-filials { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.rec-cancel { font-size: 13px; font-weight: 600; color: #B4272A; }
.rec-cancel-x { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center;
  background: rgba(244,89,91,0.16); border-radius: 6px; margin-right: 4px; font-size: 11px; }

/* ---------- «Врачи» ---------- */
#tab-doctors .kpi-value { font-size: 19px; white-space: nowrap; }
#tab-doctors .filter-row { margin-top: 2px; }
.doc-card2 .mkt-camp-name { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.doc-card2 .doc-spec { color: var(--hint); font-weight: 400; font-size: 11.5px; }
.doc-sub { margin-top: 3px; }
.doc-debt { font-size: 10.5px; font-weight: 700; color: #B4272A;
  background: rgba(244,89,91,0.14); border-radius: 7px; padding: 1px 8px; }
.doc-card2 .src-figs > span:nth-child(2) .mc-num { color: #8a6d1f; }

/* ---------- «Источники» ---------- */
#tab-sources .kpi-value { font-size: 19px; white-space: nowrap; }
.src-top-name { font-size: 17px; }
.src-top-sub { color: var(--hint); font-size: 11px; font-weight: 600; }
#src-cards { margin-top: 2px; }
.src-card .mkt-camp-name { display: flex; align-items: center; gap: 7px; }
.src-bar { height: 7px; border-radius: 4px; background: rgba(22,24,29,0.06); margin-top: 9px; overflow: hidden; }
.src-bar-fill { height: 100%; border-radius: 4px; }
/* метрики источника — адаптивная сетка (5 метрик: 3+2), подписи не сталкиваются */
.src-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 6px; margin-top: 11px; }
.src-figs > span { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.src-figs .mc-num { white-space: nowrap; }
.src-figs .mc-cap { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- «Маркетинг» ---------- */
#tab-marketing .kpi-value { font-size: 19px; white-space: nowrap; }
#mkt-recs.insights { margin-bottom: 0; }

/* заголовок-секция (капс-подпись над сеткой) */
.section-head { display: flex; align-items: center; gap: 8px; margin: 2px 2px 10px; flex-wrap: wrap; }
.section-head.tight { margin-bottom: 4px; }
.section-cap { font-weight: 800; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text); opacity: 0.65; }
.section-note { color: var(--hint); font-size: 11px; margin-left: auto; }

/* KPI: спарклайн + дельта в подвале карточки */
.mkt-kpi .kpi { padding: 13px 14px; }
.mkt-kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 8px; }
.spark { width: 62px; height: 26px; flex: 0 0 auto; display: block; }
.mkt-kpi-card .kpi-delta { margin-top: 0; }

/* ИИ-инсайт баннер (аномалии словами) — тёплый, gold */
.mkt-alert { display: flex; gap: 12px; align-items: flex-start; border-radius: 18px;
  padding: 14px 15px; margin-bottom: 16px; border-left: 5px solid; box-shadow: var(--shadow); }
.mkt-alert.warn { background: #FFF1D6; border-left-color: #F5920B; }
.mkt-alert.good { background: #E4F6EA; border-left-color: #1FAF54; }
.mkt-alert.info { background: #E5EFFF; border-left-color: #2E8BFF; }
.mkt-alert-icon { font-size: 22px; line-height: 1.1; width: 36px; height: 36px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.7); border-radius: 12px; }
.mkt-alert-title { font-weight: 800; font-size: 13.5px; }
.mkt-alert.warn .mkt-alert-title { color: #7A4A00; }
.mkt-alert.good .mkt-alert-title { color: #0F5A2C; }
.mkt-alert-detail { font-size: 12px; margin-top: 3px; line-height: 1.4; color: var(--text); opacity: 0.85; }

/* Свитч Воронка/Динамика + пилюли-метрики (единый стиль пилюль) */
.switch { display: flex; gap: 4px; padding: 4px; background: var(--surface);
  border-radius: 14px; margin-bottom: 14px; }
.switch button { flex: 1; padding: 8px 12px; border: none; background: transparent;
  color: var(--hint); font-size: 12.5px; font-weight: 700; border-radius: 11px; transition: all 0.15s; }
.switch button.active { background: var(--card); color: var(--text); box-shadow: 0 2px 6px rgba(24,26,44,0.10); }
.switch-panel { display: none; }
.switch-panel.active { display: block; }
.metric-pills { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 12px;
  background: var(--surface); border-radius: 14px; scrollbar-width: none; }
.metric-pills::-webkit-scrollbar { display: none; }
.metric-pills button { flex: 0 0 auto; padding: 7px 13px; border: none; background: transparent;
  color: var(--hint); font-size: 12px; font-weight: 700; border-radius: 10px; white-space: nowrap; }
.metric-pills button.active { background: var(--card); color: var(--text); box-shadow: 0 2px 6px rgba(24,26,44,0.10); }

/* Воронка (вертикальные ступени) */
.funnel-step { }
.funnel-step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.funnel-label { font-weight: 700; font-size: 13px; }
.funnel-val { font-weight: 800; font-size: 17px; letter-spacing: -0.4px; white-space: nowrap; }
.funnel-track { height: 12px; border-radius: 7px; background: rgba(22,24,29,0.06); margin-top: 6px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, #ffb02e, #ff8a5c); }
.funnel-step.pending .funnel-fill { background: repeating-linear-gradient(45deg,
  rgba(139,144,154,0.35) 0 6px, rgba(139,144,154,0.15) 6px 12px); }
.funnel-step.pending .funnel-val, .funnel-step.pending .funnel-label { color: var(--hint); }
.funnel-link { display: flex; justify-content: center; padding: 5px 0; }
.funnel-conv { font-size: 11.5px; font-weight: 700; color: var(--hint);
  background: rgba(22,24,29,0.05); border-radius: 20px; padding: 2px 10px; }
.funnel-note { display: inline-block; margin-top: 5px; font-size: 10.5px; font-weight: 600;
  color: var(--hint); background: rgba(22,24,29,0.05); border-radius: 8px; padding: 2px 8px; }
.funnel-note.approx { color: #8a6d1f; background: rgba(255,176,46,0.16); }
.funnel-note.pending { color: #5a6472; background: rgba(94,111,133,0.14); }

/* Блок связи с кассой MacDent */
.funnel-cash { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.cash-head { font-weight: 800; font-size: 12.5px; margin-bottom: 10px; display: flex;
  align-items: center; gap: 8px; flex-wrap: wrap; }
.cash-figs { display: flex; gap: 10px; flex-wrap: wrap; }
.cash-figs > span { display: flex; flex-direction: column; flex: 1; min-width: 90px;
  background: #DFF3E4; border-radius: 14px; padding: 10px 12px; }
.cash-num { font-weight: 800; font-size: 16px; letter-spacing: -0.3px; white-space: nowrap; }
.cash-cap { color: #245C39; opacity: 0.8; font-size: 10.5px; margin-top: 2px; }
.cash-words { margin-top: 10px; font-size: 12.5px; line-height: 1.45;
  background: #FFF0C8; border-radius: 14px; padding: 11px 13px; color: #6E4F18; }
.cash-pending { margin-top: 10px; font-size: 11.5px; line-height: 1.45; color: var(--hint); }

/* Карточки кампаний */
.mkt-camp { background: var(--card); border-radius: 16px; padding: 12px 13px; margin-bottom: 10px;
  border: 1.5px solid var(--border); box-shadow: var(--shadow); cursor: pointer; }
.mkt-camp:active { filter: brightness(0.98); }
.mkt-camp.top { border-color: #ffb02e; }
.mkt-camp-head { display: flex; align-items: flex-start; gap: 10px; }
.mkt-rank { flex: 0 0 auto; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 9px;
  background: rgba(22,24,29,0.06); color: var(--hint); font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.mkt-rank.top { background: rgba(255,176,46,0.2); color: #8a6d1f; }
.mkt-camp-main { flex: 1; min-width: 0; }
.mkt-camp-name { font-weight: 700; font-size: 13px; line-height: 1.3; }
.mkt-camp-sub { margin-top: 3px; }
.mkt-camp .chev { color: var(--hint); flex: 0 0 auto; transition: transform 0.15s; }
.mkt-camp.open .chev { transform: rotate(90deg); }
.mkt-camp-figs { display: flex; gap: 6px; margin-top: 10px; }
.mkt-camp-figs > span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mc-num { font-weight: 800; font-size: 14px; letter-spacing: -0.3px; white-space: nowrap; }
.mc-cap { color: var(--hint); font-size: 10px; margin-top: 1px; text-transform: uppercase; letter-spacing: 0.3px; }
.mkt-camp-figs > span:first-child .mc-num { color: #8a6d1f; }
.mkt-camp-drill { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border); }
.mc-words { display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 1.4; }
.mc-words b { font-weight: 800; }

.mkt-status { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px;
  border-radius: 7px; padding: 1px 7px; }
.mkt-status.on { color: #0E7A4E; background: rgba(23,185,120,0.16); }
.mkt-status.off { color: var(--hint); background: rgba(22,24,29,0.06); }

/* IG Insights: карточки-KPI используют .mkt-kpi (описан выше) */
#mkt-ig-accounts-sel:empty { display: none; }
#mkt-ig-kpi { margin-top: 12px; }

/* Топ-посты — карточки с превью */
#mkt-posts { display: flex; flex-direction: column; gap: 12px; }
.post-card { border: 1.5px solid var(--border); border-radius: 16px; padding: 11px 12px;
  box-shadow: var(--shadow); cursor: pointer; }
.post-card:active { filter: brightness(0.98); }
.post-card.open { border-color: #ffb02e; }
.post-top { display: flex; gap: 11px; align-items: flex-start; }
.post-thumb { position: relative; flex: 0 0 auto; width: 62px; height: 62px; border-radius: 12px;
  overflow: hidden; background: var(--surface); }
.post-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-thumb.noimg::after { content: "IG"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: var(--hint); font-weight: 800; font-size: 12px; }
.post-type { position: absolute; left: 3px; bottom: 3px; font-size: 8.5px; font-weight: 800;
  color: #fff; background: rgba(0,0,0,0.55); border-radius: 6px; padding: 1px 5px; letter-spacing: 0.2px; }
.post-type.reels { background: rgba(225,48,108,0.9); }
.post-type.carousel { background: rgba(93,138,255,0.9); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-rank { font-size: 10px; font-weight: 800; color: #8a6d1f; background: rgba(255,176,46,0.2);
  border-radius: 7px; padding: 1px 7px; }
.post-user { font-weight: 700; font-size: 12.5px; }
.post-cap { font-size: 12px; line-height: 1.35; margin-top: 3px; color: var(--text); opacity: 0.85;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .chev { color: var(--hint); flex: 0 0 auto; transition: transform 0.15s; }
.post-card.open .chev { transform: rotate(90deg); }
/* адаптивная сетка метрик поста — макс 3 колонки, перенос на след. ряд,
   ячейки по центру с фикс. gap, чтобы подписи НИКОГДА не сталкивались */
.post-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 6px; margin-top: 11px; }
.post-metrics > span { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.pm-num { font-weight: 800; font-size: 13.5px; letter-spacing: -0.3px; white-space: nowrap; }
.pm-cap { color: var(--hint); font-size: 9px; margin-top: 2px; text-transform: uppercase;
  letter-spacing: 0.1px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.post-drill { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border); }
.post-ai { font-size: 12px; line-height: 1.45; background: #EEF3FF; border-radius: 12px;
  padding: 10px 12px; color: #2B4A80; }
.post-ai-badge { font-weight: 800; color: #3355aa; }
.post-reco { margin-top: 8px; font-size: 12px; line-height: 1.4; font-weight: 600; color: #7A4A00; }
.post-link { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
  color: #e1306c; text-decoration: none; }
.donut-wrap { max-width: 230px; margin: 6px auto 2px; }

/* ================= Календарь выбора периода ================= */
.cal-hidden { display: none !important; }
.cal-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 11px 14px; border-radius: 14px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); transition: all 0.15s;
}
.cal-btn:active { filter: brightness(0.97); }
.cal-pop {
  position: fixed; top: 60px; right: 12px; z-index: 40;
  width: min(344px, calc(100vw - 24px));
  background: var(--card); border-radius: 18px; padding: 14px;
  box-shadow: 0 14px 40px rgba(24,26,44,0.20); border: 1px solid var(--border);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  animation: calIn 0.16s ease-out;
}
@keyframes calIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 800; font-size: 14px; }
.cal-nav {
  width: 32px; height: 32px; border: none; border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav:active { filter: brightness(0.95); }
.cal-dow { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 4px; }
.cal-dow span { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--hint); text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-cell {
  aspect-ratio: 1 / 1; border: none; background: transparent; color: var(--text);
  font-size: 13px; font-weight: 600; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; transition: background 0.12s;
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.inrange { background: var(--p5); color: #2B5590; border-radius: 0; }
.cal-cell.sel { background: var(--accent); color: #fff; font-weight: 800; border-radius: 10px; }
.cal-grid.has-range .cal-cell.sel-start { border-radius: 10px 0 0 10px; }
.cal-grid.has-range .cal-cell.sel-end   { border-radius: 0 10px 10px 0; }
.cal-cell.future { color: var(--hint); opacity: 0.35; }
.cal-cell:not(.empty):not(.sel):not(.future):active { background: var(--surface); }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.cal-sel { font-size: 11.5px; color: var(--hint); font-weight: 600; min-width: 0; }
.cal-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.cal-cancel { background: var(--surface); border: none; color: var(--text); padding: 9px 14px; border-radius: 11px; font-weight: 700; font-size: 12.5px; }
.cal-apply  { background: var(--accent); border: none; color: var(--accent-text); padding: 9px 16px; border-radius: 11px; font-weight: 700; font-size: 12.5px; }

/* ── Светофор-бенчмарки маркетинга (v11) ─────────────────────────────── */
.bench-green { color: #0E7A4E; }
.bench-amber { color: #B5730B; }
.bench-red   { color: #B4272A; }
.bench-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 5px; vertical-align: middle;
}
.bench-dot.bench-green { background: #17B978; }
.bench-dot.bench-amber { background: #F5920B; }
.bench-dot.bench-red   { background: #F4595B; }

/* авто-рекомендация по кампании */
.mkt-camp-rec {
  margin-top: 9px; padding: 7px 10px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.35; display: flex; gap: 7px; align-items: flex-start;
}
.mkt-camp-rec .rec-ic { flex: 0 0 auto; }
.mkt-camp-rec.rec-good { background: #E4F6EA; color: #0F5A2C; }
.mkt-camp-rec.rec-warn { background: #FFF1D6; color: #7A4A00; }
.mkt-camp-rec.rec-bad  { background: #FCE3E3; color: #8E1F22; }
.mkt-camp-rec.rec-wait { background: #EEF0F4; color: #565B66; }
.cpl-badge {
  display: inline-block; margin-top: 7px; font-size: 11px;
  padding: 2px 9px; border-radius: 999px; background: #EEF0F4; color: #6B7280; font-weight: 600;
}
.drill-bench {
  margin-top: 4px; font-size: 12px; color: var(--hint); line-height: 1.5;
}

/* ================= Единый белый liquid glass ================= */
:is(
  .presets, .metric-pills, .switch,
  .analytics-action,
  .account-card, .business-card, .integration-card,
  .kpi, .card, .insight, .doc-card, .review,
  .ovw-stat, .rev-branch, .mkt-alert, .mkt-camp,
  .post-card, .cal-btn, .cal-pop, .neg-alert,
  .rev-advice, .cash-figs > span, .cash-words,
  .mkt-camp-rec, .post-ai
) {
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

:is(
  .insight.good, .insight.warn, .insight.info,
  .mkt-alert.good, .mkt-alert.warn, .mkt-alert.info,
  .neg-alert.good, .neg-alert.warn,
  .mkt-camp-rec.rec-good, .mkt-camp-rec.rec-warn,
  .mkt-camp-rec.rec-bad, .mkt-camp-rec.rec-wait
) {
  background: var(--glass);
}

.kpi-grid .kpi:nth-child(6n+1) { border: 1px solid rgba(142,124,255,0.24); }
.kpi-grid .kpi:nth-child(6n+2) { border: 1px solid rgba(235,163,26,0.24); }
.kpi-grid .kpi:nth-child(6n+3) { border: 1px solid rgba(23,185,120,0.22); }
.kpi-grid .kpi:nth-child(6n+4) { border: 1px solid rgba(255,133,87,0.24); }
.kpi-grid .kpi:nth-child(6n+5) { border: 1px solid rgba(62,141,255,0.22); }
.kpi-grid .kpi:nth-child(6n+6) { border: 1px solid rgba(236,106,160,0.22); }
.insight.good, .mkt-alert.good, .neg-alert.ok { border: 1px solid rgba(31,175,84,0.26); }
.insight.warn, .mkt-alert.warn, .neg-alert.warn { border: 1px solid rgba(245,146,11,0.28); }
.insight.info, .mkt-alert.info { border: 1px solid rgba(46,139,255,0.24); }
.doc-card { border: 1px solid rgba(91,107,255,0.22); }
.review { border: 1px solid rgba(23,185,120,0.22); }
.ovw-stat.debt { border: 1px solid rgba(255,133,87,0.24); }
.ovw-stat.rating { border: 1px solid rgba(235,163,26,0.24); }

.mobile-nav {
  background: rgba(255,255,255,0.82);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

:is(
  button, .insight.diggable, .doc-card.expandable,
  .mkt-camp, .post-card
) {
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 180ms ease-out,
    box-shadow 180ms ease-out,
    filter 180ms ease-out;
}

:is(
  button, .insight.diggable, .doc-card.expandable,
  .mkt-camp, .post-card
):active {
  transform: translateY(1px) scale(0.985);
}

:is(button, input, select, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 360px) {
  .topbar { gap: 7px; padding-inline: 12px; }
  .brand-title { font-size: 18px; }
  .brand-sub { font-size: 10.5px; }
  .period-label { font-size: 9.5px; padding-inline: 7px; }
}

@media (min-width: 769px) {
  :root { --nav-space: 96px; }
}

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

/* ============================================================
   NeuroDent — стартовый splash-экран (нейро-сеть + пульс)
   Фон = цвет фона лого (градиент #5B4BE8 → #7B6CFF).
   ============================================================ */
.nd-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #5B4BE8 0%, #6E5FF3 45%, #7B6CFF 100%);
  overflow: hidden;
  opacity: 1; transition: opacity 520ms ease, visibility 520ms;
}
.nd-splash.nd-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.nd-splash-net {
  position: absolute; inset: -6% ; width: 112%; height: 112%;
  opacity: 0.9; animation: nd-drift 14s ease-in-out infinite alternate;
}
@keyframes nd-drift {
  from { transform: scale(1) translate(0,0); }
  to   { transform: scale(1.06) translate(-1.5%, -1%); }
}
.nd-lines line {
  stroke: #ffffff; stroke-width: 0.35; opacity: 0.28;
  animation: nd-line 3.6s ease-in-out infinite;
}
.nd-lines line:nth-child(3n)   { stroke: #2FD3C3; stroke-width: 0.5; animation-delay: .6s; }
.nd-lines line:nth-child(4n+1) { animation-delay: 1.2s; }
.nd-lines line:nth-child(5n)   { animation-delay: 1.9s; }
@keyframes nd-line {
  0%,100% { opacity: 0.16; } 50% { opacity: 0.5; }
}
.nd-nodes circle { transform-box: fill-box; transform-origin: center; }
.nd-nodes circle.w { fill: #ffffff; opacity: 0.5; }
.nd-nodes circle.g {
  fill: #2FD3C3;
  filter: drop-shadow(0 0 1.4px rgba(47,211,195,0.9));
  animation: nd-pulse 2.4s ease-in-out infinite;
}
.nd-nodes circle.g:nth-child(3n)   { animation-delay: .4s; }
.nd-nodes circle.g:nth-child(4n+2) { animation-delay: .9s; }
.nd-nodes circle.g:nth-child(5n+1) { animation-delay: 1.5s; }
@keyframes nd-pulse {
  0%,100% { transform: scale(0.85); opacity: 0.55; }
  50%     { transform: scale(1.75); opacity: 1; }
}
.nd-splash-logo {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: nd-logo-in 640ms cubic-bezier(.2,.7,.3,1) both;
}
.nd-splash-logo img {
  width: 104px; height: 104px; border-radius: 30px;
  background: #fff; padding: 6px;
  box-shadow: 0 20px 48px rgba(20,14,60,0.45), 0 0 0 1px rgba(255,255,255,0.5);
}
.nd-splash-word {
  color: #fff; font-size: 30px; font-weight: 800; letter-spacing: -0.5px;
  text-shadow: 0 2px 14px rgba(20,14,60,0.35);
}
.nd-splash-tag { color: rgba(255,255,255,0.82); font-size: 13px; font-weight: 500; }
@keyframes nd-logo-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nd-splash-net, .nd-lines line, .nd-nodes circle.g, .nd-splash-logo { animation: none; }
}

/* ============================================================
   ТЁМНАЯ ТЕМА — полноценные dark-токены.
   Фирменный градиент #5B6BFF→#8E7CFF сохранён как акцент.
   ============================================================ */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] {
  --bg:        #0E1017;
  --card:      #181B23;
  --surface:   #21252F;
  --panel:     #1B1F28;
  --text:      #ECEFF6;
  --hint:      #A3ACBD;   /* AA-контраст на тёмном фоне */
  --border:    rgba(255,255,255,0.10);
  --shadow:    inset 0 1px 0 rgba(255,255,255,0.04), 0 6px 16px rgba(0,0,0,0.45);
  --shadow-p:  inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 16px rgba(0,0,0,0.5);
  --glass:     linear-gradient(145deg, rgba(40,45,58,0.92), rgba(24,27,35,0.72));
  --sk-base:   #20242E;
  --sk-shine:  #2C313D;
  --scrim:     rgba(0,0,0,0.62);
  --chart-grid: rgba(255,255,255,0.09);
  /* пастель KPI приглушаем, чтобы не «кричала» на тёмном */
  --p1:#2A2740; --p2:#332C1D; --p3:#1F2E28; --p4:#33241E; --p5:#1E2838; --p6:#301F2A;
}
html[data-theme="dark"] body { background: var(--bg); }
/* приглушённые вторичные подписи → на токен --hint */
html[data-theme="dark"] .screen-head p,
html[data-theme="dark"] .analytics-copy small,
html[data-theme="dark"] .analytics-chev,
html[data-theme="dark"] .account-card span:not(.demo-badge),
html[data-theme="dark"] .business-card span,
html[data-theme="dark"] .integration-copy span,
html[data-theme="dark"] .ai-message.loading .ai-bubble { color: var(--hint); }
html[data-theme="dark"] .ai-form input::placeholder { color: var(--hint); }
/* пузырь ассистента: тёмная поверхность + светлый текст */
html[data-theme="dark"] .ai-bubble { color: var(--text); }
/* чипы дельты — читаемые на тёмном */
html[data-theme="dark"] .kpi-delta.flat { color: var(--hint); background: rgba(255,255,255,0.08); }
html[data-theme="dark"] .kpi-delta.up   { color: #4FD69C; background: rgba(23,185,120,0.16); }
html[data-theme="dark"] .kpi-delta.down { color: #FF7E80; background: rgba(244,89,91,0.18); }
/* вторичная кнопка на тёмной панели */
html[data-theme="dark"] .secondary-action { color: #B9C0FF; border-color: rgba(142,124,255,0.35); }
/* нативные контролы (date/checkbox) в тёмной гамме */
html[data-theme="dark"] input, html[data-theme="dark"] select { color-scheme: dark; }
/* поповер календаря на тёмной поверхности */
html[data-theme="dark"] .cal-pop { background: var(--card); }
/* верхняя панель (sticky) — стеклянная в тон тёмного фона */
html[data-theme="dark"] .topbar {
  background: rgba(14,16,23,0.82); border-bottom-color: var(--border);
}
html[data-theme="dark"] .brand-sub { color: var(--hint); }
/* кнопка выхода — тёмный «danger»-вариант */
html[data-theme="dark"] .settings-logout {
  color: #FF8E90; background: rgba(244,89,91,0.10); border-color: rgba(244,89,91,0.28);
}

/* ---------- Тумблер темы (Настройки) ---------- */
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.theme-copy { display: flex; flex-direction: column; gap: 3px; }
.theme-copy b { font-size: 14px; }
.theme-copy span { color: var(--hint); font-size: 11.5px; line-height: 1.4; max-width: 44ch; }
.switch { position: relative; flex: 0 0 auto; width: 52px; height: 30px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; border-radius: 20px; background: var(--border); transition: background 0.2s ease; }
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  transition: transform 0.22s cubic-bezier(0.4,0.1,0.3,1.25);
}
.switch input:checked + .switch-track { background: var(--grad); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-thumb { transition: none; } }
