/* Personal Finance — typography follows charity-crowdfund.co.za (Red Hat Display / Red Hat Text / Nunito),
   palette is navy-blue and green. */
:root {
  --navy-900: #061a2e;
  --navy: #0b2a4a;
  --navy-700: #0d3b66;
  --blue: #1f6fd1;
  --blue-600: #1a5db3;
  --blue-pale: #e9f1fc;
  --teal: #14a3a0;
  --teal-pale: #e3f6f5;
  --green: #088a3c;
  --green-600: #07732f;
  --green-500: #12a35a;
  --mint: #b9f3cf;
  --green-pale: #e8f5ee;
  --green-tint: #f0faf4;
  --bg: #f2f6f8;
  --card: #ffffff;
  --line: #e1e9ee;
  --line-soft: #eef3f6;
  --text: #0f2236;
  --muted: #5d6f80;
  --danger: #c0392b;
  --danger-pale: #fdecea;

  --font-display: 'Red Hat Display', system-ui, sans-serif;
  --font-body: 'Red Hat Text', system-ui, sans-serif;
  --font-num: 'Nunito', system-ui, sans-serif;

  --radius: 12px;
  --radius-lg: 18px;
  --card-shadow: 0 1px 2px rgba(11, 42, 74, .04), 0 8px 24px rgba(11, 42, 74, .05);
  --card-hover: 0 2px 4px rgba(11, 42, 74, .05), 0 18px 40px rgba(11, 42, 74, .10);
  --sidebar-w: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; color: var(--navy); }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 .75em; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-600); }
