/*
 * lite.css — дизайн-система MedAI Light («премиум»-слой, 2026-10-11).
 * Источник стиля: home-landing.html (палитра/типографика/кнопки/карточки/движение)
 * и marketing.html (рабочие экраны: шапка, вкладки, KPI, панели, тосты).
 * Подключается ПОСЛЕ /tokens.css. Ниже сначала новые токены, затем «мост» на старые
 * имена переменных (--sage-dark, --border, --subtle …), чтобы страницы и общий index.html
 * (чат пациента) подхватывали новую палитру без переписывания каждого правила.
 * Только внешний вид — бизнес-логика страниц не затрагивается.
 */
:root {
  --bg:#F4F7F3; --bg2:#EAF1EA; --card:#fff; --ink:#16231C; --muted:#566359; --line:#DCE5DC;
  --g900:#0F3D2E; --g700:#1B6B4D; --g500:#2E9C70; --g300:#7AD2A8; --g100:#D9F3E5;
  --clay:#D9825B; --clay-soft:#FBEADF; --gold:#F2B84B; --accent-text:#1B6B4D;
  --danger:#C0422F; --danger-soft:#FBE9E5; --info:#3F6785; --info-soft:#E6EFF6;
  --shadow:0 10px 40px rgba(15,61,46,.10); --shadow-sm:0 2px 10px rgba(15,61,46,.08);
  --shadow-up:0 -8px 30px rgba(15,61,46,.10);
  --r:22px; --r-md:16px; --r-sm:12px;
  --font:'IBM Plex Sans',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --ease:cubic-bezier(.2,.8,.2,1);
  --ring:rgba(46,156,112,.35);
  --safe-b:env(safe-area-inset-bottom,0px); --safe-t:env(safe-area-inset-top,0px);

  /* мост на старые токены (tokens.css) */
  --sage:var(--g500); --sage-dark:var(--g700); --sage-bright:var(--g700); --sage-soft:var(--g100);
  --subtle:#EEF4EE; --border:var(--line); --flag:var(--danger); --flag-bg:var(--danger-soft);
  --online:#2E9C70; --info-bg:var(--info-soft); --info-ink:var(--info);
  --radius-sm:14px; --radius-md:18px; --radius-lg:24px;
  --header-gradient:radial-gradient(900px 420px at 85% -20%,var(--g100),transparent 62%),radial-gradient(600px 360px at 0% 10%,var(--clay-soft),transparent 60%);
  --font-sans:var(--font);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0B1410; --bg2:#101C16; --card:#14231B; --ink:#E8F2EC; --muted:#9DB1A4; --line:#223529;
    --g100:#14352A; --clay-soft:#33231B; --accent-text:#7AD2A8; --danger:#EE8A78; --danger-soft:#3A2420;
    --info:#9DC0DA; --info-soft:#1C2A35;
    --shadow:0 10px 40px rgba(0,0,0,.45); --shadow-sm:0 2px 10px rgba(0,0,0,.4); --shadow-up:0 -8px 30px rgba(0,0,0,.4);
    --ring:rgba(122,210,168,.4);
    --subtle:#1A2B21; --sage-dark:#7AD2A8; --sage-bright:#7AD2A8; --sage:#7AD2A8; --online:#5FBF8D;
  }
}
:root[data-theme="dark"] {
  --bg:#0B1410; --bg2:#101C16; --card:#14231B; --ink:#E8F2EC; --muted:#9DB1A4; --line:#223529;
  --g100:#14352A; --clay-soft:#33231B; --accent-text:#7AD2A8; --danger:#EE8A78; --danger-soft:#3A2420;
  --info:#9DC0DA; --info-soft:#1C2A35;
  --shadow:0 10px 40px rgba(0,0,0,.45); --shadow-sm:0 2px 10px rgba(0,0,0,.4); --shadow-up:0 -8px 30px rgba(0,0,0,.4);
  --ring:rgba(122,210,168,.4);
  --subtle:#1A2B21; --sage-dark:#7AD2A8; --sage-bright:#7AD2A8; --sage:#7AD2A8; --online:#5FBF8D;
}

/* ---------- база ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.12; margin: 0; letter-spacing: -.02em; }
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 10px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 26px; border-radius: 16px; border: 0;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; position: relative; overflow: hidden;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s; user-select: none; -webkit-user-select: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--g500), var(--g700)); color: var(--v2-on-accent, #fff); box-shadow: 0 8px 24px rgba(30,140,100,.32); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 32px rgba(30,140,100,.45); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: scale(.97); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--g500); }
.btn-soft { background: var(--g100); color: var(--accent-text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn-xs { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-ghost.loading::after, .btn-soft.loading::after { border-color: var(--line); border-top-color: var(--g500); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- карточки, чипы, теги ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-sm); }
.card.pop { animation: pop .35s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); background: var(--g100); padding: 6px 12px; border-radius: 99px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--g100); color: var(--accent-text); white-space: nowrap; }
.pill.warn { background: var(--clay-soft); color: var(--clay); } .pill.bad { background: var(--danger-soft); color: var(--danger); } .pill.info { background: var(--info-soft); color: var(--info); } .pill.mute { background: var(--bg2); color: var(--muted); }
.chip-btn { min-height: 42px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: transform .12s, border-color .2s, background .2s; }
.chip-btn:active { transform: scale(.96); } .chip-btn:hover { border-color: var(--g500); }
.chip-btn.on { background: var(--g900); color: var(--v2-on-accent, #fff); border-color: transparent; }
:root[data-theme="dark"] .chip-btn.on { background: var(--g500); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-btn.on { background: var(--g500); } }

/* ---------- поля ---------- */
.fld { width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); padding: 0 16px; font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s; }
textarea.fld { padding: 13px 16px; min-height: 96px; resize: vertical; line-height: 1.45; }
.fld:focus { outline: none; border-color: var(--g500); box-shadow: 0 0 0 4px var(--ring); }
.fld::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hint.error { color: var(--danger); font-weight: 600; }

