/* ── Design system imports (tokens, components) ──
   tokens.css = palette, type, space, radius, shadow, motion.
   components.css = recurring patterns (cards, chips, swipes, btns, modals).
   See docs/design/system.md for the playbook. */
@import url('./tokens.css');
@import url('./components.css');

/* ── Self-hosted fonts (latin variable subsets; precached by sw.js SHELL) ── */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/webapp/fonts/fraunces-latin.woff2') format('woff2-variations'),
       url('/webapp/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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/webapp/fonts/inter-latin.woff2') format('woff2-variations'),
       url('/webapp/fonts/inter-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* :root tokens moved to tokens.css */

html, body { height: 100%; background: var(--bg); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── App shell ── */
.app {
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* ── Tab panels ── */
.tab-panel {
  display: none;
  flex: 1;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 calc(var(--nav-h) + var(--safe-bottom) + 8px);
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom nav ── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  /* Slight horizontal inset so the leftmost/rightmost labels
     ("Home", "Settings") don't sit flush against the screen edge. */
  padding-inline: 10px;
  padding-bottom: var(--safe-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text);             /* brown ink for inactive icons */
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0 4px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--accent-dark); }   /* amber/yolk active */
.nav-item svg { transition: stroke .15s; }

/* B-060: count badge on a bottom-nav item (pending expenses on History).
   Absolutely positioned over the icon's top-right corner. */
.nav-item { position: relative; }
.nav-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 8px);
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-1);
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: var(--radius-pill);
}
.nav-badge[hidden] { display: none; }

/* ── HOME HERO ──
   Toast-butter yellow slab, sized by its content (no viewport floor)
   so the cards below aren't pushed off-screen. Dark-brown ink on top;
   mascot anchored bottom-right of the hero. */
.home-hero {
  background: var(--gradient-hero);
  padding: 44px 20px 22px;
  color: var(--text);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.home-hero-mascot {
  position: absolute;
  right: 16px;
  bottom: 12px;
  width: 84px;
  height: 84px;
  object-fit: contain;
  display: none;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 3px 6px rgba(62, 39, 35, 0.12));
}
.home-hero-mascot.loaded { display: block; }

.home-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.home-greeting {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.85;
}

/* Period chip in the hero — pill on a warm brown tint. */
.home-period-label {
  background: rgba(62, 39, 35, 0.08);
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.home-period-label:hover { background: rgba(62, 39, 35, 0.14); }
.home-period-label:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.home-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.75;
  margin: 2px 0 6px;
}
/* On the warm hero, the default ash-gray info icon dies. Tint it the
   same warm brown so it reads without yelling. */
.home-hero-label .info-icon {
  background: rgba(62, 39, 35, 0.45);
}

.home-total {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.05;
  color: var(--text);
  transition: filter .2s ease;
}

.home-total-row {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
}
.home-total-row:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: 8px;
}
/* Privacy blur on the hero amount. Using filter:blur() on text clips
   the blurred glyphs at the element's bounding box, leaving a visible
   rectangle halo against the warm hero gradient. Painting transparent
   text with a soft text-shadow instead lets the glow extend naturally
   past the box edges so the obfuscation feels like part of the
   background, not a card pasted on top. */
.home-total-row.is-blurred .home-total {
  color: transparent;
  text-shadow: 0 0 18px var(--text);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

#tab-home.is-blurred .where-row-amount {
  filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.home-total-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(62, 39, 35, 0.10);
  color: var(--text);
  flex-shrink: 0;
  transition: background .15s;
}
.home-total-row:hover .home-total-eye,
.home-total-row:active .home-total-eye { background: rgba(62, 39, 35, 0.18); }
.home-total-eye svg { width: 16px; height: 16px; }
.home-total-eye .eye-open  { display: inline-block; }
.home-total-eye .eye-closed { display: none; }
.home-total-row.is-blurred .home-total-eye .eye-open  { display: none; }
.home-total-row.is-blurred .home-total-eye .eye-closed { display: inline-block; }

/* Meta row: delta pill + expense-count context, on one horizontal line. */
.home-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.home-sub {
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0.75;
}

/* Delta pill — green-tinted when spending went down, amber when up.
   Never red: higher spend is information, not a bug. */
.home-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1px;
  line-height: 1;
}
.home-delta-pill.down {
  background: rgba(46, 125, 50, 0.16);
  color: #1B5E20;
}
.home-delta-pill.up {
  background: rgba(230, 81, 0, 0.16);
  color: #BF360C;
}
.home-delta-pill.flat {
  background: rgba(62, 39, 35, 0.10);
  color: var(--text);
}

/* ── Where it went (category bar list) ──
   Replaces the donut chart. Each row is category name + amount above a
   horizontal progress bar, width proportional to share of total spend.
   Bar colour is assigned by renderWhereItWent() from the brand palette
   (same colours the donut used). */
.where-row {
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.where-row + .where-row {
  border-top: 1px solid var(--border);
}
.where-row:hover { background-color: var(--green-light); }
.where-row:active { background-color: var(--green-light); filter: brightness(0.97); }
.where-row:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.where-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 12px;
}
.where-row-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.where-row-amount {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.where-row-track {
  height: 6px;
  border-radius: 3px;
  background: #F1E9CF;
  overflow: hidden;
}
.where-row-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}

/* ── Pull-to-refresh indicator ─────────────────────────────────────────
   Lives at the top of the home scroll area; JS translates it down as the
   user drags, and spins it while a refresh is in flight. */
.ptr {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -48px);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4CAF50;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity .15s ease;
}
.ptr.visible { opacity: 1; }
.ptr-spinner svg {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform .1s linear;
}
/* While refreshing, spin the arrow icon. */
.ptr.refreshing .ptr-spinner svg {
  animation: ptr-spin 0.9s linear infinite;
}
@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
/* The scroll-area is the positioning context for the PTR spinner. */
#tab-home .scroll-area { position: relative; }

#active-trip-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: rgba(76, 175, 80, 0.12);   /* pale green wash */
  border: 1px solid rgba(76, 175, 80, 0.25);
  border-radius: 999px;
  padding: 6px 6px 6px 12px;
  width: fit-content;
  color: var(--green-dark, #2E7D32);
  font-size: 0.85rem;
  font-weight: 600;
}
.trip-banner-icon { font-size: 1rem; }
.trip-banner-end {
  background: var(--green);
  border: none;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
}
.trip-banner-end:hover { background: var(--green-dark, #2E7D32); }

/* B-060: persistent household-mode chip on the Home hero. White pill so
   it reads on the yellow hero; muted because it's ambient state, not an
   action — tapping it opens the finance-model explainer. */
.home-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-1) var(--space-3);
  width: fit-content;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--sub);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.home-mode-chip:active { opacity: 0.6; }

.trip-active-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: 20px;
  background: #D1FAE5;
  color: #065F46;
  flex-shrink: 0;
  margin-right: 4px;
}
.trip-planned-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: #EEF2FF;
  color: #4338CA;
  flex-shrink: 0;
  margin-right: 4px;
}
.trip-ended-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--sub);
  flex-shrink: 0;
  margin-right: 4px;
}

/* Period chips, section cards, swipe-to-reveal, shared swipe actions:
   moved to components.css. */

/* ── Expense rows ── */
.expense-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: var(--card);
  position: relative;
  z-index: 1;
  transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.expense-row:last-child { border-bottom: none; }
.expense-row:active { opacity: 0.6; }

.expense-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.expense-info { flex: 1; min-width: 0; }

.expense-merchant {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-meta {
  font-size: 0.75rem;
  color: var(--sub);
  margin-top: 1px;
}

.expense-right { text-align: right; flex-shrink: 0; }

.expense-amount {
  font-weight: 600;
  font-size: 0.9rem;
}

.expense-subamount {
  font-size: 0.7rem;
  color: var(--sub);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.expense-date {
  font-size: 0.72rem;
  color: var(--sub);
  margin-top: 1px;
}

/* ── Budget bars ── */
.budget-item { margin-bottom: 14px; }
.budget-item:last-child { margin-bottom: 0; }

.budget-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 5px;
}

.budget-name { font-weight: 500; }
.budget-amounts { color: var(--sub); }

.bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}

.bar-fill.ok   { background: var(--green-mid); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.over { background: var(--red); }

/* ── Member spending breakdown ── */
.member-spend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.member-spend-row:last-child { border-bottom: none; }
.member-spend-name {
  font-size: 0.88rem;
  font-weight: 500;
  width: 72px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-spend-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.member-spend-bar { height: 100%; border-radius: 3px; background: var(--green); transition: width .5s ease; }
.member-spend-amount {
  font-size: 0.82rem;
  color: var(--sub);
  text-align: right;
  width: 64px;
  flex-shrink: 0;
}

/* ── Loan rows (see Split / Paid-by section below) ── */

/* ── Empty & error states ── */
.empty-state {
  text-align: center;
  color: var(--sub);
  font-size: 0.85rem;
  padding: 16px 0;
}

.inline-error {
  background: var(--red-light);
  color: var(--red);
  font-size: 0.82rem;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
}

/* ── ADD TAB ── */
/* Yolk hero — matches .home-hero / .history-hero / .wealth-total-card
   so the Add form opens onto the same warm gradient as the other tabs,
   anchoring the big amount input visually as the "hero number". */
.add-header {
  background: var(--gradient-hero);
  padding: 44px 20px 22px;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

/* Label sits under the amount as a quiet descriptor, mirroring
   .home-hero-label so the hierarchy reads "big number → what it is". */
.add-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.75;
  margin: 2px 0 6px;
}

.amount-display-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.amount-currency-prefix {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.7;
}

.amount-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.05;
  width: 0; /* flex will size it */
  -moz-appearance: textfield;
}

.amount-input::placeholder { color: rgba(62,39,35,0.25); }
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Currency picker as a brown-tinted pill, echoing .home-period-label
   so it reads as a sibling chip on the yolk hero rather than a form
   control pasted into the page. */
.currency-select {
  background: rgba(62, 39, 35, 0.08);
  color: var(--text);
  border: none;
  border-radius: 999px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 6px 12px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.currency-select:hover { background: rgba(62, 39, 35, 0.14); }
.currency-select:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.currency-select option { color: var(--text); background: #fff; }

/* ── Form fields ── */
.add-form {
  padding: 16px;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
}

.form-field .opt {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--green);
}

/* Small "(tap multiple)" affordance next to a form-field label. Cancels
   the label's uppercase + letter-spacing so the hint reads as natural
   prose rather than a continuation of the field name. */
.filter-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sub);
  font-size: 0.7rem;
  margin-left: 4px;
}

