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

/* Light theme — cream, ledger green, muted brass */
:root {
  --color-bg:             #F6F1E8;
  --color-surface:        #FFFDF8;
  --color-surface-raised: #FFFFFF;
  --color-text:           #14110F;
  --color-text-muted:     #6F6961;
  --color-text-faint:     #A0998F;
  --color-border:         rgba(20, 17, 15, 0.12);
  --color-primary:        #183C34;
  --color-primary-pressed:#102B25;
  --color-primary-soft:   #DDE7E2;
  --color-primary-text:   #F5EFE4;
  --color-accent:         #B08D57;
  --color-accent-pressed: #967442;
  --color-accent-soft:    #EFE5D3;
  --color-danger:         #B3261E;
  --color-danger-bg:      #FEF2F2;
  --color-danger-border:  rgba(179, 38, 30, 0.25);
  --color-success:        #1F7A4D;
  --color-success-bg:     #EAF6EF;
  --color-warning:        #B06A00;
  --color-input-bg:       #FFFDF8;
  --color-overlay:        rgba(20, 17, 15, 0.45);
  --color-surface-border: transparent;

  /* Dock / layout */
  --dock-height:   64px;
  --dock-gap:      12px;
  --fab-dock-gap:  12px;
  --fab-height:    46px;
  --dock-lower-offset: 30px;

  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --radius:    14px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Dark theme overrides */
[data-theme="dark"] {
  --color-bg:             #0F1110;
  --color-surface:        #171C19;
  --color-surface-raised: #202621;
  --color-text:           #F5EFE4;
  --color-text-muted:     #B9B0A4;
  --color-text-faint:     #6A6460;
  --color-border:         rgba(245, 239, 228, 0.14);
  --color-primary:        #7FAE9B;
  --color-primary-pressed:#9CC9AA;
  --color-primary-soft:   #24382D;
  --color-primary-text:   #14110F;
  --color-accent:         #C2A06A;
  --color-accent-pressed: #D4B77F;
  --color-accent-soft:    #3B2F20;
  --color-danger:         #FFB4AB;
  --color-danger-bg:      rgba(255, 180, 171, 0.12);
  --color-danger-border:  rgba(255, 180, 171, 0.3);
  --color-success:        #9DD8B3;
  --color-success-bg:     rgba(157, 216, 179, 0.14);
  --color-warning:        #E7BE72;
  --color-input-bg:       #202621;
  --color-overlay:        rgba(0, 0, 0, 0.65);
  --color-surface-border: var(--color-border);
  --shadow:    0 2px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);
}

html {
  background: var(--color-bg);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  overflow: hidden;
}

#app-root {
  background: var(--color-bg);
}

/* ─── Screens ────────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .22s ease, transform .22s ease;
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: none;
}
.screen.slide-in  { animation: slideIn .28s ease forwards; }
.screen.slide-out { animation: slideOut .22s ease forwards; }

@keyframes slideIn  { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { from { transform: none; opacity: 1; } to { transform: translateX(-20%); opacity: 0; } }

/* ─── App Shell Header (main screen) ────────────────────────────── */
.app-shell-header {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  align-items: center;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 10;
  gap: 12px;
}

.header-side {
  display: flex;
  align-items: center;
  min-width: 0;
}
.header-side-left {
  justify-content: flex-start;
}
.header-actions {
  justify-content: flex-end;
  gap: 8px;
}
.header-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--color-primary);
}

/* ─── App Header (Settings screen) ──────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 20px 14px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 10;
}
.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--color-primary);
}
.app-header .sub { font-size: 13px; color: var(--color-text-muted); margin-top: 1px; }
.header-left { display: flex; flex-direction: column; gap: 1px; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
  font-size: 18px;
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(.92); opacity: .8; }

/* ─── Tab Content ────────────────────────────────────────────────── */
.tab-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: none;
  display: none;
  flex-direction: column;
  padding-bottom: calc(var(--dock-height) + var(--dock-gap) + var(--safe-bottom) + var(--fab-height) + var(--fab-dock-gap) + 16px);
}
.tab-pane.active { display: flex; }

/* ─── Home context bar ───────────────────────────────────────────── */
.home-context-bar {
  padding: 12px 16px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ─── Scroll area (Add / Settings screens) ───────────────────────── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

/* ─── Dual Floating Action Buttons ───────────────────────────────── */
.fab-group {
  position: fixed;
  right: 20px;
  bottom: calc(var(--dock-height) + var(--dock-gap) + var(--safe-bottom) + var(--fab-dock-gap) - var(--dock-lower-offset));
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 110;
}

/* Budget Coach FAB removed — Budget Coach is now an inline Plan card */

.fab {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
  flex-shrink: 0;
}
.fab:active { transform: scale(.91); box-shadow: 0 2px 8px rgba(0,0,0,.22); }

.fab-expense {
  background: #C0392B;
  box-shadow: 0 4px 16px rgba(192,57,43,.45);
}
[data-theme="dark"] .fab-expense {
  background: #E05348;
  box-shadow: 0 4px 20px rgba(224,83,72,.5), 0 0 0 1px rgba(224,83,72,.18);
}

.fab-income {
  background: #1A7A4D;
  box-shadow: 0 4px 16px rgba(26,122,77,.45);
}
[data-theme="dark"] .fab-income {
  background: #22A366;
  box-shadow: 0 4px 20px rgba(34,163,102,.5), 0 0 0 1px rgba(34,163,102,.18);
}

/* ─── Floating Tab Dock ──────────────────────────────────────────── */
.floating-tab-dock {
  position: fixed;
  bottom: calc(var(--dock-gap) + var(--safe-bottom) - var(--dock-lower-offset));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 48px), 320px);
  max-width: 320px;
  height: var(--dock-height);
  background: var(--color-surface);
  border-radius: 999px;
  box-shadow: 0 4px 24px rgba(0,0,0,.13), 0 0 0 1px var(--color-border);
  display: flex;
  align-items: center;
  padding: 6px;
  z-index: 100;
  gap: 4px;
}
[data-theme="dark"] .floating-tab-dock {
  box-shadow: 0 4px 28px rgba(0,0,0,.55), 0 0 0 1px var(--color-border);
}

.dock-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
  color: var(--color-text-faint);
  height: 52px;
  min-width: 52px;
  transition: color .15s, background .15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.dock-btn svg { width: 28px; height: 28px; stroke-width: 1.9; flex-shrink: 0; }
.dock-btn.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.dock-btn:active:not(.active) { background: var(--color-bg); }

/* ─── Placeholder screens ────────────────────────────────────────── */
.placeholder-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  gap: 10px;
}
.placeholder-icon { font-size: 52px; margin-bottom: 4px; line-height: 1; }
.placeholder-icon svg {
  width: 52px;
  height: 52px;
  color: var(--color-primary);
}
.reconcile-placeholder {
  min-height: 100%;
}
.placeholder-screen h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.6px;
  color: var(--color-text);
}
.placeholder-screen p {
  font-size: 15px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ─── History tab ────────────────────────────────────────────────── */
.history-header {
  flex-shrink: 0;
  padding: 12px 16px 0;
}
.history-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 6px 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
}
.history-nav-arrow {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.history-nav-arrow:active { background: var(--color-bg); color: var(--color-primary); }
.history-month-label {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.3px;
  text-align: center;
}
.history-summary {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 8px 16px 0;
  flex-shrink: 0;
}
.history-summary.summary-positive { color: var(--color-success); font-weight: 700; }
.history-summary.summary-negative { color: var(--color-danger); font-weight: 700; }

.scheduled-card {
  width: calc(100% - 32px);
  margin: 12px 16px 0;
  padding: 16px 18px;
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scheduled-card svg { color: var(--color-text-muted); flex-shrink: 0; }
.scheduled-card:active { background: var(--color-bg); }

.scheduled-list { padding-top: 4px; }
.scheduled-item,
.reconcile-item {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 12px 16px 0;
  padding: 16px;
}
.reconcile-card .reconcile-item {
  margin-left: 0;
  margin-right: 0;
  box-shadow: none;
}
.scheduled-item.paused { opacity: .62; }
.scheduled-item-main { min-width: 0; }
.scheduled-title-row,
.reconcile-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.scheduled-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.25;
}
.scheduled-meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.45;
}
.scheduled-type {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
}
.scheduled-type.income {
  color: var(--color-success);
  background: var(--color-success-bg);
}
.scheduled-type.expense {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}
.scheduled-amount {
  margin-top: 10px;
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}
.reconcile-item-top .scheduled-amount { margin-top: 0; }
.scheduled-amount.income { color: var(--color-success); }
.scheduled-amount.expense { color: var(--color-danger); }
.scheduled-actions,
.reconcile-actions,
.scheduled-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.reconcile-actions .btn-sm,
.scheduled-actions .btn-sm { flex: 1 1 auto; }
.reconcile-stack {
  padding-bottom: 64px;
}
.reconcile-segmented {
  margin: 12px 16px 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-surface-border);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}
