:root {
  --bg: #F7F7F2;
  --glass-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.38) 55%, rgba(242, 244, 240, 0.44) 100%);
  --glass-solid: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(255, 255, 255, 0.92);
  --glass-shadow:
    0 0 0 1px rgba(24, 37, 35, 0.06),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.96),
    inset 1px 0 0 rgba(255, 255, 255, 0.72),
    0 12px 36px rgba(24, 37, 35, 0.05);
  --c-ink: 24, 37, 35;        /* #182523 */
  --c-accent: 22, 135, 117;   /* #168775 Warm Minimalism Emerald/Teal */
  --c-warn: 208, 100, 100;    /* #D06464 Soft Coral Warning */
  --c-ok: 22, 135, 117;
  --muted: rgba(24, 37, 35, 0.66);
}
[data-theme="dark"] {
  --bg: #0A0D0C;
  --glass-bg: linear-gradient(145deg, rgba(32, 36, 34, 0.66) 0%, rgba(18, 20, 19, 0.48) 100%);
  --glass-solid: rgba(24, 26, 25, 0.94);
  --glass-border: rgba(255, 255, 255, 0.13);
  --glass-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 18px 44px rgba(0, 0, 0, 0.6);
  --c-ink: 245, 246, 245;
  --c-accent: 52, 211, 153;
  --c-warn: 247, 147, 50;
  --c-ok: 52, 211, 153;
  --muted: rgba(245, 246, 245, 0.66);
}
[data-theme="blue"] {
  --bg: #F4F7FB;
  --c-ink: 23, 30, 44;
  --c-accent: 44, 95, 168;
  --c-ok: 44, 95, 168;
  --muted: rgba(23, 30, 44, 0.66);
}
[data-theme="pink"] {
  --bg: #FBF6F7;
  --c-ink: 42, 24, 32;
  --c-accent: 194, 75, 110;
  --c-ok: 194, 75, 110;
  --muted: rgba(42, 24, 32, 0.66);
}
[data-theme="red"] {
  --bg: #F9F5F5;
  --c-ink: 38, 24, 24;
  --c-accent: 184, 59, 59;
  --c-ok: 184, 59, 59;
  --muted: rgba(38, 24, 24, 0.66);
}
[data-theme="midnight"] {
  --bg: #0B1020;
  --glass-bg: linear-gradient(145deg, rgba(24, 34, 60, 0.72) 0%, rgba(14, 20, 38, 0.56) 100%);
  --glass-solid: rgba(18, 26, 48, 0.95);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 18px 44px rgba(0, 0, 0, 0.6);
  --c-ink: 241, 245, 249;
  --c-accent: 96, 165, 250;
  --c-ok: 96, 165, 250;
  --muted: rgba(241, 245, 249, 0.68);
}
.theme-swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.swatch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(var(--c-ink), 0.12); background: var(--glass-bg);
  color: rgb(var(--c-ink)); font: 500 12px/1 'Onest', sans-serif;
}
.swatch.active { border-color: rgb(var(--c-accent)); box-shadow: 0 0 0 2px rgba(var(--c-accent), 0.25); }
.swatch-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.12); }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Onest', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: rgb(var(--c-ink));
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(95px); opacity: 0.36; }
.orb-1 { width: 440px; height: 440px; top: -120px; left: -90px; background: rgba(var(--c-accent), 0.24); }
.orb-2 { width: 380px; height: 380px; bottom: -120px; right: -70px; background: rgba(var(--c-accent), 0.14); }