/* Buttons (.btn-primary-full, .btn-outline-full): moved to components.css */

/* ── HISTORY TAB ──
   Full-bleed yolk hero matching .home-hero and .wealth-total-card.
   The bottom nav already labels the tab, so the page title is gone;
   the Recurring/Filters chips sit in the hero-top row like Home's
   greeting + period chip. Mascot anchors bottom-right. */
.history-hero {
  background: var(--gradient-hero);
  padding: 44px 20px 22px;
  color: var(--text);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.history-hero-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.history-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(62, 39, 35, 0.08);
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.history-hero-link:hover { background: rgba(62, 39, 35, 0.14); }
.history-hero-link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.history-hero-link svg {
  width: 12px;
  height: 12px;
}
/* Period label on the far right of the hero — matches .home-period-label
   so Home and History read as one family. margin-left:auto floats it
   past the action chips without needing to wrap them in a sub-group. */
.history-period-label {
  margin-left: auto;
  background: rgba(62, 39, 35, 0.08);
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.history-period-label:hover { background: rgba(62, 39, 35, 0.14); }
.history-period-label:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.history-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.75;
  margin: 2px 0 6px;
}
.history-total-row {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
}
.history-total-row:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: 8px;
}
.history-total {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: filter .2s ease;
}
.history-total-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(62, 39, 35, 0.10);
  color: var(--text);
  flex-shrink: 0;
  transition: background .15s;
}
.history-total-row:hover .history-total-eye,
.history-total-row:active .history-total-eye { background: rgba(62, 39, 35, 0.18); }
.history-total-eye svg { width: 16px; height: 16px; }
.history-total-eye .eye-open  { display: inline-block; }
.history-total-eye .eye-closed { display: none; }
.history-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.history-sub {
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0.75;
}
/* Delta pill — mirrors .home-delta-pill so History reads as the same
   hero shape as Home. Green when net improved (more positive vs last
   month), amber when it dipped, neutral when flat. */
.history-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1px;
}
.history-delta-pill.up {
  background: rgba(76, 175, 80, 0.18);
  color: var(--green-dark);
}
.history-delta-pill.down {
  background: rgba(255, 167, 38, 0.22);
  color: #8E5A00;
}
.history-delta-pill.flat {
  background: rgba(62, 39, 35, 0.10);
  color: var(--text);
}
/* Privacy blur — applied via #tab-history.is-blurred when the shared
   totals-hidden state is on. Same selector pattern as #tab-home. */
/* See the note on .home-total-row.is-blurred for why this uses
   transparent text + text-shadow instead of filter:blur. */
#tab-history.is-blurred .history-total {
  color: transparent;
  text-shadow: 0 0 18px var(--text);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
#tab-history.is-blurred .expense-amount,
#tab-history.is-blurred .history-summary-amount,
#tab-history.is-blurred .history-delta-pill {
  filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
#tab-history.is-blurred #btn-toggle-history-total .eye-open  { display: none; }
#tab-history.is-blurred #btn-toggle-history-total .eye-closed { display: inline-block; }
.history-hero-mascot {
  position: absolute;
  right: 16px;
  bottom: 12px;
  width: 84px;
  height: 84px;
  object-fit: contain;
  display: none;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 3px 6px rgba(62, 39, 35, 0.12));
}
.history-hero-mascot.loaded { display: block; }

/* History's search bar — now a sibling under the period row, no longer
   nested in the warm hero. A small horizontal margin matches the
   period-row's gutter so they line up. */
.history-search-bar {
  margin: 6px 16px 10px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text);
}

.search-bar input::placeholder { color: var(--sub); }

/* ── History filters ──
   The seven selects that used to live inline (3–4 rows of 130px pills)
   moved into #history-filters-modal. The header gets a count badge,
   and any active filters appear as removable chips below the search
   bar — so the default view costs zero real estate. */
.history-filters-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 4px;
  background: var(--green);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
}
.history-filters-count[hidden] { display: none; }

.history-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 10px;
}
.history-active-filters[hidden] { display: none; }
.history-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 10px;
  background: var(--card);
  border: 1.5px solid var(--green);
  border-radius: 20px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.history-active-chip strong { font-weight: 700; }
.history-active-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
}
.history-active-chip:active { opacity: 0.7; }

/* Pending-expenses chip on the History tab. Painted in the warm-amber
   palette (--accent-light bg, --accent-dark accent) to signal "needs
   attention" without using the alarming red — red is reserved for
   destructive states. Tap body filters to pending; tap (i) explains. */
.history-pending-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: calc(100% - var(--space-4) * 2);
  margin: var(--space-3) var(--space-4) var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--accent-light);
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.history-pending-chip:active { opacity: 0.7; }
.history-pending-chip-text {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.history-pending-chip-text::before {
  content: '⚠';
  color: var(--accent-dark);
  font-size: 0.95rem;
}

/* ── SETTINGS TAB ── */
.settings-header {
  background: var(--gradient-hero);
  padding: 52px 24px 20px;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.settings-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-header-mascot {
  position: absolute;
  right: 14px;
  bottom: -14px;
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: none;
  pointer-events: none;
}
.settings-header-mascot.loaded {
  display: block;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}

.settings-name  { font-size: 1rem; font-weight: 700; }
.settings-email { font-size: 0.8rem; opacity: 0.75; margin-top: 2px; }

.settings-section { padding: 16px 16px 0; }

.settings-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sub);
  margin-bottom: 8px;
}
/* Variant for labels with an inline (i) info-icon affordance — the
   icon needs the label to be a flex line so it sits beside the text
   rather than below it on the next line. */
.settings-label--inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: none;
  border: none;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}

.settings-row:last-child { border-bottom: none; }
.settings-row.danger { color: var(--red); }

/* ── Export inputs ── */
.export-row {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.export-date-group { flex: 1; }

.export-date-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sub);
  margin-bottom: 5px;
}

.export-date-input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
  background: var(--bg);
}

/* Modal (.modal-overlay, .modal-sheet, .modal-header, etc.): moved to components.css */

/* ── Edit-amount row (modal helper) ── */
.edit-amount-row {
  display: flex;
  gap: 8px;
}

.edit-amount-row input { flex: 1; }
.edit-amount-row select { width: 80px; }

/* .modal-actions, .btn-primary/.btn-secondary, .btn-primary-sm, .btn-danger-sm:
   moved to components.css */

/* ── Settings label row (label + action button) ── */
.settings-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* ── Settings row right side ── */
.settings-row-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sub);
}

.settings-badge {
  font-size: 0.78rem;
  color: var(--sub);
}
/* B-060: alert variant — recurring-alert count on the Recurring nav row.
   Red + bold so it reads as "needs attention", not just a muted count. */
.settings-badge--alert {
  color: var(--red);
  font-weight: 700;
}

/* ── Tall modal variant ── */
.modal-sheet-tall {
  max-height: 85vh;
}

/* ── Category management rows ── */
.cat-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cat-manage-row:last-child { border-bottom: none; }
.cat-manage-row:active { opacity: 0.6; }

.cat-manage-name {
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
}

.cat-manage-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-sub-count {
  font-size: 0.78rem;
  color: var(--sub);
}

.btn-icon-sm {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--sub);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.btn-icon-sm:hover { background: var(--bg); color: var(--red); }

/* ── Subcategory rows in modal ── */
.subcat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.subcat-row:last-child { border-bottom: none; }

.subcat-name { font-size: 0.9rem; }

/* ── Inline add forms ── */
.inline-add-form input,
.subcat-add-row input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 10px;
  color: var(--text);
  background: var(--bg);
}
.inline-add-form input:focus,
.subcat-add-row input:focus { border-color: var(--green); background: var(--card); }

/* ── Recurring expense rows ── */
.recurring-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recurring-row:last-child { border-bottom: none; }
.recurring-info { flex: 1; min-width: 0; }
.recurring-merchant { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.recurring-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.recurring-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.recurring-amount { font-weight: 600; font-size: 0.88rem; color: var(--text); }

/* Recurring's empty state now uses the shared .coach-empty component
   (components.css) — see _loadRecurring(). B-039. */

/* "New recurring expense" header above the inline form. */
.recurring-form-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sub);
  margin-bottom: 10px;
}

.inline-add-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Budget manage list: grouped by category with labeled lines ─────── */
.budget-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--card);
}
.budget-group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.budget-group-name {
  font-weight: 700;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text);
}
.budget-group-total {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--green);
}
.budget-group-meta {
  font-size: 0.72rem;
  color: var(--sub);
  margin-top: 2px;
}
.budget-line-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.budget-line-row:last-child { border-bottom: none; }
.budget-line-label {
  font-size: 0.84rem;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.budget-line-label .bullet { color: var(--sub); }
.budget-line-label.cap {
  font-style: italic;
  color: var(--sub);
}
.budget-line-amount {
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text);
  margin-right: 10px;
}
.budget-line-actions {
  display: flex;
  gap: 4px;
}
.budget-group-add-line {
  margin-top: 6px;
  padding: 6px 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}
.new-budget-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--sub);
  line-height: 1.4;
}

/* ── Track as recurring (edit modal) ─────────────────────────────────── */
.make-recurring-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recurring-already-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: #2ea043;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(46, 160, 67, 0.12);
}
.freq-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.freq-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--sub);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.freq-chip.selected {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.make-recurring-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-ghost-sm {
  padding: 8px 14px;
  background: transparent;
  color: var(--sub);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Account type select (inside inline add form) ── */
.acct-type-select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.acct-type-select:focus { border-color: var(--green); background: var(--card); }

/* ── Account type icon badges ── */
.acct-type-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sub);
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 7px;
}
/* Tap-to-flip clears_immediately. Same visual rhythm as .acct-type-badge
   but rendered as a button so it advertises tappability — pending uses
   the warm-amber palette (matches the History pending chip), clears
   uses the green tint already used for cleared/reconciled chips. */
.acct-clears-toggle {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
  border: 1px solid transparent;
}
.acct-clears-toggle.is-pending {
  color: var(--accent-dark);
  background: var(--accent-light);
  border-color: var(--accent-dark);
}
.acct-clears-toggle.is-clears {
  color: var(--green-dark);
  background: var(--green-light);
  border-color: var(--green-dark);
}
.acct-clears-toggle:active { opacity: 0.6; }
.acct-clears-toggle:disabled { opacity: 0.5; cursor: progress; }

