:root {
  --bg: #0f1417;
  --bg-glow: #24343a;
  --bg-2: #1b2529;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-2: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --sheet: #ffffff;
  --sheet-text: #16191b;
  --sheet-muted: #7b8186;
  --line: #eef0f1;
  --green: #2fa84f;
  --red: #e5484d;
  --accent: #2ee6c5;
  --yellow: #ffd60a;
  --mint: #2ee6c5;
  --blue: #2aa7ff;
  --purple: #a78bfa;
  --orange: #ff9f43;
  --pink: #ff6fae;
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* цвета, которые отличаются в тёмной и светлой теме */
  --btn-bg: #ffffff;
  --btn-text: #111111;
  --divider: rgba(255, 255, 255, 0.08);
  --input-line: rgba(255, 255, 255, 0.12);
  --ring: #ffffff;
  --error: #ff8a8d;
  --accent-ink: var(--accent);
  --wallet-bg: rgba(10, 13, 15, 0.9);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02)), rgba(18, 22, 26, 0.34);
  --glass-filter: blur(14px) saturate(210%) brightness(0.72);
  --glass-line: rgba(255, 255, 255, 0.16);
  --glass-icon: rgba(255, 255, 255, 0.9);
  --glass-icon-shadow: rgba(0, 0, 0, 0.45);
  --glass-ring: rgba(18, 22, 26, 0.55);
  --grain: 0.12;
  color-scheme: dark;
}
/* светлая тема: фон и надписи из настроек, карты и цвет интерфейса те же */
:root[data-theme="light"] {
  --surface: rgba(255, 255, 255, 0.85);
  --surface-2: rgba(17, 21, 24, 0.07);
  --text: #111518;
  --muted: rgba(17, 21, 24, 0.55);
  --btn-bg: #111518;
  --btn-text: #ffffff;
  --divider: rgba(17, 21, 24, 0.07);
  --input-line: rgba(17, 21, 24, 0.12);
  --ring: #111518;
  --error: #d32f2f;
  --accent-ink: color-mix(in srgb, var(--accent) 72%, #000);
  --wallet-bg: rgba(238, 241, 242, 0.88);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.22)), rgba(255, 255, 255, 0.16);
  --glass-filter: blur(14px) saturate(200%) brightness(1.06);
  --glass-line: rgba(255, 255, 255, 0.6);
  --glass-icon: rgba(17, 21, 24, 0.72);
  --glass-icon-shadow: rgba(255, 255, 255, 0.6);
  --glass-ring: rgba(255, 255, 255, 0.7);
  --grain: 0.08;
  color-scheme: light;
}
:root[data-theme="light"] .list,
:root[data-theme="light"] .person,
:root[data-theme="light"] .spending,
:root[data-theme="light"] .chip,
:root[data-theme="light"] .input { box-shadow: 0 1px 3px rgba(17, 21, 24, 0.06); }
:root[data-theme="light"] .sheet-panel { box-shadow: 0 -6px 24px rgba(17, 21, 24, 0.06); }
:root[data-theme="light"] .tabshadow { opacity: 0.22; }
:root[data-theme="light"] #toast { box-shadow: 0 10px 30px rgba(17, 21, 24, 0.15); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 60% at 80% 0%, var(--bg-glow) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
button:disabled { opacity: 0.5; cursor: default; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }

