/* Family Budget — design tokens + components.
   Everything is driven by the custom properties in :root, so retheming means
   editing one block. Both colour schemes are fully specified; nothing relies on
   the browser inverting anything. */

:root {
  color-scheme: light dark;

  /* surfaces */
  --bg: #f1f2f5;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e7eaef;
  --line: rgba(18, 21, 27, 0.085);
  --line-2: rgba(18, 21, 27, 0.16);

  /* ink */
  --txt: #14171d;
  --txt-2: #5b6371;
  --txt-3: #8d95a3;

  /* brand */
  --accent: #2f6bed;
  --accent-ink: #1d4fd0; /* accent as *text*, contrast-safe on --accent-soft */
  --accent-soft: rgba(47, 107, 237, 0.1);

  /* money */
  --pos: #0a7a5a;
  --neg: #c2413a;
  --warn: #8f5d0c;
  --pos-soft: rgba(10, 122, 90, 0.13);
  --neg-soft: rgba(194, 65, 58, 0.12);
  --warn-soft: rgba(143, 93, 12, 0.14);

  /* chrome */
  --toast-bg: #1b1f26;
  --toast-fg: #f4f6f9;
  --sh-card: 0 1px 2px rgba(18, 21, 27, 0.05), 0 1px 1px rgba(18, 21, 27, 0.03);
  --sh-sheet: 0 -24px 70px rgba(18, 21, 27, 0.2);
  --sh-accent: 0 2px 10px rgba(31, 82, 212, 0.26);

  /* geometry + motion */
  --r-card: 18px;
  --r-sheet: 28px;
  --r-btn: 14px;
  --pad-x: 16px;
  --dock-h: 76px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --surface: #171a20;
    --surface-2: #1e222a;
    --surface-3: #272c36;
    --line: rgba(255, 255, 255, 0.075);
    --line-2: rgba(255, 255, 255, 0.15);

    --txt: #eceef3;
    --txt-2: #99a1af;
    --txt-3: #6c7482;

    --accent: #3b7bff;
    --accent-ink: #8db4ff;
    --accent-soft: rgba(93, 148, 255, 0.16);

    --pos: #3fc795;
    --neg: #ff8a7c;
    --warn: #e0ad5c;
    --pos-soft: rgba(63, 199, 149, 0.15);
    --neg-soft: rgba(255, 138, 124, 0.14);
    --warn-soft: rgba(224, 173, 92, 0.15);

    --toast-bg: #2b313c;
    --toast-fg: #f1f3f7;
    --sh-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --sh-sheet: 0 -24px 70px rgba(0, 0, 0, 0.55);
    --sh-accent: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Colour tones. --tone drives progress-bar fills so one class covers text + bar. */
.t-pos { color: var(--pos); --tone: var(--pos); --tone-soft: var(--pos-soft); }
.t-warn { color: var(--warn); --tone: var(--warn); --tone-soft: var(--warn-soft); }
.t-neg { color: var(--neg); --tone: var(--neg); --tone-soft: var(--neg-soft); }
.t-flat { color: var(--txt); --tone: var(--txt-3); --tone-soft: var(--surface-3); }

/* ---------- app frame ---------- */

.app { height: 100%; display: flex; flex-direction: column; }

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-top: env(safe-area-inset-top);
}

.pad-x {
  padding-left: max(var(--pad-x), env(safe-area-inset-left));
  padding-right: max(var(--pad-x), env(safe-area-inset-right));
}

/* Keeps the last card clear of the dock. */
.scroll-tail { height: calc(var(--dock-h) + env(safe-area-inset-bottom) + 12px); }

.dock {
  display: flex;
  gap: 10px;
  padding: 10px max(var(--pad-x), env(safe-area-inset-left));
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 0.5px 0 var(--line);
}
.dock #act-add { flex: 1.55; }
.dock #act-unsure { flex: 1; }
.dock.off { opacity: 0.4; pointer-events: none; }

/* ---------- pull to refresh ---------- */

.ptr {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 6px);
  left: 0; right: 0;
  display: grid;
  place-items: center;
  height: 34px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.ptr-spin {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--line-2);
  border-top-color: var(--accent);
}
.ptr.spin { opacity: 1; transition: opacity 0.2s; }
.ptr.spin .ptr-spin { animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero ---------- */

.hero { padding: 14px 2px 18px; }
.hero-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}
.hero-month {
  font-size: 15px;
  font-weight: 600;
  color: var(--txt-2);
  letter-spacing: 0.005em;
  flex: 1;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650;
  flex: none;
}
.hero-amt {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.032em;
  line-height: 1.08;
  margin-top: 6px;
}
.hero-meta {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--txt-2);
}
.hero-bar { margin-top: 14px; }

