:root {
  --ink: #24324a;
  --muted: #6f7890;
  --navy: #233b68;
  --blue: #4e7bf2;
  --teal: #2aa198;
  --green: #44b97c;
  --coral: #e76f51;
  --gold: #f6bd4a;
  --purple: #8d6ce8;
  --pink: #ef6fa8;
  --red: #d94f55;
  --bg: #f6f5fb;
  --surface: #ffffff;
  --line: #e2e5ef;
  --soft-blue: #eef3ff;
  --soft-teal: #e9f8f6;
  --soft-coral: #fff0ec;
  --soft-purple: #f2efff;
  --soft-green: #eaf8f0;
  --soft-red: #fff0f1;
  --shadow: 0 12px 34px rgba(42, 48, 82, 0.08);
  --radius: 20px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.shell { min-height: 100vh; }
.topbar {
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,.2), transparent 30%),
    linear-gradient(125deg, #233b68 0%, #4e62bd 52%, #8d6ce8 100%);
  color: #fff;
  padding: max(18px, env(safe-area-inset-top)) 16px 18px;
}
.topbar-inner {
  width: min(1120px, 100%);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-kicker, .eyebrow {
  margin: 0 0 4px;
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.topbar .brand-kicker { color: rgba(255,255,255,.74); }
.brand-title { margin: 0; font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.05; letter-spacing: -.03em; }
.sync {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.9);
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
}
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: #8ef0b3; box-shadow: 0 0 0 4px rgba(142,240,179,.14); }
.sync-dot.busy { background: #ffe08a; }
.sync-dot.bad { background: #ff9b9f; }

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav button {
  min-height: 58px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}
.nav button span { margin-right: 6px; font-size: .85rem; }
.nav button.active { color: var(--navy); border-bottom-color: var(--purple); }

main { width: min(1120px, 100%); margin: auto; padding: 16px 12px 76px; }
h1, h2, h3, p { overflow-wrap: anywhere; }

.hero {
  background: var(--surface);
  border: 1px solid rgba(112, 107, 165, .14);
  border-radius: 26px;
  box-shadow: 0 20px 54px rgba(49, 48, 94, .11);
  padding: 20px;
  margin-bottom: 14px;
}
.visual-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .7fr);
  gap: 20px;
  align-items: center;
  background:
    radial-gradient(circle at 95% 10%, rgba(141,108,232,.13), transparent 30%),
    radial-gradient(circle at 5% 95%, rgba(42,161,152,.12), transparent 34%),
    #fff;
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero h2 { margin: 0; color: var(--navy); font-size: clamp(1.25rem, 4vw, 1.8rem); letter-spacing: -.03em; }
.hero .eyebrow { color: var(--purple); }
.days-pill {
  flex: 0 0 auto;
  background: var(--soft-purple);
  color: #6048b2;
  border-radius: 999px;
  padding: 8px 11px;
  font-weight: 900;
  font-size: .8rem;
}
.balance { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.balance-label { color: var(--muted); font-size: .84rem; font-weight: 850; }
.balance-value { margin-top: 4px; font-size: clamp(2.25rem, 8vw, 4rem); line-height: 1; font-weight: 950; color: var(--green); letter-spacing: -.055em; }
.balance-value.negative, .negative-text { color: var(--red) !important; }
.positive-text { color: #27955d !important; }
.balance-note { margin-top: 9px; color: var(--muted); font-size: .84rem; line-height: 1.45; max-width: 650px; }

.hero-ring { display: grid; place-items: center; gap: 12px; }
.budget-ring {
  --used-end: 30%;
  --reserved-end: 75%;
  width: min(230px, 62vw);
  aspect-ratio: 1;
  padding: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(
    var(--coral) 0 var(--used-end),
    var(--purple) var(--used-end) var(--reserved-end),
    #78d2aa var(--reserved-end) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.8), 0 14px 36px rgba(71,61,133,.14);
}
.ring-hole {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 12px;
}
.ring-hole strong { color: var(--navy); font-size: clamp(1.55rem, 6vw, 2.2rem); line-height: 1; }
.ring-hole span { color: var(--muted); font-size: .75rem; font-weight: 800; margin-top: 5px; }
.ring-legend { display: grid; gap: 5px; width: min(250px, 100%); }
.ring-legend span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; font-weight: 800; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-dot.used { background: var(--coral); }
.legend-dot.reserved { background: var(--purple); }
.legend-dot.free { background: #78d2aa; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.kpi {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 14px;
  box-shadow: 0 7px 22px rgba(38, 44, 76, .05);
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--blue); }
.kpi.accent-green::before { background: var(--green); }
.kpi.accent-coral::before { background: var(--coral); }
.kpi.accent-purple::before { background: var(--purple); }
.kpi-label { color: var(--muted); font-size: .73rem; font-weight: 850; }
.kpi-value { margin-top: 4px; color: var(--navy); font-size: clamp(1rem, 3vw, 1.35rem); font-weight: 950; letter-spacing: -.025em; }
.kpi-sub { margin-top: 3px; color: var(--muted); font-size: .7rem; line-height: 1.35; }


.kiwisaver-strip {
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr);
  gap: 14px;
  align-items: center;
  margin: -2px 0 14px;
  padding: 12px 14px;
  border: 1px solid #d8d0f5;
  border-radius: 16px;
  background: linear-gradient(135deg, #f4f1ff, #fbfaff);
}
.kiwisaver-strip > div { display: grid; gap: 2px; }
.kiwisaver-strip span { color: var(--muted); font-size: .69rem; font-weight: 850; }
.kiwisaver-strip strong { color: #6048b2; font-size: .98rem; }
.kiwisaver-strip p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.4; text-align: right; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 17px;
  margin-bottom: 14px;
}
.card h2, .card h3 { color: var(--navy); margin: 0; }
.card h2 { font-size: clamp(1.25rem, 4vw, 1.65rem); }
.card h3 { font-size: 1.05rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.card-head p { margin: 3px 0 0; }
.card-head > strong { color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: .8rem; line-height: 1.45; }

.quick-card { border-top: 5px solid var(--blue); }
.speed-badge { background: var(--soft-blue); color: #3d5fb8; border-radius: 999px; padding: 7px 10px; font-size: .73rem; font-weight: 900; }
.quick-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 13px; }
.quick-type {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  border-radius: 13px;
  min-height: 45px;
  font-weight: 900;
}
.quick-type.expense.active { background: var(--soft-coral); color: #b94734; border-color: #f0b8aa; }
.quick-type.income.active { background: var(--soft-green); color: #247a50; border-color: #a8dfc0; }
.quick-type.savings.active { background: var(--soft-purple); color: #6048b2; border-color: #c9bff2; }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick-grid { grid-template-columns: .8fr 1fr 1.4fr .9fr; }
.amount-first input { font-size: 1.15rem; font-weight: 950; background: #fff9ec; border-color: #e6c76e; }
label { display: grid; gap: 5px; color: var(--navy); font-weight: 850; font-size: .8rem; }
.optional { color: var(--muted); font-weight: 700; font-size: .67rem; }
input, select {
  width: 100%;
  min-height: 45px;
  padding: 10px 11px;
  border: 1px solid #bcc4d2;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 3px solid rgba(78,123,242,.16); border-color: var(--blue); }
input[type="color"] { padding: 3px; min-height: 45px; }

.btn {
  border: 0;
  border-radius: 11px;
  min-height: 44px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--navy), #4e62bd);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(53,72,140,.18);
}
.btn.secondary { color: #3f3690; background: var(--soft-purple); box-shadow: none; }
.btn.ghost { color: var(--navy); background: #fff; border: 1px solid var(--line); box-shadow: none; }
.btn.danger { color: #b33b43; background: var(--soft-red); box-shadow: none; }
.btn.small-btn { min-height: 35px; padding: 6px 10px; font-size: .75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.visual-grid, .two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.visual-card { min-width: 0; }
.category-bars { display: grid; gap: 13px; }
.category-line { min-width: 0; }
.category-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .79rem; }
.category-label span { min-width: 0; display: flex; align-items: center; gap: 7px; font-weight: 850; color: var(--ink); }
.category-label i { --category: var(--blue); width: 10px; height: 10px; flex: 0 0 auto; border-radius: 3px; background: var(--category); }
.category-label strong { color: var(--navy); white-space: nowrap; }
.bar-track { height: 10px; margin-top: 7px; border-radius: 999px; background: #edf0f5; overflow: hidden; }
.bar-track span { --category: var(--blue); display: block; height: 100%; border-radius: inherit; background: var(--category); min-width: 2px; }
.category-line.over .bar-track { box-shadow: inset 0 0 0 1px #f0a8ab; }
.category-line.over .bar-track span { background: var(--red); }
.category-meta { margin-top: 5px; color: var(--muted); font-size: .7rem; }
.category-line.over .category-meta { color: var(--red); font-weight: 800; }

.line-chart { width: 100%; height: 220px; color: var(--blue); background: linear-gradient(180deg, #f7f9ff, #fff); border: 1px solid #e6e9f3; border-radius: 14px; overflow: hidden; }
.line-chart.chart-negative { color: var(--red); }
.line-chart svg { width: 100%; height: 100%; display: block; }
.line-chart polyline { stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.line-chart .zero-line { stroke: #d8dce8; stroke-width: 1; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .68rem; font-weight: 800; margin-top: 5px; }
.chart-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.chart-stats span { border-radius: 11px; padding: 9px 10px; text-align: center; font-size: .78rem; font-weight: 900; }
.chart-stats .positive { color: #247a50; background: var(--soft-green); }
.chart-stats .negative { color: #b94734; background: var(--soft-coral); }
.chart-note { margin: 9px 0 0; }

.list { display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e6e8ef;
  border-radius: 13px;
  padding: 10px;
  background: #fff;
}
.compact-row { grid-template-columns: 11px minmax(0, 1fr) auto; }
.row-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.row-dot.expense, .row-dot.bill { background: var(--coral); }
.row-dot.income, .row-dot.incomePlan { background: var(--green); }
.row-dot.savings { background: var(--purple); }
.row-dot.spendingPlan { background: var(--gold); }
.row-main { min-width: 0; }
.row-title { font-weight: 900; color: var(--ink); overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: .74rem; margin-top: 2px; }
.row-amount { font-weight: 950; color: var(--navy); white-space: nowrap; }
.icon-btn {
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 10px;
  background: var(--soft-red);
  color: var(--red);
  font-size: 1.1rem;
  font-weight: 950;
  box-shadow: none;
}
.empty { margin: 0; text-align: center; color: var(--muted); padding: 20px 12px; background: #f7f7fb; border-radius: 12px; }

.forecast-hero { padding-bottom: 13px; }
.forecast-hero .eyebrow { color: var(--purple); }
.segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 4px 0 15px; }
.segment button { min-height: 43px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--navy); font-weight: 900; }
.segment button.active { background: linear-gradient(135deg, #4e62bd, var(--purple)); color: #fff; border-color: transparent; }
.projection-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 11px; }
.projection-head > div { background: #f7f7fb; border: 1px solid #e7e7f0; border-radius: 14px; padding: 12px; }
.projection-head span, .projection-head small { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; }
.projection-head strong { display: block; color: var(--navy); font-size: clamp(1.2rem, 4vw, 1.75rem); margin: 2px 0; }
.forecast-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.forecast-card { border-radius: 15px; padding: 12px; background: #fff; border: 1px solid var(--line); min-width: 0; }
.forecast-card.income { background: var(--soft-green); }
.forecast-card.bill { background: var(--soft-coral); }
.forecast-card.everyday { background: #fff8e5; }
.forecast-card.savings { background: var(--soft-purple); }
.forecast-card.result { background: #e5f8ef; }
.forecast-card.result.bad { background: var(--soft-red); }
.forecast-card .label { color: var(--muted); font-size: .69rem; font-weight: 850; }
.forecast-card .value { margin-top: 4px; color: var(--navy); font-size: 1.05rem; font-weight: 950; overflow-wrap: anywhere; }
.forecast-card.result.bad .value { color: var(--red); }
.more-events { margin-top: 10px; }
.more-events summary { color: var(--navy); font-weight: 900; cursor: pointer; padding: 9px; background: var(--soft-blue); border-radius: 10px; }
.more-events .list { margin-top: 9px; }

.setup-intro { padding: 8px 5px 14px; }
.setup-intro .eyebrow { color: var(--purple); }
.setup-intro h2 { margin: 0; color: var(--navy); font-size: clamp(1.45rem, 5vw, 2rem); }
.setup-intro p:last-child { margin: 6px 0 0; color: var(--muted); }
.setup-card { padding: 0; overflow: hidden; }
.setup-card details > summary { list-style: none; cursor: pointer; padding: 17px; }
.setup-card details > summary::-webkit-details-marker { display: none; }
.setup-card details > summary > span { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; align-items: center; }
.setup-card details > summary b { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--soft-purple); color: #6048b2; }
.setup-card details > summary strong { color: var(--navy); }
.setup-card details > summary small { color: var(--muted); font-size: .73rem; margin-top: 2px; }
.setup-card details > summary::after { content: "+"; float: right; margin-top: -32px; color: var(--purple); font-size: 1.2rem; font-weight: 900; }
.setup-card details[open] > summary::after { content: "−"; }
.details-body { border-top: 1px solid var(--line); padding: 16px; background: #fdfdff; }
.editor-list { display: grid; gap: 11px; }
.editor-block { border: 1px solid var(--line); border-radius: 15px; padding: 12px; background: #fff; }
.primary-editor { border-color: #c8c0ef; box-shadow: inset 4px 0 0 var(--purple); }
.editor-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--navy); }
.primary-badge { background: var(--soft-purple); color: #6048b2; border-radius: 999px; padding: 5px 8px; font-size: .68rem; font-weight: 900; }
.income-fields { display: grid; grid-template-columns: 1.3fr .8fr .8fr 1fr .8fr .8fr; gap: 8px; }
.bill-fields { display: grid; grid-template-columns: 1.25fr .8fr .7fr .8fr .95fr; gap: 8px; }
.check-label { display: flex; align-items: center; grid-template-columns: auto 1fr; gap: 8px; margin-top: 10px; color: var(--ink); }
.check-label input { width: 18px; min-height: 18px; accent-color: var(--purple); }
.editor-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.category-editor-list { display: grid; gap: 8px; }
.category-editor { display: grid; grid-template-columns: 48px minmax(140px, 1.2fr) minmax(120px, .8fr) auto 35px; gap: 8px; align-items: end; border: 1px solid var(--line); border-radius: 13px; padding: 9px; background: #fff; }
.colour-input { border-radius: 10px; }
.single-setting { grid-template-columns: minmax(200px, 340px); }
.cloud-note { margin-top: 16px; }

.notice { border-left: 4px solid var(--teal); border-radius: 12px; padding: 11px 12px; background: var(--soft-teal); color: #344054; margin-bottom: 12px; line-height: 1.45; }
.notice.warn { border-left-color: var(--gold); background: #fff7df; }
.notice.error { border-left-color: var(--red); background: var(--soft-red); color: #7a271a; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 15% 10%, rgba(78,123,242,.2), transparent 30%),
    radial-gradient(circle at 90% 85%, rgba(141,108,232,.22), transparent 34%),
    #f5f5fb;
}
.login-card { width: min(430px, 100%); border-radius: 25px; background: #fff; box-shadow: 0 26px 80px rgba(43,42,90,.17); padding: 25px; border: 1px solid #e5e4ef; }
.login-mark { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; font-size: 1.7rem; font-weight: 950; margin-bottom: 16px; }
.login-card .brand-kicker { color: var(--purple); }
.login-card h1 { margin: 0; color: var(--navy); font-size: 1.75rem; }
.login-card p { color: var(--muted); line-height: 1.5; }
.login-card form { display: grid; gap: 11px; margin-top: 18px; }
.login-card input { text-align: center; letter-spacing: .18em; font-size: 1.15rem; font-weight: 950; }
.config-code { display: block; background: #20263a; color: #f0f2fb; border-radius: 10px; padding: 11px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; margin-bottom: 13px; }

.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 100; pointer-events: none; opacity: 0; background: #20263a; color: #fff; border-radius: 999px; padding: 10px 15px; font-size: .8rem; font-weight: 850; transition: .2s ease; box-shadow: 0 9px 30px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .visual-hero { grid-template-columns: 1fr minmax(230px, .55fr); }
  .forecast-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .income-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .visual-hero { grid-template-columns: 1fr; }
  .hero-ring { grid-template-columns: auto minmax(150px, 1fr); justify-content: center; }
  .budget-ring { width: min(190px, 48vw); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kiwisaver-strip { grid-template-columns: 1fr 1fr; }
  .kiwisaver-strip p { grid-column: 1 / -1; text-align: left; }
  .visual-grid, .two-column { grid-template-columns: 1fr; }
  .quick-grid, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bill-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bill-fields label:first-child { grid-column: span 2; }
  .category-editor { grid-template-columns: 45px minmax(0, 1fr) minmax(110px, .7fr) auto 35px; }
}

@media (max-width: 600px) {
  body { padding-bottom: 68px; }
  .topbar { padding-bottom: 14px; }
  .topbar-inner { align-items: flex-start; flex-direction: column; gap: 11px; }
  .sync { font-size: .73rem; padding: 6px 9px; }
  .nav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -8px 28px rgba(37,40,70,.1);
  }
  .nav button { min-height: 59px; border-bottom: 0; border-top: 3px solid transparent; font-size: .74rem; }
  .nav button span { display: block; margin: 0 auto 2px; font-size: .95rem; }
  .nav button.active { border-top-color: var(--purple); }
  main { padding: 11px 9px 28px; }
  .hero, .card { border-radius: 17px; padding: 14px; }
  .hero-top { display: grid; }
  .days-pill { justify-self: start; }
  .hero-ring { grid-template-columns: 1fr; }
  .budget-ring { width: min(185px, 58vw); }
  .ring-legend { width: min(260px, 100%); }
  .balance-value { font-size: clamp(2.15rem, 13vw, 3.25rem); }
  .kpis { gap: 8px; }
  .kiwisaver-strip { grid-template-columns: 1fr; gap: 8px; padding: 11px 12px; }
  .kiwisaver-strip p { grid-column: auto; }
  .kpi { padding: 12px 10px 12px 13px; }
  .quick-types { gap: 6px; }
  .quick-type { font-size: .73rem; padding: 6px; }
  .quick-grid, .form-grid, .income-fields, .bill-fields, .projection-head { grid-template-columns: 1fr; }
  .bill-fields label:first-child { grid-column: auto; }
  .forecast-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .row .icon-btn { grid-column: 3; grid-row: 2; }
  .compact-row { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .category-editor { grid-template-columns: 42px minmax(0, 1fr) 35px; align-items: center; }
  .category-editor label:first-of-type { grid-column: 2; }
  .category-editor label:nth-of-type(2) { grid-column: 1 / span 2; }
  .category-editor .save-category { grid-column: 1 / span 2; }
  .category-editor .delete-category { grid-column: 3; grid-row: 1; }
  .setup-card details > summary { padding: 14px; }
  .details-body { padding: 12px; }
  .line-chart { height: 190px; }
}
