/* Mijn Budget – stijl */
:root {
  --bg: #F8F2EE; --card: #FFFDFB; --ink: #2F2A2C; --muted: #8E8387; --line: #EFE4DE; --track: #F2E9E4;
  --blush: #F3DEDA; --blush-2: #FBF0ED; --rose: #CB939B; --rose-d: #A3626C; --lav: #B5AAD6; --lav-2: #EFEBF7;
  --beige: #E8DBCE; --sage: #8DB39A; --warn: #DDAE5F; --alert: #DD8A68; --over: #BF4F5A; --pos: #5E8F72;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --tabh: 58px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; overscroll-behavior-y: none; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
body.noscroll { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--rose-d); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
p { margin: .5em 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.neg { color: var(--over) !important; }
.pos { color: var(--pos) !important; }

/* Bovenbalk */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: rgba(248, 242, 238, .9); -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px); }
.topbar h1 { flex: 1; font-size: 30px; line-height: 1.1; }
.topbar #gear svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.6; }
main { max-width: 620px; margin: 0 auto; padding: 4px 16px calc(var(--tabh) + 110px + env(safe-area-inset-bottom)); }

.round { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; font-size: 22px; line-height: 1; padding: 0; }
.round.sm { width: 32px; height: 32px; font-size: 15px; }
.link { background: none; border: 0; padding: 0; color: var(--rose-d); font-weight: 600; font-size: 15px; }
.link.small { font-size: 13px; }

