/* ===================== Пиня v2: живой фон, стекло, живой Пиня, анимации. Подключается после app.css ===================== */
:root {
  --bg: #EEF3FC; --card: rgba(255, 255, 255, .84); --card-2: #F1F5FD; --line: rgba(20, 45, 100, .09);
  --glass-line: rgba(255, 255, 255, .8); --r: 22px;
  --shadow: 0 14px 34px -22px rgba(20, 50, 120, .45), 0 2px 6px -3px rgba(20, 50, 120, .12);
  --hero-a: #3B7BFF; --hero-b: #1B4FD6; --spring: cubic-bezier(.34, 1.56, .64, 1); --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] {
  --bg: #0A0F1A; --card: rgba(24, 32, 48, .78); --card-2: #1A2336; --line: rgba(255, 255, 255, .07);
  --glass-line: rgba(255, 255, 255, .06); --hero-a: #2F63E8; --hero-b: #142F8A;
  --shadow: 0 16px 36px -22px rgba(0, 0, 0, .8);
}
html, body { background: var(--bg); }
body { overflow-x: hidden; }
.app { position: relative; z-index: 1; padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
:root.theming body, :root.theming .card, :root.theming .tabbar, :root.theming .quick button, :root.theming .tile,
:root.theming .theme-fab, :root.theming .bottom-fade, :root.theming .search, :root.theming .seg {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease !important; }

/* ---------- живой фон: мягкие пятна + снег ---------- */
.bg-fx { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-fx .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .75; animation: drift 22s ease-in-out infinite alternate; }
.bg-fx .b1 { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: #C9DCFF; }
.bg-fx .b2 { width: 55vmax; height: 55vmax; right: -25vmax; top: 12vh; background: #DCD4FF; animation-duration: 28s; animation-delay: -6s; }
.bg-fx .b3 { width: 60vmax; height: 60vmax; left: -10vmax; bottom: -35vmax; background: #CDEFFF; animation-duration: 25s; animation-delay: -12s; }
:root[data-theme="dark"] .bg-fx .blob { opacity: .5; }
:root[data-theme="dark"] .bg-fx .b1 { background: #16337A; }
:root[data-theme="dark"] .bg-fx .b2 { background: #0E5363; }
:root[data-theme="dark"] .bg-fx .b3 { background: #2A1F66; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vmax, 4vmax) scale(1.08); } 100% { transform: translate(-4vmax, 7vmax) scale(.96); } }
.snow i { position: absolute; top: -14px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%;
  background: rgba(31, 95, 224, .2); animation: fall var(--d) linear infinite; animation-delay: var(--dl); }
:root[data-theme="dark"] .snow i { background: rgba(255, 255, 255, .4); }
@keyframes fall { to { transform: translate(var(--sw), 106vh); } }

/* ---------- низ экрана: размытие и затемнение под навбаром ---------- */
.bottom-fade { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; pointer-events: none;
  height: calc(118px + env(safe-area-inset-bottom));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  background: linear-gradient(to top, var(--bg) 22%, color-mix(in srgb, var(--bg) 70%, transparent) 60%, transparent);
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent); mask-image: linear-gradient(to top, #000 55%, transparent); }

/* ---------- стекло ---------- */
.card, .quick button, .search, .seg, .list, .kpi, .tabbar, .theme-fab, .demo {
  background-color: var(--card); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-line); }
.card { padding: 16px 18px; }
.tabbar { background-color: color-mix(in srgb, var(--card) 70%, var(--bg)); border-radius: 26px; padding: 6px;
  box-shadow: 0 16px 34px -14px rgba(10, 30, 80, .45); }

/* ---------- нажатия пружинят ---------- */
.btn, .quick button, .tile, .item, .chips button, .seg button, .tabbar button, .theme-fab, .x, .sale-banner, .mascot {
  transition: transform .2s var(--spring), background-color .2s, color .2s, box-shadow .2s, opacity .2s; }
.btn:active, .quick button:active, .tile:active, .chips button:active, .seg button:active, .x:active, .sale-banner:active { transform: scale(.96); }
.item:active { transform: scale(.985); }
.tabbar button:active { transform: scale(.9); }
.btn { border-radius: 16px; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(31, 95, 224, .8); position: relative; overflow: hidden; }
.btn.ghost, .btn.danger, .btn.crypto, .btn.armed { box-shadow: none; }
.btn.ghost, .btn.crypto { background: var(--card-2); color: var(--ink); }
.btn.danger, .btn.armed, .btn.ghost.armed { background: var(--bad-soft); color: var(--bad); }
.btn.shine::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-18deg); animation: shine 4.5s ease-in-out infinite 1.2s; }
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 130%; } }

/* ---------- шапка ---------- */
.brand { font-size: 18px; }
.brand img.pinya { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); padding: 3px; }

/* ---------- герой на главной ---------- */
.hero { position: relative; overflow: hidden; border: 0; color: #fff; min-height: 172px; padding: 20px 14px 18px 20px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .24), transparent 55%), linear-gradient(135deg, var(--hero-a), var(--hero-b));
  box-shadow: 0 22px 44px -24px rgba(27, 79, 214, .9); display: flex; align-items: center; gap: 4px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); pointer-events: none; }
.hero::before { width: 190px; height: 190px; right: -40px; top: -70px; animation: bob 7s ease-in-out infinite; }
.hero::after { width: 90px; height: 90px; left: -30px; bottom: -40px; animation: bob 9s ease-in-out infinite reverse; }
@keyframes bob { 50% { transform: translate(-8px, 10px); } }
.hero .tx { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero .hi { font-size: 13px; font-weight: 600; opacity: .85; letter-spacing: .02em; }
.hero h1 { font-size: 25px; margin-top: 4px; color: #fff; }
.hero p { color: rgba(255, 255, 255, .88); font-size: 14px; margin-top: 8px; }
.hero .mascot { width: 132px; height: 132px; margin: -14px -6px -22px 0; position: relative; z-index: 1; border: 0; background: none; padding: 0; flex: none; }
.hero .spark { position: absolute; z-index: 1; color: #fff; opacity: 0; animation: twinkle 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: .95; transform: scale(1) rotate(45deg); } }

/* ---------- живой Пиня: дыхание, моргание, разовые действия ---------- */
.pl { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 96%; animation: breathe 3.4s ease-in-out infinite; }
.pl img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(10, 30, 80, .25));
  user-select: none; -webkit-user-drag: none; }
.pl .pl-c, .pl.blink .pl-o { visibility: hidden; }
.pl.blink .pl-c { visibility: visible; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.024); } }
.pl.act-hop { animation: hop .75s var(--ease); }
.pl.act-wiggle { animation: wiggle .8s ease-in-out; }
.pl.act-tilt { animation: tilt 1.4s ease-in-out; }
.pl.act-squash { animation: squash .6s var(--spring); }
.pl.act-spin { animation: spin3d 1s var(--ease); }
.pl.act-dance { animation: dance 1.2s ease-in-out; }
@keyframes hop { 0% { transform: none; } 18% { transform: scale(1.06, .9); } 45% { transform: translateY(-18%) scale(.95, 1.06); }
  70% { transform: translateY(0) scale(1.07, .92); } 85% { transform: scale(.98, 1.03); } 100% { transform: none; } }