/* ---------- переключатель ---------- */
.sw { position: relative; width: 50px; height: 30px; flex: none; display: inline-block; }
.sw input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform .25s var(--ease); }
.sw input:checked + span { background: var(--g500); } .sw input:checked + span::after { transform: translateX(20px); }
.sw input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- сегмент-контрол ---------- */
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 3px; gap: 2px; }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 11px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- аватар ---------- */
.av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative; overflow: visible;
  background: linear-gradient(135deg, var(--g100), color-mix(in srgb, var(--g300) 45%, var(--g100))); color: var(--accent-text); font-weight: 700; font-size: 16px; }
.av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.av.lg { width: 64px; height: 64px; font-size: 21px; } .av.sm { width: 36px; height: 36px; font-size: 13px; }
.av .dot { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--g500); border: 2.5px solid var(--card); }
.av .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--g500); opacity: 0; animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }

/* ---------- верхняя панель / нижняя навигация ---------- */
.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid transparent; transition: border-color .2s; }
.appbar.scrolled { border-bottom-color: var(--line); }
.appbar .ttl { font-size: 17px; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .ttl small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; font-size: 18px; position: relative; transition: transform .12s, border-color .2s; }
.icon-btn:active { transform: scale(.93); } .icon-btn:hover { border-color: var(--g500); }
.icon-btn .cnt { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: var(--v2-on-urgent, #fff); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; justify-content: center; padding: 8px 12px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--line); box-shadow: var(--shadow-up); }
.tabbar-in { display: flex; width: 100%; max-width: 560px; gap: 2px; }
.tab { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; border-radius: 14px; cursor: pointer; position: relative; transition: color .2s, background .2s, transform .12s; }
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.tab:active { transform: scale(.94); }
.tab.on { color: var(--accent-text); background: var(--g100); } .tab.on svg { transform: translateY(-1px) scale(1.08); }
.tab .cnt { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: var(--v2-on-urgent, #fff); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.has-tabbar { padding-bottom: calc(86px + var(--safe-b)); }

/* ---------- нижние шторки, тосты, скелетоны ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8,20,14,.55); backdrop-filter: blur(2px); z-index: 90; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 10px 20px calc(22px + var(--safe-b)); box-shadow: var(--shadow-up); animation: sheetin .32s var(--ease); max-height: 88vh; overflow: auto; }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-size: 20px; margin-bottom: 6px; } .sheet .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 16px; }
.sheet .acts { display: grid; gap: 10px; margin-top: 16px; }
@keyframes sheetin { from { transform: translateY(40px); opacity: 0; } }
.sheet.out { animation: sheetout .2s ease forwards; } @keyframes sheetout { to { transform: translateY(40px); opacity: 0; } }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--safe-b)); z-index: 120; display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 440px; display: flex; align-items: center; gap: 10px; background: var(--g900); color: var(--v2-on-accent, #fff); padding: 12px 16px; border-radius: 16px; font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow); animation: toastin .3s var(--ease); }
:root[data-theme="dark"] .toast { background: #E8F2EC; color: #0F3D2E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #E8F2EC; color: #0F3D2E; } }
.toast.ok { background: var(--g700); color: var(--v2-on-accent, #fff); } .toast.err { background: var(--danger); color: var(--v2-on-urgent, #fff); }
.toast button { background: transparent; border: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0 0 0 6px; }
.toast.out { animation: toastout .25s ease forwards; }
@keyframes toastin { from { opacity: 0; transform: translateY(14px) scale(.96); } } @keyframes toastout { to { opacity: 0; transform: translateY(8px) scale(.96); } }
.skel { background: linear-gradient(100deg, var(--bg2) 30%, color-mix(in srgb, var(--bg2) 55%, var(--card)) 50%, var(--bg2) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; border-radius: 14px; }
@keyframes shimmer { to { background-position: -120% 0; } }
.empty { text-align: center; padding: 38px 18px; color: var(--muted); }
.empty .ic { font-size: 38px; margin-bottom: 8px; display: block; } .empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---------- анимации появления ---------- */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s var(--ease); }
.rv.in { opacity: 1; transform: none; } .rv.d1 { transition-delay: .08s; } .rv.d2 { transition-delay: .16s; } .rv.d3 { transition-delay: .24s; }
.stagger > * { animation: pop .4s var(--ease) both; } .stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; } .stagger > *:nth-child(n+6) { animation-delay: .2s; }
.screen-in { animation: screenin .34s var(--ease) both; } @keyframes screenin { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.screen-back { animation: screenback .34s var(--ease) both; } @keyframes screenback { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.check-anim { width: 76px; height: 76px; }
.check-anim circle { stroke: var(--g500); stroke-width: 3; fill: none; stroke-dasharray: 190; stroke-dashoffset: 190; animation: dashin .6s var(--ease) forwards; }
.check-anim path { stroke: var(--g500); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 50; stroke-dashoffset: 50; animation: dashin .4s .45s var(--ease) forwards; }
@keyframes dashin { to { stroke-dashoffset: 0; } }
.float { animation: float 7s ease-in-out infinite; } @keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .rv { opacity: 1 !important; transform: none !important; }
  .check-anim circle, .check-anim path { stroke-dashoffset: 0 !important; }
}


/* ===== тема: кнопка и переходы ===== */
.theme-tgl { overflow: hidden; }
.theme-tgl svg { position: absolute; transition: transform .55s var(--ease), opacity .35s; }
.theme-tgl .i-sun { color: #E0A021; transform: rotate(0) scale(1); opacity: 1; }
.theme-tgl .i-moon { color: var(--g300); transform: rotate(-90deg) scale(.3); opacity: 0; }
.theme-tgl.is-dark .i-sun { transform: rotate(90deg) scale(.3); opacity: 0; }
.theme-tgl.is-dark .i-moon { transform: rotate(0) scale(1); opacity: 1; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; } ::view-transition-new(root) { z-index: 2; }
body, .card, .appbar, .tabbar, .sheet, .fld { transition: background-color .35s ease, border-color .35s ease, color .25s ease; }

/* ===== больше движения ===== */
body { animation: pagein .5s var(--ease) both; }
@keyframes pagein { from { opacity: 0; } }
.btn { position: relative; overflow: hidden; }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s var(--ease); pointer-events: none; }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary.pulse, .btn-primary.cta { animation: ctapulse 2.8s ease-in-out infinite; }
@keyframes ctapulse { 0%,100% { box-shadow: 0 8px 24px rgba(30,140,100,.32); } 50% { box-shadow: 0 8px 24px rgba(30,140,100,.32), 0 0 0 9px rgba(46,156,112,.14); } }
.card, .req, .p-card, .kpi { transition: transform .25s var(--ease), box-shadow .25s, border-color .25s, background-color .35s; }
@media (hover:hover) { .card:hover, .req:hover, .p-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); } }
.tab svg { transition: transform .35s var(--ease); } .tab.on svg { animation: tabbounce .5s var(--ease); } @keyframes tabbounce { 0% { transform: scale(.7) translateY(3px); } 55% { transform: scale(1.22) translateY(-3px); } 100% { transform: none; } }
.tab .cnt { animation: cntpop .5s var(--ease) both; } @keyframes cntpop { from { transform: scale(0); } 60% { transform: scale(1.3); } }
.icon-btn { transition: transform .15s var(--ease), border-color .2s, background-color .35s; } .icon-btn:hover { transform: translateY(-1px) rotate(-4deg); }
.pill { animation: pop .4s var(--ease) both; }
.stagger > * { animation: pop .5s var(--ease) both; } .stagger > *:nth-child(1){animation-delay:.04s}.stagger > *:nth-child(2){animation-delay:.1s}.stagger > *:nth-child(3){animation-delay:.16s}.stagger > *:nth-child(4){animation-delay:.22s}.stagger > *:nth-child(5){animation-delay:.28s}.stagger > *:nth-child(n+6){animation-delay:.34s}
.empty .ic { display: inline-block; animation: float 4.5s ease-in-out infinite; }
.av { transition: transform .3s var(--ease); } .req:hover .av, .p-card:hover .av { transform: scale(1.08) rotate(-4deg); }
.fld:focus, .field input:focus { animation: focuspop .35s var(--ease); } @keyframes focuspop { 50% { transform: scale(1.012); } }
.sheet { transform-origin: bottom center; }
.toast { animation: toastin .4s var(--ease); }
/* дышащий фон у героев */
.aurora { position: absolute; inset: -20% -10% auto -10%; height: 70%; pointer-events: none; z-index: 0; filter: blur(60px); opacity: .55; background: radial-gradient(40% 50% at 25% 40%, var(--g100), transparent 70%), radial-gradient(35% 45% at 75% 30%, var(--clay-soft), transparent 70%); animation: aurora 14s ease-in-out infinite alternate; }
@keyframes aurora { to { transform: translate3d(4%, 6%, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  body, .btn-primary.pulse, .btn-primary.cta, .tab.on svg, .tab .cnt, .pill, .stagger > *, .empty .ic, .aurora, .fld:focus { animation: none !important; }
  .btn-primary::after { display: none; } .card:hover, .req:hover, .p-card:hover, .icon-btn:hover { transform: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