/* ── Member rows ── */
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }

.member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

.member-info { flex: 1; min-width: 0; overflow: hidden; }
.member-name  { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-email { font-size: 0.75rem; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 20px;
}
.role-badge.owner  { background: #FEF3C7; color: #92400E; }
.role-badge.admin  { background: #EDE9FE; color: #5B21B6; }
.role-badge.member { background: var(--bg); color: var(--sub); }

.member-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.role-select {
  font-size: 0.75rem;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.role-select:focus { border-color: var(--green); }
.member-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: #FEF2F2;
  color: #DC2626;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.member-remove-btn:hover { background: #FECACA; }

/* ── Invite link box ── */
.invite-link-card {
  background: var(--green-light);
  border-radius: 10px;
  padding: 12px 14px;
}
.invite-link-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 8px;
}
.invite-link-row {
  display: flex;
  gap: 8px;
}
.invite-link-input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid rgba(27,107,58,.3);
  border-radius: 8px;
  font-size: 0.78rem;
  background: #fff;
  color: var(--text);
  outline: none;
  min-width: 0;
}

/* ── Expense status badges ── */
.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-pill.pending    { background: #FEF3C7; color: #92400E; }
.status-pill.cleared    { background: var(--green-light); color: var(--green); }
.status-pill.reconciled { background: #EDE9FE; color: #5B21B6; }

.status-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Inline status dot on expense rows */
.expense-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 4px;
}
.expense-status-dot.pending    { background: #F59E0B; }
.expense-status-dot.reconciled { background: #7C3AED; }

/* ── Clears-immediately toggle row ── */
.clears-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
  cursor: pointer;
}
.clears-toggle-label {
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}
.clears-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  cursor: pointer;
}

/* ── Info icon + popover ── moved to components.css (B-038): it's a
   reusable inline-help affordance now, not Add-Account-modal-specific. */

/* ── Reset defaults button ── */
.btn-reset-defaults {
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--sub);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
}
.btn-reset-defaults:active { opacity: 0.6; }

/* ── FX preview / info ── */
.fx-preview {
  font-size: 0.8rem;
  padding: 6px 16px 10px;
  color: var(--sub);
}
/* Inside the Add tab's yolk hero, the gray --sub reads as washed out
   against the warm gradient. Use the espresso text colour with the
   same 0.75 opacity treatment as .add-label so the meta line reads
   without competing with the big amount. The padding is reset because
   .add-header already supplies the horizontal margin. */
.add-header .fx-preview {
  color: var(--text);
  opacity: 0.78;
  padding: 6px 0 0;
}
.fx-preview-ok   { color: var(--green-mid); }
.fx-preview-warn { color: var(--warn); }
.fx-info-row {
  font-size: 0.76rem;
  color: var(--sub);
  padding: 4px 2px 0;
  font-style: italic;
}

/* ── Budget modal ── */
.budget-amount-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.budget-currency-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sub);
  flex-shrink: 0;
}
.budget-amount-row input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  min-width: 0;
}
.budget-per-month {
  font-size: 0.8rem;
  color: var(--sub);
  flex-shrink: 0;
}
.budget-manage-amount {
  font-size: 0.82rem;
  color: var(--sub);
  margin-left: 8px;
}
.budget-inline-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 3px 8px;
  border: 1.5px solid var(--green);
  border-radius: 8px;
  background: var(--card);
}
.budget-edit-input {
  border: none;
  outline: none;
  width: 72px;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  color: var(--text);
}
.btn-icon-sm.btn-edit-budget:hover { color: var(--green-dark); }

/* ── Split / Paid-by fields ── */
.split-field-row {
  display: flex;
  gap: 10px;
}
.split-field {
  flex: 1;
  min-width: 0;
}
.split-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 4px;
}
.split-field select {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  background: var(--card);
  color: var(--text);
}

/* ── Member balance card ── */
.loan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.loan-row:last-child { border-bottom: none; }
.loan-row-left { flex: 1; min-width: 0; }
.loan-amount.owes { color: var(--red); font-weight: 600; font-size: 0.87rem; }
.loan-amount.owed { color: var(--green); font-weight: 600; font-size: 0.87rem; }
.btn-settle {
  flex-shrink: 0;
  margin-left: 10px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--green-mid);
  background: transparent;
  color: var(--green-mid);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-settle:active { opacity: 0.6; }
.btn-settle:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Reconciliation wizard ── */
.reconcile-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8px 32px 16px;
}
.reconcile-step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background .2s;
}
.reconcile-step-dot.active { background: var(--green-mid); }
.reconcile-step-dot.done   { background: var(--green); }
.reconcile-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 48px;
}

.reconcile-step-panel {
  padding: 0 16px 24px;
  overflow-y: auto;
  overflow-x: hidden;   /* clip any too-wide row instead of letting it escape the sheet */
  max-height: calc(100vh - 230px);
}
.reconcile-hint {
  font-size: 0.82rem;
  color: var(--sub);
  margin: 0 0 16px;
  line-height: 1.5;
}
.reconcile-field { margin-bottom: 14px; }
.reconcile-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* B-055: re-reconcile toggle. Card-style so the user actually notices
   the opt-in (the inline-text version blended into surrounding labels). */
.reconcile-rematch-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #fff);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.reconcile-rematch-toggle:hover {
  border-color: var(--accent, #7C5CFA);
  background: var(--surface-hover, rgba(124, 92, 250, 0.04));
}
.reconcile-rematch-checkbox {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent, #7C5CFA);
}
.reconcile-rematch-toggle:has(.reconcile-rematch-checkbox:checked) {
  border-color: var(--accent, #7C5CFA);
  background: var(--surface-hover, rgba(124, 92, 250, 0.06));
}
.reconcile-rematch-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.reconcile-rematch-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.reconcile-rematch-hint {
  font-size: 0.8rem;
  color: var(--sub);
  line-height: 1.45;
}
.reconcile-file-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.87rem;
  color: var(--sub);
  background: transparent;
  transition: border-color .15s;
}
.reconcile-file-label:hover { border-color: var(--green-mid); color: var(--green-mid); }
#reconcile-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.reconcile-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.recon-stat {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--sub);
}
.recon-stat-ok   { border-color: var(--green); color: var(--green); }
.recon-stat-warn { border-color: #f59e0b; color: #f59e0b; }
.recon-stat-none { border-color: var(--border); color: var(--sub); }

.reconcile-section { margin-bottom: 18px; }
.reconcile-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.recon-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.recon-icon-ok   { background: var(--green); color: #fff; }
.recon-icon-warn { background: #f59e0b; color: #fff; }
.recon-icon-none { background: var(--border); color: var(--sub); }
.recon-count     { font-weight: 400; color: var(--sub); font-size: 0.8rem; }

.recon-list { display: flex; flex-direction: column; gap: 8px; }

.recon-row {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--card);
  /* Let flex children shrink and clip overflow so long statement
     descriptions / option text can't blow the row past the sheet edge.
     The review/unrecorded/orphan rows don't all use .recon-row-body, so
     the constraint has to live on the row itself. */
  min-width: 0;
  overflow: hidden;
}
.recon-row-ok   { border-color: rgba(34,197,94,.35); }
.recon-row-warn { border-color: rgba(245,158,11,.35); }
.recon-row-none { border-color: var(--border); opacity: .75; }
/* Duplicate guard: an unrecorded row that already exists elsewhere in the
   household. Full-opacity + warn border so the user notices it before
   confirming (it's unchecked by default). */
.recon-row-dup { border-color: var(--warn); opacity: 1; }
.recon-dup-note { color: var(--warn); font-style: normal; font-weight: 600; }

.recon-check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.recon-check-label input[type=checkbox] { margin-top: 3px; flex-shrink: 0; }
.recon-row-body { flex: 1; min-width: 0; }

.recon-txn {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.recon-date  { color: var(--sub); white-space: nowrap; }
.recon-desc  { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.recon-amt   { font-weight: 700; white-space: nowrap; color: var(--green-mid); }

.recon-expense {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--sub);
  padding-left: 2px;
}
.recon-expense svg { flex-shrink: 0; color: var(--green); }
.recon-score { margin-left: auto; font-size: 0.72rem; opacity: .65; }
.recon-fx-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #FEF3C7;
  color: #92400E;
  flex-shrink: 0;
}

.recon-unrecorded-note {
  margin-top: 4px;
  font-size: 0.77rem;
  color: var(--sub);
  font-style: italic;
}

/* B-049 phase 2 — bank-as-source-of-truth diff inside a matched row.
   Sits below the expense line; tinted to read as a "this will change"
   advisory rather than a hard error. */
.recon-diff {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--sub);
  background: rgba(245, 158, 11, 0.08);
  border-left: 2px solid rgba(245, 158, 11, 0.6);
  padding: 3px 7px;
  border-radius: 3px;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.recon-diff-label {
  font-weight: 600;
  color: #92400E;
}
.recon-diff-parts {
  flex: 1 1 auto;
  min-width: 0;
}
.recon-diff-apply-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.recon-diff-apply-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}
/* Master toggle "Apply all bank values" — sits in the auto-matched
   section header. Subtle link-style to match the section's tone. */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--green, #2E7D32);
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { opacity: 0.8; }
.link-btn:disabled {
  opacity: 0.5;
  text-decoration: none;
  cursor: default;
}

/* B-049c — post-confirm undo affordances on the Done step. */
.reconcile-undo-summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--sub);
  padding: 6px 0;
}
.reconcile-undo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.reconcile-undo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}
.reconcile-undo-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
.reconcile-undo-merchant {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reconcile-undo-detail {
  color: var(--sub);
  font-size: 0.74rem;
}
.recon-candidate-sel { width: 100%; max-width: 100%; box-sizing: border-box; }

.reconcile-step-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--card);
}

/* Done screen */
.reconcile-done-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  margin: 16px auto 14px;
}
.reconcile-done-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 8px;
}

/* ── Integrations card ───────────────────────────────────────────── */
.integration-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.integration-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.integration-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}
.integration-title-block { flex: 1; min-width: 0; }
.integration-title { font-size: 0.92rem; font-weight: 600; }
.integration-subtitle { font-size: 0.78rem; color: var(--sub); margin-top: 1px; }

