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

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg:        #f2f4f7;
  --surface:   #ffffff;
  --surface-2: #edf0f3;
  --surface-3: #dce0e5;
  --surface-4: #b8bec7;
  --border:    #e0e4e9;
  --border-strong: rgba(23, 25, 28, 0.22);
  --text:      #17191c;
  --text-muted:#60656d;
  --primary:   #202326;
  --primary-2: #202326;
  --accent:    #30353b;
  --green:     #287043;
  --red:       #b4232b;
  --yellow:    #946200;
  --shadow-soft: none;
  --shadow-card: none;
  --font-body: 'Geist', system-ui, sans-serif;
  --font-display: 'Geist', system-ui, sans-serif;
  --header-h:  72px;
  --nav-h:     72px;
  /* safe-area variables — used for PWA standalone mode */
  --safe-t:    env(safe-area-inset-top,    0px);
  --safe-b:    env(safe-area-inset-bottom, 0px);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html, body { height: 100%; min-height: 100dvh; overflow: hidden; }
#app { height: 100%; min-height: 100dvh; position: relative; }
body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen          { position: absolute; inset: 0; }
.screen.hidden   { display: none !important; }   /* !important beats ID specificity */

/* ── Sign-in ─────────────────────────────────────────────────────────────── */
#signin-screen {
  background: var(--surface);
}

.signin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  gap: 16px;
  padding: 44px 28px;
  text-align: center;
}

.signin-icon {
  width: 112px;
  height: 112px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 10px;
  position: relative;
}
.signin-icon::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  border: 1px solid rgba(23, 25, 28, 0.06);
  pointer-events: none;
}
.signin-icon svg { width: 78px; height: 78px; color: var(--primary-2); }

.signin-wrap h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.96;
}
.signin-subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 320px;
}

.btn-google {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  margin-top: 10px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;

}
.btn-google:hover  { background: #ffffff; border-color: rgba(168, 93, 63, 0.28); }
.btn-google:active { transform: scale(0.97); }

/* ── App header ──────────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--header-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 18px;
  padding-right: 18px;
  background: rgba(248, 242, 230, 0.84);


  border-bottom: 1px solid rgba(23, 25, 28, 0.08);
  z-index: 100;
}
.header-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;

  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-icon:hover { background: #ffffff; }
.btn-icon:active { transform: scale(0.97); }

/* ── Scrollable page area ────────────────────────────────────────────────── */
.page-content {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-t));
  bottom: calc(var(--nav-h) + var(--safe-b)); /* account for nav + safe area below it */
  left: 0; right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom nav ──────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding-bottom: var(--safe-b);
  background: rgba(248, 242, 230, 0.92);


  border-top: 1px solid rgba(23, 25, 28, 0.08);
  display: flex;
  z-index: 100;
}
.nav-item {
  flex: 1;
  height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0;
  transition: color 0.15s, transform 0.12s;
  position: relative;
}
.nav-item.active { color: var(--accent); }
.nav-item:active { transform: scale(0.97); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 5px;
  background: var(--primary);
  border-radius: 8px;
}

/* ── Dashboard layout ────────────────────────────────────────────────────── */
.dashboard {
  padding: 18px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Period controls ─────────────────────────────────────────────────────── */
.period-bar { display: flex; flex-direction: column; gap: 8px; }

.period-toggle {
  display: flex;
  background: var(--surface);
  border-radius: 8px;
  padding: 5px;
  border: 1px solid var(--border);

}
.period-toggle button {
  flex: 1;
  padding: 10px 6px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.period-toggle button.active {
  background: #ffffff;
  color: var(--text);

}

.period-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;

}
.period-label {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.period-nav-btn {
  background: #ffffff;
  border: 1px solid rgba(23, 25, 28, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.period-nav-btn:disabled { opacity: 0.25; cursor: default; }
.period-nav-btn:not(:disabled):hover { background: #ffffff; color: var(--text); }

/* ── Summary cards ───────────────────────────────────────────────────────── */
.overview-hero {
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.12);
  border-radius: 8px;
  padding: 20px 18px 18px;

}

.overview-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.overview-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  margin-bottom: 8px;
}

.overview-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.overview-period-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

.overview-hero-amount {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 8vw, 3.4rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--primary-2);
}

.overview-hero-amount.positive { color: var(--primary-2); }
.overview-hero-amount.muted { color: var(--text-muted); }

.overview-hero-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 14px;
}

.overview-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.overview-chip-spend {
  background: rgba(46, 95, 93, 0.1);
  border-color: rgba(46, 95, 93, 0.14);
  color: var(--accent);
}

.overview-chip-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.summary-grid-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.summary-card-wide {
  grid-column: 1 / -1;
}

.summary-card {
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface);

  min-width: 0;          /* allow content to shrink instead of overflow */
}