.reconcile-segment {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reconcile-segment.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow);
}
.reconcile-view { display: none; }
.reconcile-view.active { display: block; }
.reconcile-card {
  padding: 18px 16px;
}
.reconcile-import-card {
  padding: 18px 16px;
}
.reconcile-import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.reconcile-import-sub {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-text-muted);
}
.reconcile-import-controls {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.reconcile-source-field {
  margin: 0;
}
.reconcile-source-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 700;
}
.reconcile-import-btn {
  margin-top: 0;
}
.reconcile-dropbox-btn {
  min-height: 42px;
  opacity: .64;
}
.reconcile-import-status {
  margin-top: 12px;
  min-height: 18px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.reconcile-import-status.error { color: var(--color-danger); font-weight: 700; }
.reconcile-import-status.success { color: var(--color-success); font-weight: 700; }
.reconcile-import-summary {
  margin: 14px 16px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.reconcile-summary-pill {
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}
.reconcile-summary-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: .04em;
}
.reconcile-summary-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 850;
  color: var(--color-text);
}
.reconcile-month-tiles {
  display: grid;
  gap: 10px;
  margin: 14px 16px 0;
}
.reconcile-month-tile,
.reconcile-review-card {
  width: 100%;
  border: 1px solid var(--color-surface-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
}
.reconcile-month-tile {
  padding: 14px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reconcile-month-tile:active {
  background: var(--color-bg);
}
.reconcile-tile-top,
.reconcile-card-top,
.reconcile-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.reconcile-tile-title,
.reconcile-card-title {
  font-size: 15px;
  font-weight: 850;
  color: var(--color-text);
  line-height: 1.25;
}
.reconcile-tile-source,
.reconcile-card-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.35;
}
.reconcile-status-badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.reconcile-status-badge.needs_review {
  background: var(--color-warning-bg, #FFF4D8);
  color: var(--color-warning, #8A5B00);
}
.reconcile-status-badge.complete {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.reconcile-tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.reconcile-tile-grid strong {
  color: var(--color-text);
}
.reconcile-month-workspace {
  margin: 14px 16px 0;
}
.reconcile-workspace-panel {
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow: hidden;
}
.reconcile-workspace-header {
  align-items: flex-start;
  flex-wrap: wrap;
}
.reconcile-workspace-title-wrap {
  min-width: 0;
  flex: 1 1 180px;
}
.reconcile-close-btn {
  flex: 0 0 auto;
  max-width: 100%;
  white-space: nowrap;
}
.reconcile-workspace-title {
  font-size: 18px;
  font-weight: 850;
  color: var(--color-text);
}
.reconcile-workspace-source {
  margin-top: 3px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.reconcile-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.reconcile-dashboard-metric {
  background: var(--color-bg);
  border-radius: 8px;
  padding: 10px;
}
.reconcile-dashboard-metric span {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
}
.reconcile-dashboard-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  color: var(--color-text);
}
.reconcile-section-title {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
}
.reconcile-review-list {
  display: grid;
  gap: 10px;
}
.reconcile-review-card {
  padding: 0;
  overflow: hidden;
}
.reconcile-review-header {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 22px;
  align-items: start;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reconcile-review-card.expanded .reconcile-review-header {
  border-bottom: 1px solid var(--color-surface-border);
}
.reconcile-card-title-wrap {
  min-width: 0;
}
.reconcile-card-summary {
  margin-top: 5px;
  font-size: 11px;
  color: var(--color-text-muted);
}
.reconcile-card-right {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.reconcile-chevron {
  color: var(--color-text-muted);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}
.reconcile-card-body {
  display: none;
  padding: 0 12px 12px;
}
.reconcile-review-card.expanded .reconcile-card-body {
  display: block;
}
.reconcile-card-amount {
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}
.reconcile-card-amount.inflow { color: var(--color-success); }
.reconcile-card-amount.outflow { color: var(--color-danger); }
.reconcile-mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.reconcile-mini-badge.recommended {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.reconcile-match-list {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}
.reconcile-match-chip {
  display: block;
  padding: 7px 8px;
  border-radius: 7px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.35;
}
.reconcile-decision-actions,
.reconcile-disabled-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.reconcile-decision-actions .btn-sm,
.reconcile-decision-actions .btn-save {
  flex: 1 1 auto;
  margin-top: 0;
}
.reconcile-decision-actions .recommended {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
  font-weight: 850;
}
.reconcile-detail-grid {
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.reconcile-detail-grid strong {
  color: var(--color-text);
}
.reconcile-match-detail-body {
  display: grid;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text);
}
.reconcile-match-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.reconcile-match-detail-actions .btn-sm,
.reconcile-match-detail-actions .btn-save {
  flex: 1;
  margin-top: 0;
}
.reconcile-disabled-actions .btn-sm {
  flex: 1 1 auto;
  opacity: .5;
}

/* ── Match chip tappable buttons ──────────────────────────────────────────── */
.reconcile-match-chip.tappable {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-surface-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reconcile-match-chip.tappable:active { opacity: .7; }
.reconcile-match-chip-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.reconcile-match-chip-subline {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.3;
}
.match-chip-level {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: var(--color-surface-border);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.match-chip-level.exact { background: #1A5C3822; color: #1A5C38; }
.match-chip-level.likely { background: #B4620022; color: #B46200; }
.match-chip-level.possible { background: var(--color-surface-border); color: var(--color-text-muted); }
.match-chip-chevron { margin-left: auto; flex-shrink: 0; color: var(--color-text-faint); }

/* ── Raw description fallback line ───────────────────────────────────────── */
.reconcile-card-raw {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-top: 1px;
}

/* ── Import reason / candidate in-app sheets ──────────────────────────────── */
.import-reason-sheet {
  padding: 20px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 80vh;
  overflow-y: auto;
}
.import-reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.import-reason-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--color-surface-border);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s;
}
.import-reason-chip.selected,
.import-reason-chip:active {
  border-color: var(--color-primary);
  background: var(--color-primary)18;
  color: var(--color-primary);
}
.import-reason-text {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1.5px solid var(--color-surface-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
  color: var(--color-text);
  box-sizing: border-box;
}
.import-reason-text:focus { outline: none; border-color: var(--color-primary); }
.import-reason-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.import-reason-actions .btn-sm,
.import-reason-actions .btn-save { flex: 1; margin-top: 0; }
.btn-sm-red {
  background: var(--color-danger);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.btn-sm-red:active { opacity: .8; }

/* ── Candidate selection list ─────────────────────────────────────────────── */
.import-candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-candidate-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--color-surface-border);
  background: var(--color-surface-raised);
  text-align: left;
  cursor: pointer;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.import-candidate-item:active { opacity: .7; }
.import-candidate-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.import-candidate-merchant {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.import-candidate-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ── Resolve sheet form fields ────────────────────────────────────────────── */
.import-resolve-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.import-resolve-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.import-resolve-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.import-resolve-field .form-select,
.import-resolve-field .form-input {
  width: 100%;
  font-size: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--color-surface-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
  color: var(--color-text);
  box-sizing: border-box;
}
.import-resolve-field .form-select:focus,
.import-resolve-field .form-input:focus { outline: none; border-color: var(--color-primary); }

.reconcile-empty {
  margin: 14px 16px 0;
  padding: 28px 18px;
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-surface-border);
  border-radius: 8px;
  background: var(--color-surface);
}
.dock-btn {
  position: relative;
}
.dock-alert-dot {
  position: absolute;
  top: 9px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger);
  box-shadow: 0 0 0 2px var(--color-surface);
}
.reconcile-secondary {
  min-height: 220px;
  padding-top: 24px;
  padding-bottom: 24px;
}
.reconcile-secondary .placeholder-icon {
  font-size: 36px;
  margin-bottom: 0;
}
.reconcile-secondary .placeholder-icon svg {
  width: 36px;
  height: 36px;
}
.reconcile-secondary h2 { font-size: 20px; }
.reconcile-secondary p { font-size: 13px; max-width: 280px; }
.scheduled-modal-body {
  padding: 0;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
}
.scheduled-modal-actions {
  margin-top: 18px;
}
.scheduled-modal-actions .btn-sm,
.scheduled-modal-actions .btn-save {
  flex: 1;
  margin-top: 0;
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
  padding: 20px;
  margin: 16px 16px 0;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

/* ─── Stats card ─────────────────────────────────────────────────── */
.stats-card {
  background: linear-gradient(135deg, #183C34 0%, #264F3F 100%);
  color: #F5EFE4;
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 12px 16px 0;
  box-shadow: 0 6px 24px rgba(24,60,52,.45);
}
.stats-label { font-size: 13px; font-weight: 500; opacity: .8; margin-bottom: 6px; }
.stats-amount {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 4px;
}
.stats-sub { font-size: 13px; opacity: .7; }

/* ─── Category bars ──────────────────────────────────────────────── */
.cat-bars { display: flex; flex-direction: column; gap: 10px; }
.cat-row { display: flex; align-items: center; gap: 10px; }
.cat-icon { width: 24px; flex-shrink: 0; }
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-size: 13px; font-weight: 500; color: var(--color-text); margin-bottom: 4px; display: flex; justify-content: space-between; }
.cat-name span { color: var(--color-text-muted); font-weight: 400; }
.cat-bar-track { height: 6px; background: var(--color-bg); border-radius: 3px; overflow: hidden; }
.cat-bar-fill  { height: 100%; border-radius: 3px; transition: width .5s ease; }

/* ─── Transaction list ───────────────────────────────────────────── */
.txn-list { display: flex; flex-direction: column; }
.txn-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background .12s;
  border-radius: var(--radius-sm);
}
.txn-item:last-child { border-bottom: none; }
.txn-item:active { background: var(--color-bg); }
.txn-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.txn-body { flex: 1; min-width: 0; }
.txn-cat  { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.txn-meta { font-size: 12px; color: var(--color-text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.txn-user-tag {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.txn-right { text-align: right; flex-shrink: 0; }
.txn-amount { font-size: 16px; font-weight: 700; color: var(--color-text); }
.txn-receipt-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-success); display: inline-block; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ─── Section header ─────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 12px;
  margin-top: 20px;
}
.section-header h3 { font-size: 16px; font-weight: 700; }
.section-header a  { font-size: 13px; color: var(--color-primary); font-weight: 500; cursor: pointer; text-decoration: none; }

/* ─── Login Screen ───────────────────────────────────────────────── */
#screen-login {
  background: var(--color-bg);
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 40px 24px;
}
.login-logo {
  text-align: center;
  margin-bottom: 40px;
}
.login-logo .logo-mark {
  width: 80px; height: 80px;
  border-radius: 24px;
  margin: 0 auto 16px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(24,60,52,.45);
  background: #183C34;
}
.login-logo .logo-mark img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
}
.login-logo h1 { font-size: 30px; font-weight: 800; color: var(--color-primary); letter-spacing: -.8px; }
.login-logo p  { font-size: 15px; color: var(--color-text-muted); margin-top: 4px; }

.user-select-label { font-size: 16px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 20px; text-align: center; }
.user-select-btns  { display: flex; flex-wrap: wrap; gap: 16px; width: 100%; max-width: 320px; justify-content: center; }
.btn-add-profile {
  margin-top: 20px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  -webkit-tap-highlight-color: transparent;
}
.btn-add-profile:active { opacity: .7; }
.user-btn {
  flex: 1;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.user-btn:active { transform: scale(.96); }
.user-btn.selected { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.user-btn .u-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-size: 22px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.user-btn span { font-size: 14px; font-weight: 600; color: var(--color-text); }

/* PIN entry */
.pin-section {
  width: 100%;
  max-width: 320px;
  margin-top: 32px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.pin-section.visible { display: flex; }
.pin-label { font-size: 15px; color: var(--color-text-muted); margin-bottom: 20px; }

.pin-dots {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  transition: background .15s, border-color .15s;
}
.pin-dot.filled { background: var(--color-primary); border-color: var(--color-primary); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}
.pin-key {
  height: 64px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.pin-key:active { transform: scale(.93); background: var(--color-bg); }
.pin-key.delete { font-size: 18px; color: var(--color-text-muted); }
.pin-key.submit {
  background: #183C34;
  color: #F5EFE4;
  border-color: #183C34;
  font-size: 16px;
  font-weight: 700;
}
.pin-key.submit:active { background: #102B25; }
.pin-key.spacer { border: none; background: none; cursor: default; }

/* iOS safe area for login */
#screen-login { padding-top: calc(var(--safe-top) + 40px); }

/* ─── Add Transaction / Form screens ────────────────────────────── */
.btn-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.btn-close:active { background: var(--color-border); }

.form-body { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }

/* Simple-mode fields need their own gap so category suggestion chips don't overlap */
#exp-simple-section { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-input-bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.field.amount-field input {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.5px;
}

.receipt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  width: 100%;
  text-align: left;
}
.receipt-btn:hover, .receipt-btn:focus { border-color: var(--color-primary); background: var(--color-primary-soft); }
.receipt-btn.has-receipt { border-color: var(--color-success); background: var(--color-primary-soft); border-style: solid; }
.receipt-btn .receipt-icon { font-size: 24px; flex-shrink: 0; }
.receipt-btn .receipt-text { display: flex; flex-direction: column; gap: 2px; }
.receipt-btn .receipt-text strong { font-size: 14px; font-weight: 600; color: var(--color-text); }
.receipt-btn .receipt-text span { font-size: 12px; color: var(--color-text-muted); }
.receipt-preview-wrap { position: relative; }
.receipt-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-success);
  display: none;
}
.receipt-preview.visible { display: block; }
.btn-remove-receipt {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ─── Receipt action buttons (split: Choose from Photos / Camera) ── */
.receipt-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.receipt-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  width: 100%;
  font-family: inherit;
}
.receipt-action-btn:hover,
.receipt-action-btn:focus { border-color: var(--color-primary); background: var(--color-primary-soft); }
.receipt-action-btn:active { opacity: .85; }
.receipt-action-icon { display: flex; align-items: center; justify-content: center; }
.receipt-action-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.btn-save {
  background: #183C34;
  color: #F5EFE4;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  width: 100%;
  margin-top: 8px;
}
.btn-save:active { background: #102B25; transform: scale(.98); }
.btn-save:disabled { background: var(--color-text-faint); cursor: not-allowed; }

.btn-save-expense {
  background: #C0392B;
}
.btn-save-expense:active { background: #a52d21; }

.btn-save-income {
  background: #1A7A4D;
}
.btn-save-income:active { background: #136038; }

/* ─── Form header variants ───────────────────────────────────────── */
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 20px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.form-header h2 { font-size: 18px; font-weight: 700; flex: 1; text-align: center; }

.form-header-expense { border-bottom-color: #C0392B44; }
.form-header-income  { border-bottom-color: #1A7A4D44; }

/* ─── Two-column form row ────────────────────────────────────────── */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ─── Label optional hint ────────────────────────────────────────── */
.label-optional { font-weight: 400; text-transform: none; font-size: 11px; }

/* ─── Entry mode toggle ──────────────────────────────────────────── */
.entry-mode-toggle {
  display: flex;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1.5px solid var(--color-border);
  gap: 3px;
}
.entry-mode-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.entry-mode-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ─── Income banner ──────────────────────────────────────────────── */
.income-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1A7A4D18;
  border: 1.5px solid #1A7A4D44;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #1A7A4D;
}
[data-theme="dark"] .income-banner { color: #22A366; background: #22A36618; border-color: #22A36644; }
.income-banner-icon { font-size: 18px; font-weight: 800; }

.expense-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #C0392B18;
  border: 1.5px solid #C0392B44;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #C0392B;
}
[data-theme="dark"] .expense-banner { color: #E05348; background: #E0534818; border-color: #E0534844; }
.expense-banner-icon { font-size: 18px; font-weight: 800; }

/* ─── Split receipt lines ────────────────────────────────────────── */
.btn-add-split-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  justify-content: center;
  font-family: inherit;
  transition: background .12s, border-color .12s;
  -webkit-tap-highlight-color: transparent;
  margin-top: 4px;
}
.btn-add-split-line:active { background: var(--color-primary-soft); }

.split-line {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-surface-border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.split-line-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.split-line-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
}
.split-line-remove {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.split-line-remove:active { background: var(--color-danger-bg); color: var(--color-danger); }

.split-line-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ─── Reconciliation footer ──────────────────────────────────────── */
.recon-footer {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-surface-border);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recon-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--color-text-muted);
}
.recon-divider {
  height: 1px;
  background: var(--color-border);
  margin: 2px 0;
}
.recon-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-muted);
  transition: color .2s;
}
.recon-status-row.balanced { color: var(--color-success); }
.recon-status-row.warning  { color: var(--color-warning); }
.recon-status-row.danger   { color: var(--color-danger); }

/* ─── Transaction list additions ─────────────────────────────────── */
.txn-amount.inflow { color: var(--color-success); }

.txn-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.txn-type-badge.inflow {
  background: #1A7A4D18;
  color: var(--color-success);
}
.txn-merchant {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 6px;
}

/* ─── Categories screen ──────────────────────────────────────────── */
.cat-search-wrap {
  padding: 12px 16px 8px;
  background: var(--color-bg);
  flex-shrink: 0;
}
.cat-search-wrap input {
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.cat-search-wrap input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.cat-page-section { margin: 20px 0 0; }
.cat-page-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-faint);
  margin-bottom: 8px;
  padding: 0 20px;
}

/* ─── Settings ───────────────────────────────────────────────────── */
.settings-section { margin: 20px 16px 0; }
.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-faint);
  margin-bottom: 8px;
  padding: 0 4px;
}
.settings-group {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-left { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.settings-row-label { font-size: 15px; font-weight: 500; color: var(--color-text); }
.settings-row-sub   { font-size: 12px; color: var(--color-text-muted); }
.settings-row-action { flex-shrink: 0; }
.settings-nav-row { cursor: pointer; }
.settings-nav-row:active { background: var(--color-bg); }
.settings-chevron {
  color: var(--color-text-faint);
  font-size: 24px;
  line-height: 1;
  font-weight: 300;
}

.settings-user-profile { gap: 10px; }
.settings-user-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.settings-user-colours {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 48px;
}
.settings-colour-dot {
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  cursor: pointer;
}
.settings-colour-dot.selected {
  border-color: var(--color-text);
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-border);
}

.s-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--color-primary-text);
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.4px;
}

.user-you-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.btn-sm {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
  transition: background .12s;
  font-family: inherit;
}
.btn-sm:active { background: var(--color-bg); }
.btn-sm.blue { background: #183C34; color: #F5EFE4; border-color: #183C34; }
.btn-sm.blue:active { background: #102B25; }
.btn-sm.red  { background: var(--color-danger-bg); color: var(--color-danger); border-color: var(--color-danger-border); }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
}
.status-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-text-faint);
}
.status-dot.connected::before { background: var(--color-success); }
.status-dot.error::before { background: var(--color-danger); }

/* ─── Appearance Selector ────────────────────────────────────────── */
.appearance-selector-row { padding: 4px 16px 16px; }
.appearance-selector {
  display: flex;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--color-border);
  gap: 2px;
}
.appearance-opt {
  flex: 1;
  padding: 9px 4px;
  border: none;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  font-family: inherit;
}
.appearance-opt.selected {
  background: var(--color-surface-raised);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* ─── Toast ──────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: calc(var(--dock-height) + var(--dock-gap) + var(--safe-bottom) + var(--fab-height) + var(--fab-dock-gap) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: var(--color-bg);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 999;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--color-success); color: var(--color-surface); }
#toast.error   { background: var(--color-danger); color: var(--color-surface); }

/* ─── Loading overlay ────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#loading.show { opacity: 1; pointer-events: all; }
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modals ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--color-surface-raised);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 24px calc(24px + var(--safe-bottom));
  width: 100%;
  max-width: 440px;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
}
.modal-overlay.show .modal-sheet { transform: none; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }

/* ─── Sync badge ─────────────────────────────────────────────────── */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.sync-badge.synced { background: var(--color-primary-soft); color: var(--color-primary); }

/* ─── Misc ───────────────────────────────────────────────────────── */
input[type="file"] { display: none; }
.card .empty-state { padding: 20px 0 4px; }

/* ─── Mortgage Tab ───────────────────────────────────────────────── */

.mort-hero {
  background: linear-gradient(135deg, #183C34 0%, #264F3F 100%);
  color: #F5EFE4;
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 12px 16px 0;
  box-shadow: 0 6px 24px rgba(24,60,52,.45);
}
.mort-hero-label { font-size: 13px; font-weight: 500; opacity: .75; margin-bottom: 8px; }
.mort-hero-balance {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 5px;
}
.mort-hero-sub { font-size: 13px; opacity: .65; }

.mort-metrics-row {
  display: flex;
  gap: 10px;
  margin: 10px 16px 0;
}
.mort-metric {
  flex: 1;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
  min-width: 0;
}
.mort-metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  margin-bottom: 5px;
}
.mort-metric-value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--color-text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mort-metric-sub { font-size: 11px; color: var(--color-text-faint); }

.mort-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mort-payment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.mort-payment-row:last-child { border-bottom: none; }
.mort-payment-date  { font-size: 13px; font-weight: 600; color: var(--color-text); flex: 1; }
.mort-payment-breakdown { display: flex; flex-direction: column; gap: 1px; align-items: flex-end; }
.mort-payment-principal { font-size: 11px; color: var(--color-success); font-weight: 600; }
.mort-payment-interest  { font-size: 11px; color: var(--color-text-muted); }
.mort-payment-total { font-size: 15px; font-weight: 700; color: var(--color-text); min-width: 64px; text-align: right; }

.mort-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  justify-content: center;
}
.mort-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.mort-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mort-legend-dot.green { background: #183C34; }
.mort-legend-dot.gold  { background: #B08D57; }

.mort-savings-banner {
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mort-savings-label { font-size: 13px; font-weight: 600; color: var(--color-primary); }
.mort-savings-value { font-size: 20px; font-weight: 800; color: var(--color-success); letter-spacing: -.5px; }

.mort-schedule-header {
  display: grid;
  grid-template-columns: 28px 72px 1fr 1fr 1fr;
  gap: 6px;
  padding: 4px 2px 8px;
  border-bottom: 1.5px solid var(--color-border);
}
.mort-schedule-header span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-faint);
}
.mort-schedule-header .right,
.mort-sched-principal, .mort-sched-interest, .mort-sched-balance { text-align: right; }

.mort-schedule-row {
  display: grid;
  grid-template-columns: 28px 72px 1fr 1fr 1fr;
  gap: 6px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--color-border);
  align-items: center;
  font-size: 12px;
}
.mort-schedule-row:last-child { border-bottom: none; }
.mort-schedule-row.completed { opacity: .45; }
.mort-sched-num  { color: var(--color-text-faint); font-size: 10px; font-weight: 600; }
.mort-sched-date { color: var(--color-text); font-weight: 500; font-size: 11px; }
.mort-sched-principal { color: var(--color-success); font-weight: 600; }
.mort-sched-interest  { color: var(--color-text-muted); }
.mort-sched-balance   { color: var(--color-text); font-weight: 600; }

.mort-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}
.mort-detail { display: flex; flex-direction: column; gap: 3px; }
.mort-detail span   { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-faint); }
.mort-detail strong { font-size: 14px; font-weight: 700; color: var(--color-text); }

.mort-renewal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  gap: 12px;
}
.mort-renewal-row:last-child { border-bottom: none; }
.mort-renewal-row span   { color: var(--color-text-muted); }
.mort-renewal-row strong { font-weight: 700; color: var(--color-text); text-align: right; }

/* ─── Screen Header (Forecast / Schedule) ────────────────────────── */

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
  padding-top: calc(14px + var(--safe-top));
  background: var(--color-bg);
  flex-shrink: 0;
}
.screen-header h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  flex: 1;
}
.screen-header-spacer { width: 36px; flex-shrink: 0; }

