:root {
  --bg: #0d0716;
  --surface: #16101f;
  --surface-2: #1d1529;
  --card: #120c1b;
  --border: rgba(163, 255, 18, 0.14);
  --border-strong: rgba(163, 255, 18, 0.35);
  --border-soft: rgba(255, 255, 255, 0.08);
  --acid: #a3ff12;
  --magenta: #ff00ff;
  --pink: #e91e8c;
  --purple: #7b2ff7;
  --purple-2: #9b4dff;
  --yellow: #ffe600;
  --green: #35d95f;
  --ink: #0a0a0a;
  --text: #f7f6fa;
  --text-muted: #b6b0c4;
  --text-dim: #837c94;
  --danger: #ff3355;
  --glow-acid: 0 0 24px rgba(163, 255, 18, 0.35);
  --radius: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(123, 47, 247, 0.28), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(233, 30, 140, 0.12), transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

/* ─────────── ЗАМОК ─────────── */
.lock {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
}
.lock-box { width: min(340px, 88vw); text-align: center; }
.lock-logo {
  font-size: 40px; font-weight: 900; letter-spacing: 4px;
  color: var(--acid); text-shadow: var(--glow-acid);
  transform: rotate(-2deg); margin-bottom: 8px;
}
.lock-sub { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 32px; }
.pin-dots i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border-strong); display: block;
}
.pin-dots i.on { background: var(--acid); box-shadow: var(--glow-acid); border-color: var(--acid); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-pad button {
  aspect-ratio: 1.6; font-size: 24px; font-weight: 700;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  cursor: pointer; transition: .12s;
}
.pin-pad button:active { background: var(--acid); color: var(--ink); }
.pin-pad button.wide { grid-column: span 1; font-size: 16px; }
.lock-err { color: var(--danger); margin-top: 16px; min-height: 20px; font-size: 14px; }
.faceid {
  width: 100%; margin-top: 18px; padding: 13px;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--acid); border-radius: var(--radius);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.faceid:active { background: var(--acid); color: var(--ink); }

/* ─────────── КАРКАС ─────────── */
main { max-width: 720px; margin: 0 auto; padding: 0 16px 60px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 0 12px;
}
.logo {
  font-size: 22px; font-weight: 900; letter-spacing: 3px;
  color: var(--acid); text-shadow: var(--glow-acid); transform: rotate(-1.5deg);
}
button.ghost {
  background: transparent; border: 1px solid var(--border-soft);
  color: var(--text-muted); border-radius: var(--radius);
  padding: 6px 12px; cursor: pointer; font-size: 14px;
}
button.ghost:hover { border-color: var(--border-strong); color: var(--text); }
button.primary {
  background: var(--acid); color: var(--ink); border: none;
  border-radius: var(--radius); padding: 10px 18px;
  font-weight: 800; cursor: pointer; font-size: 14px;
}

/* ─────────── ГЛАВНЫЙ ЭКРАН ─────────── */
.hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 6px 6px; opacity: .35; pointer-events: none;
}
.hero-label {
  font-size: 12px; letter-spacing: 4px; color: var(--text-dim);
  font-weight: 700; margin-bottom: 6px;
}
.hero-value {
  font-size: clamp(44px, 13vw, 68px); font-weight: 900; line-height: 1;
  color: var(--acid); text-shadow: var(--glow-acid); letter-spacing: -2px;
}
.hero-date { color: var(--text-muted); margin: 8px 0 20px; font-size: 15px; }
.hero-foot {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft);
}
.hero-foot div { display: flex; flex-direction: column; gap: 2px; }
.hero-foot span { font-size: 15px; font-weight: 800; }
.hero-foot small { font-size: 10px; color: var(--text-dim); letter-spacing: .5px; }

/* ─────────── ПОЛОСКИ ─────────── */
.bar {
  position: relative; height: 10px; background: var(--surface-2);
  border-radius: 2px; overflow: hidden;
}
.bar.big { height: 26px; border-radius: var(--radius); }
.bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--acid), var(--green));
  transition: width .5s ease;
}
.bar-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
}

/* ─────────── БЛОКИ ─────────── */
.block { margin-top: 28px; }
.block h2 {
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 12px; font-weight: 700;
}

/* ─────────── ДОЛГИ ─────────── */
.debts { display: flex; flex-direction: column; gap: 12px; }
.debt {
  background: var(--card); border: 1px solid var(--border-soft);
  border-left: 3px solid var(--purple-2);
  border-radius: var(--radius); padding: 14px 16px;
}
.debt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.debt-name { font-weight: 800; font-size: 15px; }
.debt-sum { font-weight: 900; font-size: 17px; white-space: nowrap; }
.debt-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0;
}
.tag {
  font-size: 11px; padding: 3px 8px; border-radius: 2px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border-soft);
}
.tag.hot { color: var(--danger); border-color: rgba(255,51,85,.4); }
.tag.warn { color: var(--yellow); border-color: rgba(255,230,0,.35); }
.tag.ok { color: var(--acid); border-color: var(--border-strong); }
.debt-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; gap: 10px;
}
.debt-next { font-size: 12px; color: var(--text-muted); }
.debt-pay {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--acid); border-radius: 2px; padding: 5px 12px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.debt-pay:hover { background: var(--acid); color: var(--ink); }