.integration-status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}
.integration-status-dot.connected { background: var(--green); }
.integration-status-dot.disconnected { background: var(--border); }

.integration-url-block { display: flex; flex-direction: column; gap: 5px; }
.integration-url-label { font-size: 0.78rem; font-weight: 600; color: var(--sub); }
.integration-url-row { display: flex; gap: 6px; }
.integration-url-input {
  flex: 1;
  font-size: 0.75rem;
  font-family: monospace;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}
.integration-url-hint { font-size: 0.73rem; color: var(--sub); }
.settings-hint { font-size: 0.75rem; color: var(--muted); padding: 4px 4px 0; }

/* Small round info "(i)" button next to a form-field label. Click to toggle
   a hint paragraph below. */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.info-btn:hover { background: var(--border); color: var(--fg); }
.info-btn:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.integration-steps {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.integration-steps-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 4px 0;
}
.integration-steps-toggle::-webkit-details-marker { display: none; }
.integration-steps-toggle::before {
  content: "›";
  display: inline-block;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform .2s ease;
  color: var(--green);
}
details[open] > .integration-steps-toggle::before { transform: rotate(90deg); }

/* Kaya-styled steps panel (open state) */
.integration-steps[open] {
  background: linear-gradient(180deg, var(--bg) 0%, #FFFDF4 100%);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 12px 14px;
  margin-top: 10px;
}
.integration-steps[open] > .integration-steps-toggle {
  margin: -2px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.integration-steps-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 10px;
}
.integration-steps-header img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(62,39,35,0.12));
}
.integration-steps-header-text { flex: 1; min-width: 0; }
.integration-steps-header-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}
.integration-steps-header-sub {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--sub);
  margin-top: 1px;
}

.integration-step-list {
  margin: 6px 0 0;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  counter-reset: kaya-step;
}
.integration-step-list > li {
  position: relative;
  padding: 10px 12px 10px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(62,39,35,0.04);
  counter-increment: kaya-step;
}
.integration-step-list > li::before {
  content: counter(kaya-step);
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(76,175,80,0.35);
}
.integration-step-list > li:last-child::before {
  background: var(--accent-dark);
  box-shadow: 0 2px 4px rgba(255,152,0,0.35);
}
.integration-sub-steps {
  margin: 6px 0 0;
  padding: 0 0 0 16px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
}
.integration-step-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #DCEDC8;
  font-weight: 700;
}
.integration-steps-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 12px;
  background: var(--green-light);
  border: 1px solid #C5E1A5;
  border-radius: 10px;
  font-size: 0.78rem;
  color: var(--green-dark);
  line-height: 1.4;
  font-weight: 600;
}
.integration-steps-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px;
  background: linear-gradient(135deg, #FFF3E0 0%, #FFF8E1 100%);
  border: 1px solid #FFE0B2;
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.45;
  font-weight: 600;
}
.integration-steps-tip-mascot {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(62,39,35,0.12));
}

.shortcut-fields-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  table-layout: fixed;
  background: var(--card);
}
.shortcut-fields-table th,
.shortcut-fields-table td {
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
}
.shortcut-fields-table th {
  background: var(--green);
  color: #fff;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 800;
  border-bottom: none;
}
.shortcut-fields-table th:first-child,
.shortcut-fields-table td:first-child { width: 36%; }
.shortcut-fields-table tr:last-child td { border-bottom: none; }
.shortcut-fields-table tr.highlight td {
  background: #FFF8E1;
  border-top: 1px solid #FFE082;
  border-bottom: 1px solid #FFE082;
}
.shortcut-fields-table tr.highlight td:first-child {
  border-left: 3px solid var(--accent);
}
.shortcut-fields-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #DCEDC8;
  font-weight: 700;
}
.gmail-senders-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.gmail-sender-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
  font-size: 0.75rem;
  color: var(--text);
}
.gmail-sender-remove {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 0.9rem;
  color: var(--sub);
  cursor: pointer;
  line-height: 1;
}
.gmail-sender-remove:hover { color: var(--text); }
.gmail-add-sender-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.integration-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ── Receipt scan + attachment ────────────────────────────────────── */
.receipt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-scan-receipt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--green-mid);
  border-radius: 10px;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-scan-receipt:disabled { opacity: 0.6; cursor: not-allowed; }
.scan-status {
  font-size: 0.8rem;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
}
.scan-ok  { background: var(--green-light); color: var(--green-dark); }
.scan-err { background: #FEF2F2; color: #DC2626; }

.receipt-upload-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--sub);
  cursor: pointer;
}
.receipt-upload-label:hover { border-color: var(--green-mid); color: var(--green-mid); }

#edit-receipt-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}
.receipt-thumb-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.receipt-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
#edit-receipt-pdf-icon { font-size: 2.2rem; line-height: 1; flex-shrink: 0; }
.receipt-filename {
  font-size: 0.82rem;
  color: var(--sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.receipt-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sub);
  opacity: 0.45;
  margin-left: 5px;
  vertical-align: middle;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Kaya brand / mascot additions ───────────────────────────────── */

/* Bottom nav — warm active indicator */
.nav-item.active {
  color: var(--green);
  position: relative;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

/* Empty state with mascot */
.empty-state-mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 20px;
  gap: 10px;
  color: var(--sub);
  font-size: 0.85rem;
  text-align: center;
}
.empty-state-mascot img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  opacity: 0.88;
}
.empty-state-mascot p {
  margin: 0;
  line-height: 1.5;
}

/* Currency toggle list in Settings → Lists → Currencies.
   Single-column rows (symbol · code · name · switch) — see the reusable
   .switch component in components.css. */
.currency-list {
  display: flex;
  flex-direction: column;
}
.currency-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.currency-row:first-child { border-top: none; }
.currency-row-symbol {
  font-weight: 700;
  color: var(--sub);
  min-width: 32px;
  text-align: center;
}
.currency-row-code {
  font-weight: 700;
  color: var(--text);
  font-size: 0.9rem;
  min-width: 38px;
}
.currency-row-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom nav background — slightly warm */
.bottom-nav {
  background: #FFFDF4;
  border-top-color: var(--border);
}

/* Kaya wordmark in header */
.home-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-header-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.home-header-wordmark {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  opacity: 0.95;
}

/* Budget bars — warmer palette */
.bar-fill.ok   { background: var(--green-mid); }
.bar-fill.warn { background: var(--accent); }
.bar-fill.over { background: var(--red); }

/* Accent-coloured "Add Expense" CTA */
.btn-add-accent {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 100%);
}

/* Welcome / onboarding mascot block */
.mascot-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 16px;
  gap: 14px;
  text-align: center;
}
.mascot-block img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(62,39,35,0.12));
}
.mascot-block h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}
.mascot-block p {
  font-size: 0.9rem;
  color: var(--sub);
  margin: 0;
  line-height: 1.5;
}

/* ── Snap Expense floating action button ───────────────────────────────── */
.snap-fab {
  position: absolute;
  right: 18px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  display: none; /* shown only on Home tab */
  align-items: center;
  justify-content: center;
  box-shadow:
    0 6px 16px rgba(56, 142, 60, 0.38),
    0 2px 4px rgba(62, 39, 35, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  z-index: 50;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.snap-fab.visible { display: flex; }
.snap-fab:active {
  transform: scale(0.94);
  box-shadow:
    0 3px 10px rgba(56, 142, 60, 0.32),
    0 1px 2px rgba(62, 39, 35, 0.18);
}
.snap-fab svg { pointer-events: none; }
.snap-fab.loading {
  pointer-events: none;
}
.snap-fab.loading svg { display: none; }
.snap-fab.loading::after {
  content: "";
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: snap-fab-spin 0.8s linear infinite;
}
@keyframes snap-fab-spin { to { transform: rotate(360deg); } }

/* ── Toast notification ──────────────────────────────────────────────────── */
.app-toast {
  position: fixed;
  bottom: 88px; /* above nav bar */
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #323232;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 24px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.app-toast.app-toast-error {
  background: #c62828;
}

/* ── Category icon editing ───────────────────────────────────────────────── */
.cat-icon-display {
  font-size: 1.15rem;
  line-height: 1;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px;
  transition: background 0.15s;
}
.cat-icon-display:hover {
  background: var(--border);
}
.cat-icon-input {
  width: 44px;
  flex-shrink: 0;
  font-size: 1.1rem;
  text-align: center;
  padding: 2px 4px;
  border: 1.5px solid var(--green);
  border-radius: 6px;
  outline: none;
}

/* ── Feedback modal ──────────────────────────────────────────────────────── */
.feedback-modal {
  position: fixed;
  inset: 0;
  background: rgba(62, 39, 35, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9998;
  padding: 0;
}
.feedback-modal-card {
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(20px + var(--safe-bottom));
  width: 100%;
  max-width: 430px;
  box-shadow: 0 -8px 24px rgba(62, 39, 35, 0.2);
  animation: feedback-slide-up 0.25s ease;
}
@keyframes feedback-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.feedback-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.feedback-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}
.feedback-modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--sub);
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.feedback-modal-hint {
  font-size: 0.82rem;
  color: var(--sub);
  margin: 0 0 12px;
  line-height: 1.4;
}
.feedback-modal-card textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  min-height: 100px;
  box-sizing: border-box;
}
.feedback-modal-card textarea:focus {
  outline: none;
  border-color: var(--green);
  background: var(--card);
}
.feedback-status {
  font-size: 0.78rem;
  color: var(--sub);
  margin: 8px 0 0;
  min-height: 16px;
}
.feedback-status.success { color: var(--green-dark); font-weight: 700; }
.feedback-status.error { color: #c62828; font-weight: 700; }
.feedback-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* ── Privacy section in Account tab ──────────────────────────────────────── */
.privacy-card {
  padding: 16px 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}
.privacy-intro {
  margin: 0 0 14px;
  font-weight: 600;
  color: var(--text);
}
.privacy-h {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 16px 0 6px;
}
.privacy-h:first-of-type { margin-top: 4px; }
.privacy-list {
  margin: 0 0 6px;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--text);
}
.privacy-list li { margin-bottom: 5px; line-height: 1.45; }
.privacy-list strong { color: var(--text); font-weight: 800; }
.privacy-p {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
}
.privacy-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.privacy-toggle-row:first-of-type { margin-top: 4px; }
.privacy-toggle-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}
.privacy-toggle-hint {
  font-size: 0.74rem;
  color: var(--sub);
  margin-top: 2px;
  line-height: 1.35;
}
.privacy-toggle-footnote {
  font-size: 0.72rem;
  color: var(--sub);
  margin: 10px 0 0;
  line-height: 1.4;
  font-style: italic;
}