/* ─── Mortgage Hero top row (label + chevron) ────────────────────── */

.mort-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.mort-hero-label { font-size: 13px; font-weight: 500; opacity: .75; margin-bottom: 0; }

/* Mortgage tappable cards */
.mort-tap-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, box-shadow .12s;
}
.mort-tap-card:active { transform: scale(.985); box-shadow: var(--shadow); }
.mort-hero.mort-tap-card:active { opacity: .88; transform: none; }

/* Mortgage chevron navigation indicators */
.mort-nav-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-faint);
  width: 20px;
  height: 20px;
}
.mort-hero-nav-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(245, 239, 228, 0.5);
  width: 20px;
  height: 20px;
}

/* ─── Term & Renewal metric rows ─────────────────────────────────── */

.mort-renewal-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  gap: 12px;
}
.mort-renewal-metric-row span   { color: var(--color-text-muted); }
.mort-renewal-metric-row strong { font-weight: 700; color: var(--color-text); text-align: right; }

/* ─── Forecast screen detail list ────────────────────────────────── */

.mort-detail-list { margin: 0; }
.mort-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  gap: 12px;
}
.mort-detail-row:last-child { border-bottom: none; }
.mort-detail-row span   { color: var(--color-text-muted); flex: 1; }
.mort-detail-row strong { font-weight: 700; color: var(--color-text); text-align: right; }