/* ---------- sync pill ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--txt-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  animation: pop-in 0.3s var(--spring);
}
.pill.wait { background: var(--warn-soft); color: var(--warn); }
.pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: breathe 1.3s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.28; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.9); } }

/* ---------- cards ---------- */

.sec { margin-bottom: 22px; }
.sec-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 2px 9px;
  font-size: 13px;
  font-weight: 650;
  color: var(--txt-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sec-h-split { justify-content: space-between; }
.sec-h-note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--txt-3);
}
.sec-foot {
  margin: 9px 4px 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--txt-3);
}
.sec-h .sec-h-act {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-ink);
  background: none; border: 0; padding: 4px 2px;
}

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
}
.stack { display: flex; flex-direction: column; gap: 10px; }

.bar {
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--tone, var(--txt-3));
  transition: width 0.5s var(--spring);
}
.hero-bar .bar { height: 3px; }

/* envelope card */
.env {
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  padding: 14px 6px 15px 15px;
  display: grid;
  grid-template-columns: 30px 1fr auto 22px;
  grid-template-areas:
    "emoji name  amt  chev"
    "emoji bar   bar  chev"
    "emoji sub   sub  chev";
  align-items: center;
  column-gap: 12px;
  transition: transform 0.18s var(--spring), background-color 0.18s var(--ease);
  touch-action: manipulation;
}
.env:active { transform: scale(0.985); background: var(--surface-2); }
.env-emoji { grid-area: emoji; font-size: 23px; line-height: 1; text-align: center; }
.env-name {
  grid-area: name;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.env-amt {
  grid-area: amt;
  font-size: 22px;
  font-weight: 660;
  letter-spacing: -0.024em;
  text-align: right;
  padding-left: 10px;
}
.env-bar { grid-area: bar; margin: 10px 0 0; }
/* Tracked categories with no "usually" figure have nothing to chart against;
   the placeholder keeps the card's grid rows aligned with the others. */
.env-bar-skip { grid-area: bar; height: 0; }
.env.tracked { padding-bottom: 13px; }
.env-sub { grid-area: sub; margin-top: 7px; font-size: 12.5px; color: var(--txt-3); }
.chev {
  grid-area: chev;
  justify-self: end;
  width: 22px; height: 44px;
  display: grid; place-items: center;
  color: var(--txt-3);
}
.chev::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  border-radius: 0 0 1.5px 0;
}
/* Chevron is its own hit target laid over the card; the card body is the add path. */
.env-chev-btn {
  grid-area: chev;
  justify-self: end;
  width: 44px; height: 100%;
  margin-right: -11px;
  border: 0; background: none; padding: 0;
  display: grid; place-items: center;
  color: var(--txt-3);
  touch-action: manipulation;
}
.env-chev-btn:active { color: var(--txt-2); transform: scale(0.9); }

/* pop when a balance changes */
.pop { animation: pop 0.42s var(--spring); }
@keyframes pop {
  30% { transform: scale(1.075); }
  to { transform: scale(1); }
}

/* needs-sorting card */
.review {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: var(--r-card);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 14px 14px 14px 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  transition: transform 0.18s var(--spring);
  touch-action: manipulation;
}
.review:active { transform: scale(0.985); }
.review-emoji { font-size: 23px; line-height: 1; }
.review-txt { flex: 1; min-width: 0; }
.review-t { font-size: 16.5px; font-weight: 650; letter-spacing: -0.012em; }
.review-s { font-size: 13px; color: var(--txt-2); margin-top: 2px; }
.review .go {
  flex: none;
  height: 34px; padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px; font-weight: 650;
  display: grid; place-items: center;
}

/* unallocated — income, not a spending envelope, so it gets its own treatment */
.unalloc {
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--sh-card), inset 0 0 0 1px var(--line);
  padding: 15px;
}
.unalloc-top { display: flex; align-items: center; gap: 12px; }
.unalloc-emoji { font-size: 22px; line-height: 1; }
.unalloc-txt { flex: 1; min-width: 0; }
.unalloc-t { font-size: 15.5px; font-weight: 600; }
.unalloc-s { font-size: 12.5px; color: var(--txt-3); margin-top: 1px; }
.unalloc-amt { font-size: 21px; font-weight: 660; letter-spacing: -0.022em; }
.unalloc-acts {
  display: flex; gap: 8px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.unalloc-acts .btn { flex: 1; min-height: 40px; font-size: 14.5px; border-radius: 12px; }

/* ---------- activity ---------- */

.day-h {
  margin: 16px 2px 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--txt-3);
}
.day-h:first-child { margin-top: 0; }

/* flex: none matters — inside the sheet's flex column, `overflow: hidden` would
   otherwise let this list shrink below its rows and clip them to a sliver. */