/* ─────────── АЛЕРТЫ ─────────── */
.alert {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid; font-size: 13px; line-height: 1.5;
}
.alert.red { border-color: rgba(255,51,85,.45); background: rgba(255,51,85,.08); color: #ffb3c0; }
.alert.yellow { border-color: rgba(255,230,0,.35); background: rgba(255,230,0,.06); color: #fff2a8; }

/* ─────────── КАЛЕНДАРЬ ─────────── */
.calendar { display: flex; flex-direction: column; gap: 6px; }
.cal-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
}
.cal-date { font-size: 12px; color: var(--text-muted); min-width: 96px; }
.cal-debt { flex: 1; font-size: 13px; }
.cal-sum { font-weight: 800; font-size: 14px; }
.cal-row.soon { border-color: var(--border-strong); }

/* ─────────── СИМУЛЯТОР ─────────── */
.sim {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px 16px;
}
.sim-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px; font-size: 13px; color: var(--text-muted);
}
.sim-row output { font-weight: 800; font-size: 16px; color: var(--text); }
input[type=range] {
  width: 100%; margin-bottom: 20px; accent-color: var(--acid);
  height: 4px;
}
.seg { display: flex; gap: 8px; margin-bottom: 16px; }
.seg button {
  flex: 1; padding: 9px; font-size: 13px; font-weight: 700;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border-soft); border-radius: 2px; cursor: pointer;
}
.seg button.on { background: var(--acid); color: var(--ink); border-color: var(--acid); }
.seg.small button { padding: 7px; font-size: 12px; }
.sim-result {
  padding: 14px; background: var(--surface); border-radius: 2px;
  font-size: 14px; line-height: 1.6; color: var(--text-muted);
}
.sim-result b { color: var(--acid); font-size: 16px; }

/* ─────────── ГРАФИК ─────────── */
.chart {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px 12px 8px;
}
.chart svg { width: 100%; height: auto; display: block; }

