/* ============================================================
   Upmoney — design tokens

   One data hue for every quantitative mark — money green —
   plus a matching single-hue ordinal ramp for the heatmap:

     light  #188A4C  ·  ramp #63BE8F #2FA268 #188A4C #0B5231
     dark   #2FAE6A  ·  ramp #0E5F36 #178A4C #2FAE6A #8FD9AF

   Every one of those was run through validate_palette.js against
   the real surfaces this app paints on — page (#F3F8F1 / #0F1512)
   AND card (#FFFFFF / #161C18) — and passes the lightness band,
   chroma floor, contrast and (for the ramp) monotone-lightness,
   step-gap and single-hue checks in both modes. Re-run it if you
   touch a surface or a step.

   Gold is brand decoration only — the jar, the coins, the lid.
   It never encodes a value.
   ============================================================ */
/* Fraunces (SIL OFL 1.1) — self-hosted so the app still has its
   face offline. Used for words only: brand, headings, titles.
   Every *number* stays in the system sans, so the figures match
   the charts and stay legible at small sizes. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  --surface-0:      #F3F8F1;   /* page plane — money green */
  --surface-1:      #FFFFFF;   /* card + chart surface */
  --surface-2:      #E9F2E9;   /* subtle fill / track */
  --surface-3:      #DCEADC;

  --text-primary:   #0C110E;
  --text-secondary: #4C5750;
  --text-muted:     #7E8B83;

  --grid:           #DEE8DE;
  --axis:           #BFCEC2;
  --border:         rgba(12,17,14,0.10);
  --shadow:         0 2px 4px rgba(18,48,30,.05), 0 10px 24px -6px rgba(18,48,30,.13);

  --series-1:       #188A4C;   /* the one data hue */
  --series-1-wash:  rgba(24,138,76,.11);

  --heat-0:         #DCEADC;   /* no activity */
  --heat-1:         #63BE8F;
  --heat-2:         #2FA268;
  --heat-3:         #188A4C;
  --heat-4:         #0B5231;

  --good:           #0ca30c;   /* status: always shipped with icon + label */
  --warning:        #fab219;
  --critical:       #d03b3b;

  --gold:           #F2B23E;   /* decoration */
  --gold-deep:      #D9902A;
  --gold-wash:      #FDF0D6;

  --radius:   18px;
  --radius-l: 26px;
  --tap: 44px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  /* depth: a close contact shadow plus a wide soft one, both warm */
  --shadow-sm: 0 1px 2px rgba(18,48,30,.06);
  --shadow-md: 0 2px 4px rgba(18,48,30,.05), 0 10px 24px -6px rgba(18,48,30,.13);
  --shadow-lg: 0 4px 8px rgba(18,48,30,.08), 0 24px 48px -12px rgba(18,48,30,.22);
  --ring-gold: 0 0 0 1px rgba(217,144,42,.26);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-0: #0F1512;
    --surface-1: #161C18;
    --surface-2: #1E2620;
    --surface-3: #28322B;
    --text-primary: #ffffff;
    --text-secondary: #BFCEC2;
    --text-muted: #7E8B83;
    --grid: #26302A;
    --axis: #334036;
    --border: rgba(255,255,255,0.10);
    --shadow: 0 2px 4px rgba(0,0,0,.4), 0 14px 32px -8px rgba(0,0,0,.5);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
    --shadow-md: 0 2px 4px rgba(0,0,0,.4), 0 14px 32px -8px rgba(0,0,0,.5);
    --shadow-lg: 0 4px 10px rgba(0,0,0,.45), 0 28px 56px -14px rgba(0,0,0,.6);
    --ring-gold: 0 0 0 1px rgba(242,178,62,.25);
    --series-1: #2FAE6A;
    --series-1-wash: rgba(47,174,106,.15);
    --heat-0: #242C26;
    --heat-1: #0E5F36;
    --heat-2: #178A4C;
    --heat-3: #2FAE6A;
    --heat-4: #8FD9AF;
    --gold-wash: #35301F;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0F1512;
  --surface-1: #161C18;
  --surface-2: #1E2620;
  --surface-3: #28322B;
  --text-primary: #ffffff;
  --text-secondary: #BFCEC2;
  --text-muted: #7E8B83;
  --grid: #26302A;
  --axis: #334036;
  --border: rgba(255,255,255,0.10);
  --shadow: 0 2px 4px rgba(0,0,0,.4), 0 14px 32px -8px rgba(0,0,0,.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 2px 4px rgba(0,0,0,.4), 0 14px 32px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 4px 10px rgba(0,0,0,.45), 0 28px 56px -14px rgba(0,0,0,.6);
  --ring-gold: 0 0 0 1px rgba(242,178,62,.25);
  --series-1: #2FAE6A;
  --series-1-wash: rgba(47,174,106,.15);
  --heat-0: #242C26;
  --heat-1: #0E5F36;
  --heat-2: #178A4C;
  --heat-3: #2FAE6A;
  --heat-4: #8FD9AF;
  --gold-wash: #35301F;
}