.summary-card-compact {
  border-radius: 8px;
  padding: 15px 14px;

}

.summary-card-compact .card-label {
  margin-bottom: 7px;
}

.summary-card-compact .card-value {
  font-size: clamp(1.02rem, 3.8vw, 1.16rem);
  line-height: 1.02;
}

.summary-card-compact .card-tap-hint {
  margin-top: 5px;
}

.summary-card-balance-inline .card-value {
  font-size: clamp(0.98rem, 3.6vw, 1.1rem);
}

.summary-card.wide { grid-column: 1 / -1; }
.clickable-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s, border-color 0.15s;
}
.clickable-card:active { filter: brightness(1.15); }
.card-tap-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.5;
}

/* Colored card tints */
.card-income {
  background: var(--surface);
  border-color: rgba(47, 125, 99, 0.16);
}
.card-expense {
  background: var(--surface);
  border-color: rgba(207, 106, 82, 0.16);
}
.card-balance {
  background: var(--surface);
}

.card-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 6px;
}
.card-value {
  font-family: var(--font-display);
  /* clamp(min, preferred, max) — scales the amount down on narrow screens so
     "67 000 Kč" doesn't wrap to two lines, but keeps a nice large display
     size when there's room */
  font-size: clamp(1.05rem, 4.4vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-income  .card-value { color: var(--green); }
.card-expense .card-value { color: var(--red); }
.card-value.positive { color: var(--green); }
.card-value.negative { color: var(--red); }
.card-balance .card-value { color: var(--text); }

/* ── Needs-review banner ─────────────────────────────────────────────────── */
.review-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 8px;
  background: rgba(212, 157, 54, 0.12);
  border: 1px solid rgba(212, 157, 54, 0.24);
  color: #8f6517;
  font-size: 0.87rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.review-banner > span { flex: 1; }
.review-banner-chevron { color: #8f6517; opacity: 0.6; flex-shrink: 0; }
.review-banner:active {
  background: rgba(212, 157, 54, 0.2);
  border-color: rgba(212, 157, 54, 0.36);
}

/* ── Section titles ──────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  padding: 0 2px;
  margin-top: 4px;
}

/* ── Budget section header (title + elapsed row side by side) ────────────── */
.budget-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.budget-section-header .period-progress-row {
  /* inline next to the title — override default full-width layout */
  flex: 1;
  margin: 0;
  max-width: 180px;
}

/* ── Budget cards grid ───────────────────────────────────────────────────── */
.budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.budget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.budget-card:active { background: var(--surface-2); transform: scale(0.97); }

.budget-card-top {
  margin-bottom: 6px;
}
.budget-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  border-radius: 8px;
  line-height: 1;
}

.budget-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-card-amount {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  margin-top: 4px;
}
.budget-card-limit {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.budget-card-limit.no-budget { opacity: 0.4; font-style: italic; }

.budget-card-track {
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.budget-card-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.budget-empty {
  color: var(--text-muted);
  font-size: 0.84rem;
  padding: 16px 0;
  grid-column: 1 / -1;
}

/* Keep the old .budget-list/.budget-item styles for Period Comparison & Recurring sections */
.budget-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.budget-item {
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.budget-item:last-child { border-bottom: none; }
.budget-item.muted-row  { color: var(--text-muted); font-size: 0.84rem; padding: 16px; }
.budget-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.budget-category { font-size: 0.88rem; font-weight: 600; }
.budget-amounts { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.budget-amounts strong { color: var(--text); font-weight: 700; }

.progress-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.ok   { background: var(--surface); }
.progress-fill.warn { background: var(--surface); }
.progress-fill.over { background: var(--surface); }

/* ── Donut chart ─────────────────────────────────────────────────────────── */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;

}
.chart-container { position: relative; height: 230px; }

/* ── Refresh button ──────────────────────────────────────────────────────── */
.btn-refresh {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-top: 4px;
}
.btn-refresh:hover {
  background: var(--surface);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
}

/* ── Add page placeholder ────────────────────────────────────────────────── */
.add-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 28px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}
.add-page h2   { color: var(--text); font-size: 1.2rem; font-weight: 700; }
.add-page p    { font-size: 0.9rem; line-height: 1.6; max-width: 280px; }
.add-soon {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  letter-spacing: 0;
  color: var(--text) !important;
  background: var(--primary);

}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  gap: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.spinner {
  width: 30px; height: 30px;
  border: 2.5px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Section hint ────────────────────────────────────────────────────────── */
.section-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
}

/* ── Transactions page ───────────────────────────────────────────────────── */
.txn-page {
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

.records-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 16px 0;
  padding: 18px 18px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);

}

.records-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  margin-bottom: 8px;
}

.records-period {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.records-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  text-align: right;
}

.records-count,
.records-flow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);
  font-size: 0.75rem;
  font-weight: 700;
}

