/* =====================================================
   Help me, Doctor — стили веб-приложения
   Mobile-first; в Telegram подхватываем цвета клиента
   ===================================================== */
:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --surface-2: #eef3f3;
  --text: #11201f;
  --muted: #5f7270;
  --border: #dde6e5;
  --accent: #0f766e;
  --accent-contrast: #ffffff;
  --accent-soft: #d8f0ed;
  --doctor-bubble: #0f766e;
  --doctor-text: #ffffff;
  --patient-bubble: #ffffff;
  --danger: #c2410c;
  --danger-soft: #fdeee6;
  --warn: #b45309;
  --warn-soft: #fdf3dd;
  --ok: #15803d;
  --ok-soft: #e3f5e8;
  --gold: #d99a06;
  --shadow: 0 1px 2px rgba(16, 40, 38, .06), 0 4px 16px rgba(16, 40, 38, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --safe-top: max(env(safe-area-inset-top), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --app-h: 100dvh;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1716;
    --surface: #152321;
    --surface-2: #1c2e2c;
    --text: #e6f0ef;
    --muted: #93a8a5;
    --border: #25403d;
    --accent: #2dd4bf;
    --accent-contrast: #062a26;
    --accent-soft: #123b37;
    --doctor-bubble: #14746b;
    --doctor-text: #f0fffd;
    --patient-bubble: #1c2e2c;
    --danger: #fb923c;
    --danger-soft: #3a2116;
    --warn: #fbbf24;
    --warn-soft: #3a2f12;
    --ok: #4ade80;
    --ok-soft: #133524;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1716; --surface: #152321; --surface-2: #1c2e2c; --text: #e6f0ef; --muted: #93a8a5;
  --border: #25403d; --accent: #2dd4bf; --accent-contrast: #062a26; --accent-soft: #123b37;
  --doctor-bubble: #14746b; --doctor-text: #f0fffd; --patient-bubble: #1c2e2c;
  --danger: #fb923c; --danger-soft: #3a2116; --warn: #fbbf24; --warn-soft: #3a2f12;
  --ok: #4ade80; --ok-soft: #133524; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* Внутри Telegram — цвета клиента */
:root.tg {
  /* Запасные значения — конкретные цвета: ссылка var(--x) на саму себя сделала бы значение невалидным */
  --bg: var(--tg-theme-secondary-bg-color, #f4f7f7);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #11201f);
  --muted: var(--tg-theme-hint-color, #5f7270);
  --accent: var(--tg-theme-button-color, #0f766e);
  --accent-contrast: var(--tg-theme-button-text-color, #ffffff);
  --accent-soft: color-mix(in srgb, var(--tg-theme-button-color, #0f766e) 14%, transparent);
  --doctor-bubble: var(--tg-theme-button-color, #0f766e);
  --doctor-text: var(--tg-theme-button-text-color, #ffffff);
  --patient-bubble: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --app-h: var(--tg-viewport-stable-height, 100dvh);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (hover: hover) and (pointer: fine) { html { scrollbar-gutter: stable; } }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; }

/* ---------- Каркас ---------- */
.app { min-height: 100dvh; }
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(var(--nav-h) + 24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.page-head { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.back {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface);
  display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow); flex: none;
}
html.tg .back { display: none; } /* в Telegram — системная кнопка «Назад» */

.card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
html.tg .card { border-color: transparent; }
.card.flat { box-shadow: none; }
.card.tap { transition: background-color .15s ease, box-shadow .15s ease; }
.card.tap:active { background: var(--surface-2); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 4px 4px -6px; }

/* ---------- Нижняя навигация ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.nav-inner { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); }
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; position: relative;
}
.nav a .nav-i { width: 24px; height: 24px; stroke-width: 1.8; }
.nav a.active { color: var(--accent); }
.nav a.active .nav-i { stroke-width: 2.2; }
.nav .dot {
  position: absolute; top: 8px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; display: grid; place-items: center;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0;
  background: var(--accent); color: var(--accent-contrast); font-weight: 600; font-size: 16px;
  transition: filter .15s, transform .1s; text-decoration: none; user-select: none; text-align: center;
}
.btn:active { filter: brightness(.93); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.outline { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
/* Кнопка в ожидании: подпись прячем, но место сохраняем — ничего не сдвигается */
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--accent-contrast) 30%, transparent); border-top-color: var(--accent-contrast);
  animation: spin 1.3s cubic-bezier(.55, .15, .45, .85) infinite;
}
.btn.ghost.busy::after, .btn.outline.busy::after, .btn.danger.busy::after { border-color: color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2);
  display: grid; place-items: center; font-size: 20px; flex: none;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
button.chip:active { transform: scale(.97); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Главная ---------- */
.hello { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 20px; flex: none;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }
.xp-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.xp-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fbbf24)); border-radius: 5px; transition: width .6s ease; }
.task { display: flex; gap: 12px; align-items: center; }
.task .ico { font-size: 28px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); }

/* ---------- Пациенты ---------- */
.patient { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; }
.patient .pic {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  background: var(--surface-2); flex: none;
}
.patient .name { font-weight: 600; }
.patient .complaint { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ico { font-size: 44px; margin-bottom: 8px; }

/* ---------- Приём (чат) ---------- */
.consult { height: var(--app-h); display: flex; flex-direction: column; max-width: 820px; margin: 0 auto; }
.consult-head {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex: none;
}
.consult-head .title { font-weight: 700; }
.messages {
  flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.msg { max-width: min(82%, 560px); padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; box-shadow: var(--shadow); }
.msg.from-patient { align-self: flex-start; background: var(--patient-bubble); border-bottom-left-radius: 6px; }
.msg.from-doctor { align-self: flex-end; background: var(--doctor-bubble); color: var(--doctor-text); border-bottom-right-radius: 6px; }
.msg .meta { font-size: 11px; opacity: .65; margin-top: 2px; text-align: right; }
.msg.pending { opacity: .6; }
.msg.failed { box-shadow: inset 0 0 0 1.5px var(--danger); }
.event {
  align-self: stretch; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px;
}
.event .event-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.event .event-body { font-size: 14px; white-space: pre-wrap; }
.event.test .event-body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.divider { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 4px 12px; border-radius: 999px; }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--patient-bubble); border-radius: 18px; box-shadow: var(--shadow); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.actions-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 12px 0; flex: none; }
.actions-bar .chip { justify-content: center; padding: 9px 6px; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(10px + var(--safe-bottom));
  background: var(--bg); flex: none;
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--border); background: var(--surface); border-radius: 22px;
  padding: 11px 16px; max-height: 140px; min-height: 44px; line-height: 1.35; outline: none; font-size: 16px;
  overflow-y: hidden; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent;
}
.composer textarea::-webkit-scrollbar { width: 4px; }
.composer textarea::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 2px; }
.composer textarea:focus { border-color: var(--accent); }
.send { background: var(--accent); color: var(--accent-contrast); }
.rec { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 22px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* ---------- Нижние листы и модалки ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(8, 20, 19, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + var(--safe-bottom)); animation: up .22s ease;
}
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 12px; }
.sheet h2 { margin-bottom: 12px; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; padding-bottom: 20px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: left; font-weight: 500;
  min-height: 48px; transition: background .12s;
}
.option:active { background: var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .field textarea, .field select {
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; outline: none; font-size: 16px; width: 100%;
}
.input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 80px; }

/* ---------- Разбор ---------- */
.rating-big { font-size: 44px; font-weight: 800; line-height: 1; }
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars .i { width: 18px; height: 18px; }
.stars .i.on, .badge .i.on { fill: currentColor; }
.axis { display: grid; grid-template-columns: 110px 1fr 28px; gap: 8px; align-items: center; font-size: 14px; }
.axis .bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.axis .bar i { display: block; height: 100%; background: var(--accent); }
.quote { border-left: 3px solid var(--accent); padding: 4px 0 4px 10px; font-style: italic; }
.xp-pill { display: inline-flex; gap: 6px; align-items: center; background: var(--warn-soft); color: var(--warn); font-weight: 700; padding: 6px 12px; border-radius: 999px; }

/* ---------- Тест ---------- */
.quiz-opt { width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 500; min-height: 52px; }
.quiz-opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.quiz-opt:disabled { opacity: 1; cursor: default; }
.steps { display: flex; gap: 4px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); }
.steps i.ok { background: var(--ok); }
.steps i.bad { background: var(--danger); }
.steps i.cur { background: var(--accent); }