@keyframes wiggle { 20% { transform: rotate(-7deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(2deg); } }
@keyframes tilt { 30%, 70% { transform: rotate(-9deg) translateX(-3%); } }
@keyframes squash { 30% { transform: scale(1.12, .86); } 60% { transform: scale(.95, 1.06); } }
@keyframes spin3d { 0% { transform: none; } 50% { transform: rotateY(180deg) translateY(-8%); } 100% { transform: rotateY(360deg); } }
@keyframes dance { 25% { transform: translateX(-5%) rotate(-6deg); } 50% { transform: translateY(-6%); } 75% { transform: translateX(5%) rotate(6deg); } }

/* частицы при поглаживании */
.burst { position: fixed; z-index: 60; left: 0; top: 0; pointer-events: none; font-size: 18px; animation: burst .95s var(--ease) forwards; }
@keyframes burst { 0% { transform: translate(var(--x0), var(--y0)) scale(.4); opacity: 1; }
  100% { transform: translate(var(--x1), var(--y1)) scale(1.15) rotate(var(--r)); opacity: 0; } }

/* ---------- появление по очереди ---------- */
.view { animation: none; }
.view.enter > * { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
.view.enter .today-row { animation: rise .45s var(--ease) both; animation-delay: calc(.25s + var(--j, 0) * 70ms); }

/* ---------- быстрые действия ---------- */
.quick { gap: 10px; }
.quick button { border-radius: 20px; padding: 14px 4px 11px; gap: 7px; font-size: 12.5px; }
.quick button img { animation: float 3.4s ease-in-out infinite; }
.quick button:nth-child(2) img { animation-delay: -.8s; } .quick button:nth-child(3) img { animation-delay: -1.6s; } .quick button:nth-child(4) img { animation-delay: -2.4s; }
.quick button:nth-child(1) { background-image: linear-gradient(160deg, rgba(255, 200, 110, .4), transparent 70%); }
.quick button:nth-child(2) { background-image: linear-gradient(160deg, rgba(120, 165, 255, .42), transparent 70%); }
.quick button:nth-child(3) { background-image: linear-gradient(160deg, rgba(110, 220, 180, .4), transparent 70%); }
.quick button:nth-child(4) { background-image: linear-gradient(160deg, rgba(190, 160, 255, .45), transparent 70%); }

/* ---------- лимит: полоска заполняется, цифры считаются ---------- */
.bar { height: 10px; background: var(--card-2); }
.bar i { width: var(--w, 0); background: linear-gradient(90deg, var(--hero-a), #7FA8FF); position: relative; overflow: hidden; }
.view.enter .bar i { animation: grow 1.1s var(--ease) both .3s; }
.bar.warn i { background: linear-gradient(90deg, #F59E2B, var(--sun)); }
.bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  background-size: 200% 100%; animation: sk 2.2s infinite; }
@keyframes grow { from { width: 0; } }
.time { color: var(--pri-text); }

/* ---------- каталог ---------- */
.tile { border-radius: 22px; min-height: 126px; box-shadow: var(--shadow); }
.tile .em img { animation: float 3.6s ease-in-out infinite; }
.tiles .tile:nth-child(2n) .em img { animation-delay: -1.3s; } .tiles .tile:nth-child(3n) .em img { animation-delay: -2.2s; }
.chips button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-color: transparent; }
.item .ic { transition: transform .25s var(--spring); }
.item:active .ic { transform: scale(1.15) rotate(-6deg); }

/* ---------- таббар с бегущей подложкой ---------- */
.tabbar .ind { position: absolute; top: 6px; bottom: 6px; left: 0; width: 0; border-radius: 20px; background: var(--pri-soft); z-index: 0;
  transition: transform .45s var(--spring), width .45s var(--spring); }
.tabbar button { position: relative; z-index: 1; border-radius: 20px; }
.tabbar.has-ind button[aria-current="page"] { background: none; }
.tabbar button[aria-current="page"] svg { animation: tabpop .5s var(--spring); }
@keyframes tabpop { 40% { transform: translateY(-3px) scale(1.18); } }

/* ---------- шторка и тост ---------- */
.sheet { animation: sheetup .45s var(--spring); }
@keyframes sheetup { from { transform: translateY(70%); } }
.sheet-hero { border-radius: 24px; }
.sheet-body > * { animation: rise .45s var(--ease) both; }
.sheet-body > *:nth-child(2) { animation-delay: .05s; } .sheet-body > *:nth-child(3) { animation-delay: .1s; } .sheet-body > *:nth-child(n+4) { animation-delay: .15s; }
.toast { border-radius: 16px; animation: toastin .45s var(--spring); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .4); z-index: 45; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 20px) scale(.9); } }

.theme-fab.spin { animation: fabspin .6s var(--spring); }
@keyframes fabspin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(.8); } 100% { transform: rotate(360deg) scale(1); } }