.records-count { color: var(--text-muted); }
.records-flow  { color: var(--primary-2); }

.txn-search-wrap { padding: 12px 16px 0; display: flex; gap: 8px; align-items: center; }
.records-toolbar { padding-top: 14px; }
.txn-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text-muted);

}
.txn-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem; /* ≥16px prevents iOS auto-zoom on focus */
}
.txn-search input::placeholder { color: var(--text-muted); }
.sort-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.sort-btn:active { opacity: .7; }
.sort-btn.sort-asc {
  border-color: var(--primary-2);
  color: var(--primary-2);
}

.records-refine-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;

  -webkit-tap-highlight-color: transparent;
}
.records-refine-btn:active { transform: scale(0.985); }

.records-refine-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Billing / Month mode toggle in Records */
.txn-mode-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin: 8px 16px 0;
  gap: 2px;

}
.txn-mode-btn {
  flex: 1;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.txn-mode-btn.active {
  background: #ffffff;
  color: var(--text);
}

.records-primary-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 16px 6px;
}

.records-period-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.records-control-label {
  padding-left: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.records-period-select {
  width: 100%;
  min-height: 42px;
  padding-inline: 15px 36px;
  border-radius: 8px;
  background: var(--surface);

}

.txn-filters {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.txn-filters::-webkit-scrollbar { display: none; }
.records-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 12px;
  min-width: 0;
}

.filter-select {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 13px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.filter-clear {
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  background: rgba(213, 124, 82, 0.12);
  border: 1px solid rgba(213, 124, 82, 0.24);
  border-radius: 8px;
  color: var(--primary-2);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-clear-all {
  background: rgba(46, 95, 93, 0.1);
  border-color: rgba(46, 95, 93, 0.16);
  color: var(--accent);
}

.txn-list { padding: 0 16px 24px; }

.txn-date-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  padding: 14px 2px 6px;
}
.txn-date-header:first-child { padding-top: 4px; }

.txn-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;

  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.txn-item:active { background: #ffffff; transform: scale(0.985); }

/* txn-dot kept for backwards compat but hidden — replaced by cat-badge */
.txn-dot { display: none; }

/* ── Category icon badge ─────────────────────────────────────────────────── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  line-height: 1;
  /* width / height / font-size / background / border set inline per category */
}
/* Coloured bottom strip on budget cards reuses the progress bar colour */

.txn-body { flex: 1; min-width: 0; }
.txn-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.txn-headline {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txn-amount {
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.txn-amount-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.txn-amount.expense { color: var(--red); }
.txn-amount.income  { color: var(--green); }
.txn-amount-secondary {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.1;
}

.txn-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.txn-category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(46, 95, 93, 0.08);
  border: 1px solid rgba(46, 95, 93, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.txn-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  text-transform: none;
  letter-spacing: 0;
}
.txn-badge.review {
  background: rgba(245,158,11,0.15);
  color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.3);
}

.txn-date-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.txn-date-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.txn-date-total {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(213, 124, 82, 0.1);
  border: 1px solid rgba(213, 124, 82, 0.16);
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

.txn-week-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 10px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  border-top: 1px solid rgba(23, 25, 28, 0.08);
}

.txn-week-header:first-child {
  border-top: none;
  padding-top: 8px;
}

.txn-week-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.txn-week-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.txn-week-hint {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.records-filter-sheet .sheet-title {
  font-family: var(--font-display);
}

.records-segment {
  display: flex;
  gap: 6px;
}

.records-segment-btn {
  flex: 1;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.records-segment-btn.active {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

.records-filter-note {
  padding: 14px 15px;
  border-radius: 8px;
  background: rgba(46, 95, 93, 0.08);
  border: 1px solid rgba(46, 95, 93, 0.12);
}

.records-filter-note-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  margin-bottom: 6px;
}

.records-filter-note-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.txn-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 48px 16px;
}

/* ── Edit bottom sheet ───────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 34, 20, 0.3);

}
.sheet-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.sheet-panel.open { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--surface-4);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.sheet-title    { font-size: 1.05rem; font-weight: 700; }
.sheet-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }
.sheet-amount-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.sheet-amount   { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.sheet-amount.expense { color: var(--red); }
.sheet-amount.income  { color: var(--green); }
.sheet-amount-secondary {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sheet-extras {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.sheet-extra-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.82rem;
}
.sheet-extra-key { color: var(--text-muted); text-transform: capitalize; }
.sheet-extra-val { color: var(--text); font-weight: 500; text-align: right; }

.sheet-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }

.sheet-actions { display: flex; gap: 10px; }
.btn-secondary {
  flex: 1;
  padding: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-save {
  flex: 2;
  padding: 13px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save:disabled { opacity: 0.6; cursor: default; }

/* ── Shared field styles (edit sheet + add form) ─────────────────────────── */
.field-group  { display: flex; flex-direction: column; gap: 6px; }
.field-label  { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.field-optional { font-weight: 400; text-transform: none; letter-spacing: 0; }
.field-input,
.field-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;        /* ≥16px prevents iOS auto-zoom on focus */
  padding: 11px 14px;
  outline: none;
  width: 100%;
  max-width: 100%;        /* date inputs can overflow their container on iOS */
  min-width: 0;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
/* Remove iOS native date-picker chrome so it respects our width */
input[type="date"].field-input { -webkit-appearance: none; appearance: none; }
.field-input:focus,
.field-select:focus { border-color: var(--primary-2); }

.field-textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  padding: 11px 14px;
  outline: none;
  width: 100%;
  resize: vertical;
  min-height: 64px;
  transition: border-color 0.15s;
  line-height: 1.5;
}
.field-textarea:focus { border-color: var(--primary-2); }
.field-textarea::placeholder { color: var(--text-muted); }

/* ── Toggle ──────────────────────────────────────────────────────────────── */
.toggle-wrap  { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle-wrap input { display: none; }
.toggle-track {
  width: 42px; height: 24px;
  background: var(--surface-4);
  border-radius: 8px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-wrap input:checked + .toggle-track { background: var(--primary-2); }
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;

}
.toggle-wrap input:checked + .toggle-track .toggle-thumb { left: 20px; }
.toggle-label { font-size: 0.88rem; color: var(--text-muted); }

/* ── Add expense form ────────────────────────────────────────────────────── */
.add-page-form {
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.add-type-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;

}
.type-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.type-btn.active {
  background: #ffffff;
  color: var(--text);
}

.add-amount-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  transition: border-color 0.15s;

}
.add-amount-wrap:focus-within { border-color: var(--green); }
.add-amount-wrap.income-mode:focus-within { border-color: var(--green); }

.add-currency {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.add-amount-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  min-width: 0;
}
.add-amount-input::placeholder { color: var(--surface-3); }

.add-fields { display: flex; flex-direction: column; gap: 12px; }

.btn-submit {
  width: 100%;
  padding: 15px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 4px;
}
.btn-submit:disabled { opacity: 0.6; cursor: default; }
.btn-submit:not(:disabled):active { transform: scale(0.98); }

/* ── Period progress (budget pacing) ─────────────────────────────────────── */
.period-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
}
.period-progress-bar {
  flex: 1;
  height: 5px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
}
.period-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 8px;
  transition: width 0.4s ease;
}
.period-progress-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Week filter pills (Records page) ────────────────────────────────────── */
.week-pills {
  display: flex;
  gap: 7px;
  padding: 0 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.week-pills::-webkit-scrollbar { display: none; }
.week-pill {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.week-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

/* ── Savings rate card ───────────────────────────────────────────────────── */
.card-savings {
  background: var(--surface);
  border-color: rgba(213, 124, 82, 0.24);
}
.card-savings .card-value { color: var(--primary-2); }

/* ── Spending Trend chart ────────────────────────────────────────────────── */
.trend-wrap { height: 180px; }

/* ── Pace indicator ──────────────────────────────────────────────────────── */
.pace-line {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 2px 6px;
}
.pace-line strong { font-weight: 800; color: var(--text); }
.pace-line.pace-up strong { color: var(--red); }
.pace-line.pace-ok strong { color: var(--green); }

/* ── Period Comparison ───────────────────────────────────────────────────── */
.comparison-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.comparison-row:last-child { border-bottom: none; }
.comparison-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.comparison-amounts {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.comparison-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.comparison-badge.up      { background: rgba(244, 63, 94, 0.12); color: var(--red); }
.comparison-badge.down    { background: rgba(16, 185, 129, 0.12); color: var(--green); }
.comparison-badge.new,
.comparison-badge.neutral { background: var(--surface-2); color: var(--text-muted); }

/* ── Weekly & Day breakdown ──────────────────────────────────────────────── */
.breakdown-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.breakdown-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.breakdown-summary::-webkit-details-marker { display: none; }
.breakdown-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.breakdown-details[open] .breakdown-chevron { transform: rotate(180deg); }

.breakdown-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 4px 16px 16px;
}
.breakdown-block { display: flex; flex-direction: column; gap: 8px; }
.breakdown-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}
.breakdown-chart-wrap { position: relative; height: 200px; }

/* ── Recurring Expenses ──────────────────────────────────────────────────── */
.recurring-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.recurring-item:last-child { border-bottom: none; }
.recurring-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.recurring-avg {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.recurring-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Spent-in-period card (dashboard) ───────────────────────────────────── */
.spent-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.spent-card:active {
  background: var(--surface-2);
  border-color: rgba(124, 58, 237, 0.4);
}
.spent-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.spent-card-amount {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 14px;
}
.spent-card-seg-bar {
  display: flex;
  height: 6px;
  border-radius: 8px;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 12px;
}
.seg-segment {
  height: 100%;
  min-width: 3px;
}
.spent-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.spent-card-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.spent-card-arrow {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary-2);
}

/* ── By Merchant card (dashboard) ───────────────────────────────────────── */
.merchant-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.merchant-card:active {
  background: var(--surface-2);
  border-color: rgba(16, 185, 129, 0.4);
}
.mc-list {
  margin: 10px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mc-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.mc-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.mc-amount {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

/* ── Merchant filter chip (Records page) ────────────────────────────────── */
.filter-clear-merchant {
  background: rgba(47, 125, 99, 0.12);
  border-color: rgba(47, 125, 99, 0.24);
  color: var(--green);
}

/* ── Spending Breakdown page ─────────────────────────────────────────────── */
.bp-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 32px;
}
.bp-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin: 12px 16px 0;
}
.bp-back:hover,
.bp-back:active {
  background: #ffffff;
}
.bp-header {
  padding: 12px 16px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.bp-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.bp-total-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}
.bp-total-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.bp-total {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.bp-cat-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-bottom: 4px;
}
.bp-seg-bar {
  display: flex;
  height: 8px;
  border-radius: 8px;
  overflow: hidden;
  gap: 2px;
}
.bp-list { flex: 1; }
.bp-cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.bp-cat-row:active { background: var(--surface-2); }
.bp-cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bp-cat-body { flex: 1; min-width: 0; }
.bp-cat-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
}
.bp-cat-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bp-cat-amount {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.bp-cat-sub {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bp-cat-bar {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
}
.bp-cat-fill { height: 100%; border-radius: 8px; }
.bp-cat-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 30px;
  text-align: right;
}
.bp-row-arrow { color: var(--surface-3); flex-shrink: 0; }

/* ── Error ───────────────────────────────────────────────────────────────── */
.error-msg {
  background: rgba(207, 106, 82, 0.1);
  border: 1px solid rgba(207, 106, 82, 0.2);
  border-radius: 8px;
  padding: 14px 16px;
  color: #934c3b;
  font-size: 0.87rem;
  line-height: 1.5;
  text-align: center;
}

/* ── Today Strip (Dashboard) ─────────────────────────────────────────────── */
.today-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0;
  cursor: pointer;

  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.today-strip:active { background: #ffffff; transform: scale(0.985); }

.today-strip-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.today-strip-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
}
.today-strip-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.today-strip-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.today-strip-total {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--red);
}
.today-strip-cats {
  font-size: 1rem;
  letter-spacing: 2px;
}
.today-strip-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Daily View Page ─────────────────────────────────────────────────────── */
.daily-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 24px;
  gap: 12px;
}

.daily-back-link {
  align-self: flex-start;
}

.daily-hero {
  margin: 0 16px;
  padding: 10px 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);

}

