/* Suyber — Lorrrem: тёплая бумага, графит, один акцент Limon. Стекло — только навигация и листы. */
:root {
  color-scheme: light;
  --bg: #F4F4F1;
  --card: #FCFCFA;
  --field: #EAEAE5;
  --ink: #141414;
  --subtle: #3A3A37;
  --muted: #7A7A75;
  --line: #D3D3CE;
  --line-soft: #E4E4DF;
  --accent: #C6F04E;
  --on-accent: #141414;
  --accent-band: rgba(198, 240, 78, .28);
  --plus: #86AC22;
  --hero-bg: #141414;
  --hero-text: #F4F4F1;
  --hero-muted: #A8A8A2;
  --warn: #D9451C;
  --warn-bg: rgba(255, 90, 44, .12);
  --ok: #63801B;

  --glass: rgba(252, 252, 250, .62);
  --glass-strong: rgba(252, 252, 250, .86);
  --glass-border: rgba(255, 255, 255, .75);
  --glass-edge: rgba(20, 20, 20, .08);
  --glass-shadow: 0 10px 40px rgba(20, 20, 20, .12), 0 1px 2px rgba(20, 20, 20, .06);
  --scrim: rgba(14, 14, 14, .28);

  --c-work: #C6F04E;
  --c-tel: #1B44E8;
  --c-media: #FF5A2C;
  --c-bank: #3A3A37;
  --c-web: #A9BFA0;
  --c-charity: #FF4D8D;
  --c-other: #A8A8A2;
  --c-tax: #7B5CE0;
  --c-reserve: #2FA88A;
  --c-home: #D98A2B;

  --mono: "JetBrains Mono", "SFMono-Regular", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  --r-card: 20px;
  --r-field: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0E0E; --card: #191917; --field: #242421; --ink: #EDEDED; --subtle: #B7B7B1; --muted: #8A8A85;
    --line: #34342F; --line-soft: #262623; --accent-band: rgba(198, 240, 78, .16);
    --hero-bg: #1E1E1B; --hero-text: #EDEDED; --hero-muted: #8A8A85;
    --warn: #FF7A52; --warn-bg: rgba(255, 90, 44, .16); --ok: #A9D62F; --plus: #C6F04E;
    --glass: rgba(34, 34, 31, .58); --glass-strong: rgba(30, 30, 28, .9); --glass-border: rgba(255, 255, 255, .1);
    --glass-edge: rgba(0, 0, 0, .4); --glass-shadow: 0 10px 40px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .5);
    --c-tel: #5B7BFF; --c-bank: #B7B7B1; --c-web: #7F9477; --c-other: #7A7A75; --c-tax: #A58CFF; --c-reserve: #4FC3A1;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E0E; --card: #191917; --field: #242421; --ink: #EDEDED; --subtle: #B7B7B1; --muted: #8A8A85;
  --line: #34342F; --line-soft: #262623; --accent-band: rgba(198, 240, 78, .16);
  --hero-bg: #1E1E1B; --hero-text: #EDEDED; --hero-muted: #8A8A85;
  --warn: #FF7A52; --warn-bg: rgba(255, 90, 44, .16); --ok: #A9D62F; --plus: #C6F04E;
  --glass: rgba(34, 34, 31, .58); --glass-strong: rgba(30, 30, 28, .9); --glass-border: rgba(255, 255, 255, .1);
  --glass-edge: rgba(0, 0, 0, .4); --glass-shadow: 0 10px 40px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .5);
  --c-tel: #5B7BFF; --c-bank: #B7B7B1; --c-web: #7F9477; --c-other: #7A7A75; --c-tax: #A58CFF; --c-reserve: #4FC3A1;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); overflow-x: hidden; overscroll-behavior-x: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body { overscroll-behavior-y: contain; }
body {
  font-family: var(--mono); font-size: 14px; line-height: 20px;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }

/* ---------- стекло ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-border);
}

/* ---------- каркас ---------- */
.app { min-height: 100dvh; }
main {
  padding: calc(16px + var(--safe-t)) 16px calc(92px + var(--safe-b));
  max-width: 1120px; margin: 0 auto; display: grid; gap: 24px; outline: none;
}
.page-head { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.page-title { flex: 1; min-width: 0; }
.page-head h1 { font-size: 30px; line-height: 36px; font-weight: 800; letter-spacing: -.02em; }
.kicker { font-size: 11px; line-height: 16px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.head-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  color: var(--ink);
}
.icon-btn.plus { color: var(--plus); }
.icon-btn.plus svg { width: 26px; height: 26px; stroke-width: 2.4; }
.icon-btn svg, .nav svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Нижняя панель — плавающая стеклянная капсула */
.nav {
  position: fixed; z-index: 20; left: 12px; right: 12px; bottom: max(8px, calc(var(--safe-b) - 12px));
  height: 68px; border-radius: 34px; padding: 6px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px;
  max-width: 520px; margin: 0 auto;
}
.nav a {
  display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none;
  border-radius: 28px; color: var(--subtle); font-size: 10px; line-height: 12px; letter-spacing: .02em;
  transition: background .2s, color .2s;
}
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.nav .nav-brand { display: none; }

/* Десктоп: стеклянная боковая панель */
@media (min-width: 960px) {
  .nav {
    top: 16px; bottom: 16px; left: 16px; right: auto; width: 248px; height: auto; max-width: none; margin: 0;
    border-radius: 28px; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  }
  .nav .nav-brand { display: block; padding: 4px 12px 16px; }
  .nav .nav-brand b { display: block; font-size: 18px; line-height: 24px; }
  .nav a { display: flex; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: 14px; line-height: 20px; border-radius: 16px; }
  .nav a:hover:not([aria-current="page"]) { background: var(--accent-band); }
  .nav .nav-foot { display: block; margin-top: auto; padding: 12px; color: var(--muted); font-size: 12px; line-height: 16px; }
  main { padding: 32px 32px 48px calc(248px + 56px); max-width: calc(1120px + 248px + 56px); }
}

/* ---------- базовые блоки ---------- */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 20px; }
.section { display: grid; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 16px; line-height: 24px; font-weight: 700; }
.section-head .link { font-size: 12px; color: var(--muted); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 16px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-2 { display: grid; gap: 24px; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: 1.1fr .9fr; align-items: start; } }

