/* Layout: фарфоровый фон, графитовая сводка, глубокий вишнёвый акцент. Телефон — плавающий таб-бар; компьютер (≥900px) — графитовое меню слева, переписки и чат рядом. */
:root {
  --bg: #f4f2f3;
  --card: #ffffff;
  --raise: #faf9f9;
  --soft: #eeebec;
  --line: rgba(31, 24, 26, 0.08);
  --ink: #1d191a;
  --muted: #7a7275;
  --faint: #a9a1a4;
  --graphite: #211d1f;
  --graphite-2: #2c2729;
  --on-dark: #f6f2f3;
  --on-dark-muted: #a79ea1;
  --cherry: #b3162e;
  --cherry-hi: #cf2a44;
  --cherry-soft: #fbe8eb;
  --cherry-ink: #9b1027;
  --ok: #1f8a55;
  --ok-soft: #e2f3ea;
  --warn: #a96400;
  --warn-soft: #fcf1df;
  --blue: #2c69ad;
  --blue-soft: #e5eef8;
  --violet: #6a52c0;
  --violet-soft: #efebfb;
  --bubble-in: #ffffff;
  --bubble-out: #f9e3e6;
  --shadow-sm: 0 1px 2px rgba(40, 14, 20, 0.06);
  --shadow: 0 1px 2px rgba(40, 14, 20, 0.05), 0 8px 24px -12px rgba(40, 14, 20, 0.16);
  --shadow-lg: 0 2px 6px rgba(40, 14, 20, 0.06), 0 24px 48px -20px rgba(40, 14, 20, 0.28);
  --display: "Geologica", "Segoe UI", system-ui, sans-serif;
  --body: "Golos Text", -apple-system, "Segoe UI", Roboto, sans-serif;
  --spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121011; --card: #1c191a; --raise: #221e20; --soft: #2a2527; --line: rgba(255, 240, 244, 0.08);
    --ink: #f3eff0; --muted: #a0979a; --faint: #6f676a; --graphite: #1a1617; --graphite-2: #262123;
    --cherry: #e0304b; --cherry-hi: #f04a63; --cherry-soft: #3a1820; --cherry-ink: #ff8b9c;
    --ok: #58c98c; --ok-soft: #15301f; --warn: #eeb14f; --warn-soft: #33260f; --blue: #79b1ea; --blue-soft: #16273a;
    --violet: #a996f0; --violet-soft: #251f3e; --bubble-in: #262123; --bubble-out: #3d1a22;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 48px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121011; --card: #1c191a; --raise: #221e20; --soft: #2a2527; --line: rgba(255, 240, 244, 0.08);
  --ink: #f3eff0; --muted: #a0979a; --faint: #6f676a; --graphite: #1a1617; --graphite-2: #262123;
  --cherry: #e0304b; --cherry-hi: #f04a63; --cherry-soft: #3a1820; --cherry-ink: #ff8b9c;
  --ok: #58c98c; --ok-soft: #15301f; --warn: #eeb14f; --warn-soft: #33260f; --blue: #79b1ea; --blue-soft: #16273a;
  --violet: #a996f0; --violet-soft: #251f3e; --bubble-in: #262123; --bubble-out: #3d1a22;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 48px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
input, textarea, select { font: inherit; color: var(--ink); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--cherry); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
.tap { transition: transform .18s var(--ease), background-color .2s, box-shadow .2s; }
.tap:active { transform: scale(0.975); }

#app { min-height: 100%; }
.shell { max-width: 600px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; padding: 14px 18px 10px; display: flex; align-items: center; gap: 10px; background: linear-gradient(var(--bg) 70%, color-mix(in srgb, var(--bg) 0%, transparent)); }
.top .grow { flex: 1; min-width: 0; }
.top h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top.small h1 { font-size: 20px; }
.iconbtn { width: 40px; height: 40px; border-radius: 13px; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: none; color: var(--ink); }
.main { flex: 1; padding: 2px 16px 120px; display: flex; flex-direction: column; gap: 14px; }

/* view transitions */
.anim-fwd .view { animation: inFwd .34s var(--ease) both; }
.anim-back .view { animation: inBack .34s var(--ease) both; }
.anim-tab .view { animation: inTab .3s var(--ease) both; }
@keyframes inFwd { from { opacity: 0; transform: translateX(22px); } }
@keyframes inBack { from { opacity: 0; transform: translateX(-22px); } }
@keyframes inTab { from { opacity: 0; transform: translateY(8px); } }
.anim-fwd .stag > *, .anim-back .stag > *, .anim-tab .stag > * { animation: rise .42s var(--ease) both; }
.stag > *:nth-child(2) { animation-delay: .03s; } .stag > *:nth-child(3) { animation-delay: .06s; } .stag > *:nth-child(4) { animation-delay: .09s; }
.stag > *:nth-child(5) { animation-delay: .12s; } .stag > *:nth-child(6) { animation-delay: .15s; } .stag > *:nth-child(7) { animation-delay: .18s; }
.stag > *:nth-child(n+8) { animation-delay: .21s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* floating tab bar */
.nav { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 8; max-width: 440px; margin: 0 auto; border-radius: 24px; padding: 6px;
  background: color-mix(in srgb, var(--card) 82%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); display: grid; grid-template-columns: repeat(4, 1fr); }
.nav .ind { position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 4); border-radius: 18px; background: var(--cherry-soft); transition: transform .45s var(--spring); }
.nav button { position: relative; z-index: 1; padding: 7px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; transition: color .25s; }
.nav button.on { color: var(--cherry-ink); font-weight: 600; }
.nav button svg { transition: transform .35s var(--spring); }
.nav button.on svg { transform: translateY(-1px) scale(1.06); }
.nav .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
.badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--cherry); color: #fff; font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--card); }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* desktop */
.desk { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--graphite); color: var(--on-dark); padding: 22px 12px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { font-family: var(--display); font-size: 20px; font-weight: 700; padding: 0 12px 20px; display: flex; align-items: center; gap: 10px; }
.side .brand i { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(180deg, var(--cherry-hi), var(--cherry)); display: grid; place-items: center; font-style: normal; font-size: 15px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.side .brand small { font-family: var(--body); font-size: 12px; font-weight: 500; color: var(--on-dark-muted); margin-left: auto; }
.side button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--on-dark-muted); font-weight: 500; transition: background .2s, color .2s; }
.side button:hover { background: rgba(255,255,255,.05); color: var(--on-dark); }
.side button.on { background: rgba(255,255,255,.09); color: #fff; }
.side button.on svg { color: var(--cherry-hi); }
.side button .badge { margin-left: auto; box-shadow: none; }
.desk-main { min-width: 0; }
.desk-main .main { padding-bottom: 48px; }
.split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; height: 100vh; }
.split > div { min-width: 0; overflow-y: auto; }
.split .pane-list { border-right: 1px solid var(--line); }
.split .pane-list .main { padding-bottom: 24px; }
.split .pane-chat { display: flex; flex-direction: column; }
.placeholder { flex: 1; display: grid; place-items: center; color: var(--faint); text-align: center; padding: 40px; }