.daily-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
  gap: 8px;
}
.daily-nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.daily-nav-btn:active { background: var(--surface-2); }
.daily-nav-btn:disabled { opacity: 0.3; pointer-events: none; }

.daily-nav-label {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.daily-today-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-2);
  letter-spacing: 0;
  text-transform: none;
}
.daily-today-badge-muted { color: var(--text-muted); }
.daily-nav-date {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.daily-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 2px;
  gap: 12px;
}
.daily-total {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: -0.02em;
}
.daily-cat-chips {
  display: flex;
  gap: 6px;
  align-items: center;
}

.daily-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.daily-empty-card {
  margin: 6px 10px 2px;
  padding: 18px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);
}

.daily-empty-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.daily-empty-copy {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.weekly-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 24px;
  gap: 12px;
}

.weekly-back-link {
  align-self: flex-start;
}

.weekly-hero {
  margin: 0 16px;
  padding: 10px 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(23, 25, 28, 0.1);

}

.weekly-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
  gap: 8px;
}

.weekly-range {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Tappable date headers in Records */
.txn-date-header--link {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  padding: 10px 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.txn-date-header--link:active { color: var(--text); }
.txn-date-header--link:first-child { padding-top: 4px; }

/* ── Budget edit button (pencil icon on card) ────────────────────────────────── */
.budget-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.budget-edit-btn:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Remove budget button in edit sheet */
.btn-remove {
  flex: 1;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-remove:active  { background: rgba(244, 63, 94, 0.1); }
.btn-remove:disabled { opacity: 0.6; cursor: default; }

/* ── Owes You section ────────────────────────────────────────────────────── */
.owes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.owes-row:last-child { border-bottom: none; }
.owes-row:active { background: var(--surface-2); }
.owes-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.owes-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.owes-waiting { color: var(--yellow); }
.owes-partial { color: var(--primary-2); }
.owes-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

/* ── Menu action sheet ───────────────────────────────────────────────────── */
.menu-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 6px;
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.menu-action:last-child { border-bottom: none; }
.menu-action:active { background: #ffffff; }
.menu-action svg { color: var(--text-muted); flex-shrink: 0; }
.menu-action-danger { color: var(--red); }
.menu-action-danger svg { color: var(--red); }

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 32px;
  gap: 14px;
}
.settings-intro {
  padding: 8px 20px 16px;
}
.settings-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.settings-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.settings-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 16px;
  overflow: hidden;

}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-dim { opacity: 0.45; }
.settings-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.settings-label {
  font-size: 0.9rem;
  font-weight: 500;
}
.settings-arrows {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.arr-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.arr-btn:active  { background: var(--surface-3); color: var(--text); }
.arr-btn:disabled { opacity: 0.25; pointer-events: none; }

/* iOS-style toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-switch .toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch .toggle-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--primary-2); }
.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(18px);
  background: #fff;
}

.settings-reset-btn {
  margin: 20px 16px 0;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.settings-reset-btn:active { background: var(--surface-2); }

/* ── Debt section in edit sheet ──────────────────────────────────────────── */
.debt-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}

/* ── Planned Expenses — Dashboard card ───────────────────────────────────── */
.planned-dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;

  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.planned-dash-card:active { background: #ffffff; transform: scale(0.985); }

.planned-dash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.planned-dash-row:last-of-type { border-bottom: none; }
.planned-dash-name { flex: 1; color: var(--text); }
.planned-dash-amt  { font-weight: 700; color: var(--red); flex-shrink: 0; }
.planned-dash-more { font-size: 0.75rem; color: var(--text-muted); padding: 4px 0; }

.planned-dash-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}
.planned-dash-total     { color: var(--red); font-weight: 600; }
.planned-dash-projected          { font-weight: 700; }
.planned-dash-projected.positive { color: var(--green); }
.planned-dash-projected.negative { color: var(--red); }
.planned-dash-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Planned Expenses — Management page ──────────────────────────────────── */
.planned-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 32px;
}
.planned-section { margin: 0 0 4px; }
.planned-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}
.planned-item-wrap { position: relative; }
.planned-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.planned-row:active { background: var(--surface-2); }
.planned-emoji { font-size: 1.2rem; flex-shrink: 0; }
.planned-body  { flex: 1; min-width: 0; }
.planned-main  { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.planned-name  { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planned-amount { font-size: 0.9rem; font-weight: 700; color: var(--red); flex-shrink: 0; }
.planned-sub   { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 0.75rem; color: var(--text-muted); }
.planned-badge {
  background: var(--surface-2);
  color: var(--primary-2);
  border-radius: 8px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.planned-paid-badge {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 600;
}
.planned-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.planned-pay-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.planned-pay-btn:active { background: var(--surface-3); }
.planned-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 16px 0;
  padding: 14px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.planned-add-btn:active { opacity: 0.85; }
.planned-cancelled { margin: 8px 0; }
.planned-cancelled summary {
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Records period arrows ──────────────────────────────────────────────── */
.records-hero-left {
  min-width: 0;
}
.records-period-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: -6px; /* let the left arrow visually align with the kicker */
}
.records-period-row .records-period {
  flex: 0 1 auto;
}
.records-period-arrow {
  background: rgba(23, 25, 28, 0.08);
  border: 1px solid rgba(23, 25, 28, 0.12);
  border-radius: 8px;
  color: var(--accent);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.records-period-arrow:active { background: rgba(23, 25, 28, 0.18); }
.records-period-arrow:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Ledger layout: shared edges, one rhythm, no ornamental surface effects. */
:root { --header-h: 72px; --nav-h: 72px; --gap: 24px; --chart: #1d5fbf; }
body, #signin-screen { background: var(--bg); }
body, button, input, select, textarea { font-family: var(--font-body); }
body { font-variant-numeric: tabular-nums; font-size: 14px; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--chart); outline-offset: 3px; }
input, select, textarea { font-size: 16px; }
.app-header { background: var(--bg); padding-inline: 20px; border: 0; }
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-name { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.brand-mark { width: 24px; height: 24px; color: var(--text); }
.header-title { font-size: 24px; font-weight: 500; margin: 0; line-height: 1.2; }
.btn-icon { border: 0; background: transparent; border-radius: 6px; }
.bottom-nav { background: var(--surface); border-top: 1px solid var(--border); }
.nav-item { color: var(--text-muted); gap: 5px; font-size: 12px; }
.nav-item.active { color: var(--text); background: var(--surface-2); }
.nav-item.active::before { display: none; }
.dashboard, .daily-page, .weekly-page, .planned-page, .settings-page { padding: 24px 20px 40px; gap: var(--gap); }
.period-bar { gap: 12px; }
.period-toggle, .period-nav { background: transparent; border: 0; padding: 0; }
.period-toggle { background: var(--surface-2); padding: 4px; border-radius: 6px; }
.period-toggle button { font-size: 14px; border-radius: 4px; font-weight: 500; }
.period-toggle button.active { background: var(--surface); }
.period-nav { padding-inline: 4px; }
.period-label { font-size: 16px; font-weight: 500; }
.period-nav-btn { width: 44px; height: 44px; background: transparent; border: 0; }
.overview-hero { padding: 24px; border: 1px solid var(--border); }
.overview-title { font-size: 16px; font-weight: 500; line-height: 1.4; }
.overview-hero-amount, .overview-hero-amount.positive { font-size: clamp(28px, 7.5vw, 40px); line-height: 1.15; color: var(--text); letter-spacing: -0.04em; overflow-wrap: anywhere; }
.overview-period-badge { background: transparent; border: 0; padding: 0; min-height: 24px; font-weight: 400; }
.overview-chip { padding: 0; background: transparent; border: 0; font-size: 13px; font-weight: 400; color: var(--text-muted); }
.overview-hero-subline { gap: 16px; margin-block: 16px 24px; }
.summary-grid { gap: 20px 24px; border-top: 1px solid var(--border); padding-top: 24px; }
.summary-card { padding: 0; background: transparent; border: 0; border-radius: 0; }
.card-label { font-size: 13px; font-weight: 400; }
.summary-card-compact .card-value { font-size: 22px; line-height: 1.25; }
.card-income .card-value, .card-expense .card-value, .card-value.positive { color: var(--text); }
.card-tap-hint { opacity: 1; color: var(--text-muted); font-size: 12px; }
.section-title { font-size: 16px; font-weight: 500; margin: 0 0 16px; letter-spacing: 0; }
.section-hint { font-size: 12px; font-weight: 400; }
.dashboard-section { min-width: 0; }
.dashboard-sections { display: grid; gap: var(--gap); }
.budget-grid { gap: 12px; }
.budget-card { border-radius: 8px; padding: 20px; }
.budget-card-label { white-space: normal; font-size: 14px; }
.budget-card-amount { font-size: 22px; overflow-wrap: anywhere; }
.budget-card-icon, .cat-badge, .planned-emoji, .overview-chip-icons, .today-strip-cats { display: none; }
.budget-card-top { justify-content: flex-end; }
.budget-edit-btn { width: 44px; height: 44px; }
.budget-card-fill.ok, .progress-fill.ok { background: var(--text-muted) !important; }
.budget-card-fill.warn, .progress-fill.warn { background: var(--yellow) !important; }
.budget-card-fill.over, .progress-fill.over { background: var(--red) !important; }
.today-strip, .spent-card, .merchant-card, .chart-wrap, .budget-list, .planned-dash-card { padding: 20px; border-radius: 8px; }
.spent-card-amount { font-size: 30px; color: var(--text); }
.spent-card-label, .today-strip-label { font-size: 13px; font-weight: 500; }
.today-strip-total { color: var(--text); }
.records-hero, .daily-hero, .weekly-hero { background: var(--surface); padding: 24px 20px; }
.records-kicker { font-size: 14px; }
.txn-page { padding-top: 24px; }
.txn-item { background: var(--surface); border-radius: 0; margin: 0; border: 0; border-bottom: 1px solid var(--border); padding-block: 18px; }
.txn-amount.expense, .sheet-amount.expense, .planned-amount, .planned-dash-amt, .planned-dash-total { color: var(--text); }
.txn-category-pill, .records-count, .records-flow, .planned-badge { background: var(--surface-2); color: var(--text-muted); border: 0; }
.txn-search input { font-size: 16px; }
.txn-headline, .planned-name { overflow-wrap: anywhere; }
.settings-title { font-size: 24px; }
.settings-row { min-height: 64px; padding-block: 16px; }
.settings-label { font-size: 14px; }
.sheet-backdrop { background: rgba(0, 0, 0, .3); }
.sheet-panel { background: var(--surface); border-radius: 8px 8px 0 0; padding: 16px 24px calc(24px + var(--safe-b)); }
.sheet-fields { gap: 20px; }
.sheet-title { font-weight: 500; }
.field-label { font-size: 13px; font-weight: 500; }
.field-input, .field-select { min-height: 48px; font-size: 16px; border-radius: 6px; background: var(--surface); }
.menu-action { background: transparent; min-height: 56px; }
.add-page-form { padding: 24px 20px 40px; gap: 24px; }
.add-fields { gap: 20px; }
.add-amount-input { font-size: 32px; }
.btn-save, .btn-submit, .planned-add-btn { background: var(--primary); border-radius: 6px; }
.signin-wrap { align-items: flex-start; text-align: left; width: min(100%, 440px); margin: auto; padding: 32px; gap: 24px; }
.signin-wrap h1 { font-size: 32px; line-height: 1.1; font-weight: 500; }
.signin-icon { width: 40px; height: 40px; background: transparent; border: 0; border-radius: 0; margin-bottom: 8px; }
.signin-icon::after { display: none; }
.signin-icon svg { width: 40px; height: 40px; }
.signin-subtitle { font-size: 16px; line-height: 1.6; color: var(--text-muted); }
.btn-google { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; padding: 14px 20px; font: inherit; }
.clickable-card:hover, .txn-item:hover, .menu-action:hover { background: var(--surface-2); }
.clickable-card:active, .txn-item:active { filter: none; transform: none; }
@media (min-width: 760px) {
  .period-bar { flex-direction: row; justify-content: space-between; align-items: center; }
  .period-toggle { width: auto; min-width: 320px; }
  .period-nav { min-width: 240px; gap: 16px; }
  .summary-grid-secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .summary-card-wide { grid-column: span 2; }
  /* Two equal columns: 2 × ((1120 - 24) / 2) + 24 = 1120. Order follows settings. */
  .dashboard-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .dashboard-section:last-child:nth-child(odd), .dashboard-section[data-section="budget"] { grid-column: 1 / -1; }
  .budget-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-panel { max-width: 600px; margin-inline: auto; }
  .add-page-form, .settings-page, .planned-page { max-width: 720px; margin-inline: auto; }
}
@media (min-width: 1100px) {
  :root { --nav-h: 0px; }
  .app-header { left: max(32px, calc((100vw - 1120px) / 2)); right: max(32px, calc((100vw - 1120px) / 2)); padding-inline: 0; height: 88px; }
  .page-content { top: 88px; left: max(32px, calc((100vw - 1160px) / 2)); right: max(32px, calc((100vw - 1160px) / 2)); }
  .bottom-nav { top: 20px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); height: 48px; width: 350px; border: 0; background: transparent; gap: 4px; }
  .nav-item { flex-direction: row; gap: 8px; font-size: 14px; border-radius: 6px; }
  .nav-item svg { width: 18px; height: 18px; }
  .dashboard { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}

@media (max-width: 759px) { .signin-wrap h1 { font-size: 24px; } .brand-name { display: none; } }

.overview-hero { background: var(--surface); }
.spent-card-label, .records-kicker { text-transform: lowercase; }
.spent-card-label::first-letter, .records-kicker::first-letter { text-transform: uppercase; }
/* Final review: preserve summaries and align the frame across drill-down screens. */
.budget-edit-btn { background: transparent; border: 0; border-radius: 0; }
.daily-hero, .weekly-hero { margin-inline: 0; }
.daily-page > .txn-list, .weekly-page > .txn-list { padding-inline: 0; }
.planned-page .planned-row, .settings-page .settings-row { padding-inline: 0; }
.daily-total, .txn-date-total, .txn-week-total { color: var(--text); }
.daily-cat-chips { flex-wrap: wrap; gap: 8px; }
.category-name { font-size: 12px; color: var(--text-muted); }
@media (min-width: 760px) {
  .dashboard-section[data-section="today"] { grid-column: 1 / -1; }
}
@media (max-width: 759px) {
  .records-hero { flex-direction: column; gap: 16px; }
  .records-hero-left { width: 100%; }
  .records-period-row { justify-content: space-between; }
  .records-period { line-height: 1.25; }
  .records-hero-meta { flex-direction: row; align-items: center; text-align: left; flex-wrap: wrap; }
}
@media (min-width: 760px) {
  .dashboard-section[data-section="spent"], .dashboard-section[data-section="merchant"] { align-self: stretch; }
  .spent-card, .merchant-card { height: 100%; display: flex; flex-direction: column; }
  .spent-card-footer { margin-top: auto; }
}
/* Category counts vary by period: paired rows with a full-width final category avoid orphan tiles. */
.budget-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.settings-page .settings-intro { padding-inline: 0; }
.settings-page .settings-list { margin-inline: 0; }
.settings-page .settings-row { padding-inline: 16px; }
:is(.daily-page, .weekly-page, .planned-page, .settings-page) > .bp-back { margin-inline: 0; }
@media (min-width: 760px) {
  .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
