/* Potsy: Sunset (warm rose, apricot, lilac, sky). The logo keeps its midnight + rose gold. */
:root {
  --bg: #fbf6f2;
  --card: #ffffff;
  --ink: #2a1f2d;
  --muted: #8a7680;
  --line: #f0e4dc;
  --brand: #2a1f2d;
  --brand-ink: #ffffff;
  --brand-soft: #fde6df;
  --accent: #e0705f;
  --primary-bg: linear-gradient(135deg, #ee8a7a, #f2a65a);
  --primary-ink: #2a1f2d;
  --goal-bg: linear-gradient(135deg, #f7b2a6, #f6c58f);
  --goal-ink: #2a1f2d;
  --goal-muted: #5b4450;
  --goal-track: rgba(42, 31, 45, .14);
  --goal-bar: linear-gradient(90deg, #2a1f2d, #5b3a4a);
  --grow: #ee8a7a;
  --stab: #f2a65a;
  --ess: #a78bfa;
  --rew: #5aa9f0;
  --good: #2f7d55;
  --good-bg: #e7f4ec;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --on-c: #2a1f2d;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1320;
    --card: #241a2b;
    --ink: #f7ece8;
    --muted: #b9a3ad;
    --line: #3a2c40;
    --brand: #f4a092;
    --brand-ink: #2a1f2d;
    --brand-soft: #3d2733;
    --accent: #f4a092;
    --goal-track: rgba(42, 31, 45, .18);
    --grow: #f4a092;
    --stab: #f6b878;
    --ess: #bba5fb;
    --rew: #7cbaf3;
    --good: #86d19f;
    --good-bg: #173323;
    --warn: #fcd34d;
    --warn-bg: #3a2b08;
    --bad: #f87171;
    --bad-bg: #3a1414;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { cursor: pointer; font: inherit; color: inherit; }
button:disabled { opacity: .45; cursor: default; }

/* header + layout */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 520px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand img { width: 28px; height: 28px; }
.chip-mode { font-size: 13px; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }
main { max-width: 520px; margin: 0 auto; padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }

.card {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 12px;
}
h2 { font-size: 26px; margin: 8px 0 4px; letter-spacing: -.02em; }
h3 { font-size: 13px; margin: 0 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 6px 0 0; }
small { color: var(--muted); font-weight: 500; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.fine, .tip { font-size: 13px; color: var(--muted); margin: 8px 2px 0; }
.tip { margin: 0 4px 12px; }
.center { text-align: center; }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 0; min-width: 0; }
input, select {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
input { -webkit-appearance: none; appearance: none; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0 10px; }

/* buttons */
.primary, .ghost, .danger {
  display: inline-block; font-weight: 700; border-radius: 12px; padding: 13px 16px;
  border: 1px solid transparent; text-align: center; text-decoration: none;
}
.primary { background: var(--primary-bg); color: var(--primary-ink); }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.wide { display: block; width: 100%; margin: 4px 0 12px; }
.small { padding: 8px 12px; font-size: 14px; margin-top: 12px; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions > * { flex: 1; }
.link { background: none; border: 0; padding: 4px 0 12px; font-size: 14px; color: var(--bad); text-decoration: underline; }

/* split screen */
.goal-mini { border: 1px solid transparent; }
.goal-mini .bar { display: block; }
.goal-mini .row > span:first-child { font-weight: 700; }
.big-label { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.amount { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid var(--line); padding: 2px 0 4px; }
.amount:focus-within { border-color: var(--brand); }
.amount span { font-size: 30px; font-weight: 700; color: var(--muted); }
.amount input {
  border: 0; background: transparent; padding: 0; margin: 0; border-radius: 0;
  font-size: 44px; font-weight: 800; letter-spacing: -.03em; outline: none; min-width: 0;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.pots-list { list-style: none; margin: 14px 0 0; padding: 0; }
.pot-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.pot-row .nm { flex: 1; display: flex; flex-direction: column; font-weight: 600; line-height: 1.25; }
.pot-row .nm small { font-size: 12px; }
.pot-row b { font-size: 20px; font-variant-numeric: tabular-nums; }
.check { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.check.good { background: var(--good-bg); color: var(--good); }
.check.warn { background: var(--warn-bg); color: var(--warn); }
.check.bad { background: var(--bad-bg); color: var(--bad); }

/* bucket colours */
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.grow { --c: var(--grow); }
.stability { --c: var(--stab); }
.essentials { --c: var(--ess); }
.rewards { --c: var(--rew); }
.dot, .stack i { background: var(--c, var(--brand)); }

/* progress */
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--c, var(--grow)); border-radius: 99px; transition: width .4s; }
.bar.big { height: 14px; }
.hero .eyebrow { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hero-num { font-size: 40px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero .sub { color: var(--muted); font-weight: 600; }
.eta { margin-top: 12px; }

.banner { background: var(--good-bg); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.banner.warn { background: var(--warn-bg); }

/* pots editor */
.pot-edit .row:first-child { gap: 8px; }
.nm-in { flex: 1; margin: 0; font-weight: 700; background: transparent; border-color: transparent; padding: 8px 6px; }
.nm-in:focus { background: var(--bg); }
.pct-in { display: flex; align-items: center; gap: 4px; width: 84px; flex: none; font-weight: 700; color: var(--muted); }
.pct-in input { margin: 0; text-align: right; font-weight: 700; padding: 9px 10px; }
.pot-edit select { margin: 0; width: auto; flex: none; padding: 8px 10px; font-size: 15px; }
.pot-edit .row + .row { margin-top: 10px; }
.amt-hint { flex: 1; font-size: 13px; color: var(--muted); text-align: right; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.badge { font-size: 11px; font-weight: 700; background: var(--brand-soft); color: var(--brand); padding: 3px 8px; border-radius: 99px; flex: none; }
.stack { display: flex; gap: 3px; height: 14px; margin: 12px 0 6px; }
.stack i { border-radius: 4px; }
.pill { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp th { font-size: 12px; color: var(--muted); text-align: right; font-weight: 600; padding-bottom: 4px; }
.cmp td { padding: 7px 0; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.cmp td:first-child { text-align: left; }
.cmp td:first-child .dot { margin-right: 8px; vertical-align: -1px; }
.cmp .off { color: var(--warn); font-weight: 700; }

/* living costs */
.hero-num small { font-size: 16px; font-weight: 600; letter-spacing: 0; }
.cost { padding: 10px 0; border-top: 1px solid var(--line); }
.cost:first-child { border-top: 0; }
.cost-line { margin-top: 4px; gap: 8px; }
.amt-in {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0 10px;
}
.amt-in:focus-within { outline: 2px solid var(--brand); border-color: transparent; }
.amt-in span { color: var(--muted); font-weight: 700; }
.amt-in input { border: 0; background: transparent; padding: 9px 0; margin: 0; font-weight: 700; min-width: 0; }
.amt-in input:focus { outline: none; }
.cost select { margin: 0; width: auto; flex: none; padding: 8px; font-size: 15px; }
.cost-month { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }
.cost-month:empty { display: none; }

/* business */
.seg-top { margin: 0 0 12px; }
.amt-in select.cur { border: 0; background: transparent; padding: 0; margin: 0; width: auto; font-weight: 700; color: var(--muted); font-size: 15px; }
.amt-in select.cur:focus { outline: none; }
.sum { width: 100%; border-collapse: collapse; margin-top: 14px; font-variant-numeric: tabular-nums; }
.sum td { padding: 7px 0; border-top: 1px solid var(--line); }
.sum td:last-child { text-align: right; font-weight: 600; }
.sum tr:first-child td { border-top: 0; }
.sum .total td { font-weight: 800; font-size: 18px; border-top: 2px solid var(--ink); }
.rates { margin-top: 12px; }
.inline-rate { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--ink); font-size: 15px; }
.inline-rate input { width: 100px; margin: 0; }

/* The goal card: a warm sunset gradient with a deep plum progress bar */
.goal-mini, .hero {
  background: var(--goal-bg);
  color: var(--goal-ink); border-color: transparent;
  box-shadow: 0 10px 26px rgba(238, 138, 122, .28);
}
.goal-mini small, .hero small, .hero .sub, .hero .eyebrow, .hero .eta, .hero .fine { color: var(--goal-muted); }
.hero .eta b { color: var(--goal-ink); }
.goal-mini .bar, .hero .bar { background: var(--goal-track); }
.goal-mini .bar i, .hero .bar i { background: var(--goal-bar); }
.hero .ghost { border-color: rgba(42, 31, 45, .25); color: var(--goal-ink); }
.hero .primary { background: #2a1f2d; color: #fff; }
@media (prefers-color-scheme: dark) {
  .goal-mini, .hero { box-shadow: none; }
}
.primary { box-shadow: 0 6px 16px rgba(238, 138, 122, .3); }
.brand img { border-radius: 8px; }

/* Potsy the piggy: coin drops in the slot, piggy wiggles */
.piggy-pop {
  position: fixed; left: 50%; top: 20%; z-index: 40; pointer-events: none; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 14px 26px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
  animation: pop-in .25s ease both, pop-out .35s ease 1.85s forwards;
}
.piggy-pop svg, .ready-pig svg { display: block; width: 140px; height: 112px; margin: 0 auto; overflow: visible; }
.piggy-pop b { display: block; margin-top: 6px; font-size: 24px; letter-spacing: -.02em; }
.piggy-pop small { font-size: 14px; }
.piggy-pop .coin, .ready-pig .coin { transform-box: fill-box; transform-origin: center; animation: coin-drop .75s cubic-bezier(.5, 0, .75, 0) .2s both; }
.piggy-pop .pig, .ready-pig .pig { transform-box: fill-box; transform-origin: 50% 100%; animation: pig-wiggle .55s ease .9s both; }
.ready-pig { margin: 4px 0 6px; }
.ready-pig svg { margin: 0; width: 110px; height: 88px; }
@keyframes coin-drop {
  0% { transform: translateY(-40px); opacity: 0; }
  15% { opacity: 1; }
  80% { transform: translateY(32px); opacity: 1; }
  100% { transform: translateY(40px) scaleY(.4); opacity: 0; }
}
@keyframes pig-wiggle { 0%, 100% { transform: none; } 30% { transform: rotate(-4deg) scale(1.05); } 65% { transform: rotate(3deg); } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.92); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes pop-out { to { opacity: 0; transform: translate(-50%, -12px); } }
@media (prefers-reduced-motion: reduce) {
  .piggy-pop, .piggy-pop .coin, .piggy-pop .pig, .ready-pig .coin, .ready-pig .pig { animation: none; }
  .piggy-pop { transform: translateX(-50%); }
  .piggy-pop .coin, .ready-pig .coin { opacity: 0; }
}

/* sharing */
.code-box {
  margin-top: 12px; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 12px;
  background: var(--bg); font: 800 26px/1.2 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 2px;
}
.code-in { font: 700 20px ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 2px; text-transform: uppercase; }

/* settings + history */
.seg { display: flex; gap: 6px; margin-top: 6px; background: var(--bg); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.hist { list-style: none; margin: 8px 0 0; padding: 0; }
.hist > li { border-top: 1px solid var(--line); }
.hist summary { display: flex; justify-content: space-between; padding: 12px 0; cursor: pointer; list-style: none; }
.hist summary::-webkit-details-marker { display: none; }
.hist ul { list-style: none; margin: 0 0 4px; padding: 0 0 0 10px; font-size: 14px; }
.hist ul li { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }

/* onboarding */
.lead { color: var(--muted); margin: 0 0 18px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.pick button {
  text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.pick button.on { border-color: var(--brand); background: var(--brand-soft); }
.pick .em { font-size: 28px; line-height: 1; }
.pick small { font-size: 13px; line-height: 1.35; }
.onb .primary { margin-top: 20px; }

/* walkthrough cards */
body.onboarding main { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.intro {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.intro-progress { display: flex; gap: 4px; margin: 4px 0 28px; }
.intro-progress i { flex: 1; height: 4px; border-radius: 99px; background: var(--line); transition: background .3s; }
.intro-progress i.on { background: var(--accent); }
.slide { flex: 1; animation: slide-in .3s ease both; }
.intro-em { font-size: 60px; line-height: 1; }
.slide h2 { font-size: 32px; line-height: 1.15; margin: 18px 0 10px; }
.intro-text { font-size: 19px; line-height: 1.45; margin: 0; }
.intro-ex {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 10px 16px; font-weight: 700;
}
.intro-bar { display: flex; gap: 4px; height: 60px; margin-top: 28px; }
.intro-bar i {
  background: var(--c); border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: var(--on-c); font-style: normal; font-weight: 800; font-size: 13px;
  transform-origin: left; animation: grow-in .5s ease both;
}
.amount.try { margin-top: 22px; }
/* the try-it card holds the most, so it runs a little tighter to fit a phone screen */
.try-slide .intro-em { font-size: 40px; }
.try-slide h2 { margin-top: 10px; }
.try-slide .pot-row { padding: 8px 0; }
.try-slide .amount.try { margin-top: 14px; }
.intro-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.intro-list li {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font-size: 17px; font-weight: 600; line-height: 1.3;
  animation: slide-in .35s ease both;
}
.intro-list .ic { font-size: 24px; flex: none; }
.ready-list { margin: 0; }
.ready-list .pot-row:first-child { border-top: 0; padding-top: 0; }
.ready-list b small { font-size: 13px; }
.onb .intro-payoff { margin: 0 0 4px; }
.intro-payoff { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--good-bg); font-size: 15px; line-height: 1.45; }
.intro-nav { display: flex; gap: 10px; margin-top: 28px; }
.intro-nav .primary { flex: 1; }
@keyframes slide-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes grow-in { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .slide, .intro-bar i, .intro-list li { animation: none; } }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
  flex: 1; max-width: 130px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 0;
}
.tabs svg { width: 24px; height: 24px; }
.tabs button.on { color: var(--accent); }
body.onboarding .tabs, body.onboarding .chip-mode { display: none; }

/* pop-up (sits near the top so the phone keyboard never covers it) */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: calc(72px + env(safe-area-inset-top)) 16px 16px;
}
.sheet { width: 100%; max-width: 488px; background: var(--card); border-radius: 20px; padding: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.sheet-title { font-size: 18px; }
.sheet-in { margin-top: 12px; }
.sheet-in input { font-size: 22px; }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: .25s;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