/* ---------- общие элементы ---------- */
.screen { padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 110px); min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 48px; margin-bottom: 20px; }
.title { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--mint), var(--blue)); color: #0b1a1f; font-weight: 700; font-size: 17px;
}
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); }
.icon-btn svg { width: 22px; height: 22px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 6px;
  border-radius: 20px; background: var(--surface-2); font-weight: 600; font-size: 15px;
}
.pill.light { background: #fff; color: #111; }
.pill .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #111; color: #fff; }
.pill .dot svg { width: 16px; height: 16px; }
.pill.plain { padding: 0 16px; }
.btn {
  width: 100%; height: 56px; border-radius: 18px; background: var(--btn-bg); color: var(--btn-text); font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn svg { width: 22px; height: 22px; }
.btn.ghost { background: var(--surface); color: var(--text); }
.btn.accent { background: var(--accent); color: #062420; }
.btn.danger { background: rgba(229, 72, 77, 0.15); color: var(--red); }
.stack { display: grid; gap: 12px; }
/* подсказка под полем, например «Ещё 3 цифр номера карты» */
.field-hint { margin: -4px 4px 0; color: var(--muted); font-size: 13px; }
.field-hint:empty { display: none; }
.field-hint.bad { color: var(--error); }
.muted { color: var(--muted); }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; color: var(--muted); }
.input {
  height: 56px; border-radius: 16px; border: 1px solid var(--input-line); background: var(--surface);
  padding: 0 16px; font-size: 17px; outline: none; width: 100%;
}
.input:focus { border-color: var(--accent); }
.error { color: var(--error); font-size: 14px; min-height: 18px; }

/* ---------- вход ---------- */
.welcome { display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 32px); }
.logo { font-size: 52px; font-weight: 800; letter-spacing: -2px; }
.logo span { color: var(--accent-ink); }
.welcome-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* переключатель языка и образцы цветов */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; flex-wrap: wrap; }
.seg button { padding: 7px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.sel { background: var(--btn-bg); color: var(--btn-text); }
.row.setting { flex-wrap: wrap; row-gap: 10px; }
/* цвета в один ряд: листаются вбок и плавно исчезают у краёв, не доходя до надписи */
.row.setting.colors { flex-wrap: nowrap; padding-right: 0; gap: 4px; }
.row.setting.colors .info { flex: 0 0 auto; max-width: 34%; }
.swatches {
  flex: 1; min-width: 0; display: flex; gap: 10px; padding: 6px 22px;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent);
}
.swatches::-webkit-scrollbar { display: none; }
.swatches button { flex: none; width: 30px; height: 30px; border-radius: 50%; scroll-snap-align: center; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.25); }
.swatches button.sel { outline: 2px solid var(--ring); outline-offset: 3px; }
.welcome h2 { font-size: 26px; line-height: 1.2; margin: 18px 0 10px; letter-spacing: -0.4px; }
.welcome-cards { position: relative; height: 210px; margin: 30px 0; }
.welcome-cards .card { position: absolute; width: 78%; height: 140px; }
.welcome-cards .card:nth-child(1) { left: 0; top: 0; transform: rotate(-8deg); }
.welcome-cards .card:nth-child(2) { left: 11%; top: 30px; transform: rotate(-2deg); }
.welcome-cards .card:nth-child(3) { left: 22%; top: 60px; transform: rotate(5deg); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 16px; height: 44px; }
.back svg { width: 20px; height: 20px; }

/* ---------- биометрия ---------- */
.bio { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 10px 0 6px; }
.bio-ring {
  width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
}
.bio-ring::before, .bio-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0;
  animation: pulse 2.4s ease-out infinite;
}
.bio-ring::after { animation-delay: 1.2s; }
.bio-ring svg { width: 72px; height: 72px; color: var(--accent); }
.bio-ring.ok svg { color: var(--green); }
.bio-ring.ok::before, .bio-ring.ok::after { animation: none; }
@keyframes pulse { 0% { transform: scale(0.75); opacity: 0.9; } 100% { transform: scale(1.25); opacity: 0; } }
.bio h3 { margin: 0; font-size: 22px; }
.bio p { margin: 0; color: var(--sheet-muted); font-size: 15px; line-height: 1.4; max-width: 300px; }
.screen .bio p { color: var(--muted); }