/* ── base ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(120% 55% at 50% -8%, color-mix(in srgb, var(--series-1) 12%, transparent) 0%, transparent 62%),
    radial-gradient(90% 40% at 90% 8%, color-mix(in srgb, var(--gold) 10%, transparent) 0%, transparent 55%),
    var(--surface-0);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.brand-name, .ob-title, .card-title, .challenge-title, .level-name,
.wish-name, .wish-alert-title, .sheet-title, .hero-goal {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.005em;
}
button { font: inherit; color: inherit; }
.muted { color: var(--text-muted); font-weight: 400; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── layout shell ─────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(160deg, var(--gold), var(--gold-deep));
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-1);
  font-size: 14px; font-weight: 640; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.chip-streak.is-hot { background: var(--gold-wash); border-color: transparent; }
.chip-icon { font-size: 14px; line-height: 1; }
.chip-streak.is-cold .chip-icon { filter: grayscale(1); opacity: .5; }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-1); cursor: pointer;
  color: var(--text-secondary);
}

.view {
  flex: 1;
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
  outline: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface-0) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1 1 0; max-width: 160px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: var(--tap); padding: 6px 4px;
  border: 0; border-radius: 12px; background: none;
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  cursor: pointer;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] { color: var(--series-1); }

/* ── cards & type ─────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md);
}
.tile { box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-title { font-size: 15px; font-weight: 640; }
.card-sub { margin: 4px 0 14px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.section-title {
  margin: 22px 4px 10px; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
}

/* ── buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 15px; font-weight: 640; cursor: pointer;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--series-1); color: #fff; }
.btn-gold { background: linear-gradient(165deg, var(--gold), var(--gold-deep)); color: #3A2A08; }
.btn-ghost { background: var(--surface-2); color: var(--text-primary); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--critical); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 8px; }
.btn-row > .btn { flex: 1; }

/* ── forms ────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }
.field-narrow { flex: 0 0 118px; }
.input {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-1); color: var(--text-primary);
  font: inherit; font-size: 16px;
}
select.input { padding-right: 8px; }
.input-affix { position: relative; }
.input-affix .affix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 16px; pointer-events: none;
}
.input-affix .input { padding-left: 34px; }

/* ── onboarding ───────────────────────────────────────────── */
.onboarding {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 70% at 50% 0%, var(--gold-wash) 0%, transparent 62%),
    var(--surface-0);
}
.ob-card { width: 100%; max-width: 420px; }
.ob-jar { display: flex; justify-content: center; margin-bottom: 10px; }
.ob-jar svg { width: 120px; height: auto; }
.ob-title { text-align: center; font-size: 30px; letter-spacing: -0.02em; }
.ob-sub { margin: 8px 0 22px; text-align: center; color: var(--text-secondary); font-size: 15px; line-height: 1.45; }
.ob-note { margin: 0 0 10px; font-size: 13px; color: var(--critical); font-weight: 600; }
.ob-fine { margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── jar hero ─────────────────────────────────────────────── */
.hero {
  position: relative;
  display: grid; grid-template-columns: 132px 1fr; gap: 16px 16px; align-items: center;
  background:
    radial-gradient(90% 70% at 18% 15%, rgba(255,255,255,.85), transparent 60%),
    linear-gradient(168deg, var(--gold-wash) 0%, var(--surface-1) 68%);
  border: 1px solid var(--border); border-radius: var(--radius-l);
  padding: 18px 18px 16px; margin-bottom: 16px;
  box-shadow: var(--ring-gold), var(--shadow-lg);
  overflow: hidden;
}
.hero-jar { display: grid; place-items: center; }
.hero-jar svg { width: 118px; height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(72,52,20,.14)); }
/* the one hero number on the screen — scales up with the viewport
   but never wraps beside the jar on a narrow phone */
