:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --top: #912df6;
  --mid: #5948df;
  --bottom: #241653;
  --text: #ffffff;
  --muted: rgba(255,255,255,.66);
  --surface: rgba(255,255,255,.11);
  --strong: rgba(255,255,255,.18);
  --line: rgba(255,255,255,.12);
  --primary: #ffffff;
  --primary-text: #39217f;
  --good: #70edc0;
  --bad: #ff9aac;
}

:root[data-theme="light"] {
  color-scheme: light;
  --top: #f2eaff;
  --mid: #dedaff;
  --bottom: #c9cdf7;
  --text: #251942;
  --muted: rgba(37,25,66,.62);
  --surface: rgba(255,255,255,.54);
  --strong: rgba(255,255,255,.78);
  --line: rgba(37,25,66,.11);
  --primary: #39217f;
  --primary-text: #ffffff;
  --good: #08795c;
  --bad: #b42342;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bottom);
  color: var(--text);
}
button, input, select { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
.finance-app {
  width: min(100%, 440px);
  min-height: 100vh;
  margin: auto;
  overflow: hidden;
  padding: max(23px, env(safe-area-inset-top)) 22px max(32px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 85% 12%, rgba(255,255,255,.12), transparent 26%), linear-gradient(165deg,var(--top),var(--mid) 47%,var(--bottom));
}
.system-state { padding-top: 25vh; text-align: center; }
.system-state h1 { margin: 18px 0 8px; font-size: 28px; font-weight: 500; }
.system-state p { max-width: 310px; margin: auto; color: var(--muted); line-height: 1.45; }
.spinner { width: 40px; height: 40px; margin: auto; border: 3px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-symbol { font-size: 42px; color: var(--bad); }
.state-symbol.online { color: var(--good); }
.login-form { margin: 28px auto 0; max-width: 330px; text-align: left; }
.field { margin-top: 15px; }
.field label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.field input, .field select {
  width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 15px; outline: none; background: var(--surface); color: var(--text);
}
.field select option { color: #161025; }
.primary {
  width: 100%; min-height: 52px; margin-top: 28px; border: 0; border-radius: 17px;
  background: var(--primary); color: var(--primary-text); font-weight: 500;
}
.primary:disabled { opacity: .45; }
.error { min-height: 19px; margin-top: 12px; color: var(--bad); text-align: center; font-size: 13px; }
.topbar, .page-head { display: flex; align-items: center; justify-content: space-between; }
.round, .back {
  width: 50px; height: 50px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.20); border-radius: 50%; background: rgba(255,255,255,.09);
}
.avatar { overflow: hidden; padding: 0; background: linear-gradient(145deg,#30344b,#0c0e17); font-weight: 500; }
.avatar img, .profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.connection { color: var(--good); font-size: 12px; }
.balance { padding: 68px 0 31px; text-align: center; }
.account-picker { padding: 9px 13px; border: 0; border-radius: 18px; background: var(--surface); color: var(--muted); }
.balance-value { display: block; margin: 15px 0 0; font-size: clamp(42px,13vw,56px); line-height: 1; font-weight: 500; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.balance-value small { font-size: .39em; letter-spacing: 0; }
.accounts-pill { margin-top: 35px; padding: 12px 22px; border: 0; border-radius: 23px; background: var(--strong); font-weight: 500; }
.quick-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-bottom: 27px; }
.quick-action { min-width: 0; padding: 0; border: 0; background: transparent; text-align: center; }
.quick-icon { width: 57px; height: 57px; margin: 0 auto 9px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--strong); font-size: 23px; }
.quick-label { display: block; min-height: 36px; font-size: 13px; line-height: 1.18; font-weight: 500; }
.panel, .list { overflow: hidden; border-radius: 24px; background: var(--surface); backdrop-filter: blur(18px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px 9px; font-size: 16px; font-weight: 500; }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.transaction { display: grid; grid-template-columns: 39px 1fr auto; gap: 10px; align-items: center; padding: 13px 15px; border-top: 1px solid var(--line); }
.transaction:first-of-type { border-top: 0; }
.transaction-icon { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 13px; background: var(--strong); }
.transaction-title { font-size: 14px; font-weight: 500; }
.meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.transaction-amount { text-align: right; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.status { margin-top: 3px; color: var(--good); text-align: right; font-size: 11px; }
.page-title { margin: 0; font-size: 18px; font-weight: 500; }
.back { width: 45px; height: 45px; border: 0; background: var(--surface); font-size: 24px; }
.page-spacer { width: 45px; }
.page-body { padding-top: 35px; }
.step { color: var(--muted); text-align: center; font-size: 13px; }
.question { max-width: 330px; margin: 9px auto 25px; text-align: center; font-size: 25px; line-height: 1.15; font-weight: 500; }
.amount-entry { margin: 55px auto 0; text-align: center; }
.amount-entry input { width: 78%; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; color: var(--text); text-align: center; font-size: 43px; font-weight: 500; }
.unit { margin-top: 10px; color: var(--muted); }
.options { display: grid; gap: 10px; }
.option { width: 100%; min-height: 66px; padding: 12px 14px; display: grid; grid-template-columns: 39px 1fr 24px; gap: 11px; align-items: center; border: 1px solid transparent; border-radius: 19px; background: var(--surface); text-align: left; }
.option.selected { border-color: rgba(255,255,255,.45); background: var(--strong); }
.option-icon { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 13px; background: var(--strong); }
.option-name { display: block; font-size: 15px; font-weight: 500; }
.option-note, .role-note { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.role-note { margin: -12px 0 16px; text-align: center; font-size: 12px; }
.summary { padding: 16px; border-radius: 21px; background: var(--surface); }
.summary-row { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-top: 1px solid var(--line); }
.summary-row:first-child { border-top: 0; }
.summary-label { color: var(--muted); font-size: 12px; }
.summary-value { text-align: right; font-size: 14px; font-weight: 500; }
.success { padding-top: 90px; text-align: center; }
.success-symbol { width: 80px; height: 80px; margin: 0 auto 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--strong); color: var(--good); font-size: 37px; }
.success h2 { margin: 0; font-size: 27px; font-weight: 500; }
.success p { max-width: 310px; margin: 11px auto 0; color: var(--muted); line-height: 1.43; }
.profile { padding: 22px 0 27px; text-align: center; }
.profile-avatar { width: 108px; height: 108px; margin: 0 auto 18px; overflow: hidden; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(145deg,#30344b,#0c0e17); font-size: 29px; }
.profile-name { font-size: 28px; font-weight: 500; }
.profile-handle { margin-top: 6px; color: var(--muted); font-size: 16px; }
.role-card { margin-bottom: 18px; padding: 16px; border-radius: 20px; background: var(--surface); }
.role-card span { color: var(--muted); font-size: 12px; }
.role-card strong { display: block; margin-top: 3px; font-size: 18px; font-weight: 500; }
.list-button { width: 100%; min-height: 72px; padding: 13px 15px; display: grid; grid-template-columns: 37px 1fr 20px; gap: 11px; align-items: center; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.list-button:first-child { border-top: 0; }
.list-title { display: block; font-size: 16px; font-weight: 500; }
.list-note { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.group-label { margin: 20px 2px 8px; color: var(--muted); font-size: 13px; }
.group-label:first-child { margin-top: 0; }
.account-row { width: 100%; padding: 16px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.account-row:first-child { border-top: 0; }
.account-top { display: flex; justify-content: space-between; gap: 12px; }
.account-name, .account-sum { font-size: 15px; font-weight: 500; }
.address { padding: 15px; border-top: 1px solid var(--line); }
.address:first-child { border-top: 0; }
.address-net { color: var(--muted); font-size: 12px; }
.address-value { margin-top: 5px; overflow-wrap: anywhere; font-size: 13px; }
.menu-grid { display: grid; gap: 10px; }
.menu-card { width: 100%; padding: 18px; border: 0; border-radius: 19px; background: var(--surface); text-align: left; }
.menu-card strong { display: block; font-weight: 500; }
.menu-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.feedback { margin-top: 16px; padding: 14px; border-radius: 16px; background: var(--surface); color: var(--good); text-align: center; font-size: 13px; }
.empty { padding: 50px 20px; color: var(--muted); text-align: center; }
.danger-link { color: var(--bad); }
@media (max-width: 370px) {
  .finance-app { padding-inline: 16px; }
  .quick-icon { width: 51px; height: 51px; }
  .quick-label { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