/* ─────────── МОДАЛКА ─────────── */
.modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(5, 2, 10, .8); padding: 20px;
}
.modal-box {
  width: min(400px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
}
.modal-box h3 { font-size: 16px; margin-bottom: 16px; }
.modal-box input {
  width: 100%; padding: 12px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 2px; color: var(--text); font-size: 15px;
}
.modal-box input:focus { outline: none; border-color: var(--border-strong); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.foot { margin-top: 32px; text-align: center; font-size: 11px; color: var(--text-dim); }

/* ─────────── ВКЛАДКИ ─────────── */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button {
  flex: 1; padding: 11px; font-size: 14px; font-weight: 800;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border-soft); border-radius: var(--radius); cursor: pointer;
}
.tabs button.on { background: var(--acid); color: var(--ink); border-color: var(--acid); }

/* ─────────── БЫСТРЫЙ ВВОД ─────────── */
.quick {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.quick-row { display: flex; gap: 8px; }
.quick-row input {
  flex: 1; padding: 14px; font-size: 16px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 2px; color: var(--text);
}
.quick-row input:focus { outline: none; border-color: var(--border-strong); }
.quick-row button {
  width: 54px; font-size: 24px; font-weight: 900; flex-shrink: 0;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.presets button {
  padding: 8px 12px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border-soft); border-radius: 2px; cursor: pointer;
}
.presets button:active { background: var(--acid); color: var(--ink); }
.income-btn {
  width: 100%; margin-top: 12px; padding: 13px;
  background: transparent; border: 1px dashed var(--border-strong);
  color: var(--acid); border-radius: var(--radius);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.income-btn:active { background: var(--acid); color: var(--ink); }

/* ─────────── КОПИЛКИ ─────────── */
.pots { display: flex; flex-direction: column; gap: 10px; }
.pot {
  background: var(--card); border: 1px solid var(--border-soft);
  border-left: 3px solid var(--purple-2);
  border-radius: var(--radius); padding: 12px 14px;
}
.pot.ready { border-left-color: var(--acid); }
.pot.urgent { border-left-color: var(--yellow); }
.pot.overdue { border-left-color: var(--danger); }
.pot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pot-name { font-size: 14px; font-weight: 700; }
.pot-sum { font-size: 14px; font-weight: 800; white-space: nowrap; }
.pot-sum small { color: var(--text-dim); font-weight: 500; }
.pot-meta { font-size: 11px; color: var(--text-dim); margin: 7px 0; }
.pot-pay {
  margin-top: 8px; width: 100%; padding: 8px;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--acid); border-radius: 2px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.pot-pay:active { background: var(--acid); color: var(--ink); }

/* ─────────── ТРАТЫ ─────────── */
.recent { display: flex; flex-direction: column; gap: 4px; }
.tx {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  font-size: 13px;
}
.tx-cat { flex: 1; }
.tx-date { color: var(--text-dim); font-size: 11px; }
.tx-sum { font-weight: 800; }
.tx-card {
  font-size: 10px; padding: 2px 6px; border-radius: 2px;
  background: var(--surface-2); color: var(--text-dim);
}

/* ─────────── РАСКЛАДКА ПОСТУПЛЕНИЯ ─────────── */
.split-preview {
  margin-top: 14px; padding: 12px; background: var(--bg);
  border-radius: 2px; font-size: 13px; min-height: 40px;
}
.split-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; border-bottom: 1px solid var(--border-soft);
}
.split-row:last-child { border-bottom: none; }
.split-row b { color: var(--acid); white-space: nowrap; }
.split-row small { color: var(--text-dim); font-size: 11px; display: block; }

/* что станет с платежами после такого дележа */
.split-after { margin-top: 10px; }
.split-after-title {
  font-size: 11px; letter-spacing: 1.5px; color: var(--text-dim);
  text-transform: uppercase; margin-bottom: 8px; font-weight: 700;
}
.after-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 4px;
  background: var(--surface); border-radius: 2px;
  border-left: 2px solid var(--border-soft); font-size: 12px;
}
.after-row.ready { border-left-color: var(--acid); }
.after-row.risk { border-left-color: var(--danger); }
.after-row.tight { border-left-color: var(--yellow); }
.after-name { flex: 1; }
.after-state { color: var(--text-dim); white-space: nowrap; font-size: 11px; }
.after-row.ready .after-state { color: var(--acid); }
.after-row.risk .after-state { color: var(--danger); }
.after-bar { height: 3px; background: var(--surface-2); border-radius: 2px; margin-top: 4px; }
.after-bar i { display: block; height: 100%; background: var(--acid); border-radius: 2px; }

.split-warn {
  padding: 10px 12px; margin-bottom: 8px;
  background: rgba(255,51,85,.1); border: 1px solid rgba(255,51,85,.4);
  border-radius: 2px; font-size: 12px; color: #ffb3c0; line-height: 1.45;
}

/* подсказка про то, как устроены копилки */
.hint {
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface); border-left: 2px solid var(--border-strong);
  border-radius: 2px; font-size: 11.5px; color: var(--text-dim); line-height: 1.5;
}

/* ─────────── ТОСТ ─────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--acid); color: var(--ink);
  padding: 12px 20px; border-radius: var(--radius);
  font-weight: 800; font-size: 14px; z-index: 200;
  box-shadow: var(--glow-acid); max-width: 90vw; text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }

/* ─────────── СОВЕТНИК ─────────── */
.advisor {
  background: linear-gradient(160deg, rgba(123,47,247,.18), var(--card) 60%);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.advisor-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.advisor-title { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--acid); }
button.ghost.small { padding: 4px 10px; font-size: 12px; }
.advisor-body { font-size: 14px; line-height: 1.62; color: var(--text); }
.advisor-body p { margin-bottom: 10px; }
.advisor-body b { color: var(--acid); }
.advisor-date { margin-top: 10px; font-size: 11px; color: var(--text-dim); }
.advisor.thinking .advisor-body { opacity: .5; }

/* ─────────── ВЕХИ ─────────── */
.milestones { display: flex; flex-direction: column; gap: 8px; }
.ms {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  font-size: 13px; color: var(--text-dim);
}
.ms.done { color: var(--text); border-color: var(--border); }
.ms.done .ms-mark { background: var(--acid); color: var(--ink); }
.ms.next { border-color: var(--border-strong); color: var(--text); }
.ms-mark {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 900;
  background: var(--surface-2); color: var(--text-dim);
}
.ms-label { flex: 1; }
.ms-gap { font-size: 11px; color: var(--text-dim); }

/* ─────────── ЖЕЛАНИЯ ─────────── */
.wishes { display: flex; flex-direction: column; gap: 8px; }
.wish {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
}
.wish-name { flex: 1; font-size: 14px; font-weight: 600; }
.wish-name small { display: block; font-size: 11px; color: var(--text-dim); font-weight: 400; margin-top: 2px; }
.wish-price { font-size: 13px; font-weight: 800; white-space: nowrap; }
.wish-del {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 0 4px;
}

@media (max-width: 420px) {
  .hero-foot span { font-size: 13px; }
  .cal-date { min-width: 78px; font-size: 11px; }
}