/* ---------- главная ---------- */
.balance-label { color: var(--muted); font-size: 16px; }
.balance { font-size: 48px; font-weight: 600; letter-spacing: -1px; margin: 4px 0 18px; }
.balance small { font-size: 24px; color: var(--muted); font-weight: 500; }
.actions { display: flex; gap: 10px; }
.spending {
  margin-top: 26px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface);
  display: flex; justify-content: space-between; align-items: center;
}
.spending .label { color: var(--muted); font-size: 15px; }
.spending .value { font-size: 20px; font-weight: 600; margin-top: 4px; }
.faces { display: flex; }
.faces .avatar { border: 2px solid var(--bg-2); margin-left: -10px; }
.peek-cards {
  position: absolute; right: -14px; top: calc(var(--safe-top) + 96px); width: 74px; height: 120px; z-index: 2;
  transition: transform 0.25s;
}
.peek-cards:active { transform: translateX(-6px) scale(0.97); }
.peek-cards i {
  position: absolute; top: 0; bottom: 0; width: 40px; border-radius: 10px 0 0 10px;
  box-shadow: -6px 0 10px -2px rgba(0, 0, 0, 0.55), -2px 0 3px rgba(0, 0, 0, 0.35);  /* тень за каждой картой */
}
.peek-cards i.frozen { filter: grayscale(0.85) brightness(0.8); }
body.wallet-open .peek-cards { opacity: 0; transition: none; } /* в тот же кадр полоски подменяются самими картами */
.peek-cards i:nth-last-child(1) { right: 0; }
.peek-cards i:nth-last-child(2) { right: 11px; }
.peek-cards i:nth-last-child(3) { right: 22px; }
.peek-cards i:nth-last-child(4) { right: 33px; }