.rows {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  overflow: hidden;
  flex: none;
}
.row {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  transition: background-color 0.15s var(--ease);
  touch-action: manipulation;
}
.row + .row { box-shadow: inset 0 0.5px 0 var(--line); }
.row:active { background: var(--surface-2); }
.row-emoji { font-size: 19px; line-height: 1; width: 22px; text-align: center; flex: none; }
.row-txt { flex: 1; min-width: 0; }
.row-t {
  font-size: 15.5px;
  font-weight: 550;
  letter-spacing: -0.008em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-s {
  font-size: 12.5px;
  color: var(--txt-3);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-amt {
  flex: none;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.016em;
}
.row-amt.out { color: var(--txt); }
.row-amt.in { color: var(--pos); }
.row-pending {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warn);
  margin-left: 6px;
  vertical-align: 1px;
  animation: breathe 1.3s ease-in-out infinite;
}

/* ---------- buttons / chips / fields ---------- */

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--r-btn);
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-3);
  color: var(--txt);
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -0.005em;
  transition: transform 0.16s var(--spring), opacity 0.16s var(--ease), background-color 0.16s var(--ease);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: var(--sh-accent); }
.btn.tinted { background: var(--accent-soft); color: var(--accent-ink); }
.btn.plain { background: var(--surface-2); }
.btn.danger { background: var(--neg-soft); color: var(--neg); }
.btn.big { min-height: 52px; font-size: 16.5px; border-radius: 16px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.4; pointer-events: none; box-shadow: none; }
.btn-plus { font-size: 20px; font-weight: 500; margin-top: -2px; }

.ghost {
  border: 0; background: none;
  padding: 8px 4px;
  min-height: 40px;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent-ink);
  touch-action: manipulation;
}
.ghost:active { opacity: 0.55; }

.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
  margin: 0 -2px;
  scroll-padding: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 0;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--txt-2);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: transform 0.14s var(--spring), background-color 0.14s var(--ease);
  touch-action: manipulation;
}
.chip:active { transform: scale(0.94); }
.chip.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 0 14px;
  min-height: 48px;
}
.field label {
  font-size: 14px;
  color: var(--txt-3);
  flex: none;
  min-width: 46px;
}
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--txt);
  /* 16px minimum keeps iOS from zooming the viewport on focus */
  font-size: 16px;
  font-family: inherit;
  padding: 12px 0;
  outline: none;
}
.field input::placeholder { color: var(--txt-3); }