.btn {
  height: 48px; padding: 0 20px; border-radius: 24px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--bg); font-weight: 700; letter-spacing: .01em; text-decoration: none; white-space: nowrap;
}
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--warn); color: #fff; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 12px; border-radius: 18px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--line); font-size: 11px; line-height: 16px; letter-spacing: .04em; white-space: nowrap; color: var(--subtle);
}
.chip.warn { border-color: transparent; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.chip.accent { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip.soft { border-color: transparent; background: var(--field); }

/* Сегменты */
.seg { display: flex; padding: 4px; border-radius: 22px; background: var(--field); gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button {
  flex: 1; height: 36px; border: 0; background: transparent; border-radius: 18px; padding: 0 14px; white-space: nowrap;
  color: var(--subtle); font-size: 13px;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(20,20,20,.12); }

/* ---------- обзор ---------- */
.hero { background: var(--hero-bg); color: var(--hero-text); border-radius: 28px; padding: 24px; display: grid; gap: 20px; }
.hero .kicker { color: var(--hero-muted); }
.hero-num { font-size: clamp(40px, 11vw, 64px); line-height: 1; font-weight: 800; letter-spacing: -.04em; color: var(--accent); }
.hero-num small { font-size: .45em; letter-spacing: 0; margin-left: 6px; color: var(--hero-text); }
.hero-sub { font-size: 12px; color: var(--hero-muted); margin-top: 8px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid rgba(237,237,237,.14); padding-top: 16px; }
.hero-stats b { display: block; font-size: 16px; line-height: 24px; }
.hero-stats span { font-size: 11px; line-height: 14px; color: var(--hero-muted); }
@media (max-width: 420px) { .hero-stats { grid-template-columns: 1fr 1fr; } .hero-stats > :last-child { grid-column: 1 / -1; } }

.topup { display: grid; gap: 16px; }
.topup.urgent { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: linear-gradient(var(--accent-band), var(--accent-band)), var(--card); }
.topup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.topup-head h2 { font-size: 18px; line-height: 24px; font-weight: 800; }
.acc-list { display: grid; gap: 8px; }
.acc-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-radius: 16px; background: var(--field); }
.acc-row b { font-size: 14px; }
.acc-row .need { font-size: 16px; font-weight: 800; text-align: right; }
.acc-row .rub { grid-column: 2; text-align: right; font-weight: 700; font-size: 14px; }
.acc-row .rub-note { grid-column: 1 / -1; font-size: 11px; line-height: 14px; color: var(--muted); text-align: right; }
.acc-row .detail { grid-column: 1 / -1; font-size: 12px; line-height: 16px; color: var(--muted); }
.acc-row.covered .need { color: var(--ok); font-size: 13px; }

/* ---------- списки ---------- */
.list { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-card); overflow: hidden; }
.list-group-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px 8px; font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  width: 100%; padding: 12px 16px; background: none; border: 0; border-top: 1px solid var(--line-soft); text-align: left;
}
.list > .row:first-child, .list-group-head + .row { border-top: 0; }
.row:hover { background: var(--accent-band); }
.row.paused { opacity: .5; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  color: #141414; background: var(--cat, var(--c-other));
}
.avatar.dark-text { color: #141414; }
.avatar.light-text { color: #F4F4F1; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12px; line-height: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r { text-align: right; }
.row .r b { display: block; font-weight: 700; }
.row .r span { font-size: 12px; color: var(--muted); }
.row .r .warn { color: var(--warn); font-weight: 600; }

.search { position: relative; }
.search #q { padding-left: 44px; }
.search svg { position: absolute; z-index: 1; left: 14px; top: 14px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.managers { display: flex; gap: 8px; flex-wrap: wrap; }
.managers a {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; text-decoration: none; font-size: 13px;
}
.managers a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---------- календарь ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h2 { font-size: 20px; line-height: 28px; font-weight: 800; }
.cal-nav { display: flex; gap: 8px; }
.cal-nav .icon-btn { width: 40px; height: 40px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; letter-spacing: .08em; }
.day {
  min-height: 64px; border-radius: 14px; border: 1px solid transparent; background: var(--card);
  padding: 6px; display: flex; flex-direction: column; gap: 4px; text-align: left; overflow: hidden;
}
.day.out { background: transparent; }
.day .dn { font-size: 12px; line-height: 16px; color: var(--muted); }
.day.today .dn { background: var(--accent); color: var(--on-accent); border-radius: 8px; padding: 0 6px; align-self: flex-start; font-weight: 700; }
.day[aria-pressed="true"] { border-color: var(--ink); }
.day.has { cursor: pointer; }
.dots { display: flex; flex-wrap: wrap; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cat); display: block; }
.dots i.transfer { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.day .dsum { font-size: 10px; line-height: 12px; font-weight: 700; margin-top: auto; }
.day .names { display: none; }
@media (min-width: 960px) {
  .day { min-height: 112px; padding: 8px; }
  .day .dots { display: none; }
  .day .names { display: grid; gap: 2px; }
  .day .names span { font-size: 11px; line-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 8px; position: relative; }
  .day .names span::before { content: ""; position: absolute; left: 0; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--cat); }
  .cal-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
}
.cal-summary { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- статистика ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi { display: grid; gap: 4px; align-content: start; }
.kpi b { font-size: 22px; line-height: 28px; font-weight: 800; letter-spacing: -.02em; }
.kpi .small { color: var(--muted); }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr; } }
.donut-wrap { display: grid; gap: 20px; align-items: center; }
@media (min-width: 640px) { .donut-wrap { grid-template-columns: 220px 1fr; } }
.donut { width: 100%; max-width: 220px; margin: 0 auto; display: block; }
.donut text { fill: var(--ink); font-family: var(--mono); }
.legend { display: grid; gap: 10px; }
.leg { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
.leg i { width: 12px; height: 12px; border-radius: 4px; background: var(--cat); }
.leg .bar { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; }
.leg .bar span { display: block; height: 100%; background: var(--cat); border-radius: 3px; }
.leg .v { text-align: right; font-weight: 700; }
.leg .v small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }

/* ---------- формы ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field > .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea {
  width: 100%; height: 48px; border-radius: var(--r-field); border: 1px solid transparent; background: var(--field); padding: 0 14px; font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.field textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 20px; resize: vertical; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237A7A75' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-fields.amount { grid-template-columns: 1fr 104px; }
.row-fields.period { grid-template-columns: 88px 1fr; }
.check { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.form { display: grid; gap: 16px; }
.hint { font-size: 12px; line-height: 16px; color: var(--muted); }
.found { padding: 12px 14px; border-radius: 14px; background: var(--accent-band); font-size: 13px; }

.drop {
  display: grid; place-items: center; gap: 8px; text-align: center; padding: 28px 16px; border-radius: 20px;
  border: 1.5px dashed var(--line); color: var(--muted); cursor: pointer;
}
.drop svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shot-preview { max-height: 220px; border-radius: 16px; display: block; margin: 0 auto; }
.progress { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- лист (bottom sheet / модальное окно) ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  border-radius: 28px 28px 0 0; padding: 8px 20px calc(24px + var(--safe-b));
  background: var(--glass-strong); border-bottom: 0;
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; position: sticky; top: -8px; padding-top: 8px; background: transparent; }
.sheet-head h2 { font-size: 20px; line-height: 28px; font-weight: 800; }
.sheet-head .icon-btn { width: 40px; height: 40px; background: var(--field); border: 0; box-shadow: none; }
.sheet-body { display: grid; gap: 16px; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 560px; max-height: 86dvh; border-radius: 28px; padding: 20px 24px 24px; border-bottom: 1px solid var(--glass-border); animation: pop .22s ease-out; }
  .sheet .grab { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none; } }

.detail-amount { font-size: 36px; line-height: 40px; font-weight: 800; letter-spacing: -.03em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.cancel-box { display: grid; gap: 12px; padding: 16px; border-radius: 20px; background: var(--field); }
.cancel-box b { font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b));
  padding: 12px 18px; border-radius: 20px; font-size: 13px; max-width: calc(100% - 32px);
}
@media (min-width: 960px) { .toast { bottom: 24px; } }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.settings-list { display: grid; gap: 12px; }
.setting { display: grid; gap: 12px; }
.setting h3 { font-size: 14px; line-height: 20px; font-weight: 700; }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- профиль ---------- */
.nav .nav-user { display: none; }
.profile-btn { text-decoration: none; }
.me-initials { font-weight: 800; font-size: 14px; }
.auth-list { display: grid; gap: 8px; }
.auth-list .btn { justify-content: flex-start; gap: 12px; padding-left: 8px; height: 56px; border-radius: 28px; }
.auth-list .avatar { width: 40px; height: 40px; }
.profile-card { display: grid; gap: 4px; text-decoration: none; color: inherit; }
.profile-card:hover { border-color: var(--line); }
.profile-card h3::after { content: " →"; color: var(--muted); }
@media (min-width: 960px) {
  .nav .nav-user { display: flex; margin-top: auto; }
  .head-actions .profile-btn { display: none; }
}

/* ---------- смахивание карт в плане пополнения ---------- */
.swipe { position: relative; border-radius: 16px; overflow: hidden; background: var(--accent); transition: height .2s ease, opacity .2s ease, margin .2s ease; }
.swipe-under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding: 0 20px; font-weight: 800; font-size: 13px; color: var(--on-accent); letter-spacing: .02em; opacity: .55; }
.swipe.armed .swipe-under { opacity: 1; }
.swipe:not(.dragging):not(.leaving) .swipe-under { visibility: hidden; }
.swipe .acc-row { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.swipe.dragging .acc-row { cursor: grabbing; }
.swipe.leaving { height: 0 !important; opacity: 0; margin-block: -4px; }
.swipe.is-done { background: var(--field); }
.swipe.is-done .swipe-under { color: var(--ink); }
.swipe.is-done .acc-row > :not(.acc-done) { opacity: .55; }
.acc-done {
  grid-column: 1 / -1; justify-self: start; margin-top: 4px; height: 28px; padding: 0 12px; border-radius: 14px;
  background: transparent; border: 1px solid var(--line); color: var(--subtle); font-size: 12px;
}
.acc-done:hover { border-color: var(--ink); color: var(--ink); }
.toast-action { margin-left: 8px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: 12px; padding: 4px 12px; }
@media (prefers-reduced-motion: reduce) { .swipe { transition: none; } }

/* ---------- аватар ---------- */
.me-btn { flex: none; padding: 0; overflow: hidden; color: var(--ink); text-decoration: none; }
.me-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.me-img.sm { width: 28px; height: 28px; }
.me-img.lg { width: 88px; height: 88px; }
.nav .nav-user .me-img.sm { flex: none; }
.profile-top { display: flex; align-items: center; gap: 16px; }
.avatar-pick { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; width: 88px; height: 88px; overflow: hidden; }
.avatar-pick > svg { width: 48px; height: 48px; }
.avatar-pick span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 0 6px; font-size: 11px; background: rgba(20,20,20,.55); color: #F4F4F1; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
.avatar-opt { display: grid; gap: 6px; justify-items: center; border: 0; background: none; padding: 6px; border-radius: 16px; font-size: 11px; line-height: 14px; color: var(--subtle); }
.avatar-opt img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.avatar-opt.is-on { background: var(--accent-band); color: var(--ink); font-weight: 700; }
@media (min-width: 960px) { .page-head .me-btn { display: none; } }

/* ---------- обновление свайпом вниз ---------- */
.ptr { position: fixed; z-index: 30; left: 50%; top: calc(-44px + var(--safe-t)); width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; transform: translate(-50%, 0); opacity: 0; transition: opacity .15s; pointer-events: none; }
.ptr svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ptr.show { opacity: 1 !important; }
.ptr.ready svg, .ptr.spin svg { stroke: var(--plus); }
.ptr.spin svg { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

.hidden-link { justify-self: start; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; color: var(--subtle); font-size: 13px; font-weight: 600; }
.hidden-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden-link:hover { color: var(--ink); }
.hidden-restore { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }
.sync-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; text-decoration: none; color: inherit; flex-wrap: wrap; }

/* ---------- счётчики на обзоре ---------- */
.hero-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-counts a { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 16px; background: rgba(237,237,237,.08); color: var(--hero-muted); font-size: 12px; text-decoration: none; }
.hero-counts a b { color: var(--hero-text); font-size: 14px; }
.hero-counts a:hover { background: rgba(237,237,237,.16); }
.swipe .acc-row { cursor: pointer; }

/* ---------- стекло (Apple glass) ---------- */
:root {
  --glass-card: rgba(255, 255, 255, .55);
  --glass-card-border: rgba(255, 255, 255, .8);
  --glass-field: rgba(20, 20, 20, .05);
  --seg-on: var(--glass-card); --seg-on-border: var(--glass-card-border);
  --blob-1: rgba(198, 240, 78, .35);
  --blob-2: rgba(91, 123, 255, .18);
  --blob-3: rgba(255, 90, 44, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass-card: rgba(38, 38, 35, .5); --glass-card-border: rgba(255, 255, 255, .09); --glass-field: rgba(255, 255, 255, .06); --seg-on: rgba(255, 255, 255, .17); --seg-on-border: rgba(255, 255, 255, .16);
    --blob-1: rgba(198, 240, 78, .14); --blob-2: rgba(91, 123, 255, .16); --blob-3: rgba(255, 90, 44, .08);
  }
}
:root[data-theme="dark"] {
  --glass-card: rgba(38, 38, 35, .5); --glass-card-border: rgba(255, 255, 255, .09); --glass-field: rgba(255, 255, 255, .06); --seg-on: rgba(255, 255, 255, .17); --seg-on-border: rgba(255, 255, 255, .16);
  --blob-1: rgba(198, 240, 78, .14); --blob-2: rgba(91, 123, 255, .16); --blob-3: rgba(255, 90, 44, .08);
}
/* Мягкий цветной фон под стеклом — без него размытию нечего показывать */
body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vmax 40vmax at 15% 10%, var(--blob-1), transparent 70%),
    radial-gradient(45vmax 45vmax at 90% 20%, var(--blob-2), transparent 70%),
    radial-gradient(40vmax 40vmax at 60% 95%, var(--blob-3), transparent 70%);
}
.card, .list, .acc-row, .swipe .acc-row, .icon-btn.glass, .sheet, .managers a {
  background: var(--glass-card);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-card-border);
  box-shadow: 0 8px 30px rgba(20, 20, 20, .06), inset 0 1px 0 var(--glass-card-border);
}
.list .row + .row, .list-group-head + .row { border-top-color: var(--glass-card-border); }
.hero { background: rgba(20, 20, 20, .88); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); border: 1px solid rgba(255,255,255,.08); }
.topup.urgent { background: linear-gradient(var(--accent-band), var(--accent-band)), var(--glass-card); }
.seg { background: var(--glass-field); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
/* Выбранная пилюля: в тёмной теме заметно светлее дорожки */
.seg button[aria-pressed="true"] { background: var(--seg-on); box-shadow: 0 1px 6px rgba(20,20,20,.12), inset 0 0 0 1px var(--seg-on-border); }
.field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea, .input { background: var(--glass-field); }
.acc-row { box-shadow: none; }
.swipe { background: var(--accent); }
.hero-counts a { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.btn.ghost { background: var(--glass-field); border-color: var(--glass-card-border); }

/* Шапка: справа три стеклянные кнопки */
.head-actions { display: flex; gap: 8px; }
.icon-btn.ai { color: var(--plus); }
@media (max-width: 420px) {
  .page-head h1 { font-size: 24px; line-height: 30px; }
  .head-actions { gap: 6px; }
  .head-actions .icon-btn { width: 42px; height: 42px; }
}

/* Карточка подписки */
.detail-top { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.ring { width: 150px; height: 150px; }
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-text b { font-size: 36px; line-height: 40px; font-weight: 800; }
.ring-text span { font-size: 11px; line-height: 14px; color: var(--muted); max-width: 100px; }
.detail-head { display: flex; gap: 12px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; padding: 16px; }
.summary-grid b { display: block; font-size: 15px; line-height: 20px; }
.summary-grid span { font-size: 11px; line-height: 14px; color: var(--muted); }
@media (max-width: 420px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
.row.hist { grid-template-columns: 0 1fr auto; cursor: default; }

/* Форма: популярные сервисы */
.popular { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pop { flex: none; display: grid; justify-items: center; gap: 6px; width: 84px; padding: 10px 4px; border-radius: 16px; border: 1px solid var(--glass-card-border); background: var(--glass-field); font-size: 11px; line-height: 14px; color: var(--subtle); }
.pop .avatar { width: 40px; height: 40px; font-size: 14px; }
.list-tools { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.list-tools .sort select { min-width: 170px; }
@media (max-width: 520px) { .list-tools { grid-template-columns: 1fr; } }

/* «Это примерно как» и ИИ-разбор */
.cmp-row { display: flex; gap: 12px; align-items: baseline; }
.cmp-row b { min-width: 44px; font-size: 18px; }
.review-list { display: grid; gap: 12px; }
.review-list > div { padding: 12px 14px; border-radius: 16px; background: var(--glass-field); }
.sheet h3 { font-size: 15px; margin: 8px 0 0; }
/* Лимонная подложка «Скрыть» — только пока карточку тянут, иначе просвечивает сквозь стекло */
.swipe { background: transparent; }
.swipe.dragging, .swipe.leaving { background: var(--accent); }

/* ---------- переключатель темы ---------- */
.nav-user-row { display: none; }
@media (min-width: 960px) {
  .nav-user-row { display: flex; gap: 8px; align-items: center; margin-top: auto; }
  .nav-user-row .nav-user { flex: 1; margin-top: 0; }
  .nav-user-row .theme-btn { width: 44px; height: 44px; flex: none; }
  .page-head .head-theme { display: none; }
}
.theme-btn svg { width: 20px; height: 20px; }
.head-theme { flex: none; }
.settings-title { margin-top: 8px; }
.settings-title h2 { font-size: 20px; line-height: 28px; }

/* Смена темы: круг от кнопки, край размыт маской */
@property --vt-r { syntax: "<length>"; inherits: false; initial-value: 0px; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) {
  -webkit-mask-image: radial-gradient(circle at var(--vt-x) var(--vt-y), #000 calc(var(--vt-r) - 110px), transparent var(--vt-r));
  mask-image: radial-gradient(circle at var(--vt-x) var(--vt-y), #000 calc(var(--vt-r) - 110px), transparent var(--vt-r));
  animation: vt-reveal .75s cubic-bezier(.4, 0, .2, 1) forwards;
}
@keyframes vt-reveal { from { --vt-r: 0px; } to { --vt-r: var(--vt-end); } }

/* Логотип в скруглённом квадрате (сквиркл, как иконки iOS) */
.nav .nav-brand { align-items: center; gap: 12px; }
@media (min-width: 960px) { .nav .nav-brand { display: flex; } }
.brand-logo {
  width: 40px; height: 40px; flex: none; object-fit: cover;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 0C8 0 0 8 0 50s8 50 50 50 50-8 50-50S92 0 50 0z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 0C8 0 0 8 0 50s8 50 50 50 50-8 50-50S92 0 50 0z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* Шапка на телефоне: кнопки первой строкой, заголовок — второй */
@media (max-width: 959px) {
  .page-head { flex-wrap: wrap; row-gap: 12px; }
  .page-head .head-actions { margin-left: auto; }
  .page-head .page-title { order: 3; flex-basis: 100%; }
  .page-head .icon-btn { width: 44px; height: 44px; }
}

/* Поле поиска: место под значок лупы — и в списке, и в окне поиска */
.search .field input:not([type="checkbox"]):not([type="file"]) { padding-left: 44px; }
.search svg { top: 50%; transform: translateY(-50%); }
.search { margin-bottom: 4px; }
.nav .nav-brand .kicker { display: block; font-size: 5.5px; line-height: 8px; }
.nav .nav-brand b { line-height: 20px; }

/* Разделы только для десктопа */
.nav a.desktop-only { display: none; }
@media (min-width: 960px) { .nav a.desktop-only { display: flex; } }

/* Домовой */
.mascot-say { display: flex; gap: 12px; align-items: flex-end; }
.mascot-say img { width: 72px; height: 72px; flex: none; object-fit: contain; }
.domo { object-fit: contain; flex: none; }
.domo-center { display: grid; justify-items: center; }
.empty .domo { margin-bottom: -4px; }
.bubble { position: relative; margin: 0; padding: 12px 14px; border-radius: 18px 18px 18px 4px; background: var(--glass-field); border: 1px solid var(--glass-card-border); font-size: 13px; line-height: 19px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--plus); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.welcome { display: grid; justify-items: center; gap: 12px; text-align: left; }
.welcome img { width: 200px; height: 200px; object-fit: contain; animation: wave-in .5s cubic-bezier(.2,.9,.3,1.3) both; }
.welcome .bubble { border-radius: 18px; }
.empty-mascot { width: 160px; height: 160px; object-fit: contain; margin-bottom: -4px; }
@keyframes wave-in { from { transform: translateY(16px) scale(.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .welcome img { animation: none; } }

/* Подсказки при наведении: тёмная плашка со скруглением */
[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]::after {
    content: attr(data-tip); position: absolute; z-index: 50; top: calc(100% + 8px); left: 50%;
    transform: translate(-50%, -4px); padding: 6px 10px; border-radius: 10px; white-space: nowrap;
    background: rgba(20, 20, 20, .92); color: #F4F4F1; font: 500 12px/16px var(--mono); letter-spacing: .01em;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  }
  [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }
  .nav-user-row [data-tip]::after { top: auto; bottom: calc(100% + 8px); }
  .head-actions [data-tip]:last-child::after { left: auto; right: 0; transform: translate(0, -4px); }
  .head-actions [data-tip]:last-child:hover::after { transform: translate(0, 0); }
}

/* Полоса прокрутки: тонкая, скруглённая, «нависает» с отступом от краёв */
* { scrollbar-width: thin; scrollbar-color: rgba(120, 120, 115, .45) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; margin: 22px 0; }
::-webkit-scrollbar-thumb { background: rgba(120, 120, 115, .4); border-radius: 12px; border: 4px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(120, 120, 115, .7); }
::-webkit-scrollbar-corner { background: transparent; }
.sheet { scrollbar-gutter: auto; }

/* ---------- выпадающие списки в стекле ---------- */
select.gsel-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.gsel {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 48px; padding: 0 14px;
  border-radius: var(--r-field); border: 1px solid transparent; background: var(--glass-field); font-size: 16px; text-align: left; cursor: pointer;
}
.gsel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsel svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; transition: transform .15s; }
.gsel[aria-expanded="true"] { border-color: var(--ink); }
.gsel[aria-expanded="true"] svg { transform: rotate(180deg); }
.gsel:focus-visible { outline: none; border-color: var(--ink); }
.list-tools .sort .gsel { min-width: 170px; }
.gsel-menu {
  position: fixed; z-index: 1000; overflow-y: auto; padding: 6px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-card-border);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-card-border);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center; transition: opacity .14s, transform .14s;
  scrollbar-width: thin;
}
.gsel-menu.up { transform-origin: bottom center; transform: translateY(4px) scale(.98); }
.gsel-menu.on { opacity: 1; transform: none; }
.gsel-opt { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 8px; border-radius: 12px; font-size: 14px; line-height: 20px; cursor: pointer; white-space: nowrap; }
.gsel-opt svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; visibility: hidden; }
.gsel-opt[aria-selected="true"] { font-weight: 700; }
.gsel-opt[aria-selected="true"] svg { visibility: visible; }
.gsel-opt.active, .gsel-opt:hover { background: var(--accent-band); }
.gsel-opt[aria-disabled="true"] { opacity: .4; cursor: default; }
@media (prefers-reduced-motion: reduce) { .gsel-menu { transition: none; } }

/* ---------- чекбоксы со скруглением ---------- */
input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border-radius: 7px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 45%, transparent); background: var(--glass-field); cursor: pointer;
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
input[type="checkbox"]::after {
  content: ""; width: 12px; height: 12px; background: var(--bg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 12 5 5 11-11' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 12 5 5 11-11' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0); transition: transform .12s;
}
input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:checked::after { transform: scale(1); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Рамки плашек контрастнее */
.chip { border-color: color-mix(in srgb, var(--ink) 30%, transparent); color: var(--ink); }

/* ---------- окна на мобилке: содержимое помещается по ширине, без горизонтальной прокрутки ---------- */
.sheet { overflow-x: hidden; }
.sheet-body > *, .welcome > *, .auth-list > * { min-width: 0; max-width: 100%; }
.sheet .btn.block { white-space: normal; height: auto; min-height: 48px; padding-block: 10px; line-height: 20px; text-align: left; }
.sheet .auth-list .btn { min-height: 52px; }
.welcome .bubble { width: 100%; }
@media (max-width: 959px) {
  /* Приветствие целиком на экране: домовой и отступы ужимаются по высоте */
  .welcome img { width: min(200px, 20dvh); height: min(200px, 20dvh); }
  .welcome { gap: 8px; }
  .sheet .auth-list { gap: 6px; }
  .sheet .auth-list .btn { min-height: 46px; }
  .sheet-head { margin-bottom: 8px; }
}

/* ---------- заголовок + подзаголовок: плотнее ---------- */
.detail-amount { line-height: 34px; }
.detail-head .small { margin-top: 0; line-height: 16px; }
.ring-text b { line-height: 34px; }
.page-head h1 { line-height: 32px; }
.page-title .kicker { line-height: 14px; }
.hero-sub { margin-top: 4px; line-height: 16px; }
.hero-stats b, .summary-grid b { line-height: 18px; }
.topup-head h2 { line-height: 22px; }
.topup-head .kicker { line-height: 14px; }
.empty h2 { line-height: 24px !important; }
.empty h2 + p { margin-top: -6px; }
@media (max-width: 959px) { .page-head h1 { line-height: 26px; } }

/* ---------- стекло для всех элементов ---------- */
:root { --glass-hl: inset 0 1px 0 rgba(255, 255, 255, .55); --glass-blur: blur(18px) saturate(170%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glass-hl: inset 0 1px 0 rgba(255, 255, 255, .08); } }
:root[data-theme="dark"] { --glass-hl: inset 0 1px 0 rgba(255, 255, 255, .08); }

.btn.ghost, .chip:not(.warn):not(.accent), .sheet-head .icon-btn, .cancel-box, .bubble, .gsel,
.sheet .card, .sheet .list, .pop, .seg, .field input:not([type="checkbox"]):not([type="file"]), .field textarea, .input {
  background: var(--glass-field);
  border: 1px solid var(--glass-card-border);
  box-shadow: var(--glass-hl);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.btn.accent {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  border: 1px solid color-mix(in srgb, var(--accent) 70%, #fff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn:not(.accent):not(.danger):not(.ghost) { box-shadow: var(--glass-hl); }
.btn.ghost:hover, .gsel:hover { background: color-mix(in srgb, var(--glass-field) 50%, var(--accent-band)); }
.btn.accent:hover { filter: brightness(1.04); }
.btn:active { transform: scale(.98); }
.btn { transition: transform .1s, filter .15s, background .15s; }
.field input:focus, .field textarea:focus, .gsel[aria-expanded="true"] { border-color: var(--ink); }

/* ---------- кнопки аккуратнее ---------- */
.sheet .btn.block, .auth-list .btn { justify-content: center; text-align: center; padding-inline: 20px; gap: 10px; border-radius: 24px; }
.sheet .auth-list .btn:has(.avatar) { justify-content: flex-start; padding-left: 8px; text-align: left; }
.sheet .btn.block { min-height: 48px; }
.btn svg { flex: none; }

/* Окно: шапка прозрачная и стоит на месте, прокручивается только содержимое под ней */
.sheet { display: flex; flex-direction: column; overflow: hidden; }
.sheet .grab { flex: none; }
.sheet-head {
  flex: none; position: static; z-index: auto; margin: 0 0 4px; padding: 4px 0; align-items: center;
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.sheet-head h2 { line-height: 24px; }
.sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  margin-inline: -20px; padding: 8px 20px 4px;
}
@media (min-width: 960px) { .sheet-body { margin-inline: -24px; padding-inline: 24px; } }

/* Карточка подписки: сумма и бейджи по центру */
.detail-head { justify-content: center; text-align: center; }
.detail-head + .chips { justify-content: center; }
@media (min-width: 960px) { .sheet { padding-top: 14px; padding-bottom: 20px; } }
/* Без «ручки»: шторка по-прежнему смахивается вниз за заголовок */
.sheet .grab { display: none; }
@media (max-width: 959px) { .sheet { padding-top: 16px; } }

/* Поиск и сортировка — одной высоты и на одной линии */
.list-tools { align-items: center; }
.list-tools .field, .list-tools .search { gap: 0; display: grid; }
.list-tools .search .field, .list-tools .sort { height: 48px; }

/* Домовой в поиске — в кружке */
.mascot-say img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: center top;
  background: var(--accent-band); border: 1px solid var(--glass-card-border); box-shadow: var(--glass-hl);
}
.list-tools { grid-auto-rows: 48px; align-items: stretch; }

/* Содержимое окна растворяется под шапкой — мягкий край вместо резкого среза */
.sheet-body {
  padding-top: 16px; margin-top: -8px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
}

/* ---------- окна: переключатели вместо чекбоксов, каждый — в стеклянной рамке ---------- */
:is(.sheet .check, .check.switch) {
  justify-content: space-between; gap: 16px; min-height: 56px; padding: 12px 16px; border-radius: 20px; cursor: pointer;
  background: var(--glass-field); border: 1px solid var(--glass-card-border); box-shadow: var(--glass-hl);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); font-size: 14px;
}
:is(.sheet .check, .check.switch)[hidden] { display: none; }
:is(.sheet .check, .check.switch) input[type="checkbox"] {
  order: 2; width: 52px; height: 32px; border-radius: 16px; padding: 0; display: block; position: relative;
  background: color-mix(in srgb, var(--ink) 14%, transparent); border: 1px solid var(--glass-card-border);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: background .2s;
}
:is(.sheet .check, .check.switch) input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; transform: none;
  -webkit-mask: none; mask: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(240, 240, 236, .9));
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), inset 0 1px 0 #fff; transition: left .2s cubic-bezier(.3, .7, .3, 1.2);
}
:is(.sheet .check, .check.switch) input[type="checkbox"]:checked { background: var(--accent); border-color: color-mix(in srgb, var(--accent) 70%, #fff); }
:is(.sheet .check, .check.switch) input[type="checkbox"]:checked::after { left: 22px; }
@media (prefers-reduced-motion: reduce) { .sheet .check input[type="checkbox"], .sheet .check input[type="checkbox"]::after { transition: none; } }

/* Заголовок и подзаголовок: чуть больше воздуха */
.detail-head .small { margin-top: 6px; }
.page-title .kicker { margin-bottom: 4px; }
.hero-sub { margin-top: 8px; }
.hero-stats span, .summary-grid span { display: block; margin-top: 3px; }
.topup-head .kicker { margin-bottom: 4px; }
.empty h2 + p { margin-top: -2px; }
.row .s { margin-top: 2px; }

/* Информеры и подсказки — чёрное стекло в обеих темах */
.toast {
  background: rgba(12, 12, 12, .88) !important; color: #F4F4F1 !important;
  border: 1px solid rgba(255, 255, 255, .12) !important; box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
}
@media (hover: hover) { [data-tip]::after { background: rgba(12, 12, 12, .92); border: 1px solid rgba(255, 255, 255, .1); } }
/* Содержимое окна не сжимается по высоте: прокручивается целиком, а не сплющивает переключатели */
.sheet-body { grid-auto-rows: max-content; align-content: start; }

/* Типы расходов в настройках */
.check.switch > span { display: grid; gap: 2px; min-width: 0; }
.check.switch > span .hint { font-weight: 400; }
.check.switch input:disabled { opacity: .55; cursor: default; }
.check.switch:has(input:disabled) { cursor: default; }
.custom-kind .btn { flex: none; }
.kinds-setting { display: grid; gap: 8px; }
.kind-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 4px; }

/* Исходная сумма в другой валюте — мелко под основной */
.row .r .orig { display: block; font-size: 11px; line-height: 14px; color: var(--muted); }
.detail-head .orig { color: var(--ink); font-weight: 600; }
/* Валюты в настройках */
.cur-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip-x { border: 0; background: none; padding: 0 0 0 4px; font-size: 14px; line-height: 1; color: var(--muted); cursor: pointer; }
.chip-x:hover { color: var(--warn); }
/* Вложенный переключатель — продолжение строки над ним */
.check.switch.sub { min-height: 44px; margin: -6px 0 0 24px; padding-block: 8px; font-size: 13px; }
.check.switch.sub input[type="checkbox"] { width: 44px; height: 26px; }
.check.switch.sub input[type="checkbox"]::after { width: 20px; height: 20px; }
.check.switch.sub input[type="checkbox"]:checked::after { left: 20px; }
/* Кнопки с иконками в переключателе */
.seg-ic { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.seg-ic svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rates .rate-add { width: 48px; padding: 0; justify-self: start; }
.rates .rate-add svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.rates { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.cur-row .avatar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.rates { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.rates .field { flex: 1 1 80px; min-width: 0; }
.rates .field:last-child { flex: none; }
/* Свой курс: не больше трёх валют в ряд, новые — на следующей строке того же размера, плюсик в соседней ячейке */
.rates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.rates .field, .rates .field:last-child { flex: none; min-width: 0; }
.rates .field:last-child { justify-self: start; }
.rates input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.rates input[type="number"]::-webkit-inner-spin-button, .rates input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* Виджеты статистики нажимаются — открывают список */
.kpi[role="button"] { cursor: pointer; transition: transform .1s, background .15s; }
.kpi[role="button"]:hover { background: color-mix(in srgb, var(--glass-card) 70%, var(--accent-band)); }
.kpi[role="button"]:active { transform: scale(.98); }
.kpi[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi-total { display: grid; gap: 2px; }
.kpi-total b { font-size: 28px; line-height: 32px; font-weight: 800; letter-spacing: -.02em; }
.kpi-total span { font-size: 12px; color: var(--muted); }

/* Статистика: при переключении «в месяц / за год» ничего не сдвигается по горизонтали */
.grid-2 > * { min-width: 0; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); } }
.leg { grid-template-columns: 12px minmax(0, 1fr) 11ch; }
.leg > span:not(.bar):not(.v) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.row .r { min-width: 11ch; }
.leg { grid-template-columns: 12px minmax(0, 1fr) 9ch; }
.leg > span:not(.bar):not(.v) { white-space: normal; overflow: visible; overflow-wrap: anywhere; }

/* Исходная сумма в другой валюте — мелко перед основной, на той же строке */
.row .r b .orig { display: inline; margin-right: 6px; font-size: 11px; font-weight: 400; color: var(--muted); }

/* Кнопки входа: значок слева, текст сразу за ним */
.auth-list .btn:has(.avatar) { justify-content: flex-start; text-align: left; padding: 8px 20px 8px 8px; gap: 12px; }
.prov-mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- вход: домовой у формы ---------- */
.login-stage { display: grid; max-width: 520px; }
.login-card { position: relative; z-index: 1; }
.domo-point { display: none; }
/* Мобилка: выглядывает из-за формы, руки лежат на её верхнем крае */
.domo-peek { position: relative; z-index: 2; width: min(220px, 60%); height: auto; justify-self: center; margin-bottom: -26px; pointer-events: none; }
@media (min-width: 960px) {
  .login-stage { grid-template-columns: minmax(0, 520px) minmax(220px, 320px); align-items: center; gap: 24px; max-width: none; }
  .domo-peek { display: none; }
  .domo-point { display: block; width: 100%; max-width: 320px; height: auto; }
}
/* Мобилка: сортировка — круглая кнопка-фильтр справа от поиска */
@media (max-width: 520px) {
  .list-tools { grid-template-columns: minmax(0, 1fr) 48px; }
  .list-tools .sort .gsel { width: 48px; min-width: 0; padding: 0; justify-content: center; border-radius: 50%; }
  .list-tools .sort .gsel span, .list-tools .sort .gsel svg { display: none; }
  .list-tools .sort .gsel::before {
    content: ""; width: 20px; height: 20px; background: var(--ink);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h16M7 12h10M10 17h4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h16M7 12h10M10 17h4'/%3E%3C/svg%3E") center / contain no-repeat;
  }
}

/* ---------- мобилка: табы типов над нижней панелью ---------- */
@media (max-width: 959px) {
  .type-tabs {
    position: fixed; z-index: 19; left: 12px; right: 12px; max-width: 520px; margin: 0 auto;
    bottom: calc(max(8px, calc(var(--safe-b) - 12px)) + 68px + 8px);
    background: var(--glass); border: 1px solid var(--glass-card-border); box-shadow: var(--glass-shadow), var(--glass-hl);
    -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
    transition: transform .25s ease, opacity .25s ease;
  }
  body.tabs-hidden .type-tabs { transform: translateY(16px); opacity: 0; pointer-events: none; }
  main:has(.type-tabs) { padding-bottom: calc(150px + var(--safe-b)); }
}
@media (prefers-reduced-motion: reduce) { .type-tabs { transition: none; } }
.domo-peek { margin-bottom: -8px; }

/* Подписи в строках плотнее по горизонтали */
.row .s { letter-spacing: -.03em; word-spacing: -.12em; }

/* ---------- лендинг ---------- */
body.is-landing #nav { display: none; }
body.is-landing main { padding: calc(16px + var(--safe-t)) 16px calc(40px + var(--safe-b)); max-width: 1120px; }
.landing { display: grid; gap: 56px; }
.landing-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.landing-bar .nav-brand { display: flex !important; align-items: center; gap: 12px; padding: 0; }
.landing-bar .nav-brand b { display: block; font-size: 18px; line-height: 24px; }
.landing-bar .nav-brand .kicker { display: block; }
.landing-bar-actions { display: flex; gap: 8px; }
.landing svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.landing .btn svg { width: 18px; height: 18px; }
.landing-hero { display: grid; gap: 24px; align-items: center; }
.landing-hero h1 { font-size: clamp(32px, 7vw, 56px); line-height: 1.05; letter-spacing: -.03em; font-weight: 800; margin: 8px 0 16px; text-wrap: balance; }
.landing-hero p { margin: 0 0 16px; font-size: 16px; line-height: 24px; color: var(--subtle); max-width: 52ch; }
.landing-hero .hint { font-size: 12px; line-height: 16px; color: var(--muted); }
.landing-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.landing-domo { width: min(360px, 80%); height: auto; justify-self: center; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .18)); }
.landing-demo { max-width: 720px; }
.landing h2 { font-size: 28px; line-height: 32px; letter-spacing: -.02em; font-weight: 800; margin: 0 0 16px; }
.landing-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.landing-feature { display: grid; gap: 8px; align-content: start; padding: 20px; }
.landing-feature b { font-size: 16px; }
.landing-feature p { margin: 0; color: var(--subtle); font-size: 13px; line-height: 19px; }
.landing-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.landing-ic svg { width: 22px; height: 22px; }
.landing-steps ol { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.landing-steps li { counter-increment: s; display: grid; gap: 4px; padding: 20px; border-radius: var(--r-card);
  background: var(--glass-field); border: 1px solid var(--glass-card-border); box-shadow: var(--glass-hl); }
.landing-steps li::before { content: counter(s); font-size: 32px; line-height: 36px; font-weight: 800; color: var(--plus); }
.landing-steps li span { color: var(--muted); font-size: 13px; line-height: 19px; }
.landing-install { display: grid; gap: 16px; align-items: center; padding: 24px; }
.landing-install img { width: 180px; height: 180px; object-fit: contain; justify-self: center; }
.landing-install p { margin: 0 0 16px; color: var(--subtle); max-width: 56ch; }
.landing-foot { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line-soft); }
.landing-foot a { color: inherit; }
.install-steps { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.install-steps li { display: grid; gap: 2px; }
@media (min-width: 760px) {
  .landing-hero { grid-template-columns: 1.2fr .8fr; }
  .landing-install { grid-template-columns: 220px 1fr; }
  .landing-install img { width: 220px; height: 220px; }
}
@media (min-width: 960px) { body.is-landing main { padding: 32px 32px 48px; } }
@media (max-width: 520px) { .landing-bar-actions [data-act=install] { display: none; } .landing-bar { flex-wrap: nowrap; } }