/* iOS-style switch */
.privacy-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.privacy-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.privacy-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: 0.2s;
}
.privacy-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.privacy-switch input:checked + .privacy-slider {
  background: var(--green);
}
.privacy-switch input:checked + .privacy-slider::before {
  transform: translateX(18px);
}

/* ── Account tab nested navigation (iOS-style) ─────────────────────────── */
#settings-router {
  position: relative;
}
.settings-screen {
  display: none;
}
.settings-screen.active {
  display: block;
}

/* Top-level main view: list of nav rows */
.settings-nav-list {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  margin: 0 16px 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(62,39,35,0.04);
}
.settings-nav-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
}
.settings-nav-row:last-child { border-bottom: none; }
.settings-nav-row:active { background: var(--bg); }
.settings-nav-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-dark);
}
.settings-nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}
.settings-nav-label {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.settings-nav-sub {
  font-size: 0.74rem;
  color: var(--sub);
  margin-top: 2px;
  font-weight: 600;
}
.settings-nav-chevron {
  flex-shrink: 0;
  color: var(--sub);
  width: 14px;
  height: 14px;
}
.settings-nav-row.danger .settings-nav-icon {
  background: #FEEBEE;
  color: #c62828;
}
.settings-nav-row.danger .settings-nav-label {
  color: #c62828;
}

/* Subscription nav badge — surface cap-reached / grace-period state
   from the Settings main menu so users don't have to drill in to find
   out their AI cap is exhausted. (B-062 Phase 2d, ADR 0020) */
.settings-nav-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-light);
  color: var(--accent-dark);
  margin-left: 6px;
}
.settings-nav-badge[data-state="warn"] {
  background: var(--accent-light);
  color: var(--accent-dark);
}

/* ── Subscription detail screen (B-062 Phase 2d) ───────────────────────── */

.subscription-tier-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.subscription-tier-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.subscription-tier-sub {
  font-size: 0.85rem;
  color: var(--sub);
  margin-top: 4px;
  line-height: 1.4;
}
.subscription-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--accent-light);
  color: var(--accent-dark);
  flex-shrink: 0;
  white-space: nowrap;
}
.subscription-status-pill[data-status="in_grace_period"] {
  background: var(--accent-light);
  color: var(--accent-dark);
}
.subscription-status-pill[data-status="canceled"] {
  background: var(--border);
  color: var(--sub);
}
.subscription-status-pill[data-status="expired"],
.subscription-status-pill[data-status="refunded"] {
  background: var(--red-light);
  color: var(--red);
}
.subscription-renewal-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--sub);
}
.subscription-renewal-date {
  color: var(--text);
  font-weight: 600;
}
.subscription-usage-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.subscription-usage-numbers {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.subscription-usage-hint {
  font-size: 0.76rem;
  color: var(--sub);
  line-height: 1.4;
}
.subscription-usage-bar-wrap {
  margin-top: 10px;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.subscription-usage-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-pill);
  width: 0;
  transition: width 0.35s ease;
}
.subscription-usage-bar-fill[data-pct="100"] {
  background: var(--accent-dark);
}
.subscription-usage-free-note {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--sub);
  font-style: italic;
}
.subscription-perks-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}
.subscription-perks-list li {
  margin-bottom: 4px;
}

/* Trash items */
.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.trash-item:last-child { border-bottom: none; }
.trash-item-info { flex: 1; min-width: 0; }
.trash-item-merchant {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trash-item-meta {
  font-size: 0.82rem;
  color: var(--text-secondary, #666);
  margin-top: 2px;
}
.trash-item-deleted {
  font-size: 0.78rem;
  color: var(--text-secondary, #999);
  margin-top: 1px;
}
.trash-item-actions { flex-shrink: 0; margin-left: 12px; }
.btn-trash-restore {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.settings-detail-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.settings-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  padding: 6px 8px 6px 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.settings-back-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}
.settings-detail-title {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  padding-right: 60px;  /* offset for back button so title stays centered */
}
.settings-detail-body {
  padding: 4px 16px 0;
}

/* Profile detail card rows */
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.profile-row:last-child { border-bottom: none; }
.profile-row-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.profile-row-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

/* Connected accounts row (B-062 Phase 2c) — shows Apple link state + Unlink CTA. */
.profile-connected-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-connected-label {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.profile-connected-state {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sub);
}
.profile-connected-state[data-state="linked"] {
  color: var(--green);
}

/* ── Email forwarding: Recent activity ──────────────────────────────
   Per-event rows rendered by _loadForwardingHistory(). Each row
   shows an outcome badge, sender/subject, timestamp, and a right-
   hand action (view expense, or override Gemini via Add as expense).
   Laid out as a compact card-in-card so it visually sits inside
   the Email forwarding integration card. */
.fwd-filter-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.fwd-filter-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--sub);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}
.fwd-filter-chip.active {
  background: var(--accent);
  color: #1A1A1A;
  border-color: var(--accent);
}
.fwd-filter-count {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  min-width: 16px;
  text-align: center;
}
.fwd-filter-chip.active .fwd-filter-count {
  background: rgba(0, 0, 0, 0.15);
}

.fwd-event {
  display: flex;
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: flex-start;
}
.fwd-event-body {
  flex: 1;
  min-width: 0;  /* allow text-overflow: ellipsis to kick in */
}
.fwd-event-line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.fwd-event-sender {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #263238);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.fwd-event-when {
  font-size: 0.68rem;
  color: var(--sub);
  white-space: nowrap;
}
.fwd-event-subject {
  font-size: 0.74rem;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fwd-event-badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  line-height: 1.4;
}
.fwd-event-badge.created    { background: #D1FAE5; color: #065F46; }
.fwd-event-badge.duplicate  { background: #DBEAFE; color: #1E40AF; }
.fwd-event-badge.irrelevant { background: #FEF3C7; color: #92400E; }
.fwd-event-badge.no_amount,
.fwd-event-badge.amount_looks_like_date,
.fwd-event-badge.amount_over_sanity_max,
.fwd-event-badge.gemini_failed,
.fwd-event-badge.validation_error { background: #FEE2E2; color: #991B1B; }
.fwd-event-action {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
}
.fwd-event-action.primary {
  background: var(--accent);
  color: #1A1A1A;
}
.fwd-event-action.secondary {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
}

/* Recent-activity rows are tappable — the whole row opens the detail
   sheet. The trailing ✕ soft-dismisses without opening it. */
.fwd-event-tappable { cursor: pointer; transition: background .12s, border-color .12s; }
.fwd-event-tappable:hover { background: var(--card); border-color: var(--green); }
.fwd-event-tappable:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.fwd-event-dismiss {
  flex-shrink: 0;
  align-self: center;
  width: 26px;
  height: 26px;
  line-height: 1;
  font-size: 1.15rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--sub);
  cursor: pointer;
}
.fwd-event-dismiss:hover { background: var(--bg); color: var(--text); }

/* ── Forwarded-email detail sheet ───────────────────────────────────────
   Bottom-anchored scrolling sheet (same treatment as the setup guide):
   the overlay is reparented to <body> in JS so position:fixed resolves
   against the viewport. */
#fwd-detail-overlay { align-items: flex-end; overflow: hidden; }
.fwd-detail-sheet {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--space-5));
  padding: var(--space-6) var(--space-4) calc(var(--space-6) + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.fwd-detail-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.fwd-detail-when { font-size: 0.72rem; color: var(--sub); }
.fwd-detail-from { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.fwd-detail-subject { font-size: 0.82rem; color: var(--text); margin-top: 2px; }
.fwd-detail-preview {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--sub);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 30vh;
  overflow-y: auto;
}
.fwd-detail-found {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--green-light);
  border-radius: var(--radius-md);
}
.fwd-detail-found-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 700;
  color: var(--sub);
}
.fwd-detail-found-main { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-top: 2px; }
.fwd-detail-edit-toggle { margin-top: var(--space-2); padding-left: 0; padding-right: 0; }
.fwd-detail-fields { margin-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }
.fwd-detail-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.74rem; font-weight: 600; color: var(--sub); }
.fwd-detail-field input,
.fwd-detail-field select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--text);
  width: 100%;
}
.fwd-detail-amount-row { display: flex; gap: var(--space-2); }
.fwd-detail-amount-row input { flex: 1; }
.fwd-detail-amount-row select { flex-shrink: 0; width: auto; }
.fwd-detail-err { margin-top: var(--space-3); font-size: 0.8rem; color: var(--red); }
.fwd-detail-sheet .wizard-nav { margin-top: var(--space-5); }

/* ── Add-Expense: prefill banner ────────────────────────────────────
   Shown at the top of the Add screen when the user is converting an
   email event that Gemini misclassified. Dismissable; clearing it
   also clears the pending email_event binding. */
.add-prefill-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: #92400E;
}
.add-prefill-banner.show { display: flex; }
.add-prefill-banner-body { flex: 1; min-width: 0; }
.add-prefill-banner-title { font-weight: 700; margin-bottom: 1px; }
.add-prefill-banner-sub {
  font-size: 0.72rem;
  color: #B45309;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.add-prefill-banner-close {
  background: transparent;
  border: none;
  color: #92400E;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* ── Tag chip input ───────────────────────────────────────────────────────── */
.tag-chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  min-height: 38px;
}
.tag-chip-input:focus-within { border-color: var(--green-mid); }
.tag-chip-list { display: contents; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: var(--radius-lg);
  background: rgba(120, 144, 156, 0.12);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.tag-chip.tag-chip--personal {
  background: rgba(255, 152, 0, 0.18);
  color: var(--accent-dark);
}
.tag-chip.tag-chip--repayment {
  background: rgba(76, 175, 80, 0.18);
  color: #2E7D32;
}
.tag-chip-x {
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 0.95rem;
  padding: 0 4px;
  line-height: 1;
}
.tag-chip-x:hover { opacity: 1; }
.tag-chip-input input {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.9rem;
  padding: 4px 0;
  color: var(--text);
}
/* Badges shown inline on expense rows in History/Recent. */
.expense-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.expense-tags .tag-chip {
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 600;
}
.kind-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--radius-lg);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.kind-pill.kind-income {
  background: rgba(46, 125, 50, 0.15);
  color: #2E7D32;
}
.kind-pill.kind-repayment {
  background: rgba(2, 136, 209, 0.15);
  color: #0277BD;
}
.kind-pill.kind-transfer {
  background: rgba(255, 152, 0, 0.15);   /* Yolk Orange tint */
  color: #BF360C;
}