/* ---------- Тарифы ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { text-align: center; padding: 16px 10px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface); }
.plan.best { border-color: var(--accent); position: relative; }
.plan.best::before { content: "выгодно"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-contrast); font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.plan .price { font-size: 24px; font-weight: 800; margin: 6px 0 10px; }

/* ---------- Логин ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { max-width: 420px; width: 100%; text-align: center; padding: 28px 20px; }
.login .logo { font-size: 64px; }

/* ---------- Тосты ---------- */
#toast-root { position: fixed; left: 0; right: 0; top: calc(12px + var(--safe-top)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); max-width: 480px; animation: fade .2s; pointer-events: auto; }
.toast.error { background: var(--danger); color: #fff; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%; display: inline-block; flex: none;
  border: 3px solid color-mix(in srgb, var(--accent) 18%, transparent); border-top-color: var(--accent);
  animation: spin 1.3s cubic-bezier(.55, .15, .45, .85) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; min-height: 72px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 900px) {
  .page { padding-top: 32px; }
  .msg { max-width: 70%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Иконки ---------- */
.i { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.btn .i { width: 20px; height: 20px; }
.chip .i { width: 17px; height: 17px; }
.icon-btn .i { width: 21px; height: 21px; }
.badge .i { width: 12px; height: 12px; }
.c-accent { color: var(--accent); }
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-danger { color: var(--danger); }
.c-muted { color: var(--muted); }
.c-flame { color: #f97316; }
.c-soft { opacity: .75; margin-right: 4px; }
.row-c { display: flex; align-items: center; gap: 8px; }
.stat .row-c { justify-content: center; gap: 4px; }
.tile {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--muted);
}
.tile .i { width: 22px; height: 22px; }
.tile.accent { background: var(--accent-soft); color: var(--accent); }
.tile.ok { background: var(--ok-soft); color: var(--ok); }
.tile.warn { background: var(--warn-soft); color: var(--warn); }
.tile.lg { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 10px; }
.tile.lg .i { width: 30px; height: 30px; }
.empty .tile.lg { background: var(--surface); }
.facts { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.fact { display: flex; gap: 8px; align-items: flex-start; }
.fact > .i { margin-top: 2px; }
.cta { color: var(--accent); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.cta .i { width: 16px; height: 16px; }
.option { display: flex; align-items: center; gap: 6px; }
.login .logo { color: var(--accent); }
.login .logo .i { width: 64px; height: 64px; stroke-width: 1.6; }

/* ---------- Аватары пациентов ---------- */
.pav {
  --h: 170; width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 16px; letter-spacing: .02em;
  background: hsl(var(--h) 55% 90%); color: hsl(var(--h) 45% 30%);
}
.pav.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 14px; }
.pav.lg { width: 60px; height: 60px; border-radius: 18px; font-size: 21px; }
.pav.alien { background: #ede4ff; color: #6d28d9; }
.pav .i { width: 60%; height: 60%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pav { background: hsl(var(--h) 30% 22%); color: hsl(var(--h) 60% 80%); }
  :root:not([data-theme="light"]) .pav.alien { background: #2e2350; color: #c4b5fd; }
}

/* ---------- Ожидание с оценкой времени ---------- */
.eta { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.eta-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.eta-step { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eta-left { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 7.5ch; text-align: right; }
.eta-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; position: relative; }
.eta-bar i {
  /* Заполнение через transform — плавно и без перерасчёта раскладки */
  display: block; height: 100%; width: 100%; border-radius: 3px; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #7dd3fc));
  will-change: transform;
}
.eta.mini { max-width: 220px; gap: 5px; }
.eta.mini .eta-top { font-size: 12px; }
.eta.mini .eta-step { font-weight: 500; color: var(--muted); }
.eta.mini .eta-bar { height: 4px; }
.eta-card { height: 64px; padding: 10px 16px; display: flex; align-items: center; }
#new-patient { height: 64px; }
.typing-wrap { align-self: flex-start; display: flex; flex-direction: column; gap: 6px; }
.pending-event .eta { margin-top: 4px; }
.tg-note { width: 100%; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.quiz-opt.picked { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Экран загрузки ---------- */
.boot-logo { width: 96px; height: 96px; color: var(--accent); }
.boot-logo svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.boot-logo .heart { opacity: .35; }
.boot-logo .pulse { stroke-width: 2; stroke-dasharray: 60; stroke-dashoffset: 60; animation: ecg 1.8s ease-in-out infinite; }
@keyframes ecg { 0% { stroke-dashoffset: 60; opacity: 1; } 60% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.boot .bar { width: 160px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 15%, transparent); overflow: hidden; }
.boot .bar i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: slide 1.6s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.btn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Поле + кнопка в одной строке */
.inline-form { gap: 8px; }
.inline-form .btn { flex: none; min-width: 52px; }
.inline-form .input { min-width: 0; }

/* Маленький индикатор загрузки внутри текста */
.spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* Оценка звёздами */
.rate-row { display: flex; justify-content: center; gap: 6px; }
.rate { width: 52px; height: 52px; border: 0; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; }
.rate .i { width: 28px; height: 28px; color: var(--muted); }
.rate.on { background: var(--warn-soft, var(--accent-soft)); }
.rate.on .i { color: var(--warn); fill: var(--warn); }

.onb { border: 1.5px solid var(--accent); }

/* Анкета нового пользователя */
.onb-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: inherit; color: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface, transparent); cursor: pointer; }
.onb-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.onb-dots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.onb-dots i { height: 4px; border-radius: 2px; background: var(--border); }
.onb-dots i.on { background: var(--accent); }