/* ─── Schedule screen items (two-line) ───────────────────────────── */

.mort-sched-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
}
.mort-sched-item:last-child { border-bottom: none; }
.mort-sched-item.completed { opacity: .4; }
.mort-sched-item.next-due {
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  margin: 0 -8px;
}
.mort-sched-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-faint);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}
.mort-sched-item-main { flex: 1; min-width: 0; }
.mort-sched-item-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}
.mort-sched-date  { font-size: 13px; font-weight: 600; color: var(--color-text); }
.mort-sep         { font-size: 11px; color: var(--color-text-faint); }
.mort-sched-total { font-size: 13px; font-weight: 700; color: var(--color-text); }
.mort-sched-item-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  display: flex;
  gap: 8px;
}
.mort-sched-item-sub .principal { color: var(--color-success); font-weight: 600; }
.mort-sched-balance-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
  text-align: right;
  min-width: 72px;
}

/* ─── Renewal modal ──────────────────────────────────────────────── */

.mort-modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mort-renewal-hint {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 14px;
  line-height: 1.5;
}
.mort-scenario-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-accent);
}
.mort-scenario-divider::before,
.mort-scenario-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-accent);
  opacity: .35;
}

/* ─── Colour Picker ──────────────────────────────────────────────── */
.colour-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.colour-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.colour-dot:active { transform: scale(.9); }
.colour-dot.selected {
  border-color: var(--color-text);
  transform: scale(1.1);
}
.settings-user-colours .settings-colour-dot {
  appearance: none;
  width: 22px;
  height: 22px;
  border-width: 2px;
  padding: 0;
}
.settings-user-colours .settings-colour-dot.selected {
  transform: none;
  border-color: var(--color-text);
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-border);
}

/* ─── Onboarding Screen ──────────────────────────────────────────── */
#screen-onboarding {
  background: var(--color-bg);
  justify-content: flex-start;
  align-items: center;
  padding: calc(var(--safe-top) + 48px) 20px 40px;
  overflow-y: auto;
}
.onboarding-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Join Household Screen ──────────────────────────────────────── */
#screen-join-household {
  background: var(--color-bg);
}
#screen-join-household .scroll-area {
  padding: 0 16px;
}

/* ═══════════════════════════════════════════════════════════════════
   PLAN TAB
   ═══════════════════════════════════════════════════════════════════ */

/* Plan tab: natural scrolling — let .tab-pane overflow-y:auto handle scroll */

/* Month selector strip */
.plan-month-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 8px;
  background: var(--color-surface);
  border-radius: var(--radius);
  margin: 12px 16px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
}

.plan-nav-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 26px;
  font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.plan-nav-btn:active { background: var(--color-bg); color: var(--color-primary); }

.plan-month-label {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.3px;
  text-align: center;
}

/* ─── Plan: Apple Wallet-style card deck ─────────────────────── */
.plan-stack {
  width: 100%;
  padding: 0;
}

/* Cash flow summary strip */
.plan-summary-strip {
  overflow: hidden;
  max-height: 260px;
  opacity: 1;
  transition: max-height .4s ease, opacity .3s ease;
}
.plan-summary-strip.plan-summary-forecast {
  max-height: 330px;
}
.plan-summary-strip.plan-summary-hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Wallet deck container */
.plan-deck {
  margin: 8px 16px 0;
}

/* Individual wallet card */
.plan-deck-card {
  border-radius: var(--radius);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 18px rgba(0,0,0,.28);
}

/* Constant gap between cards — no overlap */
.plan-deck-card + .plan-deck-card {
  margin-top: 10px;
}

/* Hide inactive cards while any card is open */
.plan-deck.plan-deck-active .plan-deck-card:not(.active) {
  display: none;
}

