/* Premium, calm, card-based. Own palette (not Telegram's) so it looks the same everywhere. */
:root {
  --bg: #f2f3f6;
  --card: #ffffff;
  --fill: #eceef2;
  --text: #0b0c0f;
  --sub: #6b707c;
  --faint: #a5aab4;
  --line: rgba(11, 12, 15, 0.07);
  --accent: #3d5afe;
  --accent-soft: rgba(61, 90, 254, 0.1);
  --red: #f0384b;
  --red-soft: rgba(240, 56, 75, 0.1);
  --green: #13a865;
  --hero: radial-gradient(120% 140% at 0% 0%, #4f6bff 0%, #3a3fe8 38%, #6d35e8 72%, #a43fe0 100%);
  --ink: radial-gradient(120% 140% at 0% 0%, #2a2d36 0%, #121318 70%);
  --gold: radial-gradient(120% 140% at 0% 0%, #ffcf5a 0%, #ff9d2e 55%, #ff6b3d 100%);
  --shadow: 0 1px 2px rgba(11, 12, 15, 0.04), 0 8px 24px rgba(11, 12, 15, 0.04);
  --r: 22px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --card: #141519; --fill: #1f2126; --text: #f4f5f7; --sub: #8c919c; --faint: #5a5f69;
    --line: rgba(255, 255, 255, 0.07); --accent: #6c84ff; --accent-soft: rgba(108, 132, 255, 0.14);
    --red: #ff4d5e; --red-soft: rgba(255, 77, 94, 0.14); --shadow: none; color-scheme: dark;
    --ink: radial-gradient(120% 140% at 0% 0%, #2b2e38 0%, #17181d 70%);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #141519; --fill: #1f2126; --text: #f4f5f7; --sub: #8c919c; --faint: #5a5f69;
  --line: rgba(255, 255, 255, 0.07); --accent: #6c84ff; --accent-soft: rgba(108, 132, 255, 0.14);
  --red: #ff4d5e; --red-soft: rgba(255, 77, 94, 0.14); --shadow: none; color-scheme: dark;
  --ink: radial-gradient(120% 140% at 0% 0%, #2b2e38 0%, #17181d 70%);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input, textarea { font: inherit; color: inherit; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  margin: 0 -16px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.searchbar { flex: 1; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 20px; background: var(--card); color: var(--sub); box-shadow: var(--shadow); }
.searchbar .i { width: 18px; height: 18px; }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 15px; }
.searchbar input::placeholder { color: var(--faint); }
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); flex: none; }
.round .i { width: 20px; height: 20px; }
h1.title { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; margin: 8px 4px 16px; }

/* ---------- hero cards (one per tab, each a different kind) ---------- */
.hero { position: relative; overflow: hidden; border-radius: 26px; padding: 20px; color: #fff; background: var(--hero); margin-bottom: 20px; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.hero.ink { background: var(--ink); }
.hero.gold { background: var(--gold); }
.hero.plain { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.hero.plain::after { display: none; }
.hero-k { font-size: 13px; font-weight: 600; opacity: 0.75; letter-spacing: 0.01em; }
.hero-n { font-size: 46px; line-height: 1.05; font-weight: 700; letter-spacing: -0.04em; margin: 6px 0 2px; }
.hero-n small { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; opacity: 0.8; margin-left: 6px; }
.hero-s { font-size: 15px; opacity: 0.85; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 14px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.16); }
.hero.plain .chip { background: var(--fill); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #ff5a6a; box-shadow: 0 0 0 3px rgba(255, 90, 106, 0.25); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ring { width: 76px; height: 76px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .bg { stroke: var(--fill); }
.ring .fg { stroke: var(--accent); transition: stroke-dashoffset 0.6s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.funnel { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--fill); margin: 16px 0 10px; gap: 2px; }
.funnel i { display: block; min-width: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--sub); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend b { color: var(--text); }
.bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); overflow: hidden; margin: 14px 0 4px; }
.bar i { display: block; height: 100%; background: #fff; border-radius: 3px; }
.hero .cta { position: relative; z-index: 1; margin-top: 16px; height: 44px; padding: 0 18px; border-radius: 22px; background: #fff; color: #111; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- pills ---------- */
.pills { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; height: 36px; padding: 0 15px; border-radius: 18px; background: var(--card); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow); transition: background 0.2s, color 0.2s; }
.pill span { color: var(--faint); font-weight: 600; }
.pill.on { background: var(--text); color: var(--bg); }
.pill.on span { color: color-mix(in srgb, var(--bg) 60%, transparent); }

/* ---------- week strip (Plans) ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 20px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.day small { font-size: 11px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: 0.04em; }
.day b { font-size: 17px; font-weight: 700; }
.day i { width: 5px; height: 5px; border-radius: 50%; background: transparent; margin-top: 2px; }
.day.has i { background: var(--accent); }
.day.on { background: var(--text); color: var(--bg); }
.day.on small { color: inherit; opacity: 0.6; }
.day.on.has i { background: var(--bg); }

/* ---------- sections and cards ---------- */
.sec { margin-bottom: 22px; }
.sec-t { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 10px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.sec-t.red { color: var(--red); }
.sec-t button, .sec-t .muted { font-size: 14px; font-weight: 600; color: var(--accent); letter-spacing: 0; }
.sec-t .muted { color: var(--faint); }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.foot { font-size: 13px; color: var(--sub); padding: 10px 6px 0; line-height: 1.45; }

/* ---------- rows (swipe right = done, left = hide) ---------- */
.row { position: relative; overflow: hidden; transition: max-height 0.32s var(--ease), opacity 0.25s; }
.row + .row .row-inner::before, .row + .row.chat-head::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 72px); border-top: 1px solid var(--line); }
.row-inner { position: relative; z-index: 1; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px 16px; background: var(--card); transition: transform 0.28s var(--ease), background 0.15s; touch-action: pan-y; }
.row-inner:active { background: color-mix(in srgb, var(--card) 92%, var(--text)); }
.row.dragging .row-inner { transition: none; }
.row.gone { max-height: 0 !important; opacity: 0; }
.row.gone .row-inner { transform: translateX(110%); }
.row.gone.left .row-inner { transform: translateX(-110%); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; gap: 8px; padding: 0 22px; font-weight: 600; color: #fff; visibility: hidden; }
.swipe-bg.done { background: var(--green); }
.swipe-bg.hide { background: #7d828c; justify-content: flex-end; }
.body { flex: 1; min-width: 0; }
.l1 { display: flex; align-items: baseline; gap: 8px; }
.name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { flex: none; font-size: 13px; color: var(--faint); font-weight: 500; }
.meta.red { color: var(--red); font-weight: 600; }
.l2 { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.txt { flex: 1; min-width: 0; color: var(--sub); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.count.red { background: var(--red); }
.sub { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .ttl { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.due { flex: none; font-size: 12px; font-weight: 600; height: 24px; padding: 0 9px; border-radius: 12px; display: grid; place-items: center; background: var(--fill); color: var(--sub); }
.due.red { background: var(--red-soft); color: var(--red); }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--faint); flex: none; display: grid; place-items: center; transition: 0.2s; }
.check.red { border-color: var(--red); }
.check.on { background: var(--green); border-color: var(--green); }
.check.on::after { content: ""; width: 10px; height: 5px; border: solid #fff; border-width: 0 0 2.2px 2.2px; transform: translateY(-1px) rotate(-45deg); }
.time { width: 56px; flex: none; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.time small { display: block; font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0; margin-top: 1px; }
.time.past { color: var(--faint); }
.vline { width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); flex: none; margin: 2px 0; }
.vline.red { background: var(--red); }
.bullet .row-inner { min-height: 56px; padding-left: 20px; align-items: flex-start; }
.bullet .row-inner::after { content: ""; position: absolute; left: 20px; top: 21px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.bullet .body { padding-left: 16px; }
.bullet .t { font-size: 15px; line-height: 1.35; }
.chat-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.chat-head .name { font-size: 15px; }
.card-btn { display: block; width: 100%; text-align: center; padding: 13px; font-size: 14px; font-weight: 600; color: var(--accent); border-top: 1px solid var(--line); }
.quiet { padding: 14px 16px; font-size: 14px; color: var(--sub); line-height: 1.45; }

/* avatars */
.av { position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: 0.01em; background: linear-gradient(160deg, var(--a1), var(--a2)); }
.av.sm { width: 32px; height: 32px; font-size: 12px; }
.av.md { width: 40px; height: 40px; font-size: 14px; }
.av.lg { width: 76px; height: 76px; font-size: 26px; }
.av.urgent::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--red); border: 2.5px solid var(--card); }

/* empty state */
.empty { text-align: center; padding: 34px 24px 30px; }
.empty .ico { width: 60px; height: 60px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .ico .i { width: 28px; height: 28px; }
.empty b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.empty span { display: block; margin-top: 6px; font-size: 14px; color: var(--sub); line-height: 1.45; }

/* banner (trial) */
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 20px; border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); }
.banner .star { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--gold); font-size: 20px; flex: none; }
.banner b { display: block; font-size: 15px; }
.banner span { font-size: 13px; color: var(--sub); }
.btn-s { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; }

/* locked (trial ended): who and when stay visible, what is blurred */
.locked .txt, .locked .ttl, .locked .t, .locked .msg-text, .locked .topic-t { filter: blur(5px); user-select: none; }

/* ---------- settings ---------- */
.profile { text-align: center; padding: 18px 0 22px; }
.profile .av { margin: 0 auto 12px; }
.profile h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.profile p { margin: 4px 0 0; color: var(--sub); font-size: 14px; }
.cell { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; background: var(--card); }
.cell + .cell::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 64px); border-top: 1px solid var(--line); }
.cell.plain { --inset: 16px; }
button.cell:active { background: color-mix(in srgb, var(--card) 92%, var(--text)); }
.cell .label { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.cell .label small { display: block; font-size: 13px; color: var(--sub); font-weight: 400; margin-top: 1px; }
.cell .value { color: var(--sub); font-size: 14px; }
.cell .chev { width: 16px; height: 16px; color: var(--faint); }
.cell.danger .label { color: var(--red); text-align: center; font-weight: 600; }
.tile { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; }
.tile .i { width: 19px; height: 19px; stroke-width: 2; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--fill); flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); transition: transform 0.25s var(--ease); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; margin: 0 16px 14px; border-radius: 13px; background: var(--fill); }
.seg button { height: 34px; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--sub); transition: 0.2s; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
.cell-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.stat span { font-size: 12px; color: var(--sub); font-weight: 500; }
.tag { flex: none; font-size: 12px; font-weight: 600; height: 24px; padding: 0 9px; border-radius: 12px; display: grid; place-items: center; background: var(--fill); color: var(--sub); }

/* ---------- detail page ---------- */
.page {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: var(--bg);
  transform: translateX(100%); transition: transform 0.36s var(--ease); visibility: hidden;
  padding-bottom: calc(150px + env(safe-area-inset-bottom));
}
.page.open { transform: none; visibility: visible; }
.page-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.page-bar.tg { display: none; }
.who { text-align: center; padding: 14px 0 20px; }
.who .av { margin: 0 auto 12px; }
.who h2 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -0.03em; }
.who p { margin: 4px 0 0; font-size: 14px; color: var(--sub); }
.who .chip { margin-top: 10px; }
.acts { display: flex; justify-content: center; gap: 22px; margin-bottom: 26px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--sub); width: 64px; }
.act .c { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--accent); box-shadow: var(--shadow); transition: transform 0.15s; }
.act:active .c { transform: scale(0.94); }
.act.primary .c { background: var(--accent); color: #fff; }
.hint { font-size: 13px; color: var(--sub); padding: 0 4px 10px; margin-top: -4px; }
.topic { margin-bottom: 14px; }
.topic-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.topic-t { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.topic-h .done-btn { font-size: 13px; font-weight: 600; color: var(--accent); }
.msg { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 8px 16px; }
.msg:last-child { padding-bottom: 14px; }
.radio { width: 22px; height: 22px; margin-top: 9px; border-radius: 50%; border: 2px solid var(--faint); flex: none; display: grid; place-items: center; transition: 0.15s; }
.msg.on .radio { border-color: var(--accent); background: var(--accent); }
.msg.on .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.bubble { flex: 1; min-width: 0; padding: 10px 13px 8px; border-radius: 4px 18px 18px 18px; background: var(--fill); transition: box-shadow 0.15s, background 0.15s; }
.msg.on .bubble { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.msg-text { font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.bubble small { display: block; margin-top: 3px; font-size: 11px; color: var(--faint); text-align: right; font-weight: 500; }

/* composer */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line); transform: translateY(110%); transition: transform 0.36s var(--ease);
}
.page.open + .composer.on, .composer.on { transform: none; }
.composer .to { display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 0 auto 8px; padding: 0 6px; font-size: 13px; }
.composer .to i { width: 3px; height: 30px; border-radius: 2px; background: var(--accent); flex: none; }
.composer .to div { min-width: 0; }
.composer .to b { display: block; color: var(--accent); font-weight: 600; }
.composer .to span { display: block; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .in { display: flex; align-items: flex-end; gap: 8px; max-width: 560px; margin: 0 auto; }
.composer textarea { flex: 1; min-height: 42px; max-height: 140px; resize: none; border: 0; outline: 0; border-radius: 21px; padding: 10px 16px; background: var(--card); font-size: 16px; line-height: 1.4; box-shadow: var(--shadow); }
.composer textarea::placeholder { color: var(--faint); }
.send { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: #fff; transition: opacity 0.2s, transform 0.15s; }
.send:disabled { opacity: 0.35; }
.send:active { transform: scale(0.92); }
.send .i { width: 20px; height: 20px; stroke-width: 2.2; }
.big { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 560px; margin: 0 auto; height: 50px; border-radius: 25px; background: var(--text); color: var(--bg); font-weight: 700; font-size: 16px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
}
.tab { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); padding: 2px 0; transition: color 0.2s; }
.tab .i { width: 25px; height: 25px; stroke-width: 1.7; }
.tab.on { color: var(--text); }
.tab.on .i { stroke-width: 2.1; }
.tab .count { position: absolute; top: -3px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; border: 2px solid var(--bg); box-sizing: content-box; }

/* ---------- sheet + toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86vh; overflow-y: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform 0.36s var(--ease);
}
.sheet.open { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--faint); opacity: 0.5; margin: 0 auto 14px; }
.sheet h3 { margin: 0; text-align: center; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.sheet p { margin: 6px 0 16px; text-align: center; color: var(--sub); font-size: 14px; }
.sheet .card + .card { margin-top: 10px; }
.tick { color: var(--accent); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50; display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; border-radius: 16px; background: #1b1c20; color: #fff; font-size: 14px; font-weight: 500;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: 0.3s var(--ease); white-space: nowrap; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: #8ea2ff; font-weight: 700; }
.hero.plain .cta { background: var(--text); color: var(--bg); }
.av.img { background-size: cover; background-position: center; color: transparent; }
.txt .who { color: var(--text); font-weight: 600; }
.composer .to .open-chat { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.composer .to .open-chat .i { width: 15px; height: 15px; stroke-width: 2.2; }
.composer .to div { flex: 1; }

/* ---------- item actions, feedback, history ---------- */
.acts { gap: 12px; }
.act { width: 62px; }
.fb { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; margin-top: 4px; font-size: 14px; color: var(--sub); }
.fb span { flex: 1; }
.fb-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--sub); transition: 0.15s; }
.fb-btn .i { width: 19px; height: 19px; }
.fb-btn.on { background: var(--accent-soft); color: var(--accent); }
.fb-btn.on.down { background: var(--red-soft); color: var(--red); }
.restore { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; margin-left: 6px; }

/* sheets with steps */
.sheet-ico { width: 56px; height: 56px; border-radius: 18px; margin: 4px auto 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.sheet-ico .i { width: 26px; height: 26px; }
.steps { padding: 6px 0; margin-bottom: 14px; }
.step { display: flex; gap: 12px; padding: 10px 16px; font-size: 15px; line-height: 1.4; }
.step b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 13px; }
.sheet .big + .big { margin-top: 8px; }
.big.ghost { background: transparent; color: var(--accent); }

/* ---------- welcome ---------- */
.welcome { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.welcome.open { opacity: 1; pointer-events: auto; }
.w-body { flex: 1; max-width: 520px; width: 100%; margin: 0 auto; padding: 40px 20px 20px; text-align: center; }
.w-body h1 { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 10px; }
.w-body > p { font-size: 16px; color: var(--sub); line-height: 1.45; margin: 0 auto 24px; max-width: 360px; }
.w-body .card { text-align: left; }
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 18px; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.w-ico { width: 84px; height: 84px; border-radius: 28px; margin: 0 auto 22px; display: grid; place-items: center; color: #fff; background: var(--hero); box-shadow: 0 16px 40px rgba(61, 90, 254, 0.3); }
.w-ico .i { width: 40px; height: 40px; stroke-width: 1.7; }
.feats { padding: 6px 0; }
.feat { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.feat b { display: block; font-size: 15px; }
.feat span:not(.tile) { font-size: 13px; color: var(--sub); }
.w-foot { position: sticky; bottom: 0; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); max-width: 520px; width: 100%; margin: 0 auto; }
.dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--faint); opacity: 0.4; transition: 0.25s; }
.dots i.on { width: 22px; background: var(--accent); opacity: 1; }
.w-skip { display: block; margin: 10px auto 0; font-size: 15px; font-weight: 600; color: var(--sub); }
.choice .radio { margin-top: 0; }
.choice.on .radio { border-color: var(--accent); background: var(--accent); }
.choice.on .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.sub .state { font-weight: 600; color: var(--sub); }
.sub .state.ok { color: var(--green); }

/* welcome preview: a tilted mini version of the Replies screen */
.preview { position: relative; margin: 0 auto 26px; max-width: 330px; transform: perspective(900px) rotateX(8deg); }
.preview .pv-hero { margin-bottom: -18px; padding: 16px 18px 30px; border-radius: 22px; text-align: left; box-shadow: 0 18px 40px rgba(61, 90, 254, 0.28); }
.preview .pv-hero .hero-n { font-size: 36px; }
.preview .chips { margin-top: 10px; }
.preview .pv-list { position: relative; margin: 0 10px; text-align: left; box-shadow: 0 12px 30px rgba(11, 12, 15, 0.1); }
.pv-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.pv-row + .pv-row { border-top: 1px solid var(--line); }
.pv-row .name { font-size: 14px; }
.pv-row .txt { font-size: 13px; }
.pv-row .count { min-width: 20px; height: 20px; font-size: 11px; }
.w-body .preview + h1 { margin-top: 4px; }

/* plans */
.sheet-ico.gold { background: var(--gold); color: #fff; font-size: 26px; }
.plans { display: grid; gap: 10px; margin-bottom: 12px; }
.plan-opt { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); text-align: start; border: 2px solid transparent; }
.plan-opt.best { border-color: var(--accent); }
.plan-opt b { font-size: 16px; }
.plan-opt .price { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.plan-opt .per { font-size: 13px; color: var(--sub); }
.plan-opt .save { position: absolute; top: 14px; inset-inline-end: 14px; height: 24px; padding: 0 10px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
.usd { font-size: 0.62em; font-weight: 600; color: var(--sub); letter-spacing: 0; }
.hero .usd { color: inherit; opacity: 0.8; }
.banner.warn .star { background: var(--red); color: #fff; font-weight: 800; }

.ctx-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; max-width: 560px; margin: 0 auto; }
.ctx-actions .big { font-size: 15px; }
.ctx-actions .big.ghost { background: var(--card); box-shadow: var(--shadow); }

/* ---------- chat view: Telegram's look ---------- */
:root {
  --tg-wall: #a9c493; --tg-wall-2: #d5e3b9; --tg-in: #ffffff; --tg-out: #effedd; --tg-text: #000000;
  --tg-meta-in: #a1aab3; --tg-meta-out: #5fae4e; --tg-pill: rgba(0, 0, 0, 0.22); --tg-link: #168acd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --tg-wall: #0e1621; --tg-wall-2: #17212b; --tg-in: #182533; --tg-out: #2b5278; --tg-text: #ffffff;
    --tg-meta-in: #6d7f8f; --tg-meta-out: #7da8d3; --tg-pill: rgba(255, 255, 255, 0.12); --tg-link: #6ab3f3; }
}
:root[data-theme="dark"] { --tg-wall: #0e1621; --tg-wall-2: #17212b; --tg-in: #182533; --tg-out: #2b5278; --tg-text: #ffffff;
  --tg-meta-in: #6d7f8f; --tg-meta-out: #7da8d3; --tg-pill: rgba(255, 255, 255, 0.12); --tg-link: #6ab3f3; }

.page.chatmode { overflow: hidden; padding: 0; }
.tg-chat { position: absolute; inset: 0; display: flex; flex-direction: column; }
.tg-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 2; }
.tg-title { flex: 1; min-width: 0; }
.tg-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-title span { font-size: 13px; color: var(--sub); }
.tg-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); flex: none; }
.tg-icon .i { width: 21px; height: 21px; }
.tg-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 8px calc(140px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 20% 15%, rgba(255,255,255,.16) 0 2px, transparent 3px) 0 0 / 46px 46px,
              radial-gradient(circle at 70% 60%, rgba(255,255,255,.12) 0 1.5px, transparent 2.5px) 0 0 / 34px 34px,
              linear-gradient(160deg, var(--tg-wall-2), var(--tg-wall)); }