/* surfaces */
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 10px 4px -4px; }
.sec h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.sec a, .sec button { font-size: 14px; color: var(--cherry-ink); font-weight: 500; }
.note { font-size: 13.5px; color: var(--muted); margin: -6px 6px 0; line-height: 1.4; }
.group { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 13px; padding: 13px 16px; min-height: 58px; width: 100%; position: relative; }
.group > .row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; border-top: 1px solid var(--line); }
.group > .row.withic + .row::before, .group > .row + .row.withic::before { left: 64px; }
button.row { transition: background-color .2s; }
button.row:hover { background: var(--raise); }
button.row:active { background: var(--soft); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 500; }
.row .t span { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row .v { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.chev { color: var(--faint); display: grid; }
.sq { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 6px -2px rgba(0,0,0,.25); }
.sq svg.i { width: 19px; height: 19px; stroke-width: 2; }
.tile .sq, .row .sq, .todo .sq { color: #fff; }
.sq.cherry { background: linear-gradient(180deg, #d63a52, #b3162e); }
.sq.graphite { background: linear-gradient(180deg, #4a4346, #2a2527); }
.sq.ochre { background: linear-gradient(180deg, #e0a03a, #c07b12); }
.sq.teal { background: linear-gradient(180deg, #3aa39a, #1f7f77); }
.sq.blue { background: linear-gradient(180deg, #4b8ad0, #2c69ad); }
.sq.violet { background: linear-gradient(180deg, #8a73dc, #6a52c0); }
.sq.green { background: linear-gradient(180deg, #3eb277, #1f8a55); }
.row input.inline { border: 0; background: var(--soft); border-radius: 10px; padding: 7px 10px; color: var(--ink); outline: none; font-variant-numeric: tabular-nums; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 20px; border-radius: 16px; font-weight: 600; font-size: 15.5px; color: #fff;
  background: linear-gradient(180deg, var(--cherry-hi), var(--cherry)); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 20px -10px rgba(179,22,46,.7); transition: transform .18s var(--ease), box-shadow .2s, filter .2s; text-align: center; }
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: scale(0.97); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 10px -6px rgba(179,22,46,.7); }
.btn.block { width: 100%; }
.btn.light { background: var(--card); color: var(--ink); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }
.btn.soft { background: var(--cherry-soft); color: var(--cherry-ink); box-shadow: none; }
.btn.dark { background: linear-gradient(180deg, var(--graphite-2), var(--graphite)); color: var(--on-dark); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 20px -12px rgba(0,0,0,.6); }
.btn.sm { min-height: 36px; padding: 7px 14px; font-size: 14px; border-radius: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 500; background: var(--card); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); transition: transform .18s var(--ease), background .2s; white-space: nowrap; }
.chip:active { transform: scale(0.96); }
.chip svg.i { width: 16px; height: 16px; }
.chip.cherry { color: var(--cherry-ink); }
.chip.violet { color: var(--violet); }

/* inputs */
.field { width: 100%; background: var(--raise); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s; }
.field:focus { border-color: color-mix(in srgb, var(--cherry) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cherry) 12%, transparent); background: var(--card); }
textarea.field { resize: vertical; min-height: 120px; line-height: 1.45; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 54%, calc(100% - 14px) 54%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
.flabel { font-size: 13px; font-weight: 600; color: var(--muted); margin: 2px 4px -6px; }
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--soft); border-radius: 14px; padding: 4px; }
.seg .ind { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 11px; background: var(--card); box-shadow: var(--shadow-sm), 0 2px 8px -4px rgba(0,0,0,.2); transition: transform .4s var(--spring); }
.seg button { position: relative; z-index: 1; padding: 8px 4px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: center; transition: color .2s; }
.seg button.on { color: var(--ink); font-weight: 600; }
.seg .badge { margin-left: 5px; height: 17px; min-width: 17px; font-size: 11px; box-shadow: none; }
.sw { width: 50px; height: 30px; border-radius: 15px; background: var(--soft); position: relative; flex: none; transition: background .25s; box-shadow: inset 0 0 0 1px var(--line); }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.22); transition: transform .4s var(--spring); }
.sw.on { background: var(--ok); }
.sw.on::after { transform: translateX(20px); }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 16px; padding: 0 14px; color: var(--faint); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.search:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cherry) 12%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--cherry) 45%, transparent); }
.search input { flex: 1; border: 0; background: none; padding: 13px 0; outline: none; min-width: 0; }

/* home */
.hero { background: var(--graphite); color: var(--on-dark); border-radius: 26px; padding: 18px 18px 16px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); pointer-events: none; }
.hero .date { font-size: 13px; color: var(--on-dark-muted); display: flex; align-items: center; gap: 8px; }
.hero .live { width: 7px; height: 7px; border-radius: 50%; background: var(--cherry-hi); box-shadow: 0 0 0 4px rgba(207,42,68,.2); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(207,42,68,0); } }
.hero h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 16px; }
.kpis3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid rgba(255,255,255,.08); }
.kpis3 button { padding: 14px 6px 4px 0; color: var(--on-dark); transition: opacity .2s; }
.kpis3 button + button { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.08); }
.kpis3 button:active { opacity: .7; }
.kpis3 b { display: block; font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.kpis3 b.hot { color: #ff7d8f; }
.kpis3 span { display: block; font-size: 12.5px; color: var(--on-dark-muted); margin-top: 6px; }
.countdown { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; color: var(--on-dark-muted); }
.countdown .track { height: 5px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.countdown .track i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--cherry), var(--cherry-hi)); transform-origin: left; animation: grow 1s var(--ease) both .2s; }
@keyframes grow { from { transform: scaleX(0); } }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; width: 100%; }
.todo .t { flex: 1; min-width: 0; }
.todo .t b { display: block; font-weight: 600; }
.todo .t span { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group > .todo + .todo { border-top: 1px solid var(--line); }
.menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 14px; min-height: 118px; transition: transform .2s var(--ease), box-shadow .25s; }
.tile:hover { box-shadow: var(--shadow-lg); }
.tile:active { transform: scale(0.97); }
.tile b { font-family: var(--display); font-weight: 600; font-size: 16px; display: block; }
.tile span { font-size: 13px; color: var(--muted); }
.demo { display: flex; gap: 10px; flex-wrap: wrap; }
.demo .btn { flex: 1 1 180px; }

/* avatars / leads */
.ava { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 15px; flex: none; }
.lead { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; width: 100%; text-align: left; transition: background-color .2s; }
.lead:hover { background: var(--raise); }
.lead:active { background: var(--soft); }
.lead.sel { background: var(--cherry-soft); }
.group > .lead + .lead { border-top: 1px solid var(--line); }
.lead .t { flex: 1; min-width: 0; }
.lead .t .nm { display: flex; justify-content: space-between; gap: 8px; }
.lead .t .nm b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead .t .nm time { font-size: 12.5px; color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }
.lead .pv { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.lead .pv.need { color: var(--cherry-ink); font-weight: 500; }
.lead .tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 8px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }

/* chat */
.chat-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.chat-top .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.chat-top .ava { width: 38px; height: 38px; border-radius: 13px; font-size: 13px; }
.chat-top .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top .who span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-body { flex: 1; padding: 10px 14px 0; display: flex; flex-direction: column;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1.2px); background-size: 18px 18px; }
.alert { display: flex; gap: 10px; align-items: center; border-radius: 16px; padding: 11px 12px 11px 14px; font-size: 14px; margin-bottom: 8px; animation: rise .4s var(--ease) both; }
.alert.need { background: var(--cherry-soft); color: var(--cherry-ink); }
.alert.call { background: var(--violet-soft); color: var(--violet); }
.alert span { flex: 1; font-weight: 500; }
.msgs { display: flex; flex-direction: column; gap: 5px; padding-bottom: 12px; flex: 1; }
.day { align-self: center; font-size: 12px; font-weight: 500; color: var(--muted); background: color-mix(in srgb, var(--card) 80%, transparent); backdrop-filter: blur(6px); padding: 3px 11px; border-radius: 10px; margin: 8px 0 4px; box-shadow: var(--shadow-sm); }
.msg { max-width: 80%; padding: 8px 12px 6px; border-radius: 18px 18px 18px 6px; background: var(--bubble-in); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; box-shadow: var(--shadow-sm); }
.msg.out { align-self: flex-end; background: var(--bubble-out); border-radius: 18px 18px 6px 18px; }
.msg.new { animation: pop .38s var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.msg .meta { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg.out .meta b { color: var(--cherry-ink); font-weight: 600; }
.msg.mail { background: var(--card); border: 1px dashed var(--faint); }
.sys { align-self: center; max-width: 92%; text-align: center; font-size: 12.5px; font-weight: 500; color: var(--muted); background: color-mix(in srgb, var(--card) 85%, transparent); border-radius: 12px; padding: 6px 12px; margin: 4px 0; box-shadow: var(--shadow-sm); }
.sys.warn { color: var(--warn); background: var(--warn-soft); }
.typing { align-self: flex-start; background: var(--bubble-in); padding: 12px 15px; border-radius: 18px 18px 18px 6px; display: flex; gap: 4px; box-shadow: var(--shadow-sm); animation: pop .3s var(--spring) both; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); 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: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.composer { position: sticky; bottom: 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)); margin: 0 -14px; background: linear-gradient(transparent, var(--bg) 30%); display: flex; flex-direction: column; gap: 8px; }
.composer .helpers { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.composer .line { display: flex; gap: 8px; align-items: flex-end; background: var(--card); border-radius: 24px; padding: 5px 5px 5px 16px; box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); }
.composer textarea { flex: 1; min-height: 38px; max-height: 160px; resize: none; border: 0; background: none; outline: none; padding: 8px 0; line-height: 1.35; }
.send { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: grid; place-items: center; flex: none; background: linear-gradient(180deg, var(--cherry-hi), var(--cherry)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 14px -6px rgba(179,22,46,.8); transition: transform .2s var(--spring); }
.send:active { transform: scale(0.9); }
.send svg.i { width: 19px; height: 19px; stroke-width: 2.2; }
.draft-note { font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 7px 12px; animation: rise .3s var(--ease) both; }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(18, 8, 11, 0.42); backdrop-filter: blur(2px); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease both; }
.scrim.out { animation: fade .18s ease reverse both; }
.sheet { background: var(--card); width: 100%; max-width: 600px; border-radius: 28px 28px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 92%; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; animation: sheetUp .5s var(--spring) both; box-shadow: var(--shadow-lg); }
.scrim.out .sheet { animation: sheetDown .2s ease both; }
@media (min-width: 900px) { .scrim { align-items: center; } .sheet { border-radius: 28px; max-height: 86vh; animation-name: sheetPop; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(40px); opacity: 0; } }
@keyframes sheetPop { from { transform: scale(.94); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--soft); align-self: center; }
.sheet .sh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.sheet .x { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; color: var(--muted); flex: none; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; border-radius: 14px; font-weight: 500; transition: background .2s; }
.opt:hover { background: var(--raise); }
.opt.on { background: var(--cherry-soft); color: var(--cherry-ink); }
.opt .ck { margin-left: auto; font-weight: 700; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px; }
.preview { background: var(--bubble-out); border-radius: 18px 18px 6px 18px; padding: 9px 13px; white-space: pre-wrap; align-self: flex-end; max-width: 92%; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 10px 12px; background: var(--raise); border-radius: 16px; padding: 14px 16px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; }