/* Card compact face */
.plan-deck-face {
  height: 84px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #F5EFE4;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Circular icon badge */
.plan-deck-icon-badge {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.plan-deck-icon-badge svg {
  width: 22px;
  height: 22px;
  stroke: rgba(255,255,255,0.88);
  stroke-width: 1.8;
}

.plan-deck-label {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .9;
  min-width: 0;
}
.plan-deck-amount {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.8px;
  line-height: 1;
  flex-shrink: 0;
}

/* Full card content — expands below the face when card is active */
.plan-deck-full {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .45s cubic-bezier(0.4, 0, 0.2, 1), opacity .3s ease;
}
.plan-deck-card.active .plan-deck-full {
  max-height: 5000px;
  opacity: 1;
}
.plan-cat-list-wrap {
  background: var(--color-surface);
  padding: 0 16px 8px;
}

/* Budget summary row inside expanded card */
.plan-expanded-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px 8px;
  background: var(--color-surface);
  flex-wrap: wrap;
}
.plan-expanded-budget-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.plan-expanded-diff-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}
.plan-expanded-bar-track {
  height: 4px;
  background: var(--color-bg);
}
.plan-expanded-bar-track .plan-section-bar-fill {
  background: var(--color-primary);
  opacity: .55;
}

/* ── Section summary hero card ─────────────────────────────────── */
.plan-section-summary {
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin: 10px 0 0;
  color: #F5EFE4;
}

.plan-section-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .75;
  margin-bottom: 8px;
}

.plan-section-actual {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1;
  margin-bottom: 10px;
}

.plan-section-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.plan-section-budget-label {
  font-size: 13px;
  opacity: .75;
}

.plan-section-diff {
  font-size: 13px;
  font-weight: 600;
  opacity: .92;
}

.plan-section-bar-track {
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  overflow: hidden;
}

.plan-section-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: rgba(255,255,255,.65);
  transition: width .5s ease;
  max-width: 100%;
}

/* ── Category rows inside plan card ───────────────────────────── */
.plan-cat-list {
  margin-top: 2px;
}

.plan-cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
}
.plan-cat-row:last-child { border-bottom: none; }

.plan-cat-icon {
  width: 44px;
  flex-shrink: 0;
}

.plan-cat-body {
  flex: 1;
  min-width: 0;
}

.plan-cat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-cat-amounts {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.plan-cat-actual-amt {
  font-weight: 600;
  color: var(--color-text);
}

.plan-cat-no-budget {
  font-size: 11px;
  color: var(--color-text-faint);
  font-style: italic;
}

.plan-cat-bar-track {
  height: 3px;
  background: var(--color-bg);
  border-radius: 2px;
  overflow: hidden;
}

.plan-cat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease;
}

.plan-bar-positive { background: var(--color-success); }
.plan-bar-amber    { background: var(--color-warning); }
.plan-bar-danger   { background: var(--color-danger); }

.plan-cat-right {
  text-align: right;
  flex-shrink: 0;
  min-width: 68px;
}

.plan-cat-diff {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.2px;
}
.plan-cat-diff.positive { color: var(--color-success); }
.plan-cat-diff.amber    { color: var(--color-warning); }
.plan-cat-diff.danger   { color: var(--color-danger); }
.plan-cat-diff.neutral  { color: var(--color-text-muted); }

/* ─── Budget Coach plan card ──────────────────────────────────────── */

/* Neutral face — overrides the gradient set by section cards */
.plan-coach-face {
  background: var(--color-surface) !important;
  border-bottom: 1px solid var(--color-surface-border);
  height: 84px; /* matches .plan-deck-face */
}

/* Icon badge: green tint matching Budget Coach brand */
.plan-coach-icon-badge {
  background: var(--color-primary-soft, rgba(31,122,77,.12)) !important;
}
.plan-coach-icon-badge svg {
  stroke: var(--color-primary) !important;
  opacity: 1 !important;
}

/* Text block beside the icon */
.plan-coach-face-body {
  flex: 1;
  min-width: 0;
}
.plan-coach-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-primary);
  opacity: .9;
}
.plan-coach-summary {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-coach-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inner content of the expanded Budget Coach card */
.plan-coach-body {
  padding: 16px 16px 20px;
}
.plan-coach-content-inner {
  /* matches .budget-rec-scroll layout without fixed outer padding */
}
.plan-coach-window {
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   CATEGORIES SCREEN ENHANCEMENTS
   ═══════════════════════════════════════════════════════════════════ */

.cat-options-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 16px 6px;
  flex-shrink: 0;
}

.cat-archived-btn {
  font-size: 12px;
  padding: 5px 12px;
  color: var(--color-text-muted);
}

/* Collapsible section header */
.cat-page-section {
  margin-top: 14px;
}

.cat-page-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.cat-page-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Override existing .cat-page-section-title when inside the header */
.cat-page-section-header .cat-page-section-title {
  padding: 0;
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--color-text);
}

.cat-page-section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-faint);
  background: var(--color-bg);
  border-radius: 10px;
  padding: 1px 7px;
}

.cat-page-section-chevron {
  color: var(--color-text-faint);
  transition: transform .2s ease;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cat-section-body.collapsed {
  display: none;
}

/* Category row with budget info */
.cat-edit-row {
  cursor: pointer;
  transition: background .12s;
}
.cat-edit-row:active { background: var(--color-bg); }

.cat-hidden-row .settings-row-action {
  display: flex;
  align-items: center;
}

.cat-unhide-btn,
.cat-hidden-action {
  white-space: nowrap;
}

.cat-edit-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  margin-top: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius);
}

.cat-edit-action-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.cat-edit-action-sub {
  font-size: 12px;
  color: var(--color-text-faint);
  margin-top: 2px;
}

/* ─── Vendors page ───────────────────────────────────────────────── */
.vnd-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}
.vnd-tag.archived { color: var(--color-text-faint); background: var(--color-bg-alt); }
.vnd-tag.manual   { color: var(--color-primary);    background: var(--color-primary-soft); }

.vnd-alias-line {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════════
   CATEGORY EDIT MODAL
   ═══════════════════════════════════════════════════════════════════ */

/* Identity header inside modal */
.cat-edit-identity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
  gap: 12px;
}

.cat-edit-identity-text { flex: 1; min-width: 0; }

.cat-edit-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 3px;
}

.cat-edit-section-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.cat-edit-emoji-display {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
}

/* Toggle rows */
.cat-edit-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}

.cat-edit-toggle-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
}

/* iOS-style toggle switch */
.toggle-switch {
  display: inline-block;
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toggle-switch input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 13px;
  transition: background .22s;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--color-primary);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: transform .22s;
  pointer-events: none;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

/* Live-calc preview pair */
.cat-edit-calc-row-pair {
  display: flex;
  gap: 8px;
}

.cat-edit-calc-block {
  flex: 1;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-edit-calc-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
}

.cat-edit-calc-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.3px;
}

.cat-edit-recommendation-note {
  margin: 14px 0 0;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
}

.budget-history-section {
  margin-top: 22px;
}
.budget-history-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-faint);
  margin-bottom: 8px;
  padding: 0 4px;
}
.budget-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.budget-history-row {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow: var(--shadow);
}
.budget-history-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.budget-history-date {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text);
}
.budget-history-meta,
.budget-history-note {
  margin-top: 3px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.budget-history-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.budget-history-actions .btn-sm,
.budget-history-actions .btn-save {
  flex: 1;
  margin-top: 0;
}
.budget-history-edit-fields {
  display: none;
  gap: 10px;
  margin-top: 12px;
}
.budget-history-row.editing .budget-history-edit-fields {
  display: grid;
}
.budget-history-row.editing .budget-history-summary {
  display: none;
}
.budget-history-edit-fields .field {
  margin: 0;
}

.budget-rec-scroll {
  padding: 16px 16px 40px;
}
.budget-rec-window {
  padding: 4px;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-surface-border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.budget-rec-window-btn {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.budget-rec-window-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow);
}
.budget-rec-explainer {
  margin: 12px 2px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-muted);
}
.budget-rec-months {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.budget-rec-month-block {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.budget-rec-month-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-faint);
  margin-bottom: 4px;
}
.budget-rec-month-value {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.35;
}
.budget-rec-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.budget-rec-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.budget-rec-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.budget-rec-category {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text);
}
.budget-rec-type {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.budget-rec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.budget-rec-metric {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.budget-rec-metric span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
}
.budget-rec-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  color: var(--color-text);
}
.budget-rec-reason {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.budget-rec-card .btn-save {
  margin-top: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   TRANSACTION DETAIL MODAL
   ═══════════════════════════════════════════════════════════════════ */

.txn-detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.txn-detail-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.txn-detail-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(100dvh - 52px);
  background: var(--color-surface);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -6px 40px rgba(0,0,0,.22);
}
[data-theme="dark"] .txn-detail-sheet {
  box-shadow: 0 -6px 40px rgba(0,0,0,.55);
}
.txn-detail-overlay.show .txn-detail-sheet {
  transform: translateY(0);
}

/* Drag handle */
.txn-detail-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
  margin: 10px auto 0;
  flex-shrink: 0;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

/* Header */
.txn-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.txn-detail-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.txn-detail-close:active { background: var(--color-border); }

.txn-detail-title-wrap {
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.txn-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-detail-subline {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 3px;
  text-align: center;
  line-height: 1.5;
}

.txn-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.txn-detail-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.txn-detail-action-btn:active { background: var(--color-border); }

.txn-detail-action-btn-delete {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.txn-detail-action-btn-delete:active {
  background: var(--color-danger-border);
}

/* Subline inline elements */
.txn-detail-user-badge {
  display: inline-block;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .3px;
  vertical-align: middle;
}

.txn-detail-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}

.txn-detail-sync-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.txn-detail-sync-dot.synced  { background: var(--color-success); }
.txn-detail-sync-dot.pending { background: var(--color-warning); }

/* Scrollable body */
.txn-detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px;
}

/* ── Amount Hero ───────────────────────────────────────────────── */
.txn-detail-hero {
  padding: 28px 8px 20px;
  text-align: center;
}

.txn-detail-amount {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 10px;
}
.txn-detail-amount.expense { color: var(--color-danger); }
.txn-detail-amount.inflow  { color: var(--color-success); }

.txn-detail-hero-merchant {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

/* ── Delete confirm z-index fix ─────────────────────────────────── */
#modal-txn-delete-confirm { z-index: 700; }

/* ── Receipt re-link appears above transaction detail (z:600) and edit (z:650) */
#modal-receipt-relink { z-index: 750; }

/* ── Transaction Edit Sheet ─────────────────────────────────────── */
.txn-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 15, 0.3);
  z-index: 650;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.txn-edit-overlay.show { opacity: 1; pointer-events: all; }

.txn-edit-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(100dvh - 52px);
  background: var(--color-surface);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.txn-edit-overlay.show .txn-edit-sheet { transform: translateY(0); }

.txn-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.txn-edit-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.2px;
}
.txn-edit-cancel-btn {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  min-width: 56px;
  -webkit-tap-highlight-color: transparent;
}
.txn-edit-cancel-btn:active { opacity: .6; }
.txn-edit-save-btn {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  min-width: 56px;
  text-align: right;
  -webkit-tap-highlight-color: transparent;
}
.txn-edit-save-btn:active { opacity: .6; }
.txn-edit-save-btn:disabled { color: var(--color-text-faint); cursor: not-allowed; }