/* Tabbalk en plusknop */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; padding: 6px 4px calc(4px + env(safe-area-inset-bottom)); background: rgba(255, 253, 251, .94); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); background: none; border: 0; padding: 4px 0; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--rose-d); font-weight: 600; }
.tab.active svg { stroke-width: 2; }
.fab { position: fixed; right: 18px; bottom: calc(var(--tabh) + 16px + env(safe-area-inset-bottom)); z-index: 31; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--ink); display: grid; place-items: center; box-shadow: 0 10px 24px rgba(47, 42, 44, .28); }
.fab svg { width: 26px; height: 26px; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.fab:active { transform: scale(.94); }

/* Begroeting en hero */
.greet { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 17px; margin: 2px 2px 12px; }
.hero { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 22px 20px 18px; border-radius: 30px; color: #fff; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #D9A4AB 0%, #C38C9C 45%, #A58EBF 100%); box-shadow: 0 18px 40px -18px rgba(163, 98, 108, .55); }
.hero::after { content: ""; position: absolute; right: -60px; top: -70px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); }
.hero-l { font-size: 14px; opacity: .9; }
.hero-amount { font-family: var(--serif); font-size: clamp(34px, 10vw, 44px); font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 13px; opacity: .92; }
.hero-ring { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 10.5px; line-height: 1.25; opacity: .95; }
.ring text { fill: #fff; font: 600 17px var(--serif); }
.hero-btn { grid-column: 1 / -1; justify-self: start; margin-top: 4px; border: 0; border-radius: 999px; padding: 10px 18px; background: rgba(255, 255, 255, .95); color: var(--rose-d); font-weight: 600; font-size: 15px; }
.banner { display: block; width: 100%; text-align: left; border: 1px solid #EBD3A6; background: #FBF3E3; border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }

/* Maandkeuze */
.monthsel { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 12px; }
.ms-label { font-family: var(--serif); font-size: 20px; font-weight: 600; text-align: center; }
.ms-label .link { display: block; margin: 2px auto 0; font-family: var(--sans); font-weight: 500; }

/* Kaarten */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px; margin-bottom: 12px; }
.card h3 { font-size: 19px; }
.card h4 { font-family: var(--serif); font-size: 17px; margin: 22px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-h.pad { padding: 10px 4px 0; }
.pad { padding: 0 4px; }
.empty { text-align: center; padding: 30px 18px; }
.empty h3 { font-size: 21px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 32ch; margin: 0 auto 14px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 13px 14px; min-width: 0; }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi-v { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 3px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s { font-size: 12px; color: var(--muted); }
.kpi.in { background: var(--lav-2); border-color: #E4DEF1; }
.kpi.out { background: var(--blush-2); border-color: #F2E0DC; }
.kpi.sav { background: #F1F6F2; border-color: #E0ECE3; }
.kpi.neg .kpi-v { color: var(--over); }
.card.net { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.net-v { font-family: var(--serif); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.net-f { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.5; font-variant-numeric: tabular-nums; }

.bar { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; }
.goal-mini { margin: 10px 0 12px; }
.gm-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; margin-bottom: 6px; }

/* Grafieken */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.chart .axis.strong { fill: var(--ink); font-weight: 700; }
.donut-wrap { width: 190px; margin: 4px auto 14px; }
.donut .d-label { fill: var(--muted); font: 12px var(--sans); }
.donut .d-value { fill: var(--ink); font: 600 21px var(--serif); }
.legend { display: flex; gap: 16px; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.toplist { display: flex; flex-direction: column; gap: 12px; }
.tl-row { display: flex; align-items: center; gap: 10px; }
.tl-mid { flex: 1; min-width: 0; }
.tl-name { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 5px; }
.tl-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv { margin: 8px 0 14px; }
.yr-grid, .bsum, .goal-facts, .hilo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.bsum, .goal-facts { grid-template-columns: repeat(3, 1fr); }
.yr-grid > div, .bsum > div, .goal-facts > div, .hilo > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.yr-grid b, .bsum b, .goal-facts b, .hilo b { font-family: var(--serif); font-size: 18px; font-variant-numeric: tabular-nums; }
.hilo { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.hilo b { text-transform: capitalize; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; color: var(--muted); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl td { text-align: right; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tr.cur td { font-weight: 700; }

/* Lijsten */
.list { padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px; background: none; border: 0; text-align: left; border-bottom: 1px solid var(--line); }
.list .row:last-child, .card > .row:last-of-type { border-bottom: 0; }
.card > .row { padding-left: 0; padding-right: 0; }
.row.dim { opacity: .5; }
.row-mid { flex: 1; min-width: 0; }
.row-t { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-t2, .row-s2 { display: flex; justify-content: space-between; gap: 8px; }
.row-t2 { font-size: 15px; margin-bottom: 6px; }
.row-s2 { font-size: 12px; color: var(--muted); margin-top: 5px; }
.row-s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-a { font-family: var(--serif); font-weight: 600; font-size: 16px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-a .row-s { font-family: var(--sans); font-weight: 400; }
.row.budget.warn .state { color: #B7863A; }
.row.budget.alert .state { color: #C2663F; }
.row.budget.over .state { color: var(--over); font-weight: 600; }
.chev { color: var(--muted); font-size: 20px; }
.day { font-size: 12.5px; color: var(--muted); padding: 12px 16px 2px; text-transform: capitalize; }
.sumline { margin: 12px 4px 8px; }
.ci { width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; font-size: 19px; }
.ci.sm { width: 32px; height: 32px; border-radius: 11px; font-size: 16px; }
.ci.xs { width: 24px; height: 24px; border-radius: 8px; font-size: 13px; }
.ci.lg { width: 52px; height: 52px; border-radius: 17px; font-size: 26px; }

/* Historiek */
.search input { width: 100%; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 6px; }
.mini { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }

/* Formulieren */
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; width: 100%; min-height: 44px; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type="date"] { display: block; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(203, 147, 155, .18); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 12px 0; font-size: 13px; color: var(--muted); min-width: 0; }
.field small { font-size: 12px; }
.field-label { font-size: 13px; color: var(--muted); margin: 14px 0 7px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { margin: 6px 0; }
.amount-field { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 4px; padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.amount-field span { font-family: var(--serif); font-size: 28px; color: var(--muted); }
.amount-field input { border: 0; padding: 0; font-family: var(--serif); font-size: 42px; font-weight: 600; background: transparent; box-shadow: none !important; font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--track); border-radius: 14px; padding: 3px; margin: 4px 0 10px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 11px; padding: 8px 6px; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(47, 42, 44, .1); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px 6px 6px; font-size: 14px; }
.chips.small .chip { padding: 6px 12px; font-size: 13px; }
.chip.sel { border-color: var(--rose-d); background: var(--blush-2); color: var(--rose-d); font-weight: 600; }
.chips.icons .chip { padding: 0; width: 42px; height: 42px; justify-content: center; font-size: 21px; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.sw.sel { box-shadow: 0 0 0 2px var(--ink); }
.more { display: block; margin: 12px 0 2px; background: none; border: 0; padding: 4px 0; color: var(--rose-d); font-weight: 600; font-size: 14px; }
.switch { display: flex; width: 100%; align-items: center; justify-content: space-between; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; margin: 12px 0; font-size: 15px; text-align: left; }
.switch i { width: 46px; height: 28px; border-radius: 99px; background: var(--track); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch.on i { background: var(--sage); }
.switch.on i::after { transform: translateX(18px); }
.form-err { color: var(--over); font-size: 14px; min-height: 1px; margin: 8px 0; }
.subs { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.sub-row { display: flex; gap: 8px; align-items: center; }
.cat-preview { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 20px; margin: 4px 0 8px; }

/* Knoppen */
.btn { border: 0; border-radius: 999px; padding: 13px 20px; font-weight: 600; font-size: 16px; min-height: 48px; }
.btn.block { display: block; width: 100%; margin: 10px 0; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.soft { background: var(--blush); color: var(--rose-d); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: var(--over); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--over); border: 1px solid #F0D2D5; }
.btn:disabled { opacity: .4; }
.btn:active { transform: scale(.98); }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

/* Sparen */
.savtop { display: flex; justify-content: space-between; align-items: center; }
.big { font-family: var(--serif); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.big2 { font-family: var(--serif); font-size: 20px; margin: 6px 0 10px; }
.goal-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.goal-ic { font-size: 30px; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: var(--lav-2); }
.goal-amt { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.goal-amt b { font-family: var(--serif); font-size: 24px; font-variant-numeric: tabular-nums; }
.goal-pct { margin-left: auto; font-weight: 700; color: var(--rose-d); }
.goal-facts { margin-top: 14px; }
.goal-facts b { font-size: 16px; }
.calc-table > div { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.calc-table > div:last-child { border-bottom: 0; }
.calc-table small { display: block; color: var(--muted); font-size: 12px; }
.calc-table b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-table .total { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.calc-table .total b { font-family: var(--serif); font-size: 19px; }
.calc-out { background: var(--blush-2); border-radius: 16px; padding: 12px 14px; margin-top: 8px; }
.res { font-family: var(--serif); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.res span { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--muted); }
.note { background: var(--lav-2); border-radius: 14px; padding: 10px 12px; font-size: 13.5px; }
.note.warn { background: #FBF1E0; }
.note.alert { background: #FBE7E6; }

/* Instellingen */
.set h3 { margin-bottom: 6px; }
.set.links { padding: 4px 16px; }
.link-row { display: flex; justify-content: space-between; width: 100%; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 16px; text-align: left; }
.link-row:last-child { border-bottom: 0; }
.link-row span:last-child { color: var(--muted); font-size: 20px; line-height: 1; }
.set.danger { border-color: #F0D2D5; }

/* Sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(47, 42, 44, 0); transition: background .25s; }
.sheet-backdrop.open { background: rgba(47, 42, 44, .35); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 620px; margin: 0 auto; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--bg); border-radius: 26px 26px 0 0; padding: 8px 18px calc(24px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.sheet-backdrop.open .sheet { transform: none; }
.grabber { width: 40px; height: 5px; border-radius: 9px; background: #DCCFC9; margin: 0 auto 8px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head h2 { font-size: 23px; }

/* Dialoog, melding, update */
.dialog-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(47, 42, 44, .4); display: grid; place-items: center; padding: 24px; }
.dialog-backdrop[hidden], .sheet-backdrop[hidden] { display: none; }
.dialog { background: var(--card); border-radius: 22px; padding: 20px; width: 100%; max-width: 360px; }
.dialog h3 { font-size: 20px; }
.dialog p { color: var(--muted); font-size: 14.5px; }
.dialog input { margin: 6px 0 4px; text-transform: uppercase; }
.dialog-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 70; transform: translate(-50%, -150%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; transition: transform .3s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }
.update { position: sticky; top: 66px; z-index: 19; margin: 0 16px 8px; background: var(--lav-2); border-radius: 14px; padding: 10px 14px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.update[hidden] { display: none; }
.update button { border: 0; background: var(--ink); color: #fff; border-radius: 99px; padding: 6px 14px; font-weight: 600; font-size: 13px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 360px) { .bsum, .goal-facts { grid-template-columns: 1fr 1fr; } .kpi-v { font-size: 19px; } }

/* Snel overzicht in het toevoegscherm */
.qstrip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 2px 0 12px; }
.qstrip > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 11px; display: flex; flex-direction: column; min-width: 0; }
.qstrip span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qstrip b { font-family: var(--serif); font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qstrip b.muted { font-family: var(--sans); font-size: 13px; font-weight: 500; }
.howto { margin-top: 10px; font-size: 14px; }
.howto summary { color: var(--rose-d); font-weight: 600; cursor: pointer; padding: 4px 0; }
.howto ol { padding-left: 20px; margin: 8px 0; line-height: 1.55; }

.hero-meal { display: inline-block; margin-top: 8px; font-size: 13px; background: rgba(255, 255, 255, .2); border-radius: 99px; padding: 4px 10px; }
.hero-meal { display: inline-block; margin-top: 8px; font-size: 13px; background: rgba(255, 255, 255, .2); border-radius: 99px; padding: 4px 10px; }
