:root {
  --bg: #0e0f13;
  --card: #181a21;
  --card-2: #20232c;
  --line: #2a2e39;
  --text: #f3f4f7;
  --muted: #8b90a0;
  --accent: #7c5cff;
  --accent-2: #a78bfa;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 360px; text-align: center; }
.auth-box h1 { margin: 16px 0 4px; font-size: 26px; }
.auth-box form { margin-top: 24px; display: grid; gap: 12px; }
.logo {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 20px;
  display: grid; place-items: center; font-size: 34px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #c084fc); color: #fff;
}
.logo.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 17px; margin: 0; display: inline-grid; }
.field {
  width: 100%; padding: 15px 16px; font-size: 17px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; outline: none;
}
.field:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 16px; font-size: 17px; font-weight: 600; color: #fff; border: 0;
  border-radius: 14px; background: var(--accent); cursor: pointer;
}
.btn-primary:disabled { opacity: .5; }
.btn-danger { width: 100%; padding: 14px; font-size: 16px; font-weight: 600; color: var(--red); background: rgba(248,113,113,.1); border: 0; border-radius: 14px; cursor: pointer; }
.error { color: var(--red); min-height: 20px; margin: 4px 0 0; font-size: 14px; }

/* ---------- главный ---------- */
main { max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-top)) 16px calc(32px + var(--safe-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.icon-btn { background: var(--card); border: 0; color: var(--muted); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.top-btns { display: flex; gap: 8px; }
.icon-btn.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  margin-top: 12px; padding: 22px 20px; border-radius: 24px;
  background: radial-gradient(120% 140% at 0% 0%, #3b2a8a 0%, #1d1838 45%, var(--card) 100%);
  border: 1px solid #2d2650;
}
.hero .muted { font-size: 14px; }
.total { font-size: 36px; font-weight: 700; letter-spacing: -.5px; margin: 4px 0 14px; font-variant-numeric: tabular-nums; }
.tax-chip { display: inline-block; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(251,191,36,.12); color: var(--yellow); }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 8px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px;
  background: var(--card); border: 0; border-radius: 18px; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
}
.action:active { transform: scale(.97); }
.action-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.action-ic svg { width: 22px; height: 22px; }

.section-title { font-size: 19px; margin: 22px 0 10px; }
.accounts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.acc {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card);
  border-radius: 18px; border: 1px solid transparent; cursor: pointer; text-align: left; color: var(--text); width: 100%; font: inherit;
}
.acc.active { border-color: var(--accent); }
.acc-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; flex: none; }
.acc-name { flex: 1; min-width: 0; }
.acc-name div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-name div:last-child { font-size: 13px; color: var(--muted); }
.acc-bal { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.history-head { display: flex; align-items: baseline; justify-content: space-between; }
.link { background: none; border: 0; color: var(--accent-2); font-size: 15px; cursor: pointer; }
.export-btn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: 16px; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.export-btn b { display: block; font-weight: 600; }
.export-btn small { display: block; font-size: 13px; color: var(--muted); }
.export-btn > span:nth-child(2) { flex: 1; }
.export-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(52,211,153,.14); color: var(--green); flex: none; }
.export-ic svg, .export-arrow { width: 20px; height: 20px; }
.export-arrow { color: var(--muted); }
.day {font-size: 13px; color: var(--muted); margin: 16px 4px 6px; }
.op { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: 16px; margin-bottom: 6px; cursor: pointer; }
.op-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.op-ic svg { width: 20px; height: 20px; }
.op-ic.deposit { background: rgba(52,211,153,.14); color: var(--green); }
.op-ic.transfer { background: rgba(124,92,255,.16); color: var(--accent-2); }
.op-ic.withdraw { background: rgba(248,113,113,.14); color: var(--red); }
.op-main { flex: 1; min-width: 0; }
.op-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.op-amt.plus { color: var(--green); }
.op-amt small { display: block; font-weight: 500; font-size: 12px; color: var(--yellow); }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

/* ---------- шторка ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 560px; margin: 0 auto;
  background: #15171d; border-radius: 26px 26px 0 0; padding: 8px 18px calc(20px + var(--safe-bottom));
  max-height: 92vh; overflow-y: auto; animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grip { width: 40px; height: 5px; border-radius: 3px; background: #3a3e4a; margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 16px; font-size: 21px; }
.label { font-size: 13px; color: var(--muted); margin: 16px 0 8px; }
.amount-wrap { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.amount-wrap:focus-within { border-color: var(--accent); }
.amount { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 38px; font-weight: 700; padding: 0; font-variant-numeric: tabular-nums; }
.amount-wrap span { font-size: 30px; color: var(--muted); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 14px; border-radius: 12px; background: var(--card-2); border: 1px solid transparent; color: var(--text); font-size: 15px; cursor: pointer; }
.chip.on { border-color: var(--accent); background: rgba(124,92,255,.18); }
.chip small { display: block; color: var(--muted); font-size: 12px; }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rate { padding: 12px 6px; border-radius: 14px; background: var(--card-2); border: 1px solid transparent; color: var(--text); cursor: pointer; text-align: center; font: inherit; }
.rate b { display: block; font-size: 20px; }
.rate small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.rate.on { border-color: var(--yellow); background: rgba(251,191,36,.14); }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--card-2); border-radius: 14px; margin-top: 16px; cursor: pointer; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: #3a3e4a; position: relative; transition: .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on { background: var(--green); }
.switch.on::after { left: 23px; }
.preview { margin-top: 10px; font-size: 14px; color: var(--muted); }
.preview b { color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .btn-primary { margin-top: 20px; }
.detail { display: grid; gap: 2px; background: var(--card-2); border-radius: 14px; padding: 4px 16px; margin-bottom: 14px; }
.detail div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail div:last-child { border: 0; }
.detail span:first-child { color: var(--muted); }
.detail span:last-child { text-align: right; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); background: #262a35; color: var(--text); padding: 12px 18px; border-radius: 14px; z-index: 20; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
input[type=date].field { -webkit-appearance: none; min-height: 52px; }