/* ---------- пустые состояния — живой Пиня ---------- */
.soon .pl-wrap { width: 124px; height: 124px; }
.empty .pl-wrap { width: 60px; height: 60px; flex: none; }
.sale-banner { animation: glow 2.8s ease-in-out infinite 1s; }
@keyframes glow { 50% { box-shadow: 0 10px 30px -8px rgba(255, 122, 69, .75); } }

/* ---------- админка: выдача «Плюса» ---------- */
.card input[type=search], .card input[type=text] { font: inherit; color: var(--ink); background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; width: 100%; }
.users { display: flex; flex-direction: column; margin-top: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.user-row:first-child { border-top: 0; }
.user-row .av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); }
.user-row .tx { flex: 1; min-width: 0; }
.user-row .tx b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .tx small { color: var(--muted); font-size: 12px; }
.user-row[aria-pressed="true"] { background: var(--pri-soft); border-radius: 14px; padding-left: 8px; padding-right: 8px; }
.days-pick { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.days-pick button { border: 1px solid var(--line); background: var(--card-2); border-radius: 999px; padding: 7px 12px; font-weight: 600; font-size: 13px; }
.days-pick button[aria-pressed="true"] { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-color: transparent; }
.grant-btns { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }

@media (prefers-reduced-motion: reduce) { .snow, .bg-fx .blob { display: none; } }

/* Второстепенные кнопки видны на карточке в обеих темах: своя подложка + рамка */
.btn.ghost, .btn.crypto { background: color-mix(in srgb, var(--pri) 8%, var(--card-2)); border: 1px solid color-mix(in srgb, var(--pri) 22%, transparent); }
:root[data-theme="dark"] .btn.ghost, :root[data-theme="dark"] .btn.crypto { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .16); }
.btn.ghost.armed { border-color: transparent; }