small { font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.ic { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; color: var(--text); }
.block { display: block; }
.pos { color: var(--green); }
.neg { color: var(--danger) !important; }
.spacer { flex: 1; }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.stack { display: grid; gap: 14px; }
:focus-visible { outline: 3px solid rgba(31, 111, 209, .35); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- shell */
body.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  background: linear-gradient(170deg, var(--navy) 0%, var(--navy-900) 100%);
  color: #cfdbe7;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1.1; letter-spacing: -.01em; }
.brand:hover { color: #fff; }
.sidebar .brand { padding: 4px 10px 22px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #1f6fd1 0%, #128c74 55%, #12a35a 100%);
  box-shadow: 0 6px 16px rgba(18, 163, 90, .25);
}
.brand-mark svg { width: 26px; height: 26px; }
.nav { display: grid; gap: 4px; }
.nav a, .sidebar-foot a, .sidebar-foot button {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #cfdbe7; font-family: var(--font-display); font-weight: 600; font-size: 15px;
  background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover, .sidebar-foot a:hover, .sidebar-foot button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active, .sidebar-foot a.active { background: rgba(255, 255, 255, .10); color: #fff; box-shadow: inset 3px 0 0 #34c26b; }
.nav a.active .ic, .sidebar-foot a.active .ic { color: #6fe0a0; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 2px; }
.sidebar-foot form { margin: 0; }
.topbar { display: none; }
.scrim { display: none; }

.main { padding: 32px clamp(16px, 3vw, 40px) 64px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- cards & grids */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow); padding: 20px 22px; margin-bottom: 20px; min-width: 0;
}
.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 10px; }
.card-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card.empty { text-align: center; padding: 44px 24px; }
.card.empty h2 { margin-bottom: 6px; }
.card.empty p { color: var(--muted); }
.grid { display: grid; gap: 20px; }
.grid > .card, .grid > aside > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .stats + .card, .stats + .grid, .card + .grid { margin-top: 0; }
.grid { margin-bottom: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two-one { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid.two-one > aside { display: grid; gap: 20px; align-content: start; }
.hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.hero-grid .stats { margin: 0; }
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow); padding: 16px 18px 16px 20px;
}
.stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--blue); }
.stat.green::before { background: var(--green-500); }
.stat.navy::before { background: var(--navy-700); }
.stat.teal::before { background: var(--teal); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-family: var(--font-num); font-weight: 800; font-size: 25px; letter-spacing: -.01em; color: var(--navy); margin: 2px 0 4px; white-space: nowrap; }
.stat-foot { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat-foot .progress { width: 100%; margin-top: 4px; }

.chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 6px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.chip.up { background: var(--green-pale); color: var(--green-600); }
.chip.down { background: var(--danger-pale); color: var(--danger); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--blue-pale); color: var(--blue-600); vertical-align: middle; font-family: var(--font-body); }
.tag.green { background: var(--green-pale); color: var(--green-600); }
.tag.red { background: var(--danger-pale); color: var(--danger); }

/* hero */
.hero {
  display: flex; flex-direction: column; gap: 18px; margin: 0;
  color: #e6f0fa; border: 0;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(52, 194, 107, .35) 0%, rgba(52, 194, 107, 0) 55%),
    linear-gradient(150deg, var(--navy-700) 0%, #0f5f8c 55%, #0f8b6a 100%);
  box-shadow: 0 18px 40px rgba(11, 42, 74, .18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.hero:hover { color: #e6f0fa; transform: translateY(-1px); box-shadow: 0 22px 48px rgba(11, 42, 74, .24); }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; }
.hero-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; opacity: .8; }
.hero-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hero-figures span { display: block; font-size: 13px; opacity: .8; }
.hero-figures strong { display: block; font-family: var(--font-num); font-weight: 800; font-size: clamp(20px, 2.4vw, 28px); color: #fff; white-space: nowrap; }
.hero-figures strong.neg { color: #ffc2bb !important; }
.hero-progress-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; opacity: .9; }
.hero-foot { font-size: 13.5px; opacity: .9; }
.hero-foot strong { color: #fff; font-family: var(--font-num); }
.hero-foot strong.neg { color: #ffc2bb !important; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 20px; border-radius: var(--radius);
  background: var(--green-tint); border: 1px solid #cdeedb; color: var(--green-600);
}
.banner form { margin: 0; }

/* progress */
.progress { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue) 0%, var(--green-500) 100%); transition: width .3s ease; }
.progress.done span { background: var(--green-500); }
.progress.light { background: rgba(255, 255, 255, .18); }
.progress.light span { background: linear-gradient(90deg, #8fd0ff 0%, #6fe0a0 100%); }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.mini-progress .progress { flex: 1; height: 6px; }
.mini-progress span:last-child { font-size: 12.5px; color: var(--muted); width: 34px; text-align: right; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--green); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(8, 138, 60, .18);
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--green-600); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 12px; font-size: 13px; gap: 6px; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--line-soft); color: var(--navy); }
.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-pale); }
.btn.icon-only { padding: 9px; }
.btn.disabled { opacity: .4; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--navy); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--navy); }
.field > span small { font-weight: 500; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #cfdbe3; background: #fff;
  font: inherit; color: var(--text); transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 111, 209, .15); }