.tg-sentinel { height: 1px; }
.tg-pill { align-self: center; margin: 10px auto 6px; width: fit-content; max-width: 86%; padding: 4px 11px; border-radius: 14px; background: var(--tg-pill); color: #fff; font-size: 13px; font-weight: 600; text-align: center; }
#tg-msgs { display: flex; flex-direction: column; }
.tg-row { display: flex; align-items: flex-end; gap: 6px; margin-top: 2px; }
.tg-row.first { margin-top: 7px; }
.tg-row.out { justify-content: flex-end; }
.av.xs { width: 34px; height: 34px; font-size: 12px; }
.tg-av-gap { width: 34px; flex: none; }
.tg-bubble { --b: var(--tg-in); position: relative; max-width: min(78%, 460px); padding: 6px 9px 6px 10px; border-radius: 16px; background: var(--b); color: var(--tg-text);
  font-size: 15.5px; line-height: 1.33; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); word-wrap: break-word; white-space: pre-wrap; cursor: pointer; transition: box-shadow 0.15s; }
.tg-row.out .tg-bubble { --b: var(--tg-out); }
.tg-row.in.last .tg-bubble { border-bottom-left-radius: 4px; }
.tg-row.out.last .tg-bubble { border-bottom-right-radius: 4px; }
.tg-row.in.last .tg-bubble::before, .tg-row.out.last .tg-bubble::before { content: ""; position: absolute; bottom: 0; width: 12px; height: 14px; }
.tg-row.in.last .tg-bubble::before { left: -7px; background: radial-gradient(circle at 0 0, transparent 11.5px, var(--b) 12px); }
.tg-row.out.last .tg-bubble::before { right: -7px; background: radial-gradient(circle at 100% 0, transparent 11.5px, var(--b) 12px); }
.tg-row.bare .tg-bubble { background: none; box-shadow: none; }
.tg-row.bare .tg-bubble::before { display: none; }
.tg-name { display: block; font-size: 14px; font-weight: 600; margin-bottom: 1px; }
.tg-fwd { font-size: 13.5px; color: var(--tg-link); margin-bottom: 3px; }
.tg-quote { display: block; margin: 2px 0 5px; padding: 3px 8px; border-left: 3px solid var(--q); border-radius: 4px 6px 6px 4px; background: color-mix(in srgb, var(--q) 13%, transparent); white-space: normal; }
.tg-quote b { display: block; font-size: 13.5px; color: var(--q); }
.tg-quote span { display: block; font-size: 13.5px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-photo { width: 240px; max-width: 100%; height: 180px; margin: 2px -5px 5px; border-radius: 12px; background: rgba(0, 0, 0, 0.08) center / cover no-repeat; }
.tg-photo.none { height: 44px; background: none; }
.tg-photo.none::after { content: "🖼  Photo"; font-size: 15px; opacity: 0.7; }
.tg-sticker { font-size: 72px; line-height: 1; padding: 4px 0; }
.tg-media { display: flex; align-items: center; gap: 10px; padding: 3px 0 2px; white-space: normal; }
.tg-media-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--tg-link); color: #fff; font-size: 15px; font-weight: 700; }
.tg-text a, .tg-text .mention { color: var(--tg-link); text-decoration: none; }
.tg-meta { float: right; margin: 7px 0 -5px 10px; font-size: 11.5px; color: var(--tg-meta-in); white-space: nowrap; user-select: none; }
.tg-row.out .tg-meta { color: var(--tg-meta-out); }
.tg-ticks { font-style: normal; letter-spacing: -3px; margin-left: 2px; }
.tg-row.picked .tg-bubble { box-shadow: 0 0 0 2px var(--accent), 0 1px 1px rgba(0, 0, 0, 0.12); }
.tg-row.flash .tg-bubble { animation: tg-flash 1.8s ease-out; }
@keyframes tg-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent), 0 0 24px rgba(61, 90, 254, 0.45); } 100% { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); } }
.composer.tg { background: var(--card); }
.tg-x { flex: none; margin-inline-start: auto; width: 30px; height: 30px; border-radius: 50%; color: var(--sub); font-size: 15px; display: grid; place-items: center; }