/* B-051 — cross-source soft-duplicate chip + resolve modal. The chip
   rides in expense-tags alongside kind-pill and tag-chip; the modal is
   a standalone modal-overlay sheet. */
.dup-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  background: rgba(255, 152, 0, 0.18);   /* tinted --warn */
  color: var(--accent-dark);
  border: none;
  white-space: nowrap;
}
.dup-chip:active { transform: scale(0.97); }

.dup-resolve-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.dup-resolve-intro {
  font-size: 0.9rem;
  color: var(--sub);
  margin: 0;
}
.dup-resolve-pair {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.dup-card {
  flex: 1 1 calc(50% - var(--space-3));
  min-width: 140px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.dup-card--missing {
  background: var(--card);
  color: var(--sub);
  font-style: italic;
}
.dup-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--sub);
}
.dup-card-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.dup-card-orig {
  font-size: 0.78rem;
  color: var(--sub);
}
.dup-card-merchant {
  font-size: 0.92rem;
  color: var(--text);
}
.dup-card-meta {
  font-size: 0.78rem;
  color: var(--sub);
}
.dup-card-body {
  font-size: 0.86rem;
  color: var(--sub);
}
.dup-resolve-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* Household balances list (Settings → Household balances) */
.hh-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 0.86rem;
}
.hh-balance-row:last-child { border-bottom: none; }
.hh-balance-name { font-weight: 600; color: var(--text); }
.hh-balance-amount { font-weight: 700; }
.hh-balance-row.hh-owed    .hh-balance-amount { color: var(--accent-dark); }
.hh-balance-row.hh-settled .hh-balance-amount { color: var(--sub); font-weight: 500; }
.hh-balance-row.hh-owed { cursor: pointer; }
.hh-balance-row.hh-owed:active { background: rgba(255, 152, 0, 0.06); }

/* Settle drawer (clicking an owed member opens this) */
.hh-settle-drawer {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hh-settle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.9rem;
}
.hh-settle-header button {
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 6px;
}
.hh-settle-debts { display: flex; flex-direction: column; gap: 4px; }
.hh-debt-hint {
  font-size: 0.72rem;
  color: var(--sub);
  margin-bottom: 4px;
}
.hh-debt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #F3F4F6;
  font-size: 0.82rem;
  cursor: pointer;
}
.hh-debt-row:last-child { border-bottom: none; }
.hh-debt-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hh-debt-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.hh-debt-date { font-size: 0.7rem; color: var(--sub); }
.hh-debt-amount { font-weight: 700; }

.hh-settle-form { display: flex; flex-direction: column; gap: 8px; }
.hh-settle-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--sub);
  font-weight: 600;
}
.hh-settle-form input[type=number],
.hh-settle-form input[type=date],
.hh-settle-form input[type=text] {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card);
}
.hh-settle-form input:focus { outline: none; border-color: var(--green-mid); }
.hh-settle-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Wealth tab ────────────────────────────────────────────────────────
   Matches the Home hero visual language (PR #100–#103): toast-butter
   yellow hero card on cream chrome, Fraunces total, dark-brown ink.
   The header sits on cream with Saoirse anchored top-right (sticker
   style). Green stays exclusive to CTAs and the record-balance modal
   header (that exception is codified in PR #91). */

.wealth-toggle-row {
  padding: 10px 16px 10px;
  display: flex;
}

/* Segmented control: beige/cream track, white active pill. Full-width
   so it matches the net-worth card width visually. */
.wealth-segmented {
  display: flex;
  flex: 1;
  background: rgba(62, 39, 35, 0.08);
  border-radius: 999px;
  padding: 4px;
}
.wealth-seg {
  appearance: none;
  background: transparent;
  border: 0;
  flex: 1;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.55;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.wealth-seg.active {
  background: var(--card);
  color: var(--text);
  opacity: 1;
  box-shadow: 0 1px 3px rgba(62, 39, 35, 0.12);
}

/* Net-worth hero: full-bleed toast-butter yellow gradient matching
   the Home tab's .home-hero. The mascot (.wealth-hero-mascot) sits
   absolutely in the bottom-right corner. */
.wealth-total-card {
  padding: 44px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--gradient-hero);
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.wealth-hero-mascot {
  position: absolute;
  right: 16px;
  bottom: 12px;
  width: 84px;
  height: 84px;
  object-fit: contain;
  display: none;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 3px 6px rgba(62, 39, 35, 0.12));
}
.wealth-hero-mascot.loaded { display: block; }
.wealth-total-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text);
  opacity: 0.72;
  font-weight: 700;
}
.wealth-total-amount {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1.2px;
  line-height: 1.05;
  transition: filter .2s ease, color .15s;
}
/* Negative net worth still reads as Kaya red so the sign carries
   meaning even on the warm yellow surface. */
.wealth-total-amount.is-negative { color: #B91C1C; }

.wealth-total-row {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
  align-self: flex-start;
}
.wealth-total-row:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 8px;
}
.wealth-total-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(62, 39, 35, 0.10);
  color: var(--text);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.wealth-total-row:hover .wealth-total-eye,
.wealth-total-row:active .wealth-total-eye {
  background: rgba(62, 39, 35, 0.18);
}
.wealth-total-eye svg { width: 16px; height: 16px; }
.wealth-total-eye .eye-open   { display: inline-block; }
.wealth-total-eye .eye-closed { display: none; }

/* Meta row under the total: delta pill + "this month" sub text. Same
   visual family as Home's home-meta-row. */
.wealth-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.wealth-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.wealth-delta-pill.up {
  background: rgba(46, 125, 50, 0.18);
  color: #1B5E20;
}
.wealth-delta-pill.down {
  background: rgba(230, 81, 0, 0.18);
  color: #BF360C;
}
.wealth-delta-pill.flat {
  background: rgba(62, 39, 35, 0.12);
  color: var(--text);
}
.wealth-delta-sub {
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0.75;
}

/* Privacy blur: unchanged logic, same selectors. */
#tab-wealth.is-blurred .wealth-total-amount,
#tab-wealth.is-blurred .wealth-meta-row,
#tab-wealth.is-blurred .wealth-sparkline,
#tab-wealth.is-blurred .wealth-sparkline-labels,
#tab-wealth.is-blurred .wealth-summary-amount,
#tab-wealth.is-blurred .wealth-group-total,
#tab-wealth.is-blurred .wealth-row-amount,
#tab-wealth.is-blurred .wealth-row-native,
#tab-wealth.is-blurred .wealth-row-date,
#tab-wealth.is-blurred .wealth-row-drift {
  filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
/* Override the row-level filter:blur for the big hero amount — same
   transparent-text + text-shadow trick as Home/History so the warm
   gradient stays visually continuous behind the obfuscation. */
#tab-wealth.is-blurred .wealth-total-amount {
  filter: none;
  color: transparent;
  text-shadow: 0 0 18px var(--text);
}
#tab-wealth.is-blurred #btn-toggle-wealth-blur .eye-open   { display: none; }
#tab-wealth.is-blurred #btn-toggle-wealth-blur .eye-closed { display: inline-block; }

/* Sparkline on yolk-yellow: Yolk Orange line + fill so the curve
   reads strongly against the warm gradient. */
.wealth-sparkline {
  height: 60px;
  margin: 6px 0 0;
  min-height: 60px;
}
.wealth-sparkline svg { display: block; width: 100%; height: 100%; }
.wealth-sparkline .wealth-sparkline-line {
  fill: none;
  stroke: var(--accent-dark);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.wealth-sparkline .wealth-sparkline-fill { fill: var(--accent-dark); opacity: 0.14; }
.wealth-sparkline .wealth-sparkline-empty {
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.55;
  line-height: 60px;
}

/* Month tick labels under the sparkline. Rendered as a flex row so the
   labels distribute edge-to-edge under the curve. Right padding keeps
   the rightmost tick clear of the bottom-right hero mascot. */
.wealth-sparkline-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text);
  opacity: 0.6;
  margin-top: 2px;
  padding-right: 92px;
}
.wealth-sparkline-labels:empty { display: none; }

.wealth-scope-note {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.65;
  margin-top: 6px;
  padding-right: 92px;
}
.wealth-scope-note.wealth-scope-note-warn {
  color: #BF360C;
  opacity: 1;
}

/* Three category summary cards (CASH / INVESTMENTS / CREDIT). Equal-
   width flex row with the same rounded-card treatment as the hero,
   each card carrying a colored status dot + uppercase label +
   abbreviated amount. */
.wealth-summary-row {
  display: flex;
  gap: 10px;
  padding: 2px 12px 12px;
}
.wealth-summary-row:empty { display: none; }
.wealth-summary-card {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 12px 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(62, 39, 35, 0.06);
  min-width: 0;
}
.wealth-summary-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wealth-summary-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--sub);
}
.wealth-summary-card[data-kind="cash"]   .wealth-summary-dot { background: var(--green); }
.wealth-summary-card[data-kind="invest"] .wealth-summary-dot { background: var(--accent-dark); }
.wealth-summary-card[data-kind="credit"] .wealth-summary-dot { background: var(--red); }
.wealth-summary-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text);
  opacity: 0.62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wealth-summary-amount {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wealth-summary-card[data-kind="credit"] .wealth-summary-amount { color: var(--red); }

/* Record-balance modal header: green stays (it's a CTA surface) */
#wealth-record-balance-modal .modal-header {
  background: var(--green);
  border-bottom-color: transparent;
  color: #fff;
  margin: -8px -16px 12px;
  padding: 14px 16px;
}
#wealth-record-balance-modal .modal-title { color: #fff; }
#wealth-record-balance-modal .modal-close {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Account groups — rendered as white cards with a section label on top
   and rows below. Same rounded-card family as the summary row above. */