/* scenario */
.courses { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.courses button { flex: none; padding: 8px 14px; border-radius: 13px; font-size: 14px; font-weight: 500; background: var(--card); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); transition: all .25s var(--ease); }
.courses button.on { background: var(--graphite); color: var(--on-dark); box-shadow: 0 6px 14px -8px rgba(0,0,0,.5); }
.courses button.add { color: var(--cherry-ink); }
.step { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.step .hd { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; width: 100%; }
.step .n { width: 30px; height: 30px; border-radius: 10px; background: var(--graphite); color: var(--on-dark); display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 14px; flex: none; }
.step .hd b { flex: 1; font-family: var(--display); font-weight: 600; font-size: 16px; }
.step .say { margin: 0 16px 12px; background: var(--bubble-out); border-radius: 18px 18px 6px 18px; padding: 10px 13px; font-size: 14.5px; white-space: pre-wrap; }
.br { display: flex; gap: 12px; align-items: center; padding: 12px 16px; width: 100%; border-top: 1px solid var(--line); transition: background .2s; }
.br:hover { background: var(--raise); }
.br .if { flex: none; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 9px; background: var(--cherry-soft); color: var(--cherry-ink); max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br .if.other { background: var(--soft); color: var(--muted); }
.br .body { flex: 1; min-width: 0; }
.br .then { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.br .next { font-size: 12.5px; color: var(--blue); font-weight: 500; margin-top: 2px; display: block; }
.addbr { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--cherry-ink); width: 100%; font-weight: 500; font-size: 14.5px; }
.link-line { width: 2px; height: 16px; margin: -6px auto -6px 31px; background: repeating-linear-gradient(var(--faint) 0 3px, transparent 3px 6px); }

/* ai check */
.sandbox { display: flex; flex-direction: column; gap: 5px; min-height: 200px; max-height: 50vh; overflow-y: auto; padding: 12px; border-radius: 20px; background-color: var(--raise); background-image: radial-gradient(color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1.2px); background-size: 18px 18px; box-shadow: inset 0 0 0 1px var(--line); }
.src { font-size: 11.5px; color: var(--muted); display: block; margin-top: 3px; }

/* stats */
.bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cherry), var(--cherry-hi)); transform-origin: left; animation: grow .9s var(--ease) both .15s; }
.big { font-family: var(--display); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kcard { padding: 14px 16px; }
.kcard small { display: block; font-size: 13px; color: var(--muted); }
.kcard em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--ok); margin-left: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--graphite); color: var(--on-dark); padding: 12px 18px; border-radius: 16px; font-size: 14.5px; font-weight: 500; z-index: 30; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); animation: toastIn .45s var(--spring) both; display: flex; gap: 10px; align-items: center; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
@media (min-width: 900px) { .toast { bottom: 28px; } }
@media (max-width: 380px) { .menu { gap: 10px; } .tile { min-height: 104px; } .kpis3 b { font-size: 28px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- рабочая версия: вход, подключение Telegram, служебные метки ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login-card .logo { width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(180deg, var(--cherry-hi), var(--cherry)); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 24px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 12px 24px -12px rgba(179,22,46,.8); }
.login-card h1 { font-size: 28px; letter-spacing: -0.02em; }
.login-card p { margin: -6px 0 6px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--cherry); }
.err { color: var(--cherry-ink); background: var(--cherry-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ok-dot { color: var(--ok); font-weight: 600; }
.tgbox { background: var(--raise); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.tgbox .st { font-size: 14px; color: var(--muted); }
.tag.test { background: var(--violet-soft); color: var(--violet); }
.banner-warn { background: var(--warn-soft); color: var(--warn); border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 500; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spinr .7s linear infinite; }
@keyframes spinr { to { transform: rotate(360deg); } }
.offline { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 40; background: var(--graphite); color: var(--on-dark); padding: 8px 14px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow-lg); }
