/* Money Trace — web/PWA port of the neon design system (from ui/theme/Theme.kt) */

:root {
  /* dark palette (default — the app is dark-first) */
  --bg: #0A0613;
  --bg-soft: #120C22;
  --surface: #191230;
  --surface-variant: #150F28;
  --stroke: rgba(255, 255, 255, 0.12);
  --ink-hi: #F4EFFF;
  --ink-mid: #B9AEDA;
  --ink-low: #7C709B;
  --lime: #C9FF4A;
  --error: #FF6B6B;
  --on-accent: #0A0613;

  /* accent hues */
  --violet: #A47BFF;
  --hotpink: #FF4FD8;
  --cyan: #48E9FF;
  --tangerine: #FF9F45;
  --coral: #FF6B6B;

  --brand: linear-gradient(135deg, #A47BFF, #FF4FD8, #48E9FF);
  /* net worth hero ring — its own gradient, independent of --brand */
  --hero-gradient: linear-gradient(135deg, #FFC24B, #C9FF4A);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Noto Color Emoji";

  --r-card: 28px;
  --r-lg: 20px;
  --r-md: 18px;
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
}

:root[data-theme="light"] {
  --bg: #F6F2FF;
  --bg-soft: #EFE9FF;
  --surface: #FFFFFF;
  --surface-variant: #EDE6FF;
  --stroke: rgba(22, 15, 38, 0.10);
  --ink-hi: #160F26;
  --ink-mid: #5B5175;
  --ink-low: #8A82A0;
  --lime: #3E8E00;
  --error: #D64545;
  --on-accent: #FFFFFF;
  --shadow: 0 18px 40px -24px rgba(80, 40, 160, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink-hi);
  font-family: var(--font);
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* faint aurora glow behind everything, like the app's void gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(164, 123, 255, 0.16), transparent 70%),
    radial-gradient(50% 40% at 95% 8%, rgba(72, 233, 255, 0.12), transparent 70%),
    radial-gradient(70% 40% at 50% 100%, rgba(255, 79, 216, 0.10), transparent 70%);
}
:root[data-theme="light"] body::before { opacity: 0.5; }

#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ── typography helpers ─────────────────────────────────────────── */
.label-xs {
  font-size: 11px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ink-low);
}
.label-sm { font-size: 12px; font-weight: 700; letter-spacing: 0.4px; }
.body-sm { font-size: 13px; color: var(--ink-mid); line-height: 1.35; }
.body-md { font-size: 15px; line-height: 1.4; }
.title-md { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.title-lg { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.headline-sm { font-size: 24px; font-weight: 800; letter-spacing: -0.6px; }
.headline-md { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.money-huge {
  font-size: 44px; font-weight: 900; letter-spacing: -2px;
  line-height: 1.02; word-break: break-word;
}
.muted { color: var(--ink-mid); }
.dim { color: var(--ink-low); }
.pos { color: var(--lime); }
.neg { color: var(--error); }
.center { text-align: center; }
.strike { text-decoration: line-through; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; min-width: 0; }

/* ── layout ─────────────────────────────────────────────────────── */
.screen {
  padding: 16px 18px calc(120px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.row { display: flex; align-items: center; gap: 12px; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.end { align-items: flex-end; }
.wrap { flex-wrap: wrap; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; } .mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; } .mt-12 { margin-top: 12px; } .mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; } .mt-18 { margin-top: 18px; }

/* ── glass card ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.card.tap { cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease; }
.card.tap:active { transform: scale(0.985); }
.card.pad-sm { padding: 16px; border-radius: 26px; }

/* gradient-filled hero net-worth card */
.hero-ring {
  border-radius: 32px;
  box-shadow: var(--shadow);
}
.hero-ring > .card {
  border-radius: 32px;
  border: none;
  padding: 22px;
  box-shadow: none;
  background: var(--hero-gradient);
  color: #14100a; /* dark ink — readable on the bright gold fill, both themes */
}
.hero-ring > .card .label-xs { color: rgba(20, 16, 10, 0.85); }
.hero-ring > .card .vdivider { background: rgba(20, 16, 10, 0.2); }
/* the headline total, bigger — scales down on narrow phones */
.hero-ring > .card .money-huge { font-size: clamp(48px, 14vw, 60px); line-height: 1; }

/* ── emoji avatar with gradient ring ────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  padding: 2px;
}
.avatar > span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ── pills, chips, bars ─────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  background: var(--surface-variant);
  color: var(--ink-mid);
  white-space: nowrap;
}
.pill.solid { color: var(--on-accent); }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: none;
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: var(--surface-variant);
  color: var(--ink-mid);
  transition: transform 0.1s ease;
}
.chip:active { transform: scale(0.95); }
.chip.on { color: var(--on-accent); }

.bar {
  width: 100%;
  border-radius: 999px;
  background: var(--surface-variant);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.vdivider { width: 1px; align-self: stretch; background: var(--stroke); margin: 0 12px; }

.stat .label-xs { margin-bottom: 3px; }
.stat .val { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }

/* ── buttons ────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--r-lg);
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--on-accent);
  width: 100%;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; }
.btn.outline {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink-hi);
  width: auto;
  padding: 16px 20px;
}
.btn.ghost { background: var(--surface-variant); color: var(--ink-hi); }
.btn.sm { padding: 12px 16px; font-size: 14px; border-radius: 16px; }

.iconbtn {
  border: none;
  background: transparent;
  color: var(--ink-mid);
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px;
  flex: none;
  transition: background 0.12s ease;
}
.iconbtn:active { background: var(--surface-variant); }
.iconbtn.danger { color: var(--error); }
.iconbtn svg { width: 22px; height: 22px; }

/* ── form fields ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; }
.field > label { margin-bottom: 6px; }
.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-variant);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 0 14px;
  transition: border-color 0.15s ease;
}
.input-wrap:focus-within { border-color: var(--violet); }
.input-wrap.err { border-color: var(--error); }
.input-wrap input,
.input-wrap textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink-hi);
  font-family: inherit;
  font-size: 16px;
  padding: 15px 0;
}
.input-wrap textarea { resize: vertical; min-height: 48px; padding-top: 14px; }
.input-wrap input::placeholder,
.input-wrap textarea::placeholder { color: var(--ink-low); }
.input-affix { color: var(--ink-low); font-weight: 700; font-size: 15px; flex: none; }
.field .support { margin-top: 6px; font-size: 12px; color: var(--ink-low); }
.field .support.err { color: var(--error); }

/* date uses native picker */
.input-wrap input[type="date"] { color-scheme: dark; }
:root[data-theme="light"] .input-wrap input[type="date"] { color-scheme: light; }

/* big hero amount */
.bigmoney { align-items: center; }
.bigmoney .input-wrap {
  border-radius: 24px;
  padding: 6px 18px;
  width: 100%;
  justify-content: center;
}
.bigmoney .cur { font-size: 30px; font-weight: 900; }
.bigmoney input {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1.5px;
  text-align: center;
  padding: 12px 0;
}

/* emoji + accent pickers */
.emojistrip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.emojistrip::-webkit-scrollbar { display: none; }
.emoji-opt {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--surface-variant);
  display: grid; place-items: center;
  font-size: 22px;
  flex: none;
  padding: 3px;
}
.emoji-opt.on > span {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
}
.accentrow { display: flex; gap: 12px; flex-wrap: wrap; }
.accent-opt {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  display: grid; place-items: center;
}
.accent-opt > i {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  display: none;
}
.accent-opt.on > i { display: block; }

/* ── schedule / list rows ───────────────────────────────────────── */
.softrow {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-variant);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}
.softrow.tap { cursor: pointer; }
.tick {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--ink-low);
}
.tick.late { border-color: var(--error); }
.tick.on { border: none; color: var(--on-accent); }
.tick svg { width: 15px; height: 15px; }

.yearrow {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 9px 10px;
}
.yearrow.now { background: var(--surface-variant); }

/* ── empty state ────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty .bubble {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--surface-variant);
  display: grid; place-items: center;
  font-size: 42px;
  margin-bottom: 8px;
}

/* ── bottom nav ─────────────────────────────────────────────────── */
.bottombar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 20;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.bottombar > * { pointer-events: auto; }
.navpill {
  flex: 1;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.navtab {
  border: none;
  background: transparent;
  color: var(--ink-low);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.18s ease;
}
.navtab svg { width: 20px; height: 20px; }
.navtab.on { background: var(--surface-variant); color: var(--ink-hi); }
.navtab span { display: none; }
.navtab.on span { display: inline; }
.fab {
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: 0 10px 30px -8px rgba(255, 79, 216, 0.6);
  flex: none;
  transition: transform 0.1s ease;
}
.fab:active { transform: scale(0.94); }
.fab svg { width: 28px; height: 28px; }

/* ── dialog / sheet ─────────────────────────────────────────────── */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 3, 12, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.2s ease;
}
@media (min-width: 520px) { .scrim { align-items: center; } }
.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 28px 28px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideup 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 88dvh;
  overflow-y: auto;
}
@media (min-width: 520px) { .sheet { border-radius: 28px; margin: 20px; } }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.linkbtn { background: none; border: none; font-weight: 700; font-size: 15px; padding: 10px 12px; }

.chart-svg { width: 100%; display: block; }

.install-hint {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-variant);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}

/* toast */
.toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--ink-hi);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: fade 0.2s ease;
}