.txn-edit-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.txn-edit-section-note {
  font-size: 13px;
  color: var(--color-text-faint);
  margin: 0 0 4px;
  line-height: 1.5;
}

.txn-detail-hero-method {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Section Cards ─────────────────────────────────────────────── */
.txn-detail-card {
  background: var(--color-surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--color-surface-border);
  padding: 16px 16px 4px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.txn-detail-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-faint);
  margin-bottom: 10px;
}

/* ── Receipt Section ───────────────────────────────────────────── */
.txn-receipt-relink-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.txn-receipt-relink-btn:active { background: var(--color-primary-soft); border-color: var(--color-primary); }

/* ─── Receipt re-link picker ─────────────────────────────────────── */
.receipt-relink-options { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.receipt-relink-option-btn { width: 100%; text-align: center; padding: 12px 14px; }
.receipt-relink-cancel-btn { width: 100%; margin-top: 14px; color: var(--color-text-muted); }
.receipt-relink-list-title { font-size: 12px; font-weight: 600; color: var(--color-text-muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.relink-dropbox-files { max-height: 220px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.relink-dropbox-file-item { padding: 11px 14px; font-size: 13px; color: var(--color-text); cursor: pointer; border-bottom: 1px solid var(--color-border); }
.relink-dropbox-file-item:last-child { border-bottom: none; }
.relink-dropbox-file-item:active { background: var(--color-primary-soft); }
.relink-dropbox-loading { padding: 14px; font-size: 13px; color: var(--color-text-muted); text-align: center; }
.relink-dropbox-error { padding: 12px 14px; font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }

.txn-receipt-tap {
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.txn-receipt-tap:active { opacity: .75; }

.txn-receipt-tap.txn-receipt-unavail {
  opacity: .55;
  cursor: default;
}
.txn-receipt-tap.txn-receipt-unavail:active { opacity: .55; }

/* Shared placeholder — used for "Tap to Load", "No receipt attached",
   "Hidden in privacy mode", and transient loading states */
.txn-receipt-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.txn-receipt-placeholder-label {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-faint);
  letter-spacing: -.2px;
  text-align: center;
}

.txn-receipt-img {
  width: 100%;
  border-radius: var(--radius-sm);
  display: none;
  max-height: 70vh;
  object-fit: contain;
}

/* ── Info Rows (Details) ───────────────────────────────────────── */
.txn-detail-info-rows { display: flex; flex-direction: column; }

.txn-detail-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  min-height: 40px;
}
.txn-detail-info-row:last-child { border-bottom: none; }

.txn-detail-info-label {
  font-size: 13px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.txn-detail-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  text-align: right;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Transaction ID row — wraps and is de-emphasised */
.txn-detail-info-row-id { align-items: flex-start; }
.txn-detail-info-row-id .txn-detail-info-value {
  font-size: 10px;
  font-weight: 400;
  color: var(--color-text-faint);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  letter-spacing: .3px;
  white-space: normal;
  word-break: break-all;
  line-height: 1.5;
  overflow: visible;
}

/* ── Split Receipt Section ─────────────────────────────────────── */
.txn-detail-split-lines {
  margin-bottom: 2px;
}

.txn-detail-split-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  gap: 12px;
}
.txn-detail-split-row:last-child { border-bottom: none; }

.txn-detail-split-cat {
  color: var(--color-text);
  flex: 1;
}

.txn-detail-split-amt {
  font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}

.txn-detail-split-footer {
  padding: 8px 0 10px;
  border-top: 1px solid var(--color-border);
  margin-top: 2px;
}

.txn-detail-split-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text-muted);
  padding: 3px 0;
}

.txn-detail-split-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: 20px;
}
.txn-detail-split-status.balanced {
  background: var(--color-primary-soft);
  color: var(--color-success);
}
.txn-detail-split-status.mismatch {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ── Notes Section ─────────────────────────────────────────────── */
.txn-detail-notes {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.55;
  padding-bottom: 12px;
}

/* ── Delete Confirmation Sheet ─────────────────────────────────── */
.txn-delete-confirm-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-danger);
  margin-bottom: 10px;
}

.txn-delete-confirm-body {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* ─── Home: tappable month button ───────────────────────────────── */
.dash-month-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 8px 4px 0;
  border-radius: 8px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.dash-month-btn:active { opacity: .7; }
.dash-month-btn svg { opacity: .65; flex-shrink: 0; }

/* ─── Cash Flow hero card ────────────────────────────────────────── */
.cash-flow-card {
  background: linear-gradient(135deg, #183C34 0%, #264F3F 100%);
  color: #F5EFE4;
  border-radius: var(--radius);
  padding: 24px 18px 20px;
  margin: 12px 16px 0;
  box-shadow: 0 6px 24px rgba(24,60,52,.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 110px;
  max-height: 112px;
  position: relative;
  overflow: hidden;
  transition: max-height .32s ease, padding .32s ease;
}
.cash-flow-card.cashflow-card-expanded {
  max-height: 260px;
  padding-bottom: 18px;
}

/* Subtle wave background art */
.cf-wave-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65%;
  pointer-events: none;
}

/* Text group (label + amount) */
.cf-text-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  text-align: center;
}

.cf-label {
  font-size: 13px;
  font-weight: 500;
  opacity: .75;
  margin-bottom: 6px;
}
.cf-amount {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
}
.cf-positive { color: #7EE8A2; }
.cf-negative { color: #FFB4AB; }

.cf-amount-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
}

.cf-privacy-btn,
.cf-forecast-btn {
  border: none;
  background: rgba(255,255,255,.12);
  color: rgba(245,239,228,.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.cf-privacy-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 32px;
}
.cf-privacy-btn svg {
  width: 18px;
  height: 18px;
}
.cf-forecast-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 12px;
}
.cf-forecast-btn svg {
  width: 18px;
  height: 18px;
}
.cf-forecast-btn.active,
.cf-privacy-btn:active,
.cf-forecast-btn:active {
  background: rgba(255,255,255,.2);
  color: #F5EFE4;
}
.cf-forecast-btn:active,
.cf-privacy-btn:active {
  transform: scale(.96);
}

.cf-forecast-panel {
  width: 100%;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  overflow: hidden;
  position: relative;
  z-index: 2;
  transition: max-height .28s ease, opacity .24s ease, transform .24s ease, margin-top .28s ease;
}
.cashflow-card-expanded .cf-forecast-panel {
  max-height: 128px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 18px;
}
.cf-forecast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.cf-forecast-metric,
.cf-forecast-difference {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 9px 10px;
  text-align: center;
}
.cf-forecast-difference {
  grid-column: 1 / -1;
  padding: 10px;
}
.cf-forecast-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(245,239,228,.62);
  margin-bottom: 4px;
}
.cf-forecast-value,
.cf-forecast-diff-value {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
}
.cf-forecast-value.positive,
.cf-forecast-diff-value.positive { color: #7EE8A2; }
.cf-forecast-value.negative,
.cf-forecast-diff-value.negative { color: #FFB4AB; }
.cf-forecast-diff-value.neutral { color: rgba(245,239,228,.78); }

/* ─── Cash In / Cash Out mini cards ─────────────────────────────── */
.mini-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 16px 0;
  max-height: 90px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height .28s ease, opacity .2s ease, transform .24s ease, margin .28s ease;
}
.mini-cards-row.cashflow-mini-hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  margin-top: 0;
  pointer-events: none;
}
.mini-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Icon badge inside mini card */
.mini-card-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mini-card-in  .mini-card-icon-badge { background: rgba(31,122,77,.12); }
.mini-card-out .mini-card-icon-badge { background: rgba(179,38,30,.10); }
[data-theme="dark"] .mini-card-in  .mini-card-icon-badge { background: rgba(157,216,179,.15); }
[data-theme="dark"] .mini-card-out .mini-card-icon-badge { background: rgba(255,180,171,.12); }
.mini-card-icon-badge svg { width: 20px; height: 20px; }
.mini-card-in  .mini-card-icon-badge svg { stroke: var(--color-success); }
.mini-card-out .mini-card-icon-badge svg { stroke: var(--color-danger); }

/* Text group inside mini card */
.mini-card-text { flex: 1; min-width: 0; }

.mini-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.mini-card-amount {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.mini-card-in  .mini-card-label  { color: var(--color-success); }
.mini-card-in  .mini-card-amount { color: var(--color-success); }
.mini-card-out .mini-card-label  { color: var(--color-danger); }
.mini-card-out .mini-card-amount { color: var(--color-danger); }

/* ─── Category card (tappable) ──────────────────────────────────── */
.dash-cat-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dash-cat-card:active { opacity: .88; }

/* ─── Category spending modal ───────────────────────────────────── */
.modal-sheet-tall {
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cat-spending-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Month selector modal ───────────────────────────────────────── */
.month-select-list {
  max-height: 55dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
}
.month-select-item {
  display: block;
  width: 100%;
  padding: 14px 4px;
  border: none;
  background: none;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s;
}
.month-select-item:active { background: var(--color-bg); }
.month-select-item.selected {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 700;
}

/* ─── Dashboard Recent Transactions card ────────────────────────── */
.dash-recent-card { padding: 0; }
.dash-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
}
.dash-recent-header .card-title { margin-bottom: 0; }
.dash-history-link {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.dash-recent-card .txn-list { padding: 0 16px; }

/* ─── Category Spending Modal (Apple Wallet style) ───────────────── */
.cat-spending-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.cat-spending-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.cat-spending-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(100dvh - 52px);
  background: var(--color-surface);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -6px 40px rgba(0,0,0,.22);
}
[data-theme="dark"] .cat-spending-sheet {
  box-shadow: 0 -6px 40px rgba(0,0,0,.55);
}
.cat-spending-overlay.show .cat-spending-sheet {
  transform: translateY(0);
}
.cat-spending-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
  margin: 10px auto 0;
  flex-shrink: 0;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}
.cat-spending-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.cat-spending-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.cat-spending-close:active { background: var(--color-border); }
.cat-spending-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.3px;
}

