:root {
  --bg: #070b14;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #1f2937;
  --orange: #fb923c;
  --orange-dim: #9a4d12;
  --app-bg: #0b1220;
  --app-surface: #111827;
  --app-muted: #1f2937;
  --app-text: #f8fafc;
  --app-dim: #94a3b8;
  --positive: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --accent: #60a5fa;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  min-height: 100vh;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  background-image:
    radial-gradient(900px 420px at 80% -10%, rgba(251,146,60,0.12), transparent 55%),
    linear-gradient(180deg, rgba(96,165,250,0.04), transparent 30%);
}

.page { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.chrome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: Fraunces, Georgia, serif;
  font-size: 30px;
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand em { font-style: italic; color: var(--orange); font-weight: 500; }
.sub {
  color: var(--muted);
  margin-top: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}
.links a {
  color: var(--orange);
  border: 1px solid var(--orange-dim);
  padding: 8px 12px;
  text-decoration: none;
  font-size: 13px;
}
.links a:hover { background: rgba(251,146,60,0.1); }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 36px;
  padding: 28px 0 0;
  align-items: start;
}

.kicker {
  color: var(--orange);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  margin: 0 0 10px;
}
h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: 38px;
  line-height: 1.12;
  font-weight: 600;
  margin: 0 0 14px;
}
.lede { color: #cbd5e1; font-size: 16px; line-height: 1.55; margin: 0 0 22px; }
.facts {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
}
.facts li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.facts b { color: var(--ink); font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; }

.stage { display: flex; justify-content: center; padding-top: 4px; }
.phone {
  width: 390px;
  height: 780px;
  background: #020617;
  border: 10px solid #0f172a;
  border-radius: 42px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45), inset 0 0 0 1px #334155;
  position: relative;
  overflow: hidden;
}
.notch {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 118px;
  height: 22px;
  margin-left: -59px;
  background: #020617;
  border-radius: 0 0 16px 16px;
  z-index: 5;
}
.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  padding: 14px 22px 0;
  display: flex;
  justify-content: space-between;
  color: var(--app-text);
  font-size: 12px;
  font-weight: 600;
  z-index: 4;
  pointer-events: none;
}
.screen {
  position: absolute;
  inset: 44px 0 0;
  background: var(--app-bg);
  color: var(--app-text);
  display: flex;
  flex-direction: column;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.app-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 96px;
  scrollbar-width: thin;
}
.app-scroll::-webkit-scrollbar { width: 0; }

.hero-label { color: var(--app-dim); font-size: 12px; }
.hero-metric {
  font-family: Fraunces, Georgia, serif;
  font-size: 34px;
  margin: 2px 0 0;
  letter-spacing: -0.03em;
}
.hero-sub { color: var(--app-dim); font-size: 13px; margin-top: 2px; }
.hero-help { color: var(--app-dim); font-size: 12px; margin-top: 6px; line-height: 1.4; }
.envelope { font-size: 13px; font-weight: 600; margin-top: 8px; }
.envelope.ok { color: var(--positive); }
.envelope.bad { color: var(--danger); }

.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.onTrack { background: rgba(74,222,128,0.14); color: var(--positive); }
.badge.watch { background: rgba(251,191,36,0.14); color: var(--warning); }
.badge.overBudgetRisk, .badge.overdue, .badge.overBudget { background: rgba(248,113,113,0.14); color: var(--danger); }
.badge.paid, .badge.positive { background: rgba(74,222,128,0.14); color: var(--positive); }
.badge.upcoming, .badge.partial, .badge.warning { background: rgba(251,191,36,0.14); color: var(--warning); }

.card {
  background: var(--app-surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-top: 12px;
}
.card h3 { margin: 0; font-size: 14px; font-weight: 700; }
.card .meta { color: var(--app-dim); font-size: 12px; margin-top: 2px; }
.bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--app-muted);
  margin-top: 10px;
}
.bar > span { height: 100%; min-width: 2px; }
.legend { margin-top: 10px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }
.swatch { width: 10px; height: 10px; border-radius: 99px; flex-shrink: 0; }
.legend-row b { margin-left: auto; font-weight: 600; color: var(--app-dim); }

.txn { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid #1e293b; }
.txn:first-child { border-top: 0; padding-top: 0; }
.txn .name { font-size: 13px; font-weight: 600; }
.txn .cat { font-size: 11px; color: var(--app-dim); }
.txn .amt { font-size: 13px; font-weight: 700; }
.txn .amt.expense { color: var(--danger); }
.txn .amt.income { color: var(--positive); }

.day-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--app-dim);
  margin: 14px 0 4px;
  font-weight: 600;
}
.title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.subtitle { color: var(--app-dim); font-size: 12px; margin: 0 0 10px; line-height: 1.4; }

.search, select, input, textarea, button { font-family: inherit; }
.search, .field {
  width: 100%;
  background: var(--app-surface);
  border: 1px solid var(--line);
  color: var(--app-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.search:focus, .field:focus { border-color: var(--orange); }
.filters { display: flex; background: var(--app-muted); border-radius: 12px; padding: 3px; margin: 10px 0; }
.filters button, .chips button, .date-chips button {
  background: transparent;
  border: 0;
  color: var(--app-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.filters button.on, .chips button.on, .date-chips button.on {
  background: var(--app-surface);
  color: var(--orange);
}

.bill, .var-row {
  background: var(--app-surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-top: 10px;
}
.track { height: 6px; background: var(--app-muted); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.track > span { display: block; height: 100%; background: var(--positive); }
.track.bad > span { background: var(--danger); }
.ghost, .primary, .danger-btn {
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--app-text);
}
.primary {
  background: var(--orange);
  border: 0;
  color: #0b1220;
  width: 100%;
  padding: 12px;
  font-size: 14px;
  margin-top: 12px;
}
.danger-btn { background: transparent; border: 1px solid var(--line); color: var(--danger); }
.footer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
.snap-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.snap-row span { color: var(--app-dim); }
.snap-row b { font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; margin-right: 6px; }

.nav {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pill {
  flex: 1;
  display: flex;
  height: 58px;
  background: var(--app-surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.pill button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--app-dim);
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
}
.pill button.on { background: var(--app-muted); color: var(--orange); font-weight: 700; }
.fab {
  width: 58px;
  height: 58px;
  border-radius: 99px;
  background: var(--orange);
  color: #0b1220;
  border: 0;
  font-size: 30px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(251,146,60,0.35);
  flex-shrink: 0;
}

.sheet {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,0.62);
  display: flex;
  align-items: flex-end;
  z-index: 8;
}
.sheet-card {
  width: 100%;
  background: var(--app-bg);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px 22px;
  max-height: 92%;
  overflow: auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.chips, .date-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.error { color: var(--danger); font-size: 12px; margin-top: 6px; }
.note {
  min-height: 72px;
  resize: vertical;
}

.chart { width: 100%; height: 110px; margin-top: 8px; }
.empty { color: var(--app-dim); font-size: 13px; padding: 12px 0; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .story { order: 1; }
  .stage { order: 0; }
  h1 { font-size: 30px; }
}

@media (max-width: 440px) {
  .page { padding: 0; }
  .chrome, .story { padding-left: 16px; padding-right: 16px; }
  .phone {
    width: 100%;
    height: calc(100dvh - 92px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .notch { display: none; }
  .hint { display: none; }
}