textarea { resize: vertical; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 160px; }
.field-row > .field.grow { flex: 2 1 240px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 38px; height: 22px; border-radius: 999px; background: #cfdbe3; position: relative; flex: none; transition: background .15s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s ease; }
.switch input:checked + span { background: var(--green-500); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid rgba(31, 111, 209, .35); outline-offset: 2px; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--line-soft); gap: 2px; justify-self: start; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 14px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(11, 42, 74, .12); }
.seg input:focus-visible + span { outline: 3px solid rgba(31, 111, 209, .35); }
.form-actions, .dialog-actions { display: flex; flex-direction: row-reverse; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-actions form, .dialog-actions form { margin: 0; }

/* ---------------------------------------------------------------- dialogs */
.dialog {
  border: 0; padding: 0; border-radius: 20px; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(6, 26, 46, .35); color: var(--text);
}
.dialog.wide { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(6, 26, 46, .45); backdrop-filter: blur(2px); }
.dialog-body { display: grid; gap: 14px; padding: 22px 24px 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin: -4px -8px 2px 0; }
.dialog p { margin: 0; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 2px solid var(--line); font-weight: 700; padding-top: 12px; color: var(--navy); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num small { color: inherit; opacity: .75; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--green-tint); }
.table.compact td { padding: 8px 6px; }
.table .note-row td { padding-top: 0; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line-soft); }
.table tr:has(+ .note-row) td { border-bottom: 0; }
.neg-row td { color: var(--danger); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gl { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font-body); }
.chart .dot { transition: r .12s ease; cursor: default; }
.chart .dot:hover { r: 6; }
.chart rect:hover { opacity: .85; }
.chart .marker { stroke: var(--navy); stroke-width: 2.5; stroke-linecap: round; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; width: 14px; border-radius: 2px; }
.split-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 4px 0 6px; background: var(--line-soft); }
.split-bar span { display: block; height: 100%; min-width: 3px; }