.wealth-group {
  padding: 8px 14px 4px;
  margin: 0 12px 12px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px rgba(62, 39, 35, 0.06);
}
.wealth-group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 2px 8px;
  margin-bottom: 2px;
}
.wealth-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text);
  opacity: 0.6;
}
.wealth-group-total {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Account rows */
.wealth-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.wealth-row:last-child { border-bottom: 0; }
.wealth-row:active { background: rgba(62, 39, 35, 0.04); }

/* Type-icon tile — rounded square (not circle) matching the mock.
   Green-light bg by default so the icons read warm against the white
   card; semantic tints override for investments / liabilities. */
.wealth-row-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(76, 175, 80, 0.14);
  color: var(--green-dark, #2E7D32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wealth-row-icon svg { width: 18px; height: 18px; }
.wealth-row[data-icon="liability"] .wealth-row-icon {
  background: rgba(220, 38, 38, 0.10);
  color: var(--red, #DC2626);
}
.wealth-row[data-icon="invest"] .wealth-row-icon {
  background: rgba(255, 152, 0, 0.14);
  color: var(--accent-dark);
}

.wealth-row-left { flex: 1 1 auto; min-width: 0; }
.wealth-row-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}
.wealth-row-native,
.wealth-row-date,
.wealth-row-drift {
  font-size: 0.72rem;
  color: var(--sub);
  margin-top: 2px;
}
.wealth-row-drift {
  font-variant-numeric: tabular-nums;
}
.wealth-row-amount {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Liability amounts: red ink when this row belongs to the liabilities
   section. Applied via the data-icon attribute we already stamp. */
.wealth-row[data-icon="liability"] .wealth-row-amount { color: var(--red, #DC2626); }

/* Pending-setup rows — amber CTA instead of muted em-dash */
.wealth-group-pending .wealth-row-name { color: var(--text); }
.wealth-row-pending-hint {
  font-size: 0.78rem;
  color: var(--sub);
  margin-top: 2px;
}
.wealth-row-pending-cta {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 152, 0, 0.14);
  color: var(--yolk-dark, #E65100);
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

/* Wealth actions: one primary CTA (Add account) full-width, then a row
   of secondary chips beneath for the periodic actions (Record balance,
   Reconcile). Three equal-weight buttons made the wrapping ugly at
   430px AND misrepresented their relative importance. */
.wealth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
}
.wealth-actions-secondary {
  display: flex;
  gap: var(--space-2);
}
.wealth-action-chip {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sub);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.wealth-action-chip:active { opacity: 0.6; }

/* Wealth's empty state uses the shared .coach-empty component
   (components.css). #wealth-empty carries .coach-empty directly; only
   the secondary "Seed from your expenses" button needs its own rule. */
.wealth-empty-seed { margin-top: var(--space-2); }

/* Seed flow inherits cream tones (not white-on-green anymore) */
.wealth-seed-body { padding: 8px 16px 16px; max-height: 70vh; overflow-y: auto; }
.wealth-seed-intro {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--sub);
  padding-bottom: 12px;
}
.wealth-seed-empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--sub);
  font-size: 0.9rem;
}
.wealth-seed-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.wealth-seed-row:last-child { border-bottom: none; }
.wealth-seed-check { align-self: start; padding-top: 4px; }
.wealth-seed-check input { width: 18px; height: 18px; cursor: pointer; }
.wealth-seed-main { display: flex; flex-direction: column; gap: 6px; }
.wealth-seed-name { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.wealth-seed-meta { font-size: 0.78rem; color: var(--sub); }
.wealth-seed-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* Wealth modals */
.form-field-row { flex-direction: row; gap: 10px; align-items: center; }
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
}
.form-hint { font-size: 0.78rem; color: rgba(255, 255, 255, 0.5); margin-top: 4px; }
.form-error {
  color: #ff6b6b;
  font-size: 0.85rem;
  padding: 6px 0;
}
.wealth-detail-body { padding: 4px 16px 20px; }
.wealth-detail-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.wealth-detail-summary:empty { display: none; }
.wd-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: rgba(62, 39, 35, 0.7);
}
.wd-meta-row > span:last-child { color: var(--text); font-weight: 500; }
.wealth-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.wealth-detail-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(62, 39, 35, 0.55);
  margin: 6px 0 4px;
}

/* Balance-history rows use a swipe container: the visible .wd-row sits
   on top and translates left to reveal .wd-row-actions underneath.
   Desktop users see both the hover-revealed actions and the hidden
   swipe layer (hover wins since it has higher z-index). */