/* a row that opens a picker */
.select {
  width: 100%;
  border: 0;
  background: var(--surface-2);
  border-radius: 14px;
  min-height: 52px;
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: transform 0.16s var(--spring), background-color 0.16s var(--ease);
  touch-action: manipulation;
}
.select:active { transform: scale(0.985); background: var(--surface-3); }
.select .sl-label { font-size: 13.5px; color: var(--txt-3); flex: none; min-width: 42px; }
.select .sl-emoji { font-size: 19px; line-height: 1; }
.select .sl-name { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select .sl-amt { font-size: 14px; color: var(--txt-3); }
.select.empty .sl-name { color: var(--accent-ink); font-weight: 650; }

/* ---------- sheets ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(10, 12, 16, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.36s var(--ease);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}
.scrim.in { opacity: 1; pointer-events: auto; }

.sheets { position: fixed; inset: 0; z-index: 40; pointer-events: none; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  pointer-events: auto;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--sh-sheet);
  max-height: min(93dvh, 900px);
  display: flex;
  flex-direction: column;
  transform: translateY(101%);
  transition: transform 0.44s var(--spring), opacity 0.3s var(--ease);
  will-change: transform;
}
.sheet.in { transform: translateY(0); }
.sheet.drag { transition: none; }
/* Declared after .in so a stacked-under sheet wins. */
.sheet.behind { transform: translateY(-12px) scale(0.972); opacity: 0.4; }

.grab {
  padding: 7px 0 3px;
  display: grid;
  place-items: center;
  flex: none;
  touch-action: none;
  cursor: grab;
}
.grab::after {
  content: "";
  width: 38px; height: 5px;
  border-radius: 3px;
  background: var(--line-2);
}

.shead {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 8px;
  touch-action: none;
}
.shead h2 {
  grid-column: 2;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.014em;
  text-align: center;
  white-space: nowrap;
}
.shead .l { grid-column: 1; justify-self: start; }
.shead .r { grid-column: 3; justify-self: end; }
.ssub {
  flex: none;
  padding: 0 var(--pad-x) 4px;
  font-size: 13.5px;
  color: var(--txt-2);
  text-align: center;
}

.sbody {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 6px var(--pad-x) calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 11px;
}
/* This is a scrolling flex column, so its children must keep their natural height.
   Anything with `overflow: hidden` (the history lists) is otherwise allowed to shrink
   below its content and clips itself to a sliver. */
.sbody > * { flex-shrink: 0; }

/* ---------- amount + keypad ---------- */

.amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  padding: 8px 0 6px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 52px;
  font-weight: 640;
  letter-spacing: -0.036em;
  line-height: 1.05;
}
.amount .cur {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--txt-2);
  align-self: flex-start;
  margin-top: 0.22em;
  letter-spacing: 0;
}
.amount .dim { color: var(--txt-3); }
.amount.zero { color: var(--txt-3); }
.amount.zero .cur { color: var(--txt-3); }
.amount.nudge { animation: nudge 0.3s var(--ease); }
@keyframes nudge {
  25% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  to { transform: translateX(0); }
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.key {
  height: 54px;
  border: 0;
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--txt);
  font-size: 23px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  transition: transform 0.11s var(--spring), background-color 0.11s var(--ease);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.key:active { transform: scale(0.94); background: var(--surface-3); }
.key.fn { color: var(--txt-2); font-size: 20px; }

/* ---------- picker / stats / lists inside sheets ---------- */

.picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
/* Label above the rule-suggested envelope chips in the sort flow. */
.picker-hint {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--txt-3);
}
.pick {
  border: 0;
  background: var(--surface-2);
  border-radius: 15px;
  padding: 12px 12px 11px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 74px;
  transition: transform 0.16s var(--spring), background-color 0.16s var(--ease);
  touch-action: manipulation;
}
.pick:active { transform: scale(0.96); }
.pick.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.pick-emoji { font-size: 20px; line-height: 1.1; }
.pick-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.008em; }
.pick-amt { font-size: 12.5px; color: var(--txt-3); }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.stat {
  background: var(--surface-2);
  border-radius: 15px;
  padding: 12px 13px 11px;
}
.stat-k { font-size: 12.5px; color: var(--txt-3); }
.stat-v {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.sortrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 15px;
  padding: 11px 11px 11px 14px;
  transition: transform 0.28s var(--spring), opacity 0.28s var(--ease);
}
.sortrow.gone { transform: translateX(28px); opacity: 0; }
.sortrow-txt { flex: 1; min-width: 0; }
.sortrow-t { font-size: 15.5px; font-weight: 600; letter-spacing: -0.008em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sortrow-s { font-size: 12.5px; color: var(--txt-3); margin-top: 1px; }
.sortrow-amt { font-size: 16px; font-weight: 620; letter-spacing: -0.014em; }
.sortrow .btn { min-height: 36px; padding: 0 15px; border-radius: 999px; font-size: 14px; }

.entry-hero { text-align: center; padding: 6px 0 2px; }
.entry-hero .eh-emoji { font-size: 38px; line-height: 1; }
.entry-hero .eh-amt {
  font-size: 34px;
  font-weight: 680;
  letter-spacing: -0.028em;
  margin-top: 8px;
}
.entry-hero .eh-sub { font-size: 14px; color: var(--txt-2); margin-top: 4px; }

/* ---------- misc ---------- */

.empty {
  text-align: center;
  padding: 26px 20px 30px;
  color: var(--txt-2);
}
.empty-emoji { font-size: 30px; line-height: 1; }
.empty-t { font-size: 15.5px; font-weight: 600; color: var(--txt); margin-top: 9px; }
.empty-s { font-size: 13.5px; margin-top: 4px; line-height: 1.5; }

.banner {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: var(--r-card);
  padding: 13px 15px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.45;
}
.banner b { font-weight: 650; }

.diag {
  margin: 4px 2px 8px;
  font-size: 12.5px;
  color: var(--txt-3);
}
.diag summary { cursor: pointer; padding: 6px 0; }
.diag ul { margin: 4px 0 0; padding-left: 18px; line-height: 1.55; word-break: break-word; }

.toasts {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px calc(var(--dock-h) + env(safe-area-inset-bottom) + 10px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.35;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.26);
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.36s var(--spring), opacity 0.26s var(--ease);
}
.toast.in { transform: none; opacity: 1; }
.toast-msg { flex: 1; }
.toast button {
  flex: none;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-size: 14px;
  font-weight: 650;
  border-radius: 9px;
  min-height: 32px;
  padding: 0 12px;
  touch-action: manipulation;
}

/* first-launch skeleton */
.sk-card {
  height: 88px;
  border-radius: var(--r-card);
  background: var(--surface);
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.sk-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-2), transparent);
  transform: translateX(-100%);
  animation: sk 1.5s infinite;
}
@keyframes sk { to { transform: translateX(100%); } }

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