.hero-figure { font-size: clamp(30px, 9vw, 42px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.05; }
.hero-label { margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.hero-meta { margin-top: 12px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.hero-bar { margin-top: 10px; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hero-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--series-1); transition: width .6s cubic-bezier(.2,.7,.3,1); }

/* The jar is the progress bar. This strip carries new information
   instead — the last fortnight's rhythm. */
.hero-spark { grid-column: 1 / -1; margin-top: 2px; }
.hero-spark-label {
  grid-column: 1 / -1; margin-top: -2px;
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700;
}

/* ── challenge card ───────────────────────────────────────── */
.challenge { position: relative; overflow: hidden; }
.challenge-flavor { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--gold-deep); }
.challenge-emoji { font-size: 30px; line-height: 1; margin: 8px 0 6px; }
.challenge-title { font-size: 19px; font-weight: 680; letter-spacing: -0.015em; }
.challenge-blurb { margin: 6px 0 14px; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.challenge-amount {
  display: inline-flex; align-items: baseline; gap: 5px; margin-bottom: 14px;
  padding: 5px 11px; border-radius: 999px; background: var(--surface-2);
  font-size: 13px; color: var(--text-secondary);
}
.challenge-amount b { font-size: 15px; color: var(--text-primary); }
.challenge.is-done { background: linear-gradient(170deg, var(--gold-wash), var(--surface-1) 60%); }
.done-mark { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 640; color: var(--good); }
.done-mark svg { width: 18px; height: 18px; flex: none; }

/* ── entry list ───────────────────────────────────────────── */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.entry:last-child { border-bottom: 0; }
.entry-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--surface-2); font-size: 17px; }
.entry-main { flex: 1; min-width: 0; }
.entry-title { display: block; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.entry-amount { font-size: 15px; font-weight: 660; font-variant-numeric: tabular-nums; }
.entry-del { border: 0; background: none; padding: 8px; color: var(--text-muted); cursor: pointer; border-radius: 8px; line-height: 0; }
.entry-del svg { width: 16px; height: 16px; }

.empty { text-align: center; padding: 26px 12px; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.empty-emoji { font-size: 30px; display: block; margin-bottom: 8px; }

/* ── stat tiles ───────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; }
.tile-label { font-size: 12px; color: var(--text-muted); }
.tile-value { margin-top: 3px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.tile-note { margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.tile-note.good { color: var(--good); font-weight: 600; }

/* ── filter row (scopes every chart below it) ─────────────── */
.filterbar { display: flex; gap: 6px; margin-bottom: 14px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.filterbar button {
  flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: none;
  font-size: 13px; font-weight: 620; color: var(--text-secondary); cursor: pointer;
}
.filterbar button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(11,11,11,.08); }

/* ── charts ───────────────────────────────────────────────── */
.viz { width: 100%; display: block; touch-action: pan-y; }
/* the calendar keeps its natural width and scrolls when a year
   of weeks cannot fit the screen */
.viz.is-wide { width: auto; max-width: none; }
.scroll-x { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.viz text { font-family: var(--font); }
.viz .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz .axis-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz .tick { fill: var(--text-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.viz .value-label { fill: var(--text-primary); font-size: 11.5px; font-weight: 640; }
.viz .row-label { fill: var(--text-secondary); font-size: 12.5px; }
.viz .mark { fill: var(--series-1); }
.viz .area { fill: var(--series-1-wash); }
.viz .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .end-dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.viz .crosshair { stroke: var(--axis); stroke-width: 1; }
.viz .hit { fill: transparent; cursor: pointer; outline: none; }
.viz .focus-ring { fill: none; stroke: var(--text-primary); stroke-width: 2; }

.chart-wrap { position: relative; }
.viz-tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  padding: 7px 10px; border-radius: 9px;
  background: var(--text-primary); color: var(--surface-1);
  font-size: 12.5px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  max-width: 200px;
}
.viz-tooltip .tt-sub { display: block; font-weight: 400; opacity: .75; font-size: 11.5px; }

.table-toggle {
  margin-top: 10px; border: 0; background: none; padding: 6px 0;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.data-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.data-table th, .data-table td { padding: 7px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.data-table td:last-child, .data-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { max-height: 260px; overflow-y: auto; }

/* heatmap legend */
.heat-legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 11.5px; color: var(--text-muted); }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }

/* ── goal ring ────────────────────────────────────────────── */
.ring-wrap { display: grid; place-items: center; padding: 6px 0 2px; }
.ring-wrap svg { width: 210px; height: 210px; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 14; }
.ring-fill { fill: none; stroke: var(--series-1); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.7,.3,1); }
.ring-figure { fill: var(--text-primary); font-size: 32px; font-weight: 700; text-anchor: middle; }
.ring-caption { fill: var(--text-muted); font-size: 12px; text-anchor: middle; }

/* ── badges ───────────────────────────────────────────────── */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 13px 8px; border-radius: 14px;
  background: var(--surface-2); text-align: center;
}
.badge.is-on { background: var(--gold-wash); }
.badge-emoji { font-size: 26px; line-height: 1; }
.badge.is-off .badge-emoji { filter: grayscale(1); opacity: .35; }
.badge-name { font-size: 11.5px; font-weight: 640; line-height: 1.3; }
.badge.is-off .badge-name { color: var(--text-muted); font-weight: 500; }
.badge-hint { font-size: 10.5px; color: var(--text-muted); line-height: 1.25; }
.badge-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.badge-strip::-webkit-scrollbar { display: none; }
.badge-strip .badge { flex: 0 0 96px; }

/* ── bottom sheet ─────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(11,11,11,.42); backdrop-filter: blur(2px); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 88vh; overflow-y: auto;
  background: var(--surface-1);
  border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
  animation: sheet-in .26s cubic-bezier(.2,.8,.3,1);
}
@keyframes sheet-in { from { transform: translateY(14px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@media (min-width: 560px) {
  .sheet { left: 50%; margin-left: -240px; right: auto; width: 480px; border-radius: 22px; bottom: 24px; }
}
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 4px auto 12px; }
.sheet-title { font-size: 18px; font-weight: 660; margin-bottom: 4px; }
.sheet-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 16px; line-height: 1.45; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pick {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 13px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-1); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.pick[aria-pressed="true"] { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.amount-row { display: flex; gap: 8px; margin-bottom: 14px; }
.amount-row .pick { flex: 1; justify-content: center; }

/* ── toast, confetti, install ─────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 70;
  padding: 11px 16px; border-radius: 12px;
  background: var(--text-primary); color: var(--surface-1);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  animation: toast-in .22s ease;
  max-width: calc(100vw - 32px); text-align: center;
}
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0 } to { transform: translate(-50%, 0); opacity: 1 } }
.confetti { position: fixed; inset: 0; z-index: 65; pointer-events: none; }

.install-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px 11px 16px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); font-size: 13.5px;
}
.install-actions { display: flex; gap: 6px; flex: none; }
@media (min-width: 560px) {
  .install-bar { width: 496px; left: 50%; margin-left: -248px; right: auto; }
}

/* ── the shelf of jars ────────────────────────────────────── */
.shelf-card { padding-bottom: 12px; }
.shelf {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 2px 2px 12px; margin-bottom: 4px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf-jar {
  flex: 0 0 96px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px 12px;
  border: 1px solid transparent; border-radius: 16px;
  background: var(--surface-2);
  cursor: pointer; text-align: center;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
}
.shelf-jar:active { transform: scale(.97); }
.shelf-jar.is-active {
  background: var(--gold-wash);
  border-color: var(--gold);
  box-shadow: var(--ring-gold), var(--shadow-sm);
}
.shelf-jar-svg { display: block; width: 52px; }
.shelf-jar-svg svg { width: 52px; height: auto; display: block; }
.shelf-jar-name {
  font-size: 11.5px; font-weight: 640; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.shelf-jar-sum { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.shelf-add { justify-content: center; border-style: dashed; border-color: var(--border); background: transparent; }
.shelf-add-plus { font-size: 30px; line-height: 1; color: var(--text-muted); margin: 12px 0 6px; }

.emoji-row { gap: 6px; }
.pick-select { padding: 0 8px; border-radius: 999px; height: 38px; font-size: 13.5px; font-weight: 600; }
.ob-lang { display: flex; justify-content: center; margin-bottom: 4px; }
.input-lang { width: auto; min-height: 36px; padding: 0 30px 0 12px; font-size: 14px; border-radius: 999px; background: var(--surface-1); }
.pick-emoji { min-height: 40px; padding: 0 10px; font-size: 19px; }

/* ── impulse cooldown ─────────────────────────────────────── */
.wish-alert { background: linear-gradient(170deg, var(--gold-wash), var(--surface-1) 65%); border-color: var(--gold); }
.wish-alert-row { display: flex; align-items: center; gap: 12px; }
.wish-alert-icon { font-size: 26px; line-height: 1; flex: none; }
.wish-alert-title { font-size: 15.5px; font-weight: 660; }

.wish-due { border-color: var(--gold); }
.wish-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.wish-main { flex: 1; min-width: 0; }
.wish-name { font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wish-price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.wish-ask { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.wish-cost { margin: 0 0 14px; font-size: 13px; color: var(--text-secondary); }
.wish-cost b { color: var(--text-primary); }

/* the dot on the tab bar when a decision falls due */
.tab { position: relative; }
.tab-dot {
  position: absolute; top: 6px; right: calc(50% - 16px);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--critical);
  box-shadow: 0 0 0 2px var(--surface-0);
}

/* ── behaviour level ──────────────────────────────────────── */
.level-card { background: linear-gradient(170deg, var(--surface-2), var(--surface-1) 70%); }
.level-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.level-emoji { font-size: 28px; line-height: 1; flex: none; }
.level-main { flex: 1; min-width: 0; }
.level-name { font-size: 17px; font-weight: 680; letter-spacing: -0.015em; }
.level-score { font-size: 20px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── goal reached ─────────────────────────────────────────── */
.hero.is-full {
  background: linear-gradient(170deg, var(--gold-wash), var(--surface-1) 55%);
  border-color: var(--gold);
}
.hero.is-full .hero-bar > i { background: var(--gold-deep); }
/* a very large target still has to fit beside the jar */
.hero-figure.is-long { font-size: clamp(24px, 7vw, 32px); }

.celebrate { text-align: center; background: linear-gradient(170deg, var(--gold-wash), var(--surface-1) 62%); }
.celebrate .challenge-emoji { font-size: 40px; margin-top: 2px; }
.celebrate .challenge-blurb { margin-bottom: 16px; }
.celebrate-fine { margin: 12px 0 2px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

@keyframes jar-shake {
  0%, 100% { transform: translateX(0) rotate(0) }
  15% { transform: translateX(-4px) rotate(-3deg) }
  30% { transform: translateX(4px) rotate(3deg) }
  45% { transform: translateX(-5px) rotate(-4deg) }
  60% { transform: translateX(5px) rotate(4deg) }
  80% { transform: translateX(-2px) rotate(-1.5deg) }
}
.jar-shake { animation: jar-shake .42s ease-in-out; }

/* jar coin drop */
@keyframes coin-drop {
  0%   { transform: translateY(-70px) scale(.6); opacity: 0 }
  55%  { opacity: 1 }
  100% { transform: translateY(0) scale(1); opacity: 1 }
}
.coin-anim { animation: coin-drop .55s cubic-bezier(.3,1.4,.5,1) backwards; }
@keyframes jar-pop { 0%, 100% { transform: scale(1) } 40% { transform: scale(1.05) } }
.jar-pop { animation: jar-pop .4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* forced-colors / print: identity must not rest on hue alone */
@media (forced-colors: active) {
  .viz .mark, .viz .line { forced-color-adjust: none; fill: CanvasText; stroke: CanvasText; }
  .card, .tile { border: 1px solid CanvasText; }
}