.wd-row-swipe {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.wd-row-swipe:last-child { border-bottom: none; }

.wd-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  font-size: 0.92rem;
  background: var(--card);
  position: relative;
  z-index: 2;
  transition: transform .2s ease;
  touch-action: pan-y;
}
.wd-row-date { color: var(--text); }
.wd-native { color: rgba(62, 39, 35, 0.55); font-size: 0.78rem; }
.wd-row-amt { font-weight: 600; color: var(--text); }
.wd-change.up   { color: var(--green-dark); margin-left: 6px; font-size: 0.8rem; }
.wd-change.down { color: #d32f2f;           margin-left: 6px; font-size: 0.8rem; }

/* .wd-row-actions / .wd-act-edit / .wd-act-del are styled in the shared
   swipe block near the top of this file (keeps the two surfaces in sync). */

.wd-loading, .wd-empty { padding: 16px 0; color: rgba(62, 39, 35, 0.55); font-size: 0.9rem; text-align: center; }

/* B-027a: account aliases under the account-detail modal. */
.wd-aliases-hint {
  font-size: 0.82rem;
  color: rgba(62, 39, 35, 0.6);
  margin: 2px 0 8px;
  line-height: 1.35;
}
.wd-aliases-hint em { color: var(--text); font-style: normal; font-weight: 500; }
.wd-aliases-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-bottom: 8px;
}
.wd-aliases-add input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  background: var(--card);
  color: var(--text);
}
.wd-aliases-add input:focus { outline: 2px solid rgba(62, 39, 35, 0.15); border-color: var(--text); }
.wd-aliases-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.wd-alias-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.wd-alias-text { color: var(--text); word-break: break-word; }
.wd-alias-source {
  font-size: 0.72rem;
  color: rgba(62, 39, 35, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wd-alias-del {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  color: #d32f2f; font-size: 1rem; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.wd-alias-del:hover { background: rgba(248, 113, 113, 0.08); }
.wd-aliases-empty {
  padding: 8px 0;
  font-size: 0.85rem;
  color: rgba(62, 39, 35, 0.5);
  text-align: center;
}

/* B-059 / B-042: inline aliases panel under an account row in the
   Settings → Payment methods modal. Reuses the .wd-aliases-* / .wd-alias-*
   styles above; this just frames the per-row expansion. */
.acct-aliases-panel {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.acct-aliases-panel:last-child { border-bottom: none; }
/* The aliases toggle is a neutral expand affordance — keep .btn-icon-sm's
   red delete-hover off it. */
.btn-icon-sm.btn-acct-aliases:hover { color: var(--text); }
.btn-icon-sm.btn-acct-aliases[aria-expanded="true"] { color: var(--text); }
.btn-danger {
  background: #c62828; color: #fff; border: none;
  border-radius: 8px; padding: 10px 20px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; width: 100%;
}
.btn-danger:hover { background: #b71c1c; }

.btn-danger-sm {
  appearance: none; border: 1px solid rgba(248, 113, 113, 0.5);
  background: transparent; color: #f87171; padding: 6px 12px;
  border-radius: 8px; font-size: 0.85rem; cursor: pointer;
}
.btn-danger-sm:hover { background: rgba(248, 113, 113, 0.08); }

/* ── Source chip (expense row) ─────────────────────────────────────
   Tiny pill shown next to the category on each expense row to
   indicate ingestion origin. Manual entries show nothing.
   Colors are derived from the brand palette — brown ink on cream
   tints so the chip reads at glance without competing with the
   amount or status dots. */
.source-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.2px;
  white-space: nowrap;
  vertical-align: 1px;
  background: var(--border);        /* warm cream */
  color: var(--text);               /* dark brown */
  border: 1px solid transparent;
}

/* Telegram — cool blue tint */
.source-chip--telegram  { background: #E3F2FD; color: #1565C0; }

/* Voice (Telegram voice note) — softer lavender to differentiate */
.source-chip--voice     { background: #EDE7F6; color: #5E35B1; }

/* Apple Shortcuts — warm peach, echoes the Yolk accent */
.source-chip--shortcuts { background: #FFE8D6; color: #C2410C; }

/* Email (Gmail poller + forwarded address) — muted green */
.source-chip--email     { background: #DCFCE7; color: #166534; }

/* Unknown/legacy source — stays on cream so it disappears into chrome */
.source-chip--auto      { background: var(--border); color: var(--sub); }

/* ── Integrations hero ────────────────────────────────────────────
   One-glance status panel at the top of Settings → Integrations.
   Mirrors state from the per-card init calls; see
   _renderIntegrationsHero() in app.js. */
.integrations-hero {
  margin: 12px 16px 0;
  padding: 16px 16px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(62,39,35,.05);
}

.integrations-hero-intro { margin-bottom: 12px; }

.integrations-hero-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.integrations-hero-sub {
  font-size: 0.82rem;
  color: var(--sub);
  margin-top: 3px;
  line-height: 1.4;
  text-wrap: pretty;
}

.integrations-hero-grid {
  display: flex;
  flex-direction: column;
}

.integrations-hero-row {
  display: grid;
  grid-template-columns: 28px 1fr 14px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 4px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
  font: inherit;
}
.integrations-hero-row:first-of-type { border-top: none; }
.integrations-hero-row:hover { background: var(--bg); border-radius: 8px; }
.integrations-hero-row:active { opacity: 0.75; }

.integrations-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  color: var(--sub);
}

.integrations-hero-label {
  display: flex;
  flex-direction: column;
  min-width: 0;     /* allow ellipsis on long email addresses */
}

.integrations-hero-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.integrations-hero-state {
  font-size: 0.75rem;
  color: var(--sub);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integrations-hero-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #CBD5E1;          /* pending / unknown */
  box-shadow: 0 0 0 2px var(--card);
  flex-shrink: 0;
}
.integrations-hero-dot[data-state="on"]   { background: #16A34A; }
.integrations-hero-dot[data-state="warn"] { background: var(--accent-dark); }
.integrations-hero-dot[data-state="off"]  { background: #CBD5E1; }

/* Deep-link highlight when a hero row is tapped.
   Brief warm wash on the target card so the user's eye lands. */
.integration-card--highlighted {
  animation: integrationCardWash 1.3s ease-out;
}
@keyframes integrationCardWash {
  0%   { box-shadow: 0 0 0 0 rgba(237, 137, 54, 0); }
  30%  { box-shadow: 0 0 0 6px rgba(237, 137, 54, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(237, 137, 54, 0); }
}

/* ── Account screen: grouped nav + neutral icons + status + version ── */

.settings-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--sub);
  padding: 4px 18px 6px;
  margin: 6px 0 0;
}
.settings-group-label:first-of-type { margin-top: 0; }

.settings-screen.settings-main .settings-nav-list { margin-bottom: 12px; }
.settings-screen.settings-main .settings-nav-list:last-of-type { margin-bottom: 16px; }

.settings-nav-row:not(.danger) .settings-nav-icon {
  background: var(--bg);
  color: var(--text);
}

.settings-status {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--sub);
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.settings-version {
  text-align: center;
  font-size: 0.72rem;
  color: var(--sub);
  opacity: 0.75;
  padding: 18px 0 28px;
  letter-spacing: 0.2px;
}
.settings-version .settings-version-sep { margin: 0 6px; opacity: 0.5; }
.settings-version .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
}

/* ── History day-grouping (B-040a) ──────────────────────────────────────
   Each calendar day renders as a sticky header + a white card containing
   the existing .swipe-wrapper / .expense-row markup. Sticky headers stack
   under the page header (which is not sticky on this tab — the header
   scrolls away to give expense rows the full viewport for scanning).
   ───────────────────────────────────────────────────────────────────── */
.history-day-group { margin: 0 12px 8px; }
.history-day-group:first-child { margin-top: 8px; }

.history-day-header {
  position: sticky;
  top: 0;
  z-index: 4;
  /* Translucent cream so rows visibly slide under as the user scans;
     backdrop-filter softens the underlying expense rows for legibility. */
  background: rgba(250, 246, 232, 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 10px 14px 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.history-day-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.history-day-total {
  font-size: 0.74rem;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

/* The card the day's rows live inside. Bottom-rounded only — the sticky
   header above provides the top corners. Overflow:hidden so the swipe
   reveal layer clips against the card edge. */
.history-day-card {
  background: var(--card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.history-day-card .expense-row {
  padding-left: 14px;
  padding-right: 14px;
}
.history-day-card .swipe-wrapper:last-child .expense-row {
  border-bottom: none;
}

/* ── History empty state — scene (first-run / no-data) ──────────────── */
.history-empty-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px 80px;
  gap: 10px;
}
.history-empty-scene .hes-art {
  position: relative;
  width: 220px;
  height: 180px;
  margin-bottom: 4px;
}
.history-empty-scene .hes-receipt {
  position: absolute;
  left: 18px; bottom: 28px;
  width: 44px; height: 56px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  transform: rotate(-12deg);
  box-shadow: 0 2px 6px rgba(62, 39, 35, 0.06);
}
.history-empty-scene .hes-coin {
  position: absolute;
  right: 24px; bottom: 22px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #C49000;
}
.history-empty-scene .hes-mascot {
  position: absolute;
  left: 50%; bottom: 0;
  width: 110px;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 8px rgba(62, 39, 35, 0.18));
}
.history-empty-scene .hes-floor {
  position: absolute;
  left: 8%; right: 8%;
  bottom: 14px;
  height: 2px;
  background-image: radial-gradient(circle, rgba(62, 39, 35, 0.35) 1px, transparent 1.4px);
  background-size: 10px 2px;
  background-repeat: repeat-x;
}
.history-empty-scene .hes-headline {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}
.history-empty-scene .hes-body {
  font-size: 0.88rem;
  color: var(--sub);
  max-width: 280px;
  line-height: 1.45;
}
.history-empty-scene .hes-cta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.history-empty-scene .hes-cta-primary {
  padding: 10px 18px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Softer empty state when filters/search returned 0 — no first-run scene. */
.history-empty-soft {
  text-align: center;
  padding: 28px 24px;
  color: var(--sub);
}
.history-empty-soft .hes-soft-headline {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.history-empty-soft .hes-soft-body {
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ── Entry-type signs (B-035) ───────────────────────────────────────────
   Two things land here:
   1. .kind-chip-row + .kind-chip — the visible toggle on Add + Edit
      forms. Mirrors the hidden <select> beneath. Mimics .period-chip
      visually so the system reads consistently.
   2. .expense-row.kind-income / .kind-transfer amount tints — direction
      reads at a glance without opening the row.
   ───────────────────────────────────────────────────────────────────── */

.kind-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.kind-chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--sub);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.kind-chip:hover { background: var(--green-light); }
.kind-chip.active.is-expense {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}
.kind-chip.active.is-income {
  background: rgba(46, 125, 50, 0.16);
  border-color: var(--green);
  color: #2E7D32;
}
.kind-chip.active.is-repayment {
  background: rgba(2, 136, 209, 0.16);
  border-color: #0277BD;
  color: #0277BD;
}
.kind-chip.active.is-transfer {
  background: rgba(123, 92, 169, 0.16);
  border-color: #7B5CA9;
  color: #7B5CA9;
}
.kind-chip-label { font-size: inherit; }

/* Signed-amount tints. Direction is encoded in the prefix string in
   _expRowHTML; the tint just reinforces it. Repayment stays the
   default ink — the ↺ prefix is direction-neutral. */
.expense-row.kind-income .expense-amount {
  color: #2E7D32;       /* Pandan-green ink */
}
.expense-row.kind-transfer-in .expense-amount {
  color: #2E7D32;       /* Pandan-green — money in, matches income */
}
.expense-row.kind-transfer-out .expense-amount {
  color: #BF360C;       /* Yolk-orange ink — money out */
}

/* ── First-run onboarding overlay (B-037) ────────────────────────────
   Builds on .modal-sheet + the shared .coach-empty step layout. The
   sheet is painted on --accent-light (pale butter) instead of --card
   so the welcome reads warm rather than clinical. Steps render one at
   a time: only .onboarding-step.is-active is visible. The .is-active
   selector beats the bare .coach-empty { display: flex } at higher
   specificity, so the previous [hidden]-vs-author-CSS conflict is gone. */
.onboarding-sheet {
  position: relative;
  padding-top: var(--space-6);
  background: var(--accent-light);
}
.onboarding-step { display: none; }
.onboarding-step.is-active { display: flex; }
.onboarding-skip {
  position: absolute;
  top: var(--space-3);
  right: var(--space-4);
  background: none;
  border: none;
  padding: var(--space-1);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  z-index: 1;
}
.onboarding-link {
  background: none;
  border: none;
  padding: var(--space-1);
  margin-top: var(--space-1);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
}
.onboarding-skip:active,
.onboarding-link:active { opacity: 0.6; }
/* Parting note on the last step — where to find the tour again. */
.onboarding-hint {
  margin-top: var(--space-2);
  max-width: 280px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--sub);
}
/* Step indicator: a row of dots above the mascot. Filled dots use
   --text on the warm surface; pending dots use --border. */
.onboarding-dots {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.onboarding-dots > span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border);
}
.onboarding-dots > span.is-active {
  background: var(--text);
}
/* Inline form for the regional-prefs step. Stacks two labels above
   the CTA. Inputs match the section-card form rhythm. */
.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 280px;
  margin-top: var(--space-2);
}
.onboarding-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sub);
}
.onboarding-field select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
}
/* Finance-model radio cards. Two stacked options, full width. */
.onboarding-radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 320px;
  margin-top: var(--space-2);
}
.onboarding-radio {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
}
.onboarding-radio input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--green);
}
.onboarding-radio span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.onboarding-radio strong {
  font-size: 0.92rem;
  color: var(--text);
}
.onboarding-radio em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--sub);
  line-height: 1.4;
}
.onboarding-info {
  background: none;
  border: none;
  padding: 0;
  margin-left: var(--space-1);
  cursor: pointer;
  color: var(--sub);
  font-size: 1rem;
  line-height: 1;
}
.onboarding-error {
  margin-top: var(--space-2);
}
/* Invite-link box surfaced inline in step 5 once the link is generated. */
.onboarding-invite-box {
  display: flex;
  gap: var(--space-2);
  width: 100%;
  max-width: 320px;
  margin-top: var(--space-2);
}
.onboarding-invite-box input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
}

/* ── Email-forwarding setup guide (in-app, Gmail-first) ──────────────────────
   Guided overlay reusing .modal-sheet + .onboarding-sheet + .coach-empty.
   Steps are toggled by .is-active (same idea as .onboarding-step). */
#forwarding-guide-overlay {
  align-items: flex-end;
  overflow: hidden;
}
#forwarding-guide-overlay .onboarding-sheet {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--space-5));
  padding: var(--space-6) var(--space-4) calc(var(--space-6) + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.fwd-guide-step { display: none; }
.fwd-guide-step.is-active { display: block; }
.fwd-guide-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: var(--space-1);
}
.fwd-provider-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.fwd-provider-btn {
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.fwd-provider-btn:hover {
  border-color: var(--accent-dark);
  background: var(--accent-light);
}
.fwd-addr-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  margin: var(--space-3) 0;
}
.fwd-addr-row .fwd-guide-addr { flex: 1; font-family: monospace; font-size: 0.82rem; }
.fwd-guide-list {
  margin: var(--space-3) 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}
.fwd-guide-list code {
  background: var(--border);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}
/* Step navigation now uses the shared .wizard-nav (components.css) —
   equal-size Back + Next side-by-side. The old .fwd-guide-nav rule
   (space-between, lopsided link-vs-button) was retired with the
   app-wide wizard-nav standard. */

/* ── Finance-model explainer overlay ─────────────────────────────────
   Sibling of the welcome tour and email-forwarding guide: same
   .modal-sheet.onboarding-sheet shell, round .modal-close (top-left),
   and .coach-empty-* typography. The two models render as bordered
   --card blocks, mirroring the forwarding guide's provider cards. */
#finance-model-info-overlay .onboarding-sheet {
  display: flex;
  flex-direction: column;
}
#finance-model-info-overlay .coach-empty-body {
  max-width: none;
  margin-bottom: var(--space-1);
}
.fm-info-option {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
}
.fm-info-option-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: var(--space-1);
}
.fm-info-option-desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--sub);
}