/* платежи на главной */
.home-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 10px; font-size: 15px; color: var(--muted); }
.link { color: var(--accent-ink); font-size: 15px; font-weight: 600; }
.home-pay { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.home-pay button {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 2px; border-radius: 18px;
  background: var(--surface); font-size: 11.5px; line-height: 1.2; text-align: center; min-width: 0;
  /* длинное слово («Коммунальные») на узком экране переносится по слогам, а не вылезает за плитку */
  -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere;
}
.home-pay span {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.home-pay svg { width: 22px; height: 22px; }
/* быстрый перевод в белой панели */
.quick-head { font-size: 15px; font-weight: 600; margin: 2px 0 12px; }
.quick { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 14px; margin: 0 -20px 6px; padding-left: 20px; padding-right: 20px; border-bottom: 1px solid var(--line); }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; width: 60px; display: grid; justify-items: center; gap: 6px; }
.quick-ava { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 19px; }
.quick-ava.new { background: #f2f4f5; color: #111; border: 1.5px dashed #c5cacd; }
.quick-ava.new svg { width: 22px; height: 22px; }
.quick small { font-size: 12px; color: var(--sheet-muted); max-width: 60px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Белая панель транзакций тянется до самого низа экрана */
.screen.home { display: flex; flex-direction: column; padding-bottom: 0; }
.sheet-panel {
  flex: 1; margin: 28px -20px 0; background: var(--sheet); color: var(--sheet-text); border-radius: 30px 30px 0 0;
  padding: 10px 20px calc(var(--safe-bottom) + 120px);
}

/* ---------- кошелёк с 3D-раскрытием карт ---------- */
.wallet {
  position: fixed; inset: 0; z-index: 40; overflow-x: hidden; overflow-y: auto;
  background: rgba(10, 13, 15, 0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0);
  transition: background 0.4s, backdrop-filter 0.4s, -webkit-backdrop-filter 0.4s;
}
.wallet.open { background: var(--wallet-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.wallet.closing { transition-duration: 0.3s; transition-delay: 0.05s; }
.wallet-inner { max-width: 480px; margin: 0 auto; padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 30px); min-height: 100%; }
.wallet-head {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px;
  opacity: 0; transform: translateY(-10px); transition: opacity 0.35s, transform 0.35s;
}
.wallet.open .wallet-head { opacity: 1; transform: none; }
.wallet-total { font-size: 34px; font-weight: 600; letter-spacing: -0.5px; margin-top: 2px; }
/* Полёт карт («летящие листья») задаёт app.js через Web Animations; здесь - положение в покое и наклон за пальцем.
   У каждой карты свой слой (z-index), поэтому в полёте карты не проходят друг сквозь друга */
.wallet-stack { display: grid; }
.wcard {
  --rx: 0deg; --ry: 0deg; --shine: 0px;
  height: 190px; transform-origin: 50% 50%; z-index: calc(var(--i) + 1);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  will-change: transform;
  backface-visibility: hidden;
}
.wcard + .wcard { margin-top: -54px; }
.wcard .card-balance { font-size: 26px; }
.wallet.settled .wcard {
  transition: transform 0.15s ease-out, margin 0.45s cubic-bezier(0.22, 1, 0.36, 1), height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
/* «Управлять картами»: стопка раздвигается, карты становятся выше, появляются кнопки */
.wallet.managing .wcard + .wcard { margin-top: 16px; }
.wallet.managing .wcard { height: 200px; }
.wcard .card-tools { opacity: 0; transform: translateY(8px) scale(0.9); pointer-events: none; transition: opacity 0.25s, transform 0.3s; }
.wallet.managing .wcard .card-tools { opacity: 1; transform: none; pointer-events: auto; transition-delay: 0.15s; }
.wallet-actions { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s, margin 0.45s; }
.wallet.managing .wallet-actions { max-height: 140px; opacity: 1; margin-bottom: 18px; }
/* блик, который двигается вместе с наклоном */
.wcard::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, transparent 62%);
  transform: translateX(var(--shine)); transition: transform 0.15s;
}
.wallet-manage { margin-top: 26px; opacity: 0; transition: opacity 0.3s; }
.wallet.open .wallet-manage { opacity: 1; transition-delay: 0.35s; }
@media (prefers-reduced-motion: reduce) {
  .wcard { transition: none !important; }
}
.grabber { width: 40px; height: 5px; border-radius: 3px; background: #dfe2e4; margin: 0 auto 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.round { width: 36px; height: 36px; border-radius: 50%; background: #f2f4f5; display: grid; place-items: center; color: #6b7176; }
.round svg { width: 18px; height: 18px; }
.tx { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.tx + .tx { border-top: 1px solid var(--line); }
.tx .ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.tx .info { flex: 1; min-width: 0; }
.tx .name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .sub { color: var(--sheet-muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .amt { font-weight: 600; font-size: 16px; white-space: nowrap; }
.tx .amt.plus { color: var(--green); }
.empty { color: var(--sheet-muted); text-align: center; padding: 30px 0; }

/* ---------- карты ---------- */
.card {
  border-radius: 20px; padding: 18px; height: 180px; position: relative; overflow: hidden; color: rgba(0, 0, 0, 0.62);
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--card-bg, var(--yellow));
  box-shadow: 0 16px 40px -14px color-mix(in srgb, var(--glow, #ffd60a) 70%, transparent);
}
.card.light { color: rgba(255, 255, 255, 0.88); }
.card::after {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -90px; bottom: -120px;
  background: rgba(255, 255, 255, 0.18);
}
.card.frozen { filter: grayscale(0.85) brightness(0.8); }
.card-top { display: flex; justify-content: space-between; font-size: 17px; font-weight: 500; position: relative; z-index: 1; }
.card-balance { position: relative; z-index: 1; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; color: rgba(0, 0, 0, 0.82); }
.card-balance small { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; opacity: 0.7; }
.card.light .card-balance { color: #fff; }
.card-balance.ext { font-size: 18px; letter-spacing: 1px; text-transform: uppercase; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 16px;
  background: var(--surface); border: 2px solid transparent; text-align: left;
}
.chip.sel { border-color: var(--accent); }
.chip i { width: 28px; height: 20px; border-radius: 5px; flex: none; }
.chip b { display: block; font-size: 14px; }
.chip small { display: block; font-size: 12px; color: var(--muted); }
.modal .chip { background: #f4f6f7; }
.modal .chip.sel { border-color: #111; }
.modal .chip small, .modal .field label { color: var(--sheet-muted); }
.card-bottom { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.card-tools { display: flex; gap: 8px; }
.card-tools button {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.14); color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px);
}
.card.light .card-tools button { color: #fff; background: rgba(255, 255, 255, 0.16); }
.card-tools svg { width: 20px; height: 20px; }
.card-tools button.on { background: rgba(255, 255, 255, 0.85); color: #2aa7ff; }
.card-badge { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; background: rgba(0, 0, 0, 0.18); padding: 5px 10px; border-radius: 10px; }
.cards-list { display: grid; gap: 22px; }
.actions.wrap { flex-wrap: wrap; }
.hint { margin: 0; font-size: 13px; line-height: 1.4; color: var(--sheet-muted); }

/* выбор дизайна */
.design-preview .card { margin: 0 auto 16px; max-width: 340px; }
.design-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; }
.design-opt { display: grid; gap: 5px; justify-items: center; font-size: 12px; color: var(--sheet-muted); }
.design-opt i { display: block; width: 100%; aspect-ratio: 1.6; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.design-opt.sel i { outline: 3px solid #111; outline-offset: 2px; }
.design-opt.sel span { color: #111; font-weight: 600; }

/* ---------- переводы ---------- */
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 18px; width: 20px; height: 20px; color: var(--muted); }
.search .input { padding-left: 46px; }
.section-title { font-size: 15px; color: var(--muted); margin: 26px 0 10px; }
.people { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: var(--surface); text-align: left; width: 100%; }
.person .info { flex: 1; }
.person .name { font-weight: 600; }
.person .sub { color: var(--muted); font-size: 14px; }
.suggest:empty { display: none; }
.suggest { margin-top: 4px; }
.hint-row { padding: 14px 4px; color: var(--muted); font-size: 14px; }
.hint-row.bad { color: var(--error); }
/* карты получателя: первые и последние 4 цифры */
.rcard i { width: 46px; height: 30px; border-radius: 6px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.rcard-num { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 16px; letter-spacing: 1px; white-space: nowrap; }
.rcard:disabled { opacity: 0.45; }
.to-card {
  width: 100%; display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 16px; border-radius: 18px;
  background: var(--surface); text-align: left;
}
.to-card i { width: 40px; height: 26px; border-radius: 6px; flex: none; }
.to-card i.main { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #000)); }
.to-card span:not(.chev) { flex: 1; min-width: 0; display: grid; }
.to-card small { color: var(--muted); font-size: 12px; }
.to-card b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; font-size: 15px; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-card .chev { color: var(--accent-ink); font-size: 14px; font-weight: 600; }
.amount-input { font-size: 56px; font-weight: 600; text-align: center; background: none; border: 0; outline: none; width: 100%; padding: 10px 0; }
.amount-wrap { text-align: center; margin: 30px 0 10px; }
.amount-wrap .muted { font-size: 15px; }
.amount-currency { font-size: 20px; font-weight: 600; color: var(--muted); margin: -6px 0 8px; }

/* ---------- профиль ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 26px; }
.profile-head h2 { margin: 0; font-size: 24px; }
.list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--divider); }
.row .ri { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent-ink); flex: none; }
.row .ri svg { width: 22px; height: 22px; }
.row .info { flex: 1; min-width: 0; }
.row .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row .chev { color: var(--muted); }
.code { font-size: 44px; font-weight: 700; letter-spacing: 10px; text-align: center; margin: 10px 0; color: var(--sheet-text); }
.note { font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 18px; }

/* ---------- нижняя панель: «жидкое стекло» ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 14px); z-index: 20;
}
.tabbar[hidden] { display: none; }
.tabpill {
  position: relative; display: flex; align-items: center; gap: 4px; padding: 8px; border-radius: 36px; isolation: isolate;
}
/* стекло панели вместе с бугорком под QR-кнопкой - одна форма (её контур задаёт app.js, shapeTabbar) */
.tabglass, .tabshadow { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.tabglass {
  z-index: -1; border-radius: 36px;
  /* почти прозрачное стекло: цвета под панелью видны размытыми пятнами */
  background: var(--glass);
  backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter);
}
/* зернистость, как у матового стекла */
.tabglass::before {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); background-size: 160px;
  opacity: var(--grain); mix-blend-mode: overlay;
}
.tabglass svg, .tabshadow svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* тонкий светлый край по всему контуру (половина линии срезается формой - остаётся 1px внутри) */
.tabglass path { fill: none; stroke: var(--glass-line); stroke-width: 2; }
/* мягкая тень под всей формой */
.tabshadow { z-index: -2; filter: blur(14px); opacity: 0.55; transform: translateY(10px); }
.tabshadow path { fill: rgba(0, 0, 0, 0.6); }
.tabpill button {
  position: relative; z-index: 1; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; color: var(--glass-icon); transition: color 0.2s;
}
.tabpill button svg { width: 24px; height: 24px; filter: drop-shadow(0 1px 1px var(--glass-icon-shadow)); }
.tabpill button.active { color: #0b1a1f; transition-delay: 0.18s; } /* иконка темнеет, когда капля до неё дотекла */
.tabpill button.active svg { filter: none; }
.tabgap { flex: none; width: 78px; }
/* цветной кружок под выбранной иконкой */
.blob {
  position: absolute; left: 0; top: 8px; width: 52px; height: 52px; border-radius: 50%; z-index: 0;
  background: var(--accent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  will-change: transform; transition: opacity 0.2s;
}
.blob.away { opacity: 0; }
/* QR-код по центру: больше остальных и приподнят над панелью */
.tabqr {
  position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); z-index: 2;
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #0b1a1f;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}
.tabqr:active { transform: translateX(-50%) scale(0.94); }
.tabqr.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent), 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.tabqr svg { width: 28px; height: 28px; }

/* ---------- оплата ---------- */
.pay-hero {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); text-align: left;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent) 6%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.pay-hero-ico { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: #0b1a1f; }
.pay-hero-ico svg { width: 26px; height: 26px; }
.pay-hero .info { flex: 1; min-width: 0; }
.pay-hero b { display: block; font-size: 17px; }
.pay-hero small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.3; }
.pay-hero .chev { color: var(--muted); }
.pay-section { display: flex; align-items: center; gap: 8px; }
.pay-section svg { width: 18px; height: 18px; color: var(--accent-ink); }
.svc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.svc {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px 10px; border-radius: 18px;
  background: var(--surface); font-size: 12px; line-height: 1.25; text-align: center; min-width: 0;
}
.svc span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.svc-ico {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 18px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.phone-input { position: relative; }
.phone-input span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 17px; color: var(--muted); pointer-events: none; }
.phone-input .input { padding-left: 66px; }
.chips.sums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; overflow: visible; }
.chips.sums .chip { padding: 10px 2px; justify-content: center; text-align: center; min-width: 0; }
.chips.sums .chip b { font-size: 14px; white-space: nowrap; }

.plus { color: var(--green); }

/* ---------- мониторинг ---------- */
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 16px; border-radius: 20px; background: var(--surface); display: grid; gap: 4px; min-width: 0; }
.stat span { font-size: 14px; }
.stat b { font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat small { font-size: 12px; }
.chart-box { margin-top: 10px; padding: 16px; border-radius: 20px; background: var(--surface); }
.chart-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 14px; }
.bars { height: 120px; display: flex; align-items: flex-end; gap: 3px; }
.bars i { flex: 1; border-radius: 4px; background: color-mix(in srgb, var(--accent) 45%, transparent); min-height: 2px; }
.bars i.today { background: var(--accent); }
.bars.wide { gap: 10px; }
.bars.wide i { border-radius: 8px; }
.bar-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted); }
.bar-labels.wide span { flex: 1; text-align: center; }

/* «Куда ушли деньги»: кольцо с подписями на сегментах и карточки разделов в синих тонах */
.stats { --m-navy: #143868; --m-card: #a8cdf5; --m-ink: #0d2547; }
/* кольцо лежит прямо на фоне экрана, без подложки */
.m-ring-box { padding: 8px 0 18px; }
.m-ring { position: relative; width: min(270px, 84%); margin: 0 auto; aspect-ratio: 1; }
/* «жидкое стекло» под сегментами: размытое кольцо той же толщины, как стекло таскбара */
.m-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  -webkit-mask: radial-gradient(closest-side, transparent 63.5%, #000 64.5%, #000 95.5%, transparent 96.5%);
  mask: radial-gradient(closest-side, transparent 63.5%, #000 64.5%, #000 95.5%, transparent 96.5%);
}
.m-ring svg { position: relative; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 18px rgba(8, 24, 48, 0.35)); }
.m-ring .m-ring-empty { fill: none; stroke: color-mix(in srgb, var(--text) 8%, transparent); stroke-width: 30; }
/* светлая кромка по внешнему краю сегмента - как грань стекла */
.m-seg-rim { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 1.2; stroke-linecap: round; }
/* сегменты «вливаются» по очереди с лёгкой пружиной */
.m-seg { transform-origin: 100px 100px; animation: m-seg-in 0.75s cubic-bezier(0.2, 1.3, 0.35, 1) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes m-seg-in { from { opacity: 0; transform: scale(0.82) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .m-seg { animation: none; } }
.m-ring-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.01em; }
.m-ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; pointer-events: none; color: var(--text); }
.m-ring-center b { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.m-ring-center small { font-size: 12px; color: var(--muted); }
.m-ring-empty-note { margin: 14px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* карточка-«папка»: вкладка с названием слева, справа на тёмно-синей полосе - время последней операции */
.m-card { margin-bottom: 12px; border-radius: 22px; background: var(--m-navy); color: var(--m-ink); overflow: hidden; }
.m-card-head { display: flex; justify-content: space-between; align-items: stretch; }
.m-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 60%; padding: 12px 18px 8px;
  border-radius: 22px 22px 0 0; background: var(--m-card); font-size: 13px; font-weight: 600;
}
.m-tab i { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(13, 37, 71, 0.25); }
/* плавный вогнутый переход от вкладки к телу карточки */
.m-tab::after {
  content: ""; position: absolute; right: -18px; bottom: 0; width: 18px; height: 18px;
  background: radial-gradient(circle at 100% 0, transparent 17.5px, var(--m-card) 18px);
}
.m-meta { display: inline-flex; align-items: center; gap: 6px; padding: 12px 18px 8px; font-size: 12px; color: rgba(255, 255, 255, 0.85); white-space: nowrap; }
.m-meta svg { width: 14px; height: 14px; }
.m-card-body { padding: 14px 18px 16px; border-radius: 0 22px 22px 22px; background: var(--m-card); }
.m-card-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; overflow-wrap: anywhere; }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-chip { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; background: rgba(255, 255, 255, 0.45); border: 1px solid rgba(13, 37, 71, 0.12); }
.m-card-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(13, 37, 71, 0.14); font-size: 13px; }

/* ---------- QR-код ---------- */
.qr-view { position: relative; aspect-ratio: 1; border-radius: 28px; overflow: hidden; background: #000; }
.qr-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-frame { position: absolute; inset: 17%; border-radius: 24px; border: 3px solid rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
.qr-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: #fff; background: #000; line-height: 1.4; }
.qr-msg[hidden] { display: none; }
.qr-card { background: #fff; color: #111; border-radius: 28px; padding: 24px; display: grid; justify-items: center; gap: 16px; }
.qr-code { width: min(240px, 64vw); aspect-ratio: 1; display: grid; place-items: center; }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-name { display: grid; justify-items: center; gap: 2px; }
.qr-name b { font-size: 18px; }
.qr-name .muted { color: #6b7176; }

/* ---------- регистрация лица ---------- */
.accent-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.face-thumb { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); }
.face-screen { position: fixed; inset: 0; z-index: 55; background: #000; color: #fff; overflow: hidden; }
.face-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.face-video { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
.face-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 4; padding: calc(var(--safe-top) + 10px) 16px 18px;
  background: linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
}
.face-screen:not(.live) .face-top { background: linear-gradient(var(--bg) 65%, transparent); color: var(--text); }
.face-bar { display: flex; align-items: center; justify-content: space-between; max-width: 480px; margin: 0 auto; }
.face-bar b { font-size: 17px; }
.face-bar span { width: 42px; }
.face-screen.live .face-bar .icon-btn { background: rgba(255, 255, 255, 0.16); color: #fff; }
.face-checks { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 12px auto 0; max-width: 480px; }
.face-checks[hidden] { display: none; }
.face-checks span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 14px; font-size: 12.5px;
  background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s;
}
.face-checks i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); transition: background 0.2s; }
.face-checks .ok { color: #fff; }
.face-checks .ok i { background: #30d158; }
.face-checks .bad i { background: #ffb020; }
.face-hint { position: absolute; left: 16px; right: 16px; z-index: 3; text-align: center; pointer-events: none; }
.face-hint[hidden] { display: none; }
.face-hint span {
  display: inline-block; padding: 11px 18px; border-radius: 18px; font-size: 17px; font-weight: 600; line-height: 1.3;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.face-hint.ready span { background: #fff; color: #111; }
.face-hint.hold span, .face-hint.done span { background: #30d158; color: #04210f; font-size: 19px; }
.face-panel {
  position: absolute; inset: 0; z-index: 3; overflow-y: auto; color: var(--text);
  background: radial-gradient(120% 60% at 80% 0%, var(--bg-glow) 0%, var(--bg) 60%), var(--bg);
  padding: calc(var(--safe-top) + 70px) 20px calc(var(--safe-bottom) + 24px);
}
.face-panel[hidden] { display: none; }
.face-intro { max-width: 440px; margin: 0 auto; display: grid; gap: 14px; }
.face-center { min-height: 70vh; align-content: center; justify-items: center; text-align: center; }
.face-intro h2 { margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.face-intro p { margin: 0; line-height: 1.45; }
.face-intro-ico {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.face-intro-ico svg { width: 40px; height: 40px; }
.face-intro-ico.bad { color: #ffb020; background: rgba(255, 176, 32, 0.15); }
.face-rules { list-style: none; counter-reset: rule; margin: 0; padding: 4px 16px; border-radius: var(--radius); background: var(--surface); }
.face-rules li { counter-increment: rule; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; padding: 11px 0; }
.face-rules li + li { border-top: 1px solid var(--divider); }
.face-rules li::before {
  content: counter(rule); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #0b1a1f; background: var(--accent);
}
.face-rules b { font-size: 15px; }
.face-rules span { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.face-consent { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; line-height: 1.4; color: var(--muted); text-align: left; }
.face-consent input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--accent); }
.face-photo { width: 190px; aspect-ratio: 4 / 5; border-radius: 26px; object-fit: cover; box-shadow: 0 0 0 4px #30d158, 0 16px 40px rgba(0, 0, 0, 0.4); }

/* ---------- всплывающие окна ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s; }
.modal {
  width: 100%; max-width: 480px; background: var(--sheet); color: var(--sheet-text); border-radius: 30px 30px 0 0;
  padding: 10px 22px calc(var(--safe-bottom) + 22px); animation: up 0.25s cubic-bezier(0.2, 0.9, 0.3, 1); max-height: 92vh; overflow: auto;
}
.modal .btn { background: #111; color: #fff; }
.modal .btn.ghost { background: #f2f4f5; color: #111; }
.modal .btn.danger { background: #fdecec; color: var(--red); }
.modal .input { background: #f4f6f7; border-color: #e6e9eb; color: #111; }
.modal h3 { margin: 6px 0 14px; font-size: 20px; text-align: center; }
.summary { background: #f4f6f7; border-radius: 18px; padding: 6px 16px; margin-bottom: 18px; }
.summary div { display: flex; justify-content: space-between; padding: 10px 0; font-size: 15px; }
.summary div + div { border-top: 1px solid #e6e9eb; }
.summary span:first-child { color: var(--sheet-muted); }
.summary b { font-weight: 600; }
.card-details { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 22px; letter-spacing: 2px; text-align: center; margin: 8px 0 4px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

#toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 12px); transform: translate(-50%, -150%); z-index: 70;
  background: #fff; color: #111; padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); transition: transform 0.3s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: #fdecec; color: #b42326; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { min-height: 100vh; display: grid; place-items: center; }