/* Подключения */
.conn { display: flex; align-items: center; gap: 12px; }
.conn .tx { flex: 1; min-width: 0; }
.conn .tx b { display: block; font-weight: 600; }
.conn .tx small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.conn-ic { width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; flex: none;
  box-shadow: 0 2px 8px -4px rgba(10, 30, 80, .35); }
.conn .btn { width: auto; padding: 10px 16px; }

/* Выбор срока «Плюса»: месяц / год */
.plan-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plan-pick button { position: relative; border: 1.5px solid var(--line); background: var(--card-2); border-radius: 16px; padding: 10px 12px;
  text-align: left; font-weight: 700; font-size: 15px; display: flex; flex-direction: column; gap: 2px;
  transition: transform .2s var(--spring), border-color .2s, background-color .2s; }
.plan-pick button small { font-weight: 600; font-size: 12.5px; color: var(--muted); }
.plan-pick button[aria-pressed="true"] { border-color: var(--pri); background: color-mix(in srgb, var(--pri) 10%, var(--card)); }
.plan-pick button:active { transform: scale(.97); }
.plan-pick .save { position: absolute; top: -9px; right: 10px; font-size: 11px; font-weight: 800; color: #fff; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(135deg, #1E9E6A, #2FC48A); box-shadow: 0 6px 14px -8px rgba(30, 158, 106, .8); }

/* Воронка в админке */
.mini-seg { display: flex; gap: 4px; background: var(--card-2); border-radius: 10px; padding: 3px; }
.mini-seg button { border: 0; background: none; border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mini-seg button[aria-pressed="true"] { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; }
.f-step { padding: 8px 0; border-top: 1px solid var(--line); }
.f-step:first-of-type { border-top: 0; }
.f-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.f-top b { font-variant-numeric: tabular-nums; }
.f-bar { height: 10px; border-radius: 6px; background: var(--card-2); margin: 6px 0 4px; overflow: hidden; }
.f-bar i { display: block; height: 100%; width: var(--w); border-radius: 6px; background: linear-gradient(90deg, var(--hero-a), #7FA8FF); }
.f-step small { color: var(--muted); font-size: 12px; }
.f-rets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.f-ret { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.f-ret b { font: 700 20px var(--f-display); font-variant-numeric: tabular-nums; }
.f-ret span { font-size: 12.5px; }
.f-ret small { color: var(--muted); font-size: 11.5px; }

/* Утренняя сводка: переключатель и поля */
.switch { width: 46px; height: 28px; border-radius: 999px; border: 0; padding: 3px; background: var(--line); position: relative; flex: none;
  transition: background-color .25s; }
.switch i { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .3s var(--spring); }
.switch[aria-checked="true"] { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); }
.switch[aria-checked="true"] i { transform: translateX(18px); }
.digest select, .digest input[type=text] { font: inherit; color: var(--ink); background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; width: 100%; }

/* Новое: метка NEW и баннер на главной */
.new-badge { position: absolute; top: 10px; right: 10px; z-index: 1; font: 800 10px/1 var(--f-body); letter-spacing: .06em; color: #fff;
  padding: 4px 7px; border-radius: 999px; background: linear-gradient(135deg, #FF7A45, #F5B53F); box-shadow: 0 4px 10px -4px rgba(255, 122, 69, .8); }
.new-badge.inline { position: static; display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 3px 6px; font-size: 9px; }
.whatsnew { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; color: var(--ink);
  background-image: linear-gradient(120deg, rgba(255, 122, 69, .16), rgba(245, 181, 63, .12) 45%, transparent 75%); }
.whatsnew .wn-ic img { animation: float 3s ease-in-out infinite; }
.whatsnew .tx { flex: 1; min-width: 0; }
.whatsnew .tx b { display: block; font: 700 15px var(--f-display); }
.whatsnew .tx small { color: var(--muted); font-size: 12.5px; }
.whatsnew:active { transform: scale(.98); }

/* Мои файлы */
.files .row { align-items: center; }
.files .f-ic { font-size: 22px; line-height: 1; flex: 0 0 auto; }
.files .tx { min-width: 0; }
.files .tx b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.files .btn.small { margin-top: 8px; width: 100%; padding: 10px; font-size: 14px; }

.conn-more { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--chip, rgba(61, 99, 245, .08)); }

/* Кнопка темы прокручивается вместе со страницей — не висит поверх карточек */
.theme-fab { position: absolute; }
/* Формы в сценариях и новое напоминание */
.sform { display: grid; gap: 12px; margin: 4px 0 14px; }
.ff { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.ff i { font-style: normal; font-weight: 500; opacity: .7; }
.ff input, .ff select, .ff textarea, .name-edit input { width: 100%; min-width: 0; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--card-2); color: var(--ink); font: 500 16px/1.3 inherit; font-family: inherit; outline: none; }
.ff input:focus, .ff select:focus, .ff textarea:focus, .name-edit input:focus { border-color: var(--accent, #3B6CFF); }
.ff .err, .ff input.err { border-color: #E5484D; }
.ff [hidden], label.ff[hidden] { display: none; }
.add-rem { width: 100%; margin-bottom: 12px; }
.row.series .time { font-size: 15px; }
.name-edit { gap: 8px; }

/* длинные имена: сначала уменьшаем шрифт, рвём слово только если оно совсем не влезает (anywhere сжимал блок и резал «папоч/ка») */
.hero h1, .page-title { overflow-wrap: break-word; word-break: normal; hyphens: manual; }
.hero h1.long { font-size: 21px; } .hero h1.xlong { font-size: 18px; }

/* Плитки каталога на узком экране: текст не залезает под картинку и метку NEW */
.tile small { max-width: calc(100% - 62px); }
.tile:has(.new-badge) b { max-width: calc(100% - 50px); }
@media (max-width: 380px) {
  .tiles { gap: 8px; }
  .tile { padding: 12px; min-height: 132px; }
  .tile b { font-size: 13.5px; }
  .tile small { font-size: 11.5px; max-width: calc(100% - 48px); }
  .tile .em img { width: 50px; height: 50px; }
  .new-badge { top: 8px; right: 8px; padding: 3px 6px; font-size: 9px; }
}

/* ===================== v3: освежение ===================== */
:root { --ring-a: #5B8CFF; --ring-b: #8B5CF6; --ring-track: rgba(59, 108, 255, .12); }
:root[data-theme="dark"] { --ring-track: rgba(255, 255, 255, .08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ring-track: rgba(255, 255, 255, .08); } }

/* карточки: тонкий световой кант сверху — объём без лишних теней */
.card { position: relative; border-radius: 24px; }
.card:not(.hero)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 0 0 1px var(--line); }
:root[data-theme="dark"] .card:not(.hero)::after { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 0 1px var(--line); }

/* быстрые действия: крупнее иконки, мягкий цветной фон */
.quick button { padding: 14px 4px 12px; gap: 8px; font-weight: 700; }
.quick button img { width: 40px; height: 40px; }
.quick button:nth-child(2) { background-image: linear-gradient(160deg, rgba(120, 165, 255, .45), transparent 70%); }
.quick button:nth-child(4) { background-image: linear-gradient(160deg, rgba(255, 110, 110, .38), transparent 70%); }

/* лимит — кольцо */
.ring-meter { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.ring { position: relative; flex: 0 0 64px; width: 64px; height: 64px; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .ring-bg { stroke: var(--ring-track); }
.ring .ring-fg { stroke: url(#rg); stroke-linecap: round; stroke-dashoffset: var(--off); animation: ringin 1.1s var(--ease, ease) both; }
.ring-meter.warn { --ring-a: #FFB020; --ring-b: #FF6B4A; }
@keyframes ringin { from { stroke-dashoffset: var(--full); } }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 15px var(--f-display); font-variant-numeric: tabular-nums; }
.ring-meter .tx { flex: 1; min-width: 0; }
.ring-meter .tx b { display: block; font: 700 15px var(--f-display); margin-bottom: 3px; }
.ring-meter .tx small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.ring-meter .plus-cta { flex: 0 0 auto; background: linear-gradient(135deg, #FFD36E, #FF9F43); color: #3A2100; border: 0; font-weight: 800; }

/* «Своя просьба» — микрофон */
.ask { gap: 14px; }
.ask-ic { flex: 0 0 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(120, 165, 255, .35), rgba(139, 92, 246, .18)); }
.ask-ic img { animation: float 3.4s ease-in-out infinite; }

/* каталог: заголовки разделов и строки списка */
.group h3 { letter-spacing: -.01em; }
.item .ic { border-radius: 14px; }
.item:active { transform: scale(.985); }
.tile .em img { filter: drop-shadow(0 8px 12px rgba(10, 30, 80, .22)); }

/* навбар: активная вкладка с мягким свечением */
.tabbar button[aria-current="page"], .tabbar button.on, .tabbar button[aria-selected="true"] {
  box-shadow: 0 6px 18px -8px rgba(59, 108, 255, .65); }

/* узкий экран 320 px: плитки без наложений, имя переносится по-русски (проверено вживую) */
@media (max-width: 380px) {
  .tiles .tile { padding: 12px 12px 54px; min-height: 0; justify-content: flex-start; gap: 4px; }
  .tiles .tile b, .tiles .tile small { max-width: 100%; }
  .tiles .tile:has(.new-badge) b { margin-top: 18px; }
  .tiles .tile .em { right: 8px; bottom: 6px; }
  .tiles .tile .em img { width: 44px; height: 44px; }
  .new-badge { top: 8px; right: 8px; }
  .hero h1.long  { font-size: 18px; }
  .hero h1.xlong { font-size: 15.5px; }
  .hero h1 { hyphens: auto; -webkit-hyphens: auto; }
}
.btn[disabled] { opacity: .5; }

/* ---------- Траты ---------- */
.exp-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }
.exp-nav b { font: 700 16px/1.2 var(--f-display); }
.exp-nav .x { min-width: 40px; font-size: 20px; }
.exp-nav .x:disabled { opacity: .3; }
.exp-total small { color: var(--muted); font-size: 13px; }
.exp-total .sum { font: 800 32px/1.15 var(--f-display); margin: 4px 0 2px; letter-spacing: -.01em; }
.exp-total .chip { margin-top: 8px; }
.exp-chart { display: flex; align-items: flex-end; gap: 2px; height: 92px; margin-top: 14px; padding-bottom: 16px; position: relative; }
.exp-chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.exp-chart .col i { display: block; width: 100%; max-width: 12px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--hero-a), var(--hero-b)); }
.exp-chart .col em { position: absolute; bottom: -16px; font: 600 10px/1 var(--f-body); font-style: normal; color: var(--muted); }
.exp-cat .tx { min-width: 0; }
.exp-cat .bar { display: block; height: 6px; border-radius: 999px; background: var(--card-2); margin-top: 6px; overflow: hidden; }
.exp-cat .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--hero-a), var(--hero-b)); }
.row .amt { text-align: right; white-space: nowrap; }
.row .amt small { display: block; color: var(--muted); font-size: 12px; }
.exp-day { color: var(--muted); font: 700 12px/1 var(--f-body); text-transform: uppercase; letter-spacing: .06em; padding: 12px 0 4px; }
/* ---------- Списки ---------- */
.li-row { width: 100%; background: none; border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.li-row .ck { width: 24px; height: 24px; flex: none; border-radius: 8px; border: 2px solid var(--line); display: inline-flex; align-items: center;
  justify-content: center; font-weight: 800; color: #fff; }
.li-row.done .ck { background: var(--ok); border-color: var(--ok); }
.li-row.done .tx b { text-decoration: line-through; opacity: .55; }
.li-add { display: flex; gap: 8px; margin-top: 10px; }
.li-add input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font: 500 15px var(--f-body); }

/* первая строка сразу после заголовка карточки — без линии сверху (:first-of-type не срабатывал после .card-h) */
.card-h + .row, .card-h + .muted-p + .row, .card-h + .f-step { border-top: 0; }
.li-add .x { min-width: 46px; font-size: 22px; font-weight: 700; }

/* ---------- главная: траты за месяц и лимит картинок ---------- */
.money-strip { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 12px 14px; border: 0; border-radius: 16px;
  background: linear-gradient(135deg, rgba(110, 220, 180, .22), rgba(110, 220, 180, .06)); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.money-strip .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.money-strip .tx small { color: var(--muted); font-size: 12.5px; }
.money-strip .tx b { font: 800 19px/1.2 var(--f-display); letter-spacing: -.01em; }
.money-strip .ms-n { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.money-strip .ms-n i { font-style: normal; font-size: 18px; margin-left: 2px; }
.meter-img { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.bar.img i { background: linear-gradient(90deg, #A78BFA, #EC4899); }

/* админка: скорость ответов */
.speed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.speed-grid > div { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.speed-grid small { color: var(--muted); font-size: 12px; }
.speed-grid b { font: 800 22px/1.2 var(--f-display); }
.speed-grid i { font-style: normal; color: var(--muted); font-size: 11.5px; }

/* ---------- «Я»: список разделов ---------- */
.me-head { display: flex; align-items: center; gap: 14px; }
.me-head .me-av { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); overflow: hidden; }
.me-head .me-av img { width: 54px; height: 54px; margin-top: 8px; }
.me-head .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-head .tx b { font: 800 20px/1.2 var(--f-display); overflow-wrap: anywhere; }
.me-head .tx small { color: var(--muted); font-size: 13.5px; }
.mgroup { display: flex; flex-direction: column; gap: 6px; }
.mg-h { color: var(--pri-text); font: 700 13px/1 var(--f-body); letter-spacing: .02em; padding: 0 6px; }
.mg-list { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--glass-line); }
.mi { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; border: 0; background: none; color: var(--ink);
  font: 500 15.5px/1.25 var(--f-body); text-align: left; cursor: pointer; position: relative; }
.mi + .mi::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--line); }
.mi:active { background: var(--card-2); }
.mi-ic { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 17px; line-height: 1; }
.mi-ic .g-logo svg { width: 18px; height: 18px; display: block; }
.mi-t { flex: 1; min-width: 0; }
.mi-t.accent { color: #8B5CF6; font-weight: 700; }
.mi-v { color: var(--muted); font-size: 14px; white-space: nowrap; max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
.mi-chev { color: var(--muted); font-size: 22px; line-height: 1; opacity: .6; margin-left: -4px; }
.t-violet { background: linear-gradient(135deg, #A78BFA, #7C3AED); }
.t-pink { background: linear-gradient(135deg, #F9A8D4, #EC4899); }
.t-blue { background: linear-gradient(135deg, #93C5FD, #3B82F6); }
.t-sun { background: linear-gradient(135deg, #FDE68A, #F59E0B); }
.t-lilac { background: linear-gradient(135deg, #DDD6FE, #A78BFA); }
.t-mint { background: linear-gradient(135deg, #A7F3D0, #10B981); }
.t-teal { background: linear-gradient(135deg, #99F6E4, #14B8A6); }
.t-indigo { background: linear-gradient(135deg, #C7D2FE, #6366F1); }
.t-gray { background: linear-gradient(135deg, #E2E8F0, #94A3B8); }
.t-red { background: linear-gradient(135deg, #FCA5A5, #EF4444); }
.t-white { background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.me-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.me-foot a { color: inherit; }
.sub-top { display: flex; align-items: center; margin-bottom: -6px; }
.sub-title { margin-top: 0; }

/* секретарь */
.sec-how { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
.ff.sec-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; font-size: 14.5px; }
.sec-check input { width: 20px; height: 20px; flex: none; }
.sform textarea { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  padding: 11px 14px; font: 500 15px/1.4 var(--f-body); resize: vertical; }

.sec-tpl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: -4px; }
.sec-tpl small { color: var(--muted); font-size: 12.5px; width: 100%; }
.chip-btn { border: 1px solid var(--line); background: var(--card-2); color: var(--ink); border-radius: 999px; padding: 7px 12px;
  font: 600 13px/1 var(--f-body); cursor: pointer; }

/* ---------- полноэкранный режим Telegram (Bot API 8.0+) ----------
   --tg-safe-area-inset-* — вырез и строка статуса, --tg-content-safe-area-inset-* — плавающие кнопки Telegram («Закрыть», «…»).
   Telegram сам выставляет эти переменные; в обычном режиме они 0, и ничего не меняется. */
:root { --top-safe: calc(var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
        --bottom-safe: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px)); }
.app { padding-top: calc(14px + var(--top-safe)); padding-bottom: calc(130px + var(--bottom-safe)); }
.theme-fab { top: calc(12px + var(--top-safe)); }
.tabbar { bottom: calc(12px + var(--bottom-safe)); }
.toast { bottom: calc(86px + var(--bottom-safe)); }
.sheet { max-height: calc(100vh - var(--top-safe) - 16px); padding-bottom: calc(18px + var(--bottom-safe)); }

/* ---------- лендинг (pinya.net в обычном браузере) ---------- */
body.is-landing .tabbar, body.is-landing .bottom-fade { display: none !important; }
body.is-landing .app { max-width: 720px; margin: 0 auto; padding-bottom: calc(110px + var(--bottom-safe)); }
.lp-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 56px; }
.lp-mini { padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font: 700 14px/1 var(--f-body); text-decoration: none; }
.lp-hero .tx { display: flex; flex-direction: column; gap: 6px; }
.lp-hero h1 { font-size: 46px !important; line-height: 1.05; }
.lp-hero p { max-width: 30ch; }
.lp-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; align-self: flex-start;
  background: #fff !important; color: #1B4FD6 !important; text-decoration: none; padding: 14px 20px; box-shadow: 0 12px 26px -12px rgba(0, 0, 0, .45); }
.lp-note { color: rgba(255, 255, 255, .85); font-size: 12.5px; }
.lp-chat { display: flex; flex-direction: column; gap: 8px; }
.lp-msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.35; }
.lp-msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-bottom-right-radius: 6px; }
.lp-msg.bot { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 6px; }
.lp-h { font: 800 22px/1.2 var(--f-display); margin: 10px 2px -2px; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lp-f { background: var(--card); border: 1px solid var(--glass-line); border-radius: 20px; padding: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lp-f b { font-size: 15px; }
.lp-f small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.lp-steps { display: flex; flex-direction: column; gap: 12px; }
.lp-step { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.lp-step i { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 14px var(--f-display);
  font-style: normal; color: #fff; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); }
.lp-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.lp-plan { display: flex; flex-direction: column; gap: 4px; }
.lp-plan.plus { background: linear-gradient(135deg, rgba(59, 123, 255, .16), rgba(27, 79, 214, .08)); border-color: rgba(59, 123, 255, .35); }
.lp-price { font: 800 28px/1.15 var(--f-display); }
.lp-price small { font: 500 14px var(--f-body); color: var(--muted); }
.lp-plan > small { color: var(--muted); font-size: 13.5px; }
.lp-link { color: var(--pri-text); font-weight: 700; text-decoration: none; padding: 0 4px; }
.lp-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; padding: 10px 0 4px; }
.lp-foot a { color: var(--muted); font-size: 13.5px; }
.lp-sticky { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--bottom-safe));
  width: min(560px, calc(100% - 28px)); display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px 18px;
  border-radius: 20px; color: #fff; text-decoration: none; font: 800 16px/1 var(--f-display);
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); box-shadow: 0 18px 40px -16px rgba(27, 79, 214, .75); }
.lp-sticky:active { transform: translateX(-50%) scale(.98); }
.lp-cta { width: auto !important; white-space: nowrap; }
body.is-landing .app { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
@media (max-width: 520px) {   /* на телефоне пингвин справа сверху, кнопка «Открыть в Telegram» — во всю ширину карточки */
  .lp-hero { position: relative; }
  .lp-hero .tx { width: 100%; }
  .lp-hero .tx p { max-width: calc(100% - 104px); }
  .lp-hero .mascot { position: absolute; right: 8px; top: 34px; width: 112px; }
  .lp-cta { width: 100% !important; align-self: stretch; }
}