.shell { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 30px 24px 88px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.grid-3-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.grid-2-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.mini-stat { padding: 14px; border-radius: 16px; background: rgba(var(--c-ink), 0.03); border: 1px solid rgba(var(--c-ink), 0.06); }
.mini-val { font-size: 18px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .grid-2, .grid-3-mini { grid-template-columns: 1fr; } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: rgb(var(--c-accent)); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
[data-theme="dark"] .brand-mark { color: #052e22; }

.nav-pills {
  display: inline-flex; gap: 4px; background: var(--glass-bg);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  padding: 4px; border-radius: 999px;
  backdrop-filter: blur(26px) saturate(180%); -webkit-backdrop-filter: blur(26px) saturate(180%);
}
.pill { border: none; background: transparent; color: var(--muted); font: 500 13px/1 'Onest', sans-serif; padding: 8px 16px; border-radius: 999px; cursor: pointer; transition: all 0.2s ease; }
.pill.active { background: rgb(var(--c-accent)); color: #fff; }
[data-theme="dark"] .pill.active { color: #052e22; font-weight: 600; }

.actions { display: flex; align-items: center; gap: 8px; }
.btn {
  border: 1px solid var(--glass-border); background: var(--glass-bg); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: rgb(var(--c-ink)); padding: 9px 14px; border-radius: 999px;
  font: 500 13px/1 'Onest', sans-serif; cursor: pointer;
}
.btn-primary {
  border: none; background: rgb(var(--c-accent)); color: #fff;
  padding: 10px 18px; border-radius: 999px; font: 600 13px/1 'Onest', sans-serif; cursor: pointer;
  box-shadow: 0 4px 16px rgba(var(--c-accent), 0.24);
}
[data-theme="dark"] .btn-primary { color: #052e22; }

.glass {
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 26px;
  box-shadow: var(--glass-shadow); backdrop-filter: blur(30px) saturate(185%);
  -webkit-backdrop-filter: blur(30px) saturate(185%); padding: 24px; margin-bottom: 18px;
}
.kpi-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-val { font-size: 38px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; margin: 6px 0; }
.kpi-sub { font-size: 13px; color: var(--muted); }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }

.smart-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 6px 6px 6px 14px; border-radius: 16px;
  background: rgba(var(--c-ink), 0.04); border: 1px solid rgba(var(--c-ink), 0.08);
  margin-bottom: 14px;
}
.smart-bar input {
  flex: 1; border: none; background: transparent; outline: none;
  color: rgb(var(--c-ink)); font: 500 14px/1.2 'Onest', sans-serif;
}
.smart-preview { font-size: 12px; color: rgb(var(--c-accent)); margin-bottom: 12px; min-height: 16px; }

.insight-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid rgba(var(--c-ink), 0.06); }
.insight-item:last-child { border-bottom: none; }
.insight-ico { width: 32px; height: 32px; border-radius: 10px; background: rgba(var(--c-accent), 0.12); color: rgb(var(--c-accent)); display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }

.tx-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 6px; border-bottom: 1px solid rgba(var(--c-ink), 0.06); cursor: pointer; border-radius: 10px; }
.tx-row:hover { background: rgba(var(--c-accent), 0.04); }
.tx-row:last-child { border-bottom: none; }
.tx-left { display: flex; align-items: center; gap: 13px; }
.tx-ico { width: 38px; height: 38px; border-radius: 12px; background: rgba(var(--c-accent), 0.10); color: rgb(var(--c-accent)); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.tx-name { font-size: 14px; font-weight: 600; }
.tx-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tx-amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.bar-track { height: 7px; border-radius: 999px; background: rgba(var(--c-ink), 0.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: rgb(var(--c-accent)); transition: width 0.3s ease; }
.bar-fill.warn { background: rgb(var(--c-warn)); }

.view { display: none; }
.view.active { display: block; }
.empty-box { text-align: center; padding: 30px 18px; color: var(--muted); font-size: 14px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.34); backdrop-filter: blur(10px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 440px; background: var(--glass-solid); border: 1px solid var(--glass-border); border-radius: 26px; padding: 24px; box-shadow: var(--glass-shadow); backdrop-filter: blur(30px); }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select { width: 100%; padding: 11px 13px; border-radius: 13px; border: 1px solid rgba(var(--c-ink), 0.10); background: var(--bg); color: rgb(var(--c-ink)); font: 500 14px/1.2 'Onest', sans-serif; }
.auth-btn { width: 100%; padding: 13px; border-radius: 14px; font: 600 14px/1 'Onest', sans-serif; cursor: pointer; margin-top: 10px; border: 1px solid rgba(var(--c-ink), 0.10); }
.btn-apple { background: rgb(var(--c-ink)); color: var(--bg); }
.btn-google { background: var(--glass-solid); color: rgb(var(--c-ink)); }
.badge { font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(var(--c-accent), 0.12); color: rgb(var(--c-accent)); }
.badge-warn { background: rgba(var(--c-warn), 0.14); color: rgb(var(--c-warn)); }
.footer-bar { text-align: center; margin-top: 24px; font-size: 12px; color: var(--muted); display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.footer-link { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; margin-bottom: 16px; }
.plan-card { padding: 14px; border-radius: 16px; border: 1px solid rgba(var(--c-ink), 0.10); background: rgba(var(--c-ink), 0.03); font-size: 12px; line-height: 1.6; }

/* Pro Feature Blur Lock */
.pro-lock-wrap { position: relative; }
.pro-lock-wrap.locked .pro-blur {
  filter: blur(7px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.pro-lock-overlay {
  display: none;
  position: absolute; inset: 0; z-index: 5;
  align-items: center; justify-content: center; flex-direction: column; gap: 10px;
  text-align: center; padding: 20px; border-radius: 22px;
  background: rgba(var(--c-ink), 0.02);
  cursor: pointer;
}
.pro-lock-wrap.locked .pro-lock-overlay { display: flex; }

/* ───── Design pass: hero number, welcome, focus, mobile tab bar ───── */
[data-theme="dark"] .orb, [data-theme="midnight"] .orb { opacity: 0.55; }

.kpi-hero { font-size: 54px; line-height: 1.05; letter-spacing: -0.045em; margin: 8px 0 8px; }
.kpi-delta { align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.kpi-delta.good { background: rgba(var(--c-ok), 0.12); color: rgb(var(--c-ok)); }
.kpi-delta.bad { background: rgba(var(--c-warn), 0.14); color: rgb(var(--c-warn)); }

.welcome-title { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin: 8px 0 6px; }
.welcome-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 1px solid rgba(var(--c-accent), 0.28); background: rgba(var(--c-accent), 0.08); color: rgb(var(--c-ink)); font: 500 13px/1 'Onest', sans-serif; padding: 9px 13px; border-radius: 999px; cursor: pointer; transition: background 0.15s ease; }
.chip:hover { background: rgba(var(--c-accent), 0.16); }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: rgb(var(--c-accent)); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.quick-card { padding: 14px; }

/* Visible keyboard focus everywhere */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid rgb(var(--c-accent));
  outline-offset: 2px;
}
.smart-bar:focus-within { border-color: rgba(var(--c-accent), 0.5); box-shadow: 0 0 0 3px rgba(var(--c-accent), 0.15); }
.smart-bar input:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Mobile bottom tab bar — hidden on desktop */
.tabbar { display: none; }
@media (max-width: 640px) {
  .shell { padding: 18px 16px calc(110px + env(safe-area-inset-bottom)); }
  .glass { padding: 18px; border-radius: 22px; margin-bottom: 14px; }
  .topbar { margin-bottom: 18px; flex-wrap: nowrap; }
  .top-nav, .top-add { display: none; }
  .kpi-hero { font-size: 44px; }
  .welcome-title { font-size: 24px; }
  /* Timeframe pills: one scrollable row instead of wrapping */
  #tf-pills, #graph-tf-pills { flex-wrap: nowrap !important; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  #tf-pills::-webkit-scrollbar, #graph-tf-pills::-webkit-scrollbar { display: none; }
  #tf-pills .pill, #graph-tf-pills .pill { flex-shrink: 0; }

  .tabbar {
    display: flex; align-items: center; justify-content: space-around;
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
    padding: 6px; border-radius: 24px;
    background: var(--glass-solid); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), 0 10px 30px rgba(0,0,0,0.18);
    backdrop-filter: blur(26px) saturate(180%); -webkit-backdrop-filter: blur(26px) saturate(180%);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: none; background: none; color: var(--muted); padding: 7px 0; border-radius: 16px;
    font: 600 10.5px/1 'Onest', sans-serif; cursor: pointer;
  }
  .tab-ico { font-size: 17px; line-height: 1; }
  .tab.active { color: rgb(var(--c-accent)); background: rgba(var(--c-accent), 0.10); }
  .tab-fab {
    width: 50px; height: 50px; flex-shrink: 0; margin: 0 4px; border: none; border-radius: 50%;
    background: rgb(var(--c-accent)); color: #fff; font: 400 28px/1 'Onest', sans-serif; cursor: pointer;
    box-shadow: 0 6px 18px rgba(var(--c-accent), 0.35);
  }
  [data-theme="dark"] .tab-fab { color: #052e22; }
}
.quick-card .smart-preview:empty { display: none; }
.mini-val .link-btn { font-size: 14px; font-weight: 600; white-space: nowrap; }

/* ───── Overview v2: available-per-day hero, category rings, cash flow, day groups ───── */
.kpi-hero.neg, .kpi-perday.neg, .cf-net.neg { color: rgb(var(--c-warn)); }
.kpi-perday { font-size: 15px; color: var(--muted); margin: -2px 0 10px; font-variant-numeric: tabular-nums; }
.kpi-perday strong { color: rgb(var(--c-ink)); font-weight: 700; }
.kpi-perday.neg strong { color: rgb(var(--c-warn)); }
.kpi-perday .link-btn { font-size: 14px; font-weight: 500; }

.cat-rings { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.cat-rings::-webkit-scrollbar { display: none; }
.cat-ring {
  flex: 0 0 auto; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 1px solid transparent; border-radius: 18px; padding: 8px 4px; cursor: pointer;
  color: rgb(var(--c-ink)); font: inherit; scroll-snap-align: start; transition: background 0.15s ease;
}
.cat-ring:hover { background: rgba(var(--c-ink), 0.04); }
.cat-ring.active { background: rgba(var(--c-accent), 0.10); border-color: rgba(var(--c-accent), 0.30); }
.ring-wrap { position: relative; width: 56px; height: 56px; }
.ring { width: 56px; height: 56px; display: block; }
.ring-track { fill: none; stroke: rgba(var(--c-ink), 0.08); stroke-width: 5; }
.ring-fill { fill: none; stroke: rgb(var(--c-accent)); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.ring-fill.warn { stroke: rgb(var(--c-warn)); }
.ring-ico { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 700; color: rgb(var(--c-accent)); }
.ring-name { font-size: 11.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring-amt { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ring-amt.warn { color: rgb(var(--c-warn)); font-weight: 600; }

.cf-summary { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cf-net { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.cf-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cf-chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.cf-chip.in { background: rgba(var(--c-accent), 0.12); color: rgb(var(--c-accent)); }
.cf-chip.out { background: rgba(var(--c-warn), 0.14); color: rgb(var(--c-warn)); }
.cf-chart { display: flex; align-items: stretch; gap: 8px; height: 150px; border-bottom: 1px solid rgba(var(--c-ink), 0.08); }
.cf-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.cf-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.cf-bar { width: 38%; max-width: 16px; min-height: 2px; border-radius: 5px 5px 2px 2px; opacity: 0.55; transition: height 0.4s ease; }
.cf-col.current .cf-bar { opacity: 1; }
.cf-bar.in { background: rgb(var(--c-accent)); }
.cf-bar.out { background: rgb(var(--c-warn)); }
.cf-month { font-size: 11px; color: var(--muted); padding-bottom: 6px; }
.cf-col.current .cf-month { color: rgb(var(--c-ink)); font-weight: 600; }
.cf-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cf-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cf-legend i.in { background: rgb(var(--c-accent)); }
.cf-legend i.out { background: rgb(var(--c-warn)); }

.day-group + .day-group { margin-top: 6px; }
.day-head { display: flex; justify-content: space-between; padding: 10px 6px 4px; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-head .pos, .tx-amt.pos { color: rgb(var(--c-accent)); }
.day-group .tx-row:last-child { border-bottom: none; }
.tx-ico { font-size: 17px; }

.upcoming { border: 1px solid rgba(var(--c-ink), 0.08); border-radius: 16px; padding: 2px 10px; margin-bottom: 8px; background: rgba(var(--c-ink), 0.02); }
.upcoming summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.upcoming summary::-webkit-details-marker { display: none; }
.upcoming summary::after { content: "›"; font-size: 18px; color: var(--muted); transition: transform 0.2s ease; }
.upcoming[open] summary::after { transform: rotate(90deg); }
.up-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--c-accent), 0.10); color: rgb(var(--c-accent)); font-weight: 700; }
.up-text { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.upcoming .tx-row { padding-left: 0; padding-right: 0; }
@media (max-width: 640px) {
  .cf-chart { height: 130px; gap: 4px; }
  .cat-ring { width: 76px; }
}

/* Budget popup */
.budget-amount { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-radius: 18px; background: rgba(var(--c-ink), 0.04); border: 1px solid rgba(var(--c-ink), 0.10); margin-bottom: 12px; }
.budget-amount:focus-within { border-color: rgba(var(--c-accent), 0.55); box-shadow: 0 0 0 3px rgba(var(--c-accent), 0.15); }
.budget-cur { font-size: 28px; font-weight: 600; color: var(--muted); }
.budget-amount input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; color: rgb(var(--c-ink)); font: 700 34px/1.1 'Onest', sans-serif; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.budget-amount input::-webkit-outer-spin-button, .budget-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.budget-suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.budget-preview { font-size: 13px; color: var(--muted); min-height: 20px; margin-bottom: 16px; line-height: 1.45; }
.budget-preview strong { color: rgb(var(--c-ink)); }
.budget-preview.neg, .budget-preview.neg strong { color: rgb(var(--c-warn)); }
.kpi-perday .link-btn { font-size: 13px; }
@media (max-width: 640px) {
  /* Popups that slide up from the bottom on phones */
  .modal-backdrop.sheet { align-items: flex-end; padding: 0; }
  .modal-backdrop.sheet .modal { max-width: none; border-radius: 26px 26px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); animation: sheet-up 0.22s ease-out; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───── Money calculators (public calculators.html + the app's Plan view) ───── */
.calc-hero h1 { font-size: 40px; letter-spacing: -0.04em; line-height: 1.05; margin: 6px 0 10px; }
.calc-hero p { color: var(--muted); font-size: 16px; max-width: 560px; }
.calc-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; margin: 22px 0 16px; border-radius: 999px; background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); scrollbar-width: none; }
.calc-tabs::-webkit-scrollbar { display: none; }
.calc-tabs .pill { flex-shrink: 0; }
.calc-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; align-items: start; }
.calc-panel { display: none; }
.calc-panel.active { display: block; }
.calc-panel h2 { font-size: 20px; margin-bottom: 4px; }
.calc-intro { color: var(--muted); font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.calc-field { margin-bottom: 14px; }
.calc-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.calc-input { display: flex; align-items: center; gap: 6px; padding: 10px 13px; border-radius: 13px; border: 1px solid rgba(var(--c-ink), 0.12); background: rgba(var(--c-ink), 0.03); }
.calc-input:focus-within { border-color: rgba(var(--c-accent), 0.55); box-shadow: 0 0 0 3px rgba(var(--c-accent), 0.15); }
.calc-input input, .calc-input select { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: rgb(var(--c-ink)); font: 600 16px/1.2 'Onest', sans-serif; font-variant-numeric: tabular-nums; }
.calc-input span { color: var(--muted); font-size: 14px; font-weight: 500; }
.calc-result { padding: 20px; border-radius: 20px; background: rgba(var(--c-accent), 0.07); border: 1px solid rgba(var(--c-accent), 0.18); }
.calc-big { font-size: 40px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.calc-rows { margin-top: 14px; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(var(--c-ink), 0.07); font-size: 14px; font-variant-numeric: tabular-nums; }
.calc-row span:first-child { color: var(--muted); }
.calc-row strong { font-weight: 600; }
.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: 14px 0 6px; background: rgba(var(--c-ink), 0.06); }
.split-bar i, .growth i { display: block; height: 100%; }
.seg-a { background: rgb(var(--c-accent)); }
.seg-b { background: rgba(var(--c-accent), 0.45); }
.seg-c { background: rgb(var(--c-warn)); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.growth { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin-top: 14px; }
.growth div { flex: 1; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 2px 2px; overflow: hidden; min-height: 2px; }
.growth i { height: auto; }
.growth-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.calc-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(var(--c-ink), 0.07); font-size: 13px; color: var(--muted); }
.calc-cta a { text-decoration: none; }
.calc-cta button:disabled { opacity: 0.5; cursor: not-allowed; }
.calc-note { font-size: 12px; color: var(--muted); margin-top: 18px; line-height: 1.5; }
.pro-extra { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(var(--c-ink), 0.08); }
.pro-extra:empty { display: none; }
.pro-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pro-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pro-table-wrap { overflow-x: auto; max-height: 360px; overflow-y: auto; border-radius: 14px; border: 1px solid rgba(var(--c-ink), 0.08); }
.pro-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pro-table th { position: sticky; top: 0; background: var(--glass-solid); text-align: right; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 9px 12px; border-bottom: 1px solid rgba(var(--c-ink), 0.08); }
.pro-table td { text-align: right; padding: 8px 12px; border-bottom: 1px solid rgba(var(--c-ink), 0.05); white-space: nowrap; }
.pro-table th:first-child, .pro-table td:first-child { text-align: left; }
.pro-table tr:last-child td { border-bottom: none; }
.pro-locked { position: relative; border-radius: 14px; overflow: hidden; }
.pro-locked .pro-blur { filter: blur(6px); opacity: 0.5; pointer-events: none; user-select: none; }
.pro-lock-cta { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; }
.pro-lock-cta p { font-size: 13px; color: var(--muted); max-width: 360px; }
.compare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.compare-card { padding: 14px; border-radius: 16px; background: rgba(var(--c-ink), 0.03); border: 1px solid rgba(var(--c-ink), 0.06); }
.compare-card .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.compare-card .t { font-size: 12px; color: var(--muted); margin-top: 2px; }
.compare-card .t.over { color: rgb(var(--c-warn)); font-weight: 600; }
.compare-card .t.ok { color: rgb(var(--c-accent)); font-weight: 600; }
/* In the app the tabs sit at the top of the Plan view */
#view-plan .calc-tabs { margin-top: 0; }
.plan-intro { margin-bottom: 6px; }
.plan-intro h2 { margin-bottom: 4px; }
.plan-card-link { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.plan-card-link .plan-icons { display: flex; gap: 6px; font-size: 20px; }
@media (max-width: 820px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-hero h1 { font-size: 30px; }
  .calc-big { font-size: 34px; }
}
@media (max-width: 640px) { .compare-grid { grid-template-columns: 1fr; } }

/* Quick-add error */
.smart-preview.smart-error { color: rgb(var(--c-warn)); font-weight: 500; }
.smart-bar.has-error { border-color: rgb(var(--c-warn)); box-shadow: 0 0 0 3px rgba(var(--c-warn), 0.15); }

/* ───── Quick add: focused card over a blurred page ───── */
.qa-trigger { width: 100%; margin: 0; cursor: text; text-align: left; font: inherit; color: inherit; }
.qa-trigger:hover { border-color: rgba(var(--c-accent), 0.35); }
.qa-trigger-text { flex: 1; min-width: 0; color: var(--muted); font: 500 14px/1.2 'Onest', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-trigger-text.has-draft { color: rgb(var(--c-ink)); }
.qa-trigger-add { padding: 7px 14px; font-size: 12px; pointer-events: none; }
.qa-shortcut-hint { font-size: 11px; margin-top: 8px; }
.qa-shortcut-hint kbd { font: 600 11px/1 'Onest', sans-serif; padding: 2px 6px; border-radius: 5px; border: 1px solid rgba(var(--c-ink), 0.18); background: rgba(var(--c-ink), 0.04); }
@media (max-width: 640px), (hover: none) { .qa-shortcut-hint { display: none; } }

.qa-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  animation: qa-fade-in 0.2s ease-out;
}
[data-theme="dark"] .qa-backdrop, [data-theme="midnight"] .qa-backdrop { background: rgba(0, 0, 0, 0.42); }
.qa-backdrop[hidden] { display: none; }
.qa-card {
  width: 100%; max-width: 560px; margin-top: 6vh; padding: 18px;
  border-radius: 24px; background: var(--glass-solid); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), 0 24px 60px rgba(0, 0, 0, 0.22);
}
.qa-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.qa-head h2 { margin: 0; font-size: 17px; }
.qa-close { width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer; background: rgba(var(--c-ink), 0.06); color: rgb(var(--c-ink)); font-size: 13px; font-weight: 700; }
.qa-bar { margin-bottom: 0; }
.qa-bar input { font-size: 16px; } /* 16px stops iOS Safari zooming in */
.qa-status { margin: 10px 2px 0; min-height: 0; font-size: 13px; color: var(--muted); }
.qa-status:empty { display: none; }
.qa-status.qa-added { color: rgb(var(--c-accent)); font-weight: 600; }
#qa-chips:not(:empty) { margin-top: 12px; }
.qa-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.qa-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: rgba(var(--c-ink), 0.05); border: 1px solid transparent; color: rgb(var(--c-ink));
  font: 500 13px/1.1 'Onest', sans-serif; font-variant-numeric: tabular-nums;
}
.qa-chip.strong { background: rgba(var(--c-accent), 0.14); color: rgb(var(--c-accent)); font-weight: 700; }
.qa-select { position: relative; padding-right: 26px; cursor: pointer; }
.qa-select::after { content: "▾"; position: absolute; right: 11px; color: var(--muted); font-size: 11px; pointer-events: none; }
.qa-select select { appearance: none; -webkit-appearance: none; border: none; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.qa-select:focus-within { border-color: rgba(var(--c-accent), 0.5); }
.qa-pick { cursor: pointer; border-color: rgba(var(--c-ink), 0.08); }
.qa-pick:hover { background: rgba(var(--c-accent), 0.08); }
.qa-pick-amt { color: rgba(var(--c-ink), 0.6); }
.qa-more { margin-top: 14px; font-size: 12px; }
body.qa-open .tabbar { opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
body.qa-open { overflow: hidden; }
.qa-backdrop.closing { animation: qa-fade-out 0.18s ease-in forwards; }
.qa-backdrop.closing .qa-card { animation: qa-card-out 0.18s ease-in forwards; }
@keyframes qa-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes qa-fade-out { to { opacity: 0; } }
@keyframes qa-card-out { to { transform: translateY(-8px) scale(0.98); opacity: 0; } }
@media (max-width: 640px) { .qa-card { margin-top: 0; } }
@media (prefers-reduced-motion: reduce) {
  .qa-backdrop, .qa-backdrop.closing, .qa-backdrop.closing .qa-card { animation: none; }
}
/* Keep the card short above a phone keyboard: recent picks scroll sideways */
@media (max-width: 640px) {
  #qa-recent .qa-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px 2px; }
  #qa-recent .qa-chips::-webkit-scrollbar { display: none; }
  #qa-recent .qa-pick { flex-shrink: 0; }
}

/* On-device smarts */
.kpi-forecast { font-size: 13px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-forecast strong { color: rgb(var(--c-ink)); font-weight: 600; }
.kpi-forecast.neg strong { color: rgb(var(--c-warn)); }
.insight-ico.warn { background: rgba(var(--c-warn), 0.14); color: rgb(var(--c-warn)); font-weight: 700; }
.headsup-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.qa-learned { font-size: 12px; color: rgb(var(--c-accent)); font-weight: 500; margin-bottom: 8px; }

/* ───── Design v3: flat surfaces, Schibsted Grotesk, sentence-case labels, budget strip ───── */
:root {
  --bg: #EEF2EF;
  --surface: #FFFFFF;
  --line: rgba(19, 32, 29, 0.12);
  --c-ink: 19, 32, 29;        /* #13201D */
  --c-warn: 196, 85, 77;      /* #C4554D spending / over budget */
  --muted: rgba(19, 32, 29, 0.64);
  --glass-solid: #FFFFFF;
  --glass-border: rgba(19, 32, 29, 0.10);
  --glass-shadow: 0 1px 0 rgba(19, 32, 29, 0.04);
}
[data-theme="blue"], [data-theme="pink"], [data-theme="red"] { --surface: #FFFFFF; --line: rgba(var(--c-ink), 0.12); }
[data-theme="dark"] { --bg: #0D1110; --surface: #151B19; --line: rgba(255, 255, 255, 0.10); --glass-solid: #151B19; --glass-border: rgba(255, 255, 255, 0.10); --glass-shadow: none; }
[data-theme="midnight"] { --surface: #121A30; --line: rgba(255, 255, 255, 0.10); --glass-solid: #121A30; --glass-border: rgba(255, 255, 255, 0.10); --glass-shadow: none; }

body { font-family: 'Onest', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 15px; line-height: 1.45; }
.ambient { display: none; }

/* Flat surfaces: no blur, one hairline, no drop shadow */
.glass {
  background: var(--surface); border: 1px solid var(--line); box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 18px;
}
.nav-pills, .btn, .calc-tabs { background: var(--surface); border: 1px solid var(--line); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.btn-primary { box-shadow: none; }
.modal { backdrop-filter: none; }

/* Labels and headings: sentence case, no tracking */
.kpi-label { font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.pro-table th { text-transform: none; letter-spacing: 0; font-size: 12px; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.modal h2, .qa-head h2 { font-size: 18px; }

/* Overview: sections sit on the page, divided by rules; only quick add keeps a surface */
#view-home > .glass:not(.quick-card):not(.welcome-card) {
  background: none; border: none; border-top: 1px solid var(--line); border-radius: 0;
  padding: 26px 0 22px; margin: 0;
}
#view-home > #kpi-card { border-top: none; padding-top: 4px; }
#view-home > .quick-card { margin: 4px 0 26px; }
@media (min-width: 900px) {
  #view-home { column-gap: 40px; }
  #view-home.active { display: grid; grid-template-columns: 1fr 1fr; }
  #view-home > * { grid-column: 1 / -1; }
  #view-home > #cat-ring-card { grid-column: 1; }
  #view-home > #cashflow-card { grid-column: 2; }
}

/* Hero */
.kpi-hero { font-size: 76px; font-weight: 700; line-height: 0.95; letter-spacing: -0.045em; margin: 10px 0 12px; }
.kpi-perday { font-size: 17px; color: rgb(var(--c-ink)); margin: 0 0 22px; }
.kpi-perday strong { font-weight: 650; }
.kpi-perday .link-btn { font-size: 15px; margin-left: 10px; text-decoration: underline; text-underline-offset: 3px; }
.kpi-sub, .kpi-forecast { font-size: 14px; }
.kpi-delta { padding: 0; background: none !important; font-weight: 500; margin: 6px 0 0; display: block; }
.kpi-forecast { margin-top: 2px; }

/* Budget strip: one bar per day of the month */
.strip { margin: 0 0 14px; }
.strip-bars { display: flex; align-items: flex-end; gap: 3px; height: 72px; }
.strip-bar { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.strip-bar i { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 1px 1px; background: rgba(var(--c-ink), 0.26); transform-origin: bottom; }
.strip-bar.over i { background: rgb(var(--c-warn)); }
.strip-bar.today i { background: rgb(var(--c-ink)); }
.strip-bar.clipped i { border-top: 3px solid rgb(var(--c-warn)); }
.strip-bar.future i { background: rgba(var(--c-accent), 0.22); border-top: 2px solid rgb(var(--c-accent)); border-radius: 0; }
.strip-bar.future.neg i { background: none; border-top: 2px dashed rgb(var(--c-warn)); }
.strip-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip-axis .now { color: rgb(var(--c-ink)); font-weight: 600; }
.strip.animate .strip-bar i { animation: strip-grow 0.6s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 14ms); }
@keyframes strip-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .strip.animate .strip-bar i { animation: none; } }

@media (max-width: 640px) {
  .kpi-hero { font-size: 54px; }
  .kpi-perday { font-size: 16px; margin-bottom: 18px; }
  .strip-bars { height: 56px; gap: 2px; }
  #view-home > .glass:not(.quick-card):not(.welcome-card) { padding: 22px 0 18px; }
  .tabbar { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 8px 24px rgba(0,0,0,0.12); border: 1px solid var(--line); }
}
.strip-axis { position: relative; }
.strip-axis .now { position: absolute; top: 0; transform: translateX(-50%); }
/* Schibsted's tabular figures give the decimal point a full digit width; proportional figures read better */
body, body * { font-variant-numeric: proportional-nums !important; }
.pill { padding: 8px 14px; }
.strip-axis .now.at-end { left: auto !important; right: 0; transform: none; }
/* Dark themes restated after the v3 :root block (same specificity, so order matters) */
[data-theme="dark"] { --bg: #0D1110; --c-ink: 236, 241, 238; --muted: rgba(236, 241, 238, 0.64); --c-warn: 240, 128, 112; }
[data-theme="midnight"] { --bg: #0B1020; --c-ink: 241, 245, 249; --muted: rgba(241, 245, 249, 0.68); --c-warn: 240, 128, 112; }

/* ═════ Design v4: dark glass. Colour glow at the top, frosted panels, big titles, airy rows ═════ */
:root {
  --bg: #EEF1F0;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --panel-line: rgba(19, 32, 29, 0.06);
  --chip: rgba(19, 32, 29, 0.06);
  --chip-on: rgba(255, 255, 255, 0.95);
  --glow: var(--c-accent);
  --glow-strength: 0.28;
  --btn-bg: rgb(19, 32, 29);
  --btn-fg: #FFFFFF;
  --blur: blur(28px) saturate(160%);
  --radius: 26px;
}
[data-theme="dark"] {
  --bg: #050607;
  --c-ink: 244, 246, 245;
  --muted: rgba(244, 246, 245, 0.56);
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(32, 34, 36, 0.92);
  --panel-line: rgba(255, 255, 255, 0.06);
  --chip: rgba(255, 255, 255, 0.08);
  --chip-on: rgba(255, 255, 255, 0.16);
  --glow-strength: 0.55;
  --btn-bg: #FFFFFF;
  --btn-fg: #050607;
  --c-warn: 255, 107, 107;
}
body[data-view="analytics"], body[data-view="plan"] { --glow: 112, 76, 222; }
body[data-view="settings"] { --glow: 92, 108, 128; }
body[data-view="transactions"] { --glow-strength: 0.32; }

body { font-family: 'Onest', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 16px; letter-spacing: -0.005em; background: var(--bg); }
body, body * { font-variant-numeric: normal !important; }

/* The glow: one large soft light at the top of the page, tinted per screen */
.ambient { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.ambient .orb { display: none; }
.ambient::before {
  content: ""; position: absolute; left: -20%; right: -20%; top: -35vh; height: 85vh;
  background: radial-gradient(closest-side, rgba(var(--glow), var(--glow-strength)), transparent);
  transition: background 0.5s ease;
}

/* Frosted panels */
.glass, .day-card, .upcoming, #view-home > .glass:not(#kpi-card):not(#recent-card) {
  background: var(--panel); border: 1px solid var(--panel-line); box-shadow: none;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius); padding: 20px; margin: 0 0 16px;
}
#view-home > #kpi-card, #view-home > #recent-card {
  background: none; border: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 8px 0 0; margin: 0 0 12px;
}
#view-home > .quick-card { padding: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { #view-home { column-gap: 16px; } }

/* Type */
.page-title { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin: 6px 0 22px; }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 16px; }
.kpi-label { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi-hero { font-size: 80px; font-weight: 700; letter-spacing: -0.05em; }
.kpi-sub, .kpi-forecast { font-size: 15px; }
.kpi-perday { font-size: 18px; }
.tx-meta { font-size: 14px; }

/* Round glass buttons and pills */
.btn, .round-btn {
  background: var(--chip); border: 1px solid var(--panel-line); color: rgb(var(--c-ink));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: none;
  padding: 11px 18px; font-size: 15px; font-weight: 500; border-radius: 999px;
}
.round-btn { width: 48px; height: 48px; padding: 0; display: inline-grid; place-items: center; font-size: 20px; cursor: pointer; }
#edit-mode-btn { width: auto; padding: 0 18px; font-size: 15px; }
.btn-primary, [data-theme="dark"] .btn-primary {
  background: var(--btn-bg); color: var(--btn-fg); box-shadow: none; padding: 12px 20px; font-size: 15px; font-weight: 600;
}
.nav-pills { background: transparent; border: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; gap: 2px; }
.pill { font-size: 15px; font-weight: 500; padding: 10px 16px; color: var(--muted); border: 1px solid transparent; }
.pill.active, [data-theme="dark"] .pill.active {
  background: var(--chip-on); color: rgb(var(--c-ink)); font-weight: 600;
  border-color: var(--panel-line); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}
:root:not([data-theme="dark"]) .pill.active { box-shadow: 0 1px 3px rgba(19, 32, 29, 0.10); }
.top-nav { background: var(--chip); border-radius: 999px; padding: 4px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.badge { background: var(--chip); color: rgb(var(--c-ink)); font-weight: 500; }

/* Search */
.search-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.search-field {
  flex: 1; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px; border-radius: 999px;
  background: var(--chip); border: 1px solid var(--panel-line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font-size: 22px; color: rgb(var(--c-ink));
}
.search-field input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: rgb(var(--c-ink)); font: 400 17px/1 'Onest', sans-serif; }
.search-field input::placeholder { color: var(--muted); }
.search-field:focus-within { border-color: rgba(var(--c-ink), 0.25); }

/* Lists: day title on the page, that day's items in one panel, no dividers */
.day-group + .day-group { margin-top: 0; }
.day-head { padding: 26px 4px 12px; font-size: 20px; font-weight: 600; color: rgb(var(--c-ink)); letter-spacing: -0.015em; align-items: baseline; }
.day-head span:last-child { font-size: 15px; font-weight: 500; color: var(--muted); }
.day-head .pos { color: rgb(var(--c-accent)) !important; }
.day-card { padding: 6px 18px; margin: 0; }
.tx-row { padding: 14px 0; border-bottom: none; border-radius: 0; }
.tx-row:hover { background: none; }
.tx-row:hover .tx-name { text-decoration: underline; text-underline-offset: 3px; }
.tx-left { gap: 15px; }
.tx-ico { width: 46px; height: 46px; border-radius: 50%; background: var(--chip); font-size: 20px; }
.tx-name { font-size: 17px; font-weight: 500; }
.tx-amt { font-size: 17px; font-weight: 500; }
.tx-amt.pos { color: rgb(var(--c-accent)); }
.upcoming { padding: 4px 18px; margin: 4px 0 0; }
.upcoming summary { padding: 14px 0; }
.up-ico { width: 46px; height: 46px; border-radius: 50%; background: var(--chip); }
.up-text { font-size: 17px; }
#recent-card h2 { margin-bottom: 4px; }

/* Rings and charts on dark */
.cat-ring.active { background: var(--chip-on); border-color: var(--panel-line); }
.ring-track { stroke: var(--chip); }
.ring-name { font-size: 13px; font-weight: 500; }
.ring-amt { font-size: 12.5px; }

/* Modals and quick add: solid frosted sheets */
.modal, .qa-card { background: var(--panel-strong); border: 1px solid var(--panel-line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: 30px; }
.field input, .field select, .budget-amount, .calc-input { background: var(--chip); border-color: var(--panel-line); }
.smart-bar { background: var(--chip); border-color: var(--panel-line); border-radius: 999px; padding: 6px 6px 6px 18px; }
.qa-trigger-text { font-size: 16px; }

/* Bottom tab bar: one glass capsule, the active tab in a lighter pill */
@media (max-width: 640px) {
  .tabbar {
    background: var(--panel-strong); border: 1px solid var(--panel-line); border-radius: 999px; padding: 6px;
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  }
  [data-theme="dark"] .tabbar { background: rgba(40, 42, 45, 0.62); }
  .tab { border-radius: 999px; font-size: 11px; font-weight: 500; padding: 8px 0; }
  .tab.active { background: var(--chip-on); color: rgb(var(--c-ink)); }
  .tab-fab, [data-theme="dark"] .tab-fab { background: var(--btn-bg); color: var(--btn-fg); box-shadow: none; width: 48px; height: 48px; }
  .page-title { font-size: 34px; margin-bottom: 18px; }
  .kpi-hero { font-size: 58px; }
  .glass, .day-card, .upcoming, #view-home > .glass:not(#kpi-card):not(#recent-card) { padding: 18px; }
  .day-card { padding: 4px 16px; }
  .back-btn { margin-bottom: 14px; }
}
.plan-intro .page-title { margin-top: 0; }
.footer-bar { color: var(--muted); }
/* The glow belongs to the top of the page and scrolls away with it */
body { position: relative; }
.ambient { position: absolute; top: 0; left: 0; right: 0; bottom: auto; height: 100vh; overflow: hidden; }
.kpi-perday .link-btn { margin-left: 4px; }
/* Budget strip v2: a faint slot for every day, an even-day guide, bars scaled to a normal day */
.strip-bars { position: relative; gap: 3px; }
.strip-bar { background: rgba(var(--c-ink), 0.05); border-radius: 999px; overflow: hidden; }
.strip-bar i { border-radius: 999px; min-height: 6px; background: rgba(var(--c-ink), 0.45); }
.strip-bar.today i { background: rgb(var(--c-ink)); }
.strip-bar.over i { background: rgb(var(--c-warn)); }
.strip-bar.future i { background: rgba(var(--c-accent), 0.35); border: none; border-radius: 999px; }
.strip-bar.today.empty::after { content: ""; display: block; width: 5px; height: 5px; margin: auto auto 3px; border-radius: 50%; background: rgb(var(--c-ink)); }
.strip-bar.today.empty { display: flex; align-items: flex-end; }
.strip-guide { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed rgba(var(--c-ink), 0.5); pointer-events: none; }
.strip-axis .even { color: var(--muted); }
/* Chart period tabs and weekly/monthly layouts */
.strip-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--chip); margin-bottom: 14px; }
.strip-tabs .pill { font-size: 13px; padding: 7px 14px; }
.strip-weekly .strip-bars, .strip-monthly .strip-bars { gap: 0; justify-content: space-around; }
.strip-weekly .strip-bar, .strip-monthly .strip-bar { flex: 0 0 20px; }
.strip-bar { position: relative; }
.strip-bar b { position: absolute; left: 0; right: 0; background: rgba(var(--c-accent), 0.3); border-radius: 999px 999px 0 0; }
.strip-labels { display: flex; justify-content: space-around; margin-top: 6px; font-size: 12px; color: var(--muted); }
.strip-labels span { width: 20px; display: flex; justify-content: center; white-space: nowrap; }
.strip-labels .now-l { color: rgb(var(--c-ink)); font-weight: 600; }
.strip-axis .end { color: rgb(var(--c-ink)); font-weight: 600; }

/* ───── Light mode: Porcelain. No colour wash; a soft white light at the top, white panels with a gentle lift.
   Colour is kept for what it means (income, over budget). Dark mode keeps its tinted glow. ───── */
html:not([data-theme="dark"]) { --panel: rgba(255,255,255,0.92); --panel-line: rgba(20,24,22,0.06); --chip: rgba(20,24,22,0.045); }
html:not([data-theme="dark"]) body { background: var(--bg); }
html:not([data-theme="dark"]) .ambient::before { background: radial-gradient(closest-side, rgba(255,255,255,0.95), transparent); }
html:not([data-theme="dark"]) .glass:not(#kpi-card):not(#recent-card),
html:not([data-theme="dark"]) .day-card,
html:not([data-theme="dark"]) .upcoming { box-shadow: 0 1px 2px rgba(20,24,22,0.04), 0 8px 24px rgba(20,24,22,0.05); }

/* ───── Liquid glass: translucent panels with a strong blur, a bright top edge and a soft lift ───── */
:root {
  --glass-edge: inset 0 1px 0 rgba(255,255,255,0.95), inset 0 0 0 1px rgba(255,255,255,0.55);
  --glass-lift: 0 1px 2px rgba(20,24,22,0.04), 0 10px 30px rgba(20,24,22,0.07);
  --liquid: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.58) 100%);
  --liquid-blur: blur(30px) saturate(190%);
}
[data-theme="dark"] {
  --glass-edge: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 0 0 1px rgba(255,255,255,0.07);
  --glass-lift: 0 10px 30px rgba(0,0,0,0.35);
  --liquid: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.05) 100%);
}
.glass:not(#kpi-card):not(#recent-card), .day-card, .upcoming, .modal, .qa-card,
#view-home > .glass:not(#kpi-card):not(#recent-card) {
  background: var(--liquid);
  border: none;
  -webkit-backdrop-filter: var(--liquid-blur); backdrop-filter: var(--liquid-blur);
  box-shadow: var(--glass-edge), var(--glass-lift);
}
html:not([data-theme="dark"]) .glass:not(#kpi-card):not(#recent-card),
html:not([data-theme="dark"]) .day-card, html:not([data-theme="dark"]) .upcoming {
  box-shadow: var(--glass-edge), var(--glass-lift);
}
.btn, .round-btn, .search-field, .top-nav, .strip-tabs {
  background: var(--liquid); border-color: transparent;
  -webkit-backdrop-filter: var(--liquid-blur); backdrop-filter: var(--liquid-blur);
  box-shadow: var(--glass-edge);
}
@media (max-width: 640px) {
  .tabbar, [data-theme="dark"] .tabbar {
    background: var(--liquid); border: none;
    -webkit-backdrop-filter: var(--liquid-blur); backdrop-filter: var(--liquid-blur);
    box-shadow: var(--glass-edge), 0 12px 32px rgba(0,0,0,0.18);
  }
}
.pill.active, [data-theme="dark"] .pill.active, .tab.active { box-shadow: var(--glass-edge), 0 1px 3px rgba(0,0,0,0.08); }