/* ─── Merchant memory — recent chips ────────────────────────────────────── */

#recent-merchants-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  scrollbar-width: none;
}
#recent-merchants-chips::-webkit-scrollbar { display: none; }

.recent-merchant-chip {
  flex: 0 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: background .1s;
}
.recent-merchant-chip:active { background: var(--color-border); }

/* ─── Merchant memory — suggestion chip ─────────────────────────────────── */

/* Income source quick-selects — same layout as expense merchant chips */
#recent-sources-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  scrollbar-width: none;
}
#recent-sources-chips::-webkit-scrollbar { display: none; }

/* Scheduled activity — merchant chips (same layout as recent merchant chips) */
#scheduled-merchants-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  scrollbar-width: none;
}
#scheduled-merchants-chips::-webkit-scrollbar { display: none; }

.merchant-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--color-primary-soft);
  border: 1.5px solid var(--color-primary);
  border-radius: 20px;
  padding: 6px 13px 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.merchant-suggestion-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.merchant-suggestion-chip .chip-label { flex: 1; }
.merchant-suggestion-chip .chip-dismiss {
  font-size: 11px;
  opacity: .55;
  margin-left: 2px;
  line-height: 1;
}

/* ─── Category picker button (replaces the <select>) ────────────────────── */

.cat-picker-btn {
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: border-color .15s;
  box-sizing: border-box;
}
.cat-picker-btn.has-value { color: var(--color-text); }
.cat-picker-btn:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.cat-picker-btn-chevron {
  width: 16px;
  height: 16px;
  opacity: .35;
  flex-shrink: 0;
}

/* ─── Category picker overlay & sheet ───────────────────────────────────── */

.cat-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 3000;
  /* Anchor to TOP so the iOS keyboard rises from the bottom without covering the sheet */
  align-items: flex-start;
  padding-top: calc(var(--safe-top) + 56px);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.cat-picker-overlay.open { display: flex; }

.cat-picker-sheet {
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  /* Stretch to fill overlay content area so keyboard can't crop the sheet */
  align-self: stretch;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
}

.cat-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.cat-picker-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.3px;
}
.cat-picker-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.cat-picker-close:active { background: var(--color-border); }

.cat-picker-search-wrap {
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
#cat-picker-search {
  width: 100%;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 16px;
  color: var(--color-text);
  font-family: inherit;
  -webkit-appearance: none;
  box-sizing: border-box;
}
#cat-picker-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.cat-picker-list {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.cat-picker-section-head {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-muted);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.cat-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .08s;
}
.cat-picker-row:active { background: var(--color-border); }

.cat-picker-emoji {
  font-size: 19px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}
.cat-picker-name {
  flex: 1;
  font-size: 15px;
  color: var(--color-text);
}
.cat-picker-star {
  font-size: 18px;
  color: var(--color-text-muted);
  opacity: .3;
  cursor: pointer;
  padding: 2px 6px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .1s, color .1s;
  line-height: 1;
}
.cat-picker-star.active {
  opacity: 1;
  color: #F59E0B;
}

/* ─── SVG icon helpers ───────────────────────────────────────────────────── */

/* SVG inside transaction icon circle */
.txn-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
  display: block;
}

/* SVG inside category bar icon column */
.cat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.cat-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
  display: block;
}

/* Plan category icon cell */
.plan-cat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.plan-cat-icon svg {
  width: 29px;
  height: 29px;
  stroke-width: 1.7;
  display: block;
}

/* Categories page icon span */
.cat-page-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
}
.cat-page-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
  display: block;
}

/* Category edit modal icon */
.cat-edit-emoji-display svg {
  display: block;
  color: var(--color-primary);
}

/* Empty state SVG icon (replaces .emoji) */
.empty-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--color-text-faint);
}

/* Receipt button icon SVG sizing */
.receipt-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ─── Plan budget edit button ────────────────────────────────────────────── */

.plan-budget-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-faint);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  transition: color .12s, background .12s;
  font-family: inherit;
}
.plan-budget-edit-btn:active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* ─── Plan category icon-as-button (replaces pencil edit icon) ─────────────── */

.plan-cat-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
  font-family: inherit;
  transition: background .12s;
}
.plan-cat-icon-btn:active {
  background: rgba(0, 0, 0, .08);
}
[data-theme="dark"] .plan-cat-icon-btn:active {
  background: rgba(255, 255, 255, .1);
}
.plan-cat-icon-btn svg {
  width: 29px;
  height: 29px;
  stroke-width: 1.7;
  display: block;
}

/* Plan category row — full row is tappable for Activity drill-down */
.plan-cat-row {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, .04);
}
[data-theme="dark"] .plan-cat-row {
  -webkit-tap-highlight-color: rgba(255, 255, 255, .06);
}

/* ─── Activity filter tile ──────────────────────────────────────────────────── */

.activity-filter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 32px);
  margin: 8px 16px 0;
  padding: 16px 18px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  text-align: left;
}
.activity-filter-card svg { color: var(--color-text-muted); flex-shrink: 0; }
.activity-filter-card:active { background: var(--color-bg); }

.activity-filter-card.override-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.activity-filter-card.override-active .activity-filter-label {
  color: var(--color-primary);
}

.activity-filter-card-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.activity-filter-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ─── Generic Confirm Bottom Sheet ──────────────────────────────── */
.confirm-sheet-overlay { z-index: 9000; }
.confirm-sheet-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-text);
}
.confirm-sheet-body {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0 0 12px;
  line-height: 1.5;
}
.confirm-sheet-warning {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-danger);
  background: rgba(220,38,38,.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 0 0 16px;
}
.confirm-sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.confirm-sheet-actions .btn-sm { flex: 1; }
.confirm-sheet-actions .btn-sm.confirm-destructive {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

/* ─── Duplicate Expense Warning Sheet ──────────────────────────── */
.dup-warning-overlay { z-index: 580; }
.dup-warning-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-text);
}
.dup-warning-body {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}
.dup-warning-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dup-warning-actions .btn-sm { width: 100%; }