/* ---------------------------------------------------------------- checklist & lines */
.check { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid #c3d2dc; flex: none;
  display: grid; place-items: center; color: transparent; background: #fff;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.check:hover .box { border-color: var(--green-500); }
.check input:checked + .box { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.check input:focus-visible + .box { outline: 3px solid rgba(31, 111, 209, .35); outline-offset: 2px; }
.check-text { display: grid; min-width: 0; }
.check-text small { color: var(--muted); }
.checklist { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.checklist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line-soft); transition: opacity .25s ease; }
.checklist li:last-child { border-bottom: 0; }
.checklist li.is-paid { opacity: .45; }
.checklist li.is-paid .check-text { text-decoration: line-through; }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.empty-inline { display: flex; align-items: center; gap: 8px; color: var(--green); margin: 8px 0; }

/* ---------------------------------------------------------------- budget page */
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.summary-item {
  display: grid; gap: 1px; padding: 14px 16px; border-radius: var(--radius); background: #fff;
  border: 1px solid var(--line); box-shadow: var(--card-shadow); color: var(--text);
}
a.summary-item:hover { color: var(--text); border-color: #c9d8e2; }
.summary-item i { width: 24px; height: 4px; border-radius: 4px; display: block; margin-bottom: 8px; }
.summary-item span { font-size: 13px; color: var(--muted); font-weight: 600; }
.summary-item strong { font-family: var(--font-num); font-weight: 800; font-size: 20px; color: var(--navy); white-space: nowrap; }
.summary-item small { color: var(--muted); }
.summary-item.total { background: linear-gradient(150deg, var(--green-tint), #e7f2fd); border-color: #cfe6dc; }
.summary-item.total i { background: linear-gradient(90deg, var(--blue), var(--green-500)); }
.summary-item.total.neg strong { color: var(--danger); }

.budget-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.budget-side { position: sticky; top: 20px; }
.section-card { padding-bottom: 12px; scroll-margin-top: 20px; }
.dot-lg { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sec-total { font-family: var(--font-num); font-weight: 800; font-size: 17px; color: var(--navy); white-space: nowrap; }
.lines { display: grid; }
.line-group { display: flex; justify-content: space-between; padding: 12px 4px 6px 40px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
.line { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 32px; align-items: center; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--line-soft); transition: background .15s ease; }
.line:hover { background: var(--green-tint); border-radius: 8px; }
.line-desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.line.is-paid .line-desc, .line.is-paid .amt { color: var(--muted); }
.line.is-paid .line-name { text-decoration: line-through; text-decoration-color: rgba(93, 111, 128, .5); }
.check-spacer { width: 22px; }
.add-line {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--blue); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
.add-line:hover { background: var(--blue-pale); }
.tracker h2 { margin-bottom: 12px; }
.kv { margin: 0; display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.kv .kv-total { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 700; }
.kv .kv-total dt { color: var(--navy); }
.kv .excluded { opacity: .55; }
.tracker-progress { margin: 14px 0 18px; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.tracker-form { display: grid; gap: 12px; }
.after { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--green-tint); border: 1px solid #cdeedb; }
.after span { font-size: 13px; color: var(--green-600); font-weight: 600; }
.after strong { font-family: var(--font-num); font-weight: 800; font-size: 22px; color: var(--green-600); }
.after.neg { background: var(--danger-pale); border-color: #f5c6c0; }
.after.neg span, .after.neg strong { color: var(--danger); }

.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.scenario { display: grid; gap: 2px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(160deg, #fff, var(--bg)); color: var(--muted); font-size: 13.5px; transition: box-shadow .15s ease, transform .15s ease; }
.scenario:hover { box-shadow: var(--card-hover); transform: translateY(-1px); color: var(--muted); }
.scenario strong { font-family: var(--font-display); font-size: 16px; color: var(--navy); margin-bottom: 4px; }

/* ---------------------------------------------------------------- net worth */
.breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.breakdown-col h3 { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 2px solid var(--line); margin-bottom: 4px; }
.breakdown-col h3 span { font-family: var(--font-num); font-weight: 800; }
.breakdown-col ul { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.breakdown-col li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.breakdown-col li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.snapshot-form { display: grid; gap: 18px; }
.entry-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 10px; margin: 0; }
.entry-group legend { font-family: var(--font-display); font-weight: 700; color: var(--navy); padding: 0 6px; }
.entry-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
.snapshot-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-radius: var(--radius); background: linear-gradient(150deg, var(--navy-700), #0f8b6a); color: #fff; }
.snapshot-total strong { font-family: var(--font-num); font-size: 26px; font-weight: 800; }

/* ---------------------------------------------------------------- liabilities, zakaat, goals */
.extra-form label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.extra-form input { width: 110px; padding: 6px 10px; }
.prime-form { display: grid; gap: 12px; margin-bottom: 10px; }
.settled { list-style: none; margin: 0; padding: 0; }
.settled li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.settled li span { display: inline-flex; align-items: center; gap: 8px; }
.settled .ic { color: var(--green-500); }
.zakaat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.zakaat-grid .card { margin: 0; display: grid; gap: 12px; align-content: start; }
.zakaat-grid .card-head { margin-bottom: 0; }
.calc-preview { padding: 12px 14px; border-radius: var(--radius); background: var(--green-tint); color: var(--green-600); font-size: 14px; }
.calc-preview strong { font-family: var(--font-num); }
.milestones { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.milestone { padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); display: grid; gap: 10px; }
.milestone.hit { background: var(--green-tint); border-color: #cdeedb; }
.milestone-top { display: grid; grid-template-columns: 36px minmax(0, 1fr) 30px; gap: 10px; align-items: start; }
.milestone-badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-pale); color: var(--blue); }
.milestone.hit .milestone-badge { background: var(--green-500); color: #fff; }
.milestone-top strong { font-family: var(--font-display); color: var(--navy); }
.milestone-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.goal { padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
.goal.hit { background: var(--green-tint); }
.goal-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-top strong { font-family: var(--font-display); color: var(--navy); }

/* ---------------------------------------------------------------- banking */
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--line-soft); padding: 2px 6px; border-radius: 6px; }
.mt { margin-top: 18px; margin-bottom: 6px; }
.hint { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; font-size: 12.5px; color: var(--green-600); }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.link-btn:hover { color: var(--blue-600); text-decoration: underline; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 20px; }
.acct {
  position: relative; display: grid; gap: 2px; padding: 18px 20px; border-radius: var(--radius-lg);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--card-shadow);
}
.acct.primary {
  color: #e6f0fa; border: 0;
  background: radial-gradient(120% 140% at 100% 0%, rgba(52, 194, 107, .35) 0%, rgba(52, 194, 107, 0) 55%), linear-gradient(150deg, var(--navy-700) 0%, #0f5f8c 60%, #0f8b6a 100%);
}
.acct-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acct-name { font-family: var(--font-display); font-weight: 700; color: var(--navy); }
.acct.primary .acct-name { color: #fff; }
.acct-meta { font-size: 12.5px; color: var(--muted); }
.acct.primary .acct-meta, .acct.primary .acct-foot { color: rgba(230, 240, 250, .8); }
.acct-bal { font-family: var(--font-num); font-weight: 800; font-size: 26px; color: var(--navy); margin-top: 8px; white-space: nowrap; }
.acct.primary .acct-bal { color: #fff; }
.acct-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.acct-action { margin: 6px 0 0; }
.tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; font-family: var(--font-display); font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--green-500); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 18px; }
.filters .field { flex: 1 1 150px; }
.filters .field.grow { flex: 2 1 220px; }
.filters-total { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters-total span { color: var(--muted); font-size: 13px; }
.filters-total strong { font-family: var(--font-num); font-weight: 800; font-size: 22px; color: var(--navy); }
input[type=search] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #cfdbe3; background: #fff; font: inherit; color: var(--text); }

.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li { border-bottom: 1px solid var(--line-soft); }
.tx-list li:last-child { border-bottom: 0; }
.tx {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%;
  padding: 10px 6px; border: 0; background: none; text-align: left; font: inherit; color: inherit; border-radius: 10px;
}
button.tx { cursor: pointer; }
button.tx:hover { background: var(--green-tint); }
.tx-date { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--blue-pale); color: var(--blue-600); font-size: 11px; font-weight: 700; text-transform: uppercase; line-height: 1.05; }
.tx-date strong { font-family: var(--font-num); font-size: 17px; color: var(--navy); }
.tx-main { display: grid; gap: 4px; min-width: 0; }
.tx-desc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.cat-chip { padding: 1px 8px; border-radius: 999px; background: var(--line-soft); color: var(--navy); font-weight: 600; }
.line-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--green-pale); color: var(--green-600); font-weight: 600; }
.tx-amt { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; color: var(--navy); }
.tx-list.compact .tx { padding: 8px 2px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pager a { min-width: 34px; padding: 6px 10px; text-align: center; border-radius: 8px; border: 1px solid var(--line); color: var(--navy); font-weight: 600; }
.pager a.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.cat-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cat-bar { display: grid; grid-template-columns: minmax(110px, 1.1fr) 2fr auto; gap: 12px; align-items: center; padding: 7px 6px; border-radius: 8px; color: var(--text); }
.cat-bar:hover { background: var(--green-tint); color: var(--text); }
.cat-name { display: grid; font-weight: 600; font-size: 14px; }
.cat-name small { font-weight: 500; color: var(--muted); }
.cat-track { height: 10px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.cat-track span { display: block; height: 100%; border-radius: inherit; }
.cat-amt { display: grid; justify-items: end; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.cat-amt small { font-weight: 600; }

.match-card { border-color: #cfe6dc; background: linear-gradient(160deg, #fff 0%, var(--green-tint) 100%); }
.match-card h2 .ic { color: var(--green-500); }
.matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.matches li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.match-pair { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1.2fr); gap: 12px; align-items: center; flex: 1 1 420px; min-width: 0; }
.match-pair strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-pair small { color: var(--muted); }
.match-arrow { color: var(--muted); }
.match-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.switch.sm { font-size: 12.5px; gap: 6px; color: var(--muted); }
.switch.sm span { width: 30px; height: 18px; }
.switch.sm span::after { width: 12px; height: 12px; }
.switch.sm input:checked + span::after { transform: translateX(12px); }
.bank-chip { display: flex; width: fit-content; align-items: center; gap: 4px; margin-top: 3px; padding: 1px 4px 1px 8px; border-radius: 999px; background: var(--green-pale); color: var(--green-600); font-size: 11.5px; font-weight: 600; text-decoration: none; }
.bank-chip.over { background: #fff4e5; color: #a35c00; }
.bank-chip form { margin: 0; }
.chip-x { display: grid; place-items: center; width: 16px; height: 16px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; opacity: .6; padding: 0; }
.chip-x:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

/* ---------------------------------------------------------------- flash */
.flash { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 500; }
.flash-success { background: var(--green-pale); color: var(--green-600); border: 1px solid #cdeedb; }
.flash-info { background: var(--blue-pale); color: var(--blue-600); border: 1px solid #cfe0f6; }
.flash-error { background: var(--danger-pale); color: var(--danger); border: 1px solid #f5c6c0; }
.flash-x { border: 0; background: none; color: inherit; cursor: pointer; opacity: .6; display: grid; place-items: center; padding: 2px; }
.flash-x:hover { opacity: 1; }

/* ---------------------------------------------------------------- auth */
body.bare { min-height: 100vh; background: #fff; }
.auth-main { min-height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden; display: flex; align-items: center; padding: 48px clamp(24px, 6vw, 80px);
  background:
    radial-gradient(90% 80% at 100% 0%, rgba(52, 194, 107, .35) 0%, rgba(52, 194, 107, 0) 60%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-700) 50%, #0f6f6a 100%);
  color: #cfe0ee;
}
.auth-art-inner { max-width: 440px; display: grid; gap: 18px; }
.auth-art h2 { color: #fff; font-size: clamp(32px, 4vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 30px; }
.auth-art p { font-size: 17px; line-height: 1.55; }
.auth-chart { width: 100%; max-width: 380px; margin-top: 18px; }
.auth-panel { display: grid; place-items: center; padding: 40px 16px; }
.auth-form { width: min(380px, 100%); display: grid; gap: 16px; }
.auth-form .sub { color: var(--muted); margin: -8px 0 6px; }
.auth-form .btn { padding: 13px 18px; font-size: 16px; margin-top: 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .budget-layout { grid-template-columns: minmax(0, 1fr); }
  .budget-side { position: static; }
  .hero-grid, .grid.two, .grid.two-one { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  body.shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); z-index: 40;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0, 0, 0, .3);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(6, 26, 46, .45); z-index: 30; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    padding: 10px 12px; background: var(--navy); color: #fff;
  }
  .topbar .icon-btn { color: #fff; }
  .topbar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .topbar .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .topbar .brand-mark svg { width: 21px; height: 21px; }
  .main { padding: 22px 16px 48px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 24px; min-height: 0; }
  .auth-art h2 { margin-top: 12px; font-size: 30px; }
  .auth-art p, .auth-chart { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .stats.three { grid-template-columns: 1fr 1fr; }
  .match-pair { grid-template-columns: minmax(0, 1fr); gap: 4px; flex-basis: 100%; }
  .match-arrow { display: none; }
  .cat-bar { grid-template-columns: minmax(90px, 1fr) 1fr auto; gap: 8px; }
  .tx { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  .card { padding: 16px; border-radius: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .stats, .stats.four { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat { padding: 12px 12px 12px 16px; }
  .stat-value { font-size: 19px; }
  .hero-figures { grid-template-columns: 1fr 1fr; }
  .hero-figures > div:last-child { grid-column: 1 / -1; }
  .hide-sm { display: none; }
  .breakdown { grid-template-columns: minmax(0, 1fr); }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .entry-row { grid-template-columns: minmax(0, 1fr) 120px 30px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .line { grid-template-columns: 26px minmax(0, 1fr) auto 30px; gap: 8px; }
  .line-group { padding-left: 34px; }
  .page-actions .btn span { display: none; }
  .page-actions .btn { padding: 9px; }
  .dialog-body { padding: 18px; }
}
@media (max-width: 400px) {
  .stats, .stats.four { grid-template-columns: minmax(0, 1fr); }
}