/* ─── Reconcile History modal ────────────────────────────────────── */
.reconcile-history-overlay { z-index: 600; }
.reconcile-history-sheet {
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.reconcile-history-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reconcile-history-month {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--color-surface);
}
.reconcile-history-month-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.reconcile-history-month-left { flex: 1; min-width: 0; }
.reconcile-history-month-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.reconcile-history-month-counts {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.6;
}
.reconcile-history-month-status {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}
.rh-status-complete { background: var(--color-primary-soft); color: var(--color-primary); }
.rh-status-manual { background: var(--color-accent-soft); color: var(--color-accent); }
.rh-status-pending { background: rgba(220,38,38,.1); color: var(--color-danger); }
.rh-status-held { background: rgba(234,179,8,.12); color: #b45309; }
.reconcile-history-month-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.reconcile-history-btn { z-index: 600; }
.reconcile-history-empty {
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 24px 0;
}

/* ─── Reconcile History — source rows ────────────────────────────── */
.rh-source-list {
  margin: 8px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.rh-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: opacity 0.2s;
}
.rh-source-row:last-child { border-bottom: none; }
.rh-source-done {
  opacity: 0.5;
}
.rh-source-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.rh-source-check {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.rh-source-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rh-source-counts {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.btn-xs {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-xs:active { opacity: 0.7; }
.rh-source-btn { }
.rh-source-empty { opacity: 0.38; }
.rh-source-circle {
  color: var(--color-border);
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}
.rh-source-status {
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: 4px;
}

/* ─── Reconcile Workspace Redesign (v65) ─────────────────────────── */

/* Import toolbar */
.rc-toolbar {
  padding: 10px 16px 0;
}
.rc-import-section {
  padding: 16px 16px 0;
}
.rc-import-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}
.rc-import-guidance {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  line-height: 1.45;
}
.rc-toolbar-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rc-src-select {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
}
.rc-import-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.rc-import-trigger:active { opacity: 0.82; }

/* Source badges */
.rc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
  line-height: 1;
}
.rc-badge-ws    { background: #111; color: #fff; }
.rc-badge-simplii { background: #c0392b; color: #fff; }
.rc-badge-scotia  { background: #cc0000; color: #fff; }
.rc-badge-generic { background: var(--color-primary-soft); color: var(--color-primary); }

/* Overview container */
.rc-overview {
  padding: 14px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rc-overview[hidden] { display: none; }
.rc-workspace[hidden] { display: none; }
.rc-workspace:not([hidden]) {
  display: block;
  padding-bottom: 80px;
}
.rc-empty {
  padding: 48px 24px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* Current month card */
.rc-current-month-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rc-month-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
}
.rc-month-card-left { min-width: 0; flex: 1; }
.rc-month-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}
.rc-month-card-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.rc-month-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.rc-badge-active  { background: var(--color-success-bg); color: var(--color-success); }
.rc-badge-complete { background: var(--color-primary-soft); color: var(--color-primary); }

.rc-open-month-btn {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.rc-open-month-btn:active { opacity: 0.82; }

/* Source list rows in overview month card */
.rc-source-list {
  border-top: 1px solid var(--color-border);
}
.rc-source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.rc-source-row:last-child { border-bottom: none; }
.rc-source-row:active { background: var(--color-bg); }
.rc-source-info { flex: 1; min-width: 0; }
.rc-source-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.rc-source-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.rc-source-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.rc-status-chip {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
}
.rc-status-review  { background: rgba(176,106,0,.12); color: var(--color-warning); }
.rc-status-done    { background: var(--color-success-bg); color: var(--color-success); }
.rc-status-none    { background: var(--color-bg); color: var(--color-text-faint); }
.rc-progress-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.rc-progress-track {
  width: 80px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}
.rc-progress-bar {
  height: 4px;
  background: var(--color-success);
  border-radius: 2px;
  min-width: 2px;
  transition: width .3s;
}
.rc-progress-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.rc-chevron { color: var(--color-text-faint); flex-shrink: 0; }

/* Stats grid in month card */
.rc-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  border-top: 1px solid var(--color-border);
}
.rc-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  gap: 2px;
  border-right: 1px solid var(--color-border);
}
.rc-stat-card:last-child { border-right: none; }
.rc-stat-icon { margin-bottom: 2px; }
.rc-stat-icon svg { display: block; }
.rc-stat-reconciled .rc-stat-icon { color: var(--color-success); }
.rc-stat-review .rc-stat-icon     { color: var(--color-warning); }
.rc-stat-reviewed .rc-stat-icon   { color: var(--color-primary); }
.rc-stat-uncategorized .rc-stat-icon { color: #9b59b6; }
.rc-stat-label {
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: center;
  letter-spacing: .02em;
}
.rc-stat-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}
.rc-stat-sub {
  font-size: 9px;
  color: var(--color-text-faint);
  text-align: center;
}
.rc-stat-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Section headers */
.rc-section-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.rc-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}
.rc-section-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  flex: 1;
}
.rc-view-all-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.rc-view-all-btn:active { opacity: 0.7; }

/* Active work grid */
.rc-work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.rc-work-bucket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
}
.rc-work-bucket:active { background: var(--color-bg); }
.rc-work-bucket svg { color: var(--color-warning); }
.rc-bucket-label {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.3;
}
.rc-bucket-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

/* Reviewed outcomes */
.rc-outcomes-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.rc-outcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.rc-outcome-card svg { color: var(--color-success); }
.rc-outcome-label {
  font-size: 11px;
  color: var(--color-text-muted);
}
.rc-outcome-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

/* Past months */
.rc-past-months {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rc-past-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}
.rc-past-row:last-child { border-bottom: none; }
.rc-past-tappable { cursor: pointer; }
.rc-past-tappable:active { background: var(--color-bg); }
.rc-past-left { flex: 1; min-width: 0; }
.rc-past-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rc-past-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.rc-past-status {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}
.rc-past-complete { background: var(--color-primary-soft); color: var(--color-primary); }
.rc-past-pending  { background: var(--color-danger-bg); color: var(--color-danger); }
.rc-past-counts {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.rc-past-counts span {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}
.rc-past-counts small {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.rc-past-alert { color: var(--color-danger) !important; }

/* ─── Month workspace panel ──────────────────────────────────────── */
.rc-ws-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.rc-ws-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.rc-ws-back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.rc-ws-back-btn:active { background: var(--color-primary-soft); }
.rc-ws-header-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.rc-ws-month-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
}
.rc-ws-header-right { width: 36px; flex-shrink: 0; }

/* Source summary strip */
.rc-ws-source-strip {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.rc-ws-src-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
}
.rc-ws-src-chip:last-child { border-bottom: none; }
.rc-ws-src-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}
.rc-ws-src-counts {
  font-size: 12px;
  color: var(--color-text-muted);
}
.rc-ws-src-counts strong {
  color: var(--color-warning);
}

/* Workspace tabs */
.rc-ws-tabs {
  display: flex;
  gap: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0 16px;
}
.rc-ws-tab {
  flex: 1;
  padding: 11px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  text-align: center;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.rc-ws-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Filter chips */
.rc-filter-chips {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rc-filter-chips::-webkit-scrollbar { display: none; }
.rc-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.rc-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}
.rc-chip:active { opacity: 0.8; }

/* Workspace items list */
.rc-ws-items {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 16px;
}
.rc-ws-empty {
  padding: 36px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
}
.rc-ws-loading {
  padding: 36px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* Reviewed note banner */
.rc-reviewed-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 8px;
  padding: 10px 12px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-primary);
}
.rc-reviewed-footer {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-faint);
  padding: 12px 16px 20px;
}

/* Continue Review bottom bar */
.rc-review-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}
.rc-review-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}
.rc-continue-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.rc-continue-btn:active { opacity: 0.82; }

/* Scheduled match chip in card */
.rc-sched-match-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 6px;
}

/* ─── Batch Entry Mode ───────────────────────────────────────────────── */

/* Header title in batch mode */
.header-title.batch-entry-mode {
  color: var(--color-accent);
  cursor: pointer;
}
.header-title { cursor: pointer; }

/* Batch entry view container */
#batch-entry-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 32px;
}

/* Status pill */
.batch-status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 10px rgba(176, 141, 87, 0.35);
}
[data-theme="dark"] .batch-status-pill {
  background: var(--color-accent);
  color: #14110F;
}

/* Merchant tile */
.batch-merchant-tile {
  background: var(--color-surface-raised);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-surface-border);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}
.batch-merchant-edit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.batch-merchant-edit-btn:active { background: var(--color-accent-soft); color: var(--color-accent); }

.batch-merchant-tile-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 42px;
}
.batch-merchant-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -1px;
  flex-shrink: 0;
  text-transform: uppercase;
}
[data-theme="dark"] .batch-merchant-badge {
  background: var(--color-primary-soft);
  color: #7FAE9B;
}
.batch-merchant-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.batch-merchant-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-merchant-sub {
  font-size: 14px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-merchant-payment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 50px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  align-self: flex-start;
}
.batch-merchant-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-faint);
  padding-top: 2px;
}

/* Batch field groups */
.batch-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.batch-field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}
.batch-label-optional {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-faint);
}

/* Date input row */
.batch-field-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface-raised);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--color-text-muted);
}
.batch-date-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  min-width: 0;
}
.batch-notes-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: 16px;
  outline: none;
  min-width: 0;
}
.batch-notes-input::placeholder { color: var(--color-text-faint); }
.batch-date-input::-webkit-calendar-picker-indicator { opacity: 0.5; }

/* Amount wrapper */
.batch-amount-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface-raised);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.batch-currency-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.batch-amount-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 36px;
  font-weight: 300;
  letter-spacing: -1px;
  outline: none;
  text-align: center;
  min-width: 0;
  -moz-appearance: textfield;
}
.batch-amount-input:focus { color: var(--color-text); }
.batch-amount-input::placeholder { color: var(--color-text-faint); }
.batch-amount-input::-webkit-inner-spin-button,
.batch-amount-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Receipt tiles */
.batch-receipt-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.batch-receipt-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  background: var(--color-surface-raised);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.batch-receipt-tile:active { background: var(--color-primary-soft); border-color: var(--color-primary); }
.batch-receipt-preview-wrap {
  position: relative;
  display: inline-block;
}
.batch-receipt-preview-img {
  max-height: 120px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  display: block;
  width: 100%;
}

/* Save & Add Next button */
.btn-batch-save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 24px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(176, 141, 87, 0.35);
  transition: opacity .15s, transform .1s;
  margin-top: 4px;
}
.btn-batch-save:active { opacity: 0.88; transform: scale(.98); }
[data-theme="dark"] .btn-batch-save {
  color: #14110F;
}

/* Helper text */
.batch-helper-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-faint);
  text-align: center;
  padding-bottom: 8px;
}

/* Batch setup sheet */
.batch-setup-sheet {
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.batch-setup-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.batch-setup-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}
.batch-setup-actions .btn-save {
  flex: 1;
}

/* form-input used in batch setup */
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--color-accent); }
.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 16px;
  outline: none;
}
