/* ============================================================
   LEDGER — themed stylesheet
   Themes swap CSS variables on <body class="theme-*">
   ============================================================ */

:root {
  --line: #E4DDCD;
  --muted: #8A8272;
  --accent: #3D8B6E; /* overridden live in RGB mode via JS */
}

body.theme-light {
  --ink: #1C1B1A;
  --paper: #FAF7F0;
  --paper-dim: #F1EBDD;
  --card-bg: #ffffff;
  --line: #E4DDCD;
  --muted: #8A8272;
  --shadow: rgba(0,0,0,0.06);
}

body.theme-dark {
  --ink: #F1EDE3;
  --paper: #1A1917;
  --paper-dim: #232120;
  --card-bg: #242220;
  --line: #38352F;
  --muted: #96907F;
  --shadow: rgba(0,0,0,0.35);
}

body.theme-rgb {
  --ink: #1C1B1A;
  --paper: #FAFAFA;
  --paper-dim: #F0F0F0;
  --card-bg: #ffffff;
  --line: #E2E2E2;
  --muted: #83807A;
  --shadow: rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

#root { min-height: 100%; }

.page { min-height: 100%; background: var(--paper); }
.page-inner { max-width: 760px; margin: 0 auto; padding: 20px 20px 60px; }

/* top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  -webkit-app-region: drag;
}
.brand-row { display: flex; align-items: center; gap: 10px; -webkit-app-region: no-drag; padding-top: 6px; }
.brand-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 1px;
  line-height: 1;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  font-style: italic;
  font-family: 'Fraunces', serif;
}

.top-actions { display: flex; align-items: center; gap: 8px; -webkit-app-region: no-drag; }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: transform 0.15s ease, background 0.2s ease;
}
.icon-btn:hover { transform: scale(1.08); background: var(--paper-dim); }

.total-card {
  background: var(--ink);
  color: var(--paper);
  padding: 8px 16px;
  border-radius: 4px;
  text-align: right;
  transition: transform 0.15s ease, background 0.25s ease;
  box-shadow: 0 2px 0 var(--shadow);
}
body.theme-rgb .total-card { background: var(--accent); }
.total-card.flash { transform: scale(1.04); }
.total-label {
  font-size: 9px;
  letter-spacing: 1.2px;
  opacity: 0.65;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.total-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

/* month navigation */
.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.month-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.month-nav-btn:hover { background: var(--paper-dim); }
.month-select, .year-select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}
.today-btn {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.today-btn:hover { color: var(--ink); border-color: var(--ink); }

/* manage panel (tabbed settings) */
.manage-panel {
  background: var(--card-bg);
  border: 1.3px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
}
.manage-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.manage-tab {
  flex-shrink: 0;
  padding: 6px 11px;
  border-radius: 100px;
  border: 1.3px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.manage-tab.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
body.theme-rgb .manage-tab.active { background: var(--accent); border-color: var(--accent); }
.manage-tab-content { min-height: 60px; }
.manage-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-bottom: 10px;
}
.manage-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 220px; overflow-y: auto; }
.manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 5px 8px;
  background: var(--paper-dim);
  border-radius: 5px;
  gap: 8px;
}
.manage-item em { color: var(--muted); font-style: italic; font-size: 10.5px; }
.manage-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.manage-remove:hover { color: #C0392B; }
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
}
.manage-add-form { display: flex; gap: 5px; }
.manage-add-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12px;
}
.manage-add-form input.emoji-input { flex: 0 0 44px; text-align: center; }
.manage-add-form input[type="color"] {
  width: 34px;
  height: 30px;
  border: 1.3px solid var(--line);
  border-radius: 5px;
  padding: 2px;
  background: var(--card-bg);
  cursor: pointer;
}
.manage-add-form button {
  padding: 6px 10px;
  border-radius: 5px;
  border: none;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.theme-options { display: flex; flex-direction: column; gap: 6px; }
.theme-opt {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.theme-opt.active { border-color: var(--accent); background: var(--paper-dim); font-weight: 700; }
.rgb-controls { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rgb-label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.rgb-controls input[type="color"] { width: 30px; height: 26px; border-radius: 5px; border: 1.3px solid var(--line); cursor: pointer; }

/* mode switcher */
.mode-switcher {
  display: flex;
  gap: 4px;
  background: var(--paper-dim);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
}
.mode-btn {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.mode-btn.active { background: var(--card-bg); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }

/* method filter chips */
.method-filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 5px 12px;
  border-radius: 100px;
  border: 1.3px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  color: var(--muted);
}

/* quick add */
.add-trigger {
  width: 100%;
  padding: 13px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  margin-bottom: 20px;
}
body.theme-rgb .add-trigger { background: var(--accent); }
.add-trigger:hover { opacity: 0.92; }
.add-plus { font-size: 18px; line-height: 1; }

.add-form {
  background: var(--card-bg);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 16px var(--shadow);
  margin-bottom: 20px;
}
.add-form-row {
  display: flex;
  align-items: center;
  border-bottom: 1.5px dashed var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
  gap: 8px;
}
.add-form-currency { font-size: 26px; font-family: 'JetBrains Mono', monospace; color: var(--muted); margin-right: 4px; }
.add-form-amount {
  flex: 1;
  border: none;
  outline: none;
  font-size: 28px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  min-width: 0;
}
.date-input {
  border: 1.3px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  background: var(--card-bg);
  color: var(--ink);
  flex-shrink: 0;
}
.add-form-methods { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.method-pick {
  flex: 1 1 auto;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s ease;
  background: var(--card-bg);
  color: var(--ink);
}
.add-form-row2 { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.add-form-select, .add-form-note {
  flex: 1 1 160px;
  padding: 9px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--card-bg);
  outline: none;
}
.add-form-select:focus, .add-form-note:focus, .add-form-amount:focus { border-color: var(--ink); }
.add-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.cancel-btn {
  padding: 9px 16px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.submit-btn {
  padding: 9px 20px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.submit-btn:hover { opacity: 0.92; }

/* inline edit form wrapper */
.inline-edit-form { margin-bottom: 6px; }

/* feed */
.date-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.receipt-swipe-wrap {
  position: relative;
  margin-bottom: 6px;
  border-radius: 6px;
  overflow: hidden;
}
.receipt-swipe-wrap .receipt-line { margin-bottom: 0; }
.receipt-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  transition: opacity 0.2s ease, transform 0.2s ease;
  touch-action: pan-y;
  will-change: transform;
  z-index: 1;
}
.receipt-line.removing { opacity: 0; transform: translateX(30px) !important; }

/* swipe-revealed action row, sits behind .receipt-line */
.receipt-swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 0;
}
.swipe-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 56px;
  border: none;
  cursor: pointer;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.swipe-action-icon { font-size: 16px; line-height: 1; }
.swipe-action-edit { background: #4a7fc9; }
.swipe-action-skip { background: #b98b3e; width: 44px; }
.swipe-action-delete { background: #c1493f; }
.swipe-action:active { filter: brightness(0.9); }
.stamp-dot {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}
.receipt-main { flex: 1; min-width: 0; }
.receipt-top { display: flex; justify-content: space-between; gap: 8px; }
.receipt-category { font-size: 13.5px; font-weight: 600; }
.receipt-amount { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 14.5px; flex-shrink: 0; }
.receipt-bottom {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.receipt-method { font-weight: 500; flex-shrink: 0; }
.receipt-note { overflow: hidden; text-overflow: ellipsis; }
.edit-btn, .delete-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  position: relative; /* anchors the invisible expanded-hit-area pseudo-element below */
}
/* Expands the actual tappable area beyond the visually compact 26px
   icon — measured center-to-center spacing between adjacent action
   buttons in this row is 36px, so the hit zone is capped at 32px (with a
   4px safety margin) to guarantee no overlap between edit/skip/delete,
   while still meaningfully improving on the original 26px hit area. */
.edit-btn::before, .delete-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
}
.delete-btn { font-size: 18px; }
.edit-btn:hover, .delete-btn:hover { background: var(--paper-dim); color: var(--ink); }

/* grid */
.grid-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grid-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-top: 4px solid;
  border-radius: 8px;
  padding: 14px 12px;
  opacity: 0;
}
.grid-card-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }
.grid-edit, .grid-delete { border: none; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; }
.grid-delete { font-size: 16px; }
.grid-edit:hover, .grid-delete:hover { background: var(--paper-dim); color: var(--ink); }
.grid-icon { font-size: 22px; margin-bottom: 8px; }
.grid-amount { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 18px; }
.grid-category { font-size: 12px; color: var(--muted); margin-top: 2px; margin-bottom: 8px; }
.grid-method-tag { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; padding: 2px 8px; border-radius: 100px; letter-spacing: 0.3px; }
.grid-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; font-style: italic; }
.grid-date { font-size: 10px; color: var(--muted); opacity: 0.7; margin-top: 8px; font-family: 'JetBrains Mono', monospace; }

/* breakdown */
.breakdown-wrap { display: flex; flex-direction: column; gap: 26px; }
.breakdown-title { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 14px; }
.method-bars { display: flex; flex-direction: column; gap: 12px; }
.method-bar-row { display: flex; align-items: center; gap: 10px; }
.method-bar-label { font-size: 12.5px; width: 84px; flex-shrink: 0; font-weight: 500; }
.method-bar-track { flex: 1; height: 10px; background: var(--paper-dim); border-radius: 100px; overflow: hidden; }
.method-bar-fill { height: 100%; border-radius: 100px; width: 0; }
.method-bar-amount { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; width: 70px; text-align: right; flex-shrink: 0; }
.category-list { display: flex; flex-direction: column; }
.category-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); opacity: 0; }
.category-icon { font-size: 16px; width: 22px; flex-shrink: 0; }
.category-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.category-pct { font-size: 11.5px; color: var(--muted); width: 34px; text-align: right; }
.category-pct-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; width: 44px; }
.category-pct-col .category-pct { width: auto; }
.category-delta { font-size: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.category-delta-up { color: #C0392B; }
.category-delta-down { color: #3D8B6E; }
body.theme-dark .category-delta-up { color: #E8935C; }
body.theme-dark .category-delta-down { color: #6FBE9E; }
.category-amt { font-family: 'JetBrains Mono', monospace; font-size: 13px; width: 70px; text-align: right; font-weight: 600; }

/* trend */
.trend-chart { display: flex; gap: 6px; align-items: flex-end; height: 180px; border-bottom: 1.5px solid var(--ink); padding-bottom: 4px; overflow-x: auto; }
.trend-col { flex: 1 0 32px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.trend-bar-track { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.trend-label { font-size: 9px; color: var(--muted); margin-top: 6px; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.trend-value { display: block; font-size: 9px; text-align: center; color: #fff; font-family: 'JetBrains Mono', monospace; padding-top: 3px; }

/* stats mode */
.stats-wrap { display: flex; flex-direction: column; gap: 28px; }
.stats-summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stats-summary-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.stats-summary-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 1px; color: var(--muted); margin-bottom: 6px; }
.stats-summary-value { font-family: 'JetBrains Mono', monospace; font-size: 19px; font-weight: 700; }
.stats-section {}

.donut-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-svg { flex-shrink: 0; }
.donut-seg {
  stroke-dasharray: 0 999;
  animation: donutGrow 0.8s cubic-bezier(0.2,0.8,0.3,1) forwards;
}
@keyframes donutGrow {
  from { stroke-dasharray: 0 999; }
  to { stroke-dasharray: var(--dash-len) var(--dash-gap); }
}
.donut-center-label { font-family: 'JetBrains Mono', monospace; font-size: 8px; fill: var(--muted); letter-spacing: 1px; }
.donut-center-amt { font-family: 'JetBrains Mono', monospace; font-size: 13px; fill: var(--ink); font-weight: 700; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-name { flex: 1; }
.legend-pct { font-family: 'JetBrains Mono', monospace; color: var(--muted); font-size: 11.5px; }

.line-chart-wrap { background: var(--card-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.line-chart-svg { display: block; }
.line-chart-area { fill: var(--accent); opacity: 0.12; }
.line-chart-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: lineDraw 1s ease forwards;
}
@keyframes lineDraw { to { stroke-dashoffset: 0; } }
.line-chart-dot {
  fill: var(--accent);
  opacity: 0;
  animation: dotPop 0.3s ease forwards;
}
@keyframes dotPop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.line-chart-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; fill: var(--muted); }

.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: flex; align-items: center; gap: 10px; }
.hbar-track { flex: 1; height: 26px; background: var(--paper-dim); border-radius: 6px; overflow: hidden; }
.hbar-fill {
  height: 100%;
  border-radius: 6px;
  width: 0;
  display: flex;
  align-items: center;
  padding-left: 10px;
  min-width: fit-content;
}
.hbar-fill-label { font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; }
.hbar-amount { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; width: 70px; text-align: right; flex-shrink: 0; }

/* empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { display: flex; justify-content: center; margin-bottom: 12px; opacity: 0.5; }
.empty-icon-emoji { font-size: 40px; line-height: 1; }
.empty-title { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.empty-text { font-size: 13px; }
.empty-cta-btn {
  margin-top: 18px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

/* animations */
@keyframes printIn {
  0% { opacity: 0; transform: translateY(-16px) scaleY(0.7); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scaleY(1); }
}
.ledger-print-in { transform-origin: top; animation: printIn 0.5s cubic-bezier(0.2, 0.8, 0.3, 1); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ledger-slide-down { animation: slideDown 0.22s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ledger-fade-in { animation: fadeIn 0.35s ease forwards; }

@keyframes tabTransition {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ledger-tab-transition { animation: tabTransition 0.22s ease; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ledger-card-in { animation: cardIn 0.32s ease forwards; }

.ledger-bar-grow { animation: barGrow 0.7s cubic-bezier(0.2,0.8,0.3,1) forwards; }
@keyframes barGrow { from { width: 0; } to { width: var(--target-w); } }

.ledger-bar-grow-v {
  width: 100%;
  border-radius: 4px 4px 0 0;
  animation: barGrowV 0.6s cubic-bezier(0.2,0.8,0.3,1) forwards;
  height: 0;
  background: linear-gradient(180deg, var(--accent), var(--ink));
}
@keyframes barGrowV { from { height: 0; } to { height: var(--target-h); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Budget bar
   ============================================================ */
.budget-empty-row { margin-bottom: 14px; }

/* Safe-to-Spend card */
.s2s-card {
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 12px;
  margin-bottom: 14px;
}
.s2s-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.s2s-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
}
.s2s-card.s2s-warn .s2s-amount { color: #A32D1F; }
body.theme-dark .s2s-card.s2s-warn .s2s-amount { color: #E8935C; }
.s2s-warn-text {
  margin-top: 6px;
  font-size: 11.5px;
  color: #A32D1F;
  background: #FAE0DD;
  border-radius: 6px;
  padding: 5px 8px;
  display: inline-block;
}
body.theme-dark .s2s-warn-text { color: #E8935C; background: #3D2515; }
.s2s-card.s2s-empty {
  padding: 10px 12px;
  text-align: left;
}
.s2s-empty-text { font-size: 12px; color: var(--muted); }

.budget-set-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.budget-set-link:hover { color: var(--ink); }

.budget-bar-wrap { margin-bottom: 14px; }
.budget-bar-row { display: flex; align-items: center; gap: 8px; }
.budget-bar-track {
  flex: 1;
  height: 8px;
  background: var(--paper-dim);
  border-radius: 100px;
  overflow: hidden;
}
.budget-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.2,0.8,0.3,1), background 0.3s ease;
}
.budget-bar-fill.budget-ok { background: #3D8B6E; }
.budget-bar-fill.budget-warn { background: #D4A62E; }
.budget-bar-fill.budget-danger { background: #E4823D; }
.budget-bar-fill.budget-over { background: #C0392B; }
.budget-edit-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.budget-edit-link:hover { background: var(--paper-dim); color: var(--ink); }
.budget-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}
.budget-pct.budget-warn { color: #B8860B; font-weight: 700; }
.budget-pct.budget-danger { color: #C56A2E; font-weight: 700; }
.budget-pct.budget-over { color: #C0392B; font-weight: 700; }

/* ============================================================
   Settings blocks (budget/reminders tabs)
   ============================================================ */
.settings-block { margin-bottom: 18px; }
.settings-block:last-child { margin-bottom: 0; }
.settings-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
}
.settings-hint { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.inline-set-form { display: flex; align-items: center; gap: 8px; }
.inline-set-form input[type="number"] {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
}
.inline-set-form button {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.threshold-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.threshold-input {
  width: 54px;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}
.settings-action-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}
.settings-action-btn.danger { color: #C0392B; border-color: #E8B4AC; }
.settings-action-btn.danger:hover { background: #FBEAE7; }
.account-name-display {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ============================================================
   Method inline edit row
   ============================================================ */
.manage-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.manage-edit-method {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  width: 20px;
  height: 20px;
}
.manage-edit-method:hover { color: var(--ink); }
.method-edit-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--paper-dim);
  border-radius: 5px;
  margin-top: -2px;
  margin-bottom: 4px;
}
.method-edit-inline input[type="text"] {
  flex: 1;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12px;
}
.method-edit-inline input[type="color"] {
  width: 30px;
  height: 26px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  cursor: pointer;
}
.edit-method-save {
  border: none;
  background: #3D8B6E;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================
   Stats range picker
   ============================================================ */
.stats-range-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stats-range-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.stats-range-row select { min-width: 130px; }

/* ============================================================
   Account gate (create account / unlock screen)
   ============================================================ */
.gate-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--paper);
}
.gate-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.gate-icon { color: var(--ink); display: flex; justify-content: center; margin-bottom: 14px; }
.gate-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.gate-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 24px;
  font-style: italic;
  font-family: 'Fraunces', serif;
}
.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-form input {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
  outline: none;
  font-family: 'Inter', sans-serif;
}
.gate-form input:focus { border-color: var(--ink); }
.gate-error { color: #C0392B; font-size: 12px; min-height: 16px; }
.gate-submit {
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}
.gate-submit:hover { opacity: 0.92; }

/* ============================================================
   RTL support (Arabic)
   ============================================================ */
body.rtl { direction: rtl; }
body.rtl .top-bar { flex-direction: row-reverse; }
body.rtl .brand-row { flex-direction: row-reverse; }
body.rtl .total-card { text-align: left; }
body.rtl .receipt-top,
body.rtl .receipt-bottom,
body.rtl .grid-card-actions,
body.rtl .manage-item,
body.rtl .method-bar-row,
body.rtl .category-row,
body.rtl .hbar-row,
body.rtl .stats-summary-row,
body.rtl .legend-item,
body.rtl .threshold-row,
body.rtl .inline-set-form { direction: rtl; }
body.rtl .grid-card-actions { left: 6px; right: auto; }
body.rtl .add-form-row { flex-direction: row-reverse; }
body.rtl .add-form-currency { margin-right: 0; margin-left: 4px; }
body.rtl .month-nav-btn:first-child { transform: scaleX(-1); }
body.rtl .month-nav-btn:nth-child(4) { transform: scaleX(-1); }
body.rtl .receipt-swipe-actions { right: auto; left: 0; }
body.rtl .s2s-card.s2s-empty { text-align: right; }

/* ============================================================
   Archive panel
   ============================================================ */
.archive-btn { position: relative; }
.archive-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #C0392B;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  font-family: 'JetBrains Mono', monospace;
}
.archive-panel {
  background: var(--card-bg);
  border: 1.3px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.archive-panel-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-bottom: 10px;
}
.archive-panel-hint { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.7; }
.archive-list { max-height: 280px; }
.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}
.archive-item:last-child { border-bottom: none; }
.archive-item-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.archive-stamp { width: 28px; height: 28px; font-size: 9px; flex-shrink: 0; }
.archive-item-top { font-size: 12.5px; font-weight: 500; }
.archive-item-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.archive-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.archive-restore {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 17px;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}
.archive-restore:hover { background: var(--paper-dim); }

/* ============================================================
   Profile picker & avatars
   ============================================================ */
.profile-picker-card { max-width: 380px; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 8px;
}
.profile-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 10px;
}
.profile-tile:hover { background: var(--paper-dim); }
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 17px;
}
.profile-avatar-add {
  background: var(--paper-dim);
  color: var(--muted);
  border: 1.5px dashed var(--line);
  font-size: 22px;
}
.profile-avatar-inline {
  width: 26px;
  height: 26px;
  font-size: 11px;
  display: inline-flex;
  vertical-align: middle;
  margin-right: 8px;
}
body.rtl .profile-avatar-inline { margin-right: 0; margin-left: 8px; }
.profile-tile-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gate-back-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   Recurring expenses
   ============================================================ */
.recur-block { margin-bottom: 14px; }
.recur-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
}
.recur-checkbox-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.recur-freq-row { display: flex; gap: 6px; margin-top: 8px; }
.recur-freq-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.recur-freq-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.recur-virtual-hint {
  font-size: 11px;
  color: var(--muted);
  background: var(--paper-dim);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 14px;
  line-height: 1.4;
}
.recur-badge {
  display: inline-block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

/* ============================================================
   Splash screen
   ============================================================ */
.splash-wrap {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--paper, #FAF7F0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.splash-wrap.splash-exit {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.splash-logo-frame {
  animation: splashFrameIn 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes splashFrameIn {
  from { opacity: 0; transform: translateY(14px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.splash-logo { overflow: visible; }

.splash-receipt {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: splashDraw 0.9s cubic-bezier(0.2, 0.8, 0.3, 1) forwards 0.1s;
}
@keyframes splashDraw {
  to { stroke-dashoffset: 0; }
}

.splash-line {
  opacity: 0;
  animation: splashFadeIn 0.35s ease forwards;
}
.splash-line-1 { animation-delay: 0.75s; }
.splash-line-2 { animation-delay: 0.88s; }
.splash-line-3 { animation-delay: 1.01s; }
@keyframes splashFadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.splash-bar {
  animation: splashBarGrow 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  transform-box: fill-box;
  transform-origin: bottom;
  transform: scaleY(0);
}
.splash-bar-1 { animation-delay: 1.1s; }
.splash-bar-2 { animation-delay: 1.2s; }
.splash-bar-3 { animation-delay: 1.3s; }
@keyframes splashBarGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.splash-coin {
  opacity: 0;
  transform-origin: 90px 26px;
  animation: splashCoinPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 1.45s;
}
.splash-coin-text {
  opacity: 0;
  animation: splashFadeIn 0.3s ease forwards 1.65s;
}
@keyframes splashCoinPop {
  0% { opacity: 0; transform: scale(0) rotate(-45deg); }
  70% { opacity: 1; transform: scale(1.15) rotate(8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.splash-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--ink, #1C1B1A);
  opacity: 0;
  animation: splashFadeIn 0.5s ease forwards 1.8s;
}

.splash-dots {
  display: flex;
  gap: 6px;
  opacity: 0;
  animation: splashFadeIn 0.4s ease forwards 2.1s;
}
.splash-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #8A8272);
  animation: splashDotPulse 1.1s ease-in-out infinite;
}
.splash-dot:nth-child(1) { animation-delay: 0s; }
.splash-dot:nth-child(2) { animation-delay: 0.15s; }
.splash-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes splashDotPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ============================================================
   Category limits
   ============================================================ */
.category-manage-item { align-items: center; }
.category-limit-inline { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.category-limit-btn {
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--muted);
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
}
.category-limit-btn:hover { color: var(--ink); border-color: var(--ink); }

.category-limit-inline-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--paper-dim);
  border-radius: 5px;
  margin-top: -2px;
  margin-bottom: 4px;
}
.category-limit-inline-edit .add-form-currency { font-size: 15px; margin-right: 0; }
.category-limit-inline-edit input {
  width: 70px;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.category-limit-suffix { font-size: 11px; color: var(--muted); }

.category-limit-tag {
  display: inline-block;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  padding: 1px 7px;
  border-radius: 100px;
  margin-left: 6px;
  font-weight: 600;
}
body.rtl .category-limit-tag { margin-left: 0; margin-right: 6px; }
.category-limit-ok { background: #E4F2EC; color: #2A6E52; }
.category-limit-warn { background: #FBF0D9; color: #8A6410; }
.category-limit-danger { background: #FBE4D5; color: #A14F1F; }
.category-limit-over { background: #FAE0DD; color: #A32D1F; }
body.theme-dark .category-limit-ok { background: #163829; color: #6FCBA0; }
body.theme-dark .category-limit-warn { background: #3A2E10; color: #E8C05C; }
body.theme-dark .category-limit-danger { background: #3D2515; color: #E8935C; }
body.theme-dark .category-limit-over { background: #3D1A15; color: #E87C6A; }

/* ============================================================
   Lockout / security messaging
   ============================================================ */
.gate-locked-msg {
  color: #C0392B;
  font-weight: 600;
}

/* ============================================================
   Backup format row
   ============================================================ */
.backup-format-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.backup-format-row .settings-action-btn {
  margin-bottom: 0;
}

/* ============================================================
   Bottom tab bar navigation
   ============================================================ */
.page-with-tabbar { padding-bottom: 64px; } /* room for the fixed bottom bar */

.bottom-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.bottom-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
.bottom-tab-btn.active { color: var(--accent); }
body.theme-rgb .bottom-tab-btn.active { color: var(--accent); }
.bottom-tab-icon { font-size: 19px; line-height: 1; }
.bottom-tab-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.2px; }

/* ============================================================
   Sub-mode switchers (within Transactions / Insights tabs)
   ============================================================ */
.sub-mode-switcher {
  display: flex;
  gap: 4px;
  background: var(--paper-dim);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.sub-mode-switcher-3 { margin-top: 4px; }
.sub-mode-btn {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.sub-mode-btn.active { background: var(--card-bg); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.sub-mode-switcher-5 .sub-mode-btn { font-size: 11px; padding: 8px 3px; }

/* ============================================================
   Home dashboard tab
   ============================================================ */
.home-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.home-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.home-stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 6px;
}
.home-stat-value { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; }
.home-stat-value-small { font-size: 13px; font-family: 'Inter', sans-serif; font-weight: 600; }

.home-recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 8px;
}
.home-recent-header span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--muted);
  text-transform: uppercase;
}
.home-see-all {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   Budget dashboard tab (category limits view)
   ============================================================ */
.budget-cat-row { margin-bottom: 14px; }
.budget-cat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.budget-cat-track { height: 8px; margin-top: 0; }

/* ============================================================
   Settings tab (no longer an overlay, just a tab's content)
   ============================================================ */
.settings-tab .manage-panel {
  margin-bottom: 0;
  border: none;
  padding: 0;
  background: transparent;
}

/* ============================================================
   Home dashboard v2 (spec-driven redesign)
   ============================================================ */
.home-hero {
  text-align: center;
  padding: 18px 0 14px;
}
.home-hero-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.home-hero-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.home-hero-today {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}
.home-hero-today strong { color: var(--ink); font-family: 'JetBrains Mono', monospace; }

.home-comparison {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 18px;
}
.home-comparison-arrow { font-weight: 700; font-size: 14px; }
.home-comparison-up { color: #C0392B; }
.home-comparison-down { color: #3D8B6E; }

.home-insight-card {
  background: var(--paper-dim);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
body.rtl .home-insight-card { border-left: none; border-right: 3px solid var(--accent); }
.home-insight-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-bottom: 4px;
}
.home-insight-text { font-size: 13px; line-height: 1.4; color: var(--ink); }

/* Insights sub-tab (Phase 3): list of multiple tone-colored insight rows */
.insights-list { display: flex; flex-direction: column; gap: 8px; }
.insight-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--paper-dim);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 11px 13px;
}
body.rtl .insight-row { border-left: none; border-right: 3px solid var(--accent); }
.insight-row-icon { font-size: 13px; line-height: 1.4; flex-shrink: 0; }
.insight-row-text { font-size: 13px; line-height: 1.4; color: var(--ink); }
.insight-row.insight-tone-warning { border-color: #A32D1F; }
.insight-row.insight-tone-warning .insight-row-icon { color: #A32D1F; }
body.theme-dark .insight-row.insight-tone-warning { border-color: #E8935C; }
body.theme-dark .insight-row.insight-tone-warning .insight-row-icon { color: #E8935C; }
.insight-row.insight-tone-notice { border-color: #B98B3E; }
.insight-row.insight-tone-notice .insight-row-icon { color: #B98B3E; }
.insight-row.insight-tone-positive { border-color: #3D8B6E; }
.insight-row.insight-tone-positive .insight-row-icon { color: #3D8B6E; }
.insight-row.insight-tone-info { border-color: var(--accent); }
.insight-row.insight-tone-info .insight-row-icon { color: var(--accent); }

.home-section-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--muted);
  text-transform: uppercase;
  margin: 20px 0 8px;
}

.home-top-cats { display: flex; flex-direction: column; gap: 2px; }
.home-top-cat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.home-top-cat-name { font-weight: 500; }
.home-top-cat-amt { font-family: 'JetBrains Mono', monospace; font-weight: 600; }

.home-upcoming-list { display: flex; flex-direction: column; gap: 6px; }
.home-upcoming-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
}
.home-upcoming-main { display: flex; flex-direction: column; gap: 2px; }
.home-upcoming-main > span:first-child { font-size: 13px; font-weight: 500; }
.home-upcoming-due { font-size: 10.5px; color: var(--muted); }
.home-upcoming-amt { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13.5px; }

/* ============================================================
   Fast Add: duplicate-last button, quick category chips
   ============================================================ */
.quick-add-trigger-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.quick-add-trigger-row .add-trigger { margin-bottom: 0; flex: 1; }
.duplicate-last-btn {
  flex-shrink: 0;
  width: 46px;
  border: none;
  border-radius: 6px;
  background: var(--paper-dim);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}
.duplicate-last-btn:hover { background: var(--line); }

.quick-cat-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.quick-cat-chip {
  padding: 6px 11px;
  border-radius: 100px;
  border: 1.5px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.quick-cat-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ============================================================
   Advanced recurring expense UI
   ============================================================ */
.recur-custom-row, .recur-extra-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.recur-custom-row input, .recur-extra-row select, .recur-extra-row input[type="date"], .recur-extra-row input[type="number"] {
  padding: 6px 9px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12.5px;
}
.recur-custom-row input { width: 60px; }
.recur-end-label { font-size: 12px; color: var(--muted); width: 100%; }
.recur-variable-row { width: 100%; margin-top: 4px; }

.confirm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #D4A62E;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.receipt-needs-confirm { border-color: #D4A62E; }

.skip-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  position: relative;
}
.skip-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
}
.skip-btn:hover { background: var(--paper-dim); color: var(--ink); }

/* ============================================================
   Advanced transaction search & filters
   ============================================================ */
.txn-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.txn-search-input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.txn-search-input:focus { border-color: var(--ink); }
.txn-filter-toggle {
  flex-shrink: 0;
  width: 40px;
  border-radius: 6px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  position: relative;
}
.txn-filter-toggle.has-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.txn-filters-panel {
  background: var(--card-bg);
  border: 1.3px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.txn-filter-row { display: flex; flex-direction: column; gap: 5px; }
.txn-filter-row label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.txn-amount-range { display: flex; align-items: center; gap: 6px; }
.txn-amount-range input {
  flex: 1;
  padding: 7px 9px;
  border-radius: 5px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 12.5px;
}
.txn-amount-range span { color: var(--muted); }

.txn-results-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.txn-clear-filters {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   Calendar view
   ============================================================ */
.calendar-view { margin-top: 4px; }
.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.cal-weekday-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  border: 1.3px solid var(--line);
  background: var(--card-bg);
  cursor: pointer;
  position: relative;
  padding: 2px;
}
.cal-cell-empty { border: none; background: transparent; cursor: default; }
.cal-cell-today { border-color: var(--ink); border-width: 2px; }
.cal-cell-selected { background: var(--accent); border-color: var(--accent); }
.cal-cell-selected .cal-day-num, .cal-cell-selected .cal-day-amt { color: #fff; }
.cal-cell-high:not(.cal-cell-selected) { background: #FBE4D5; border-color: #E4A87A; }
body.theme-dark .cal-cell-high:not(.cal-cell-selected) { background: #3D2515; border-color: #8A5230; }
.cal-day-num { font-size: 11px; font-weight: 600; color: var(--ink); }
.cal-day-amt { font-family: 'JetBrains Mono', monospace; font-size: 8.5px; color: var(--muted); }
.cal-cell-selected .cal-day-amt { color: rgba(255,255,255,0.85); }
.cal-recur-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4A6FA5;
}
.cal-cell-selected .cal-recur-dot { background: #fff; }

.cal-legend {
  display: flex;
  gap: 16px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
}
.cal-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.cal-legend-high { background: #E4A87A; }
.cal-legend-recur { background: #4A6FA5; }

.cal-day-detail {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.cal-day-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
}
.cal-day-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  width: 24px;
  height: 24px;
}

/* ============================================================
   Undo toast (swipe-to-delete / delete confirmation)
   ============================================================ */
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 78px; /* clears the bottom tab bar */
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 12px 10px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
}
.undo-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.undo-toast-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.undo-toast-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--accent, #6fa8ff);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  cursor: pointer;
  padding: 4px 6px;
}
.undo-toast-btn:hover { text-decoration: underline; }
body.rtl .undo-toast { padding: 10px 16px 10px 12px; }

/* ============================================================
   Subscription Manager (Phase 3)
   ============================================================ */
.subs-wrap { display: flex; flex-direction: column; }
.subs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.subs-header-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.3px;
  color: var(--muted);
}
.subs-header-total { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted); }
.subs-header-amt { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 15px; color: var(--ink); }

.subs-list { display: flex; flex-direction: column; gap: 6px; }
.sub-row {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.sub-row-main { display: flex; flex-direction: column; gap: 4px; }
.sub-row-top { display: flex; justify-content: space-between; align-items: center; }
.sub-row-name { font-size: 13.5px; font-weight: 500; }
.sub-row-cost { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13.5px; color: var(--accent); }
.sub-row-bottom { display: flex; justify-content: space-between; align-items: center; }
.sub-row-due { font-size: 10.5px; color: var(--muted); }
.sub-row-cancel {
  border: none;
  background: transparent;
  color: #A32D1F;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
body.theme-dark .sub-row-cancel { color: #E8935C; }
.sub-row-cancel:hover { text-decoration: underline; }

.subs-annual-hint {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--paper-dim);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.4;
  text-align: center;
}

/* ============================================================
   Financial Goals (Phase 3)
   ============================================================ */
.goals-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.goal-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.goal-card.goal-complete { border-color: #3D8B6E; }
.goal-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.goal-card-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.goal-delete-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.goal-delete-btn:hover { color: #C0392B; }
.goal-card-amounts { display: flex; align-items: baseline; gap: 4px; margin-bottom: 8px; }
.goal-current { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 20px; color: var(--ink); }
.goal-target { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted); }
.goal-progress-track { margin-bottom: 6px; }
.goal-progress-fill { background: var(--accent); }
.goal-card-bottom { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.goal-progress-pct { font-weight: 700; }

.goal-contribute-form {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.goal-contribute-form .goal-contribute-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.goal-contribute-form button[type="submit"] {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.goal-add-btn {
  width: 100%;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--accent);
  border-radius: 8px;
  padding: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.add-goal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.add-goal-form input[type="text"],
.add-goal-form input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.add-goal-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.add-goal-form-actions button[type="submit"] {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   Financial Health score card (Phase 3)
   ============================================================ */
.health-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.health-card-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.health-score-ring {
  --ring-color: var(--accent);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--paper-dim) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.health-score-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--card-bg);
}
.health-score-num {
  position: relative;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
}
.health-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-bottom: 2px;
}
.health-card-band { font-size: 16px; font-weight: 700; color: var(--ink); }
.health-band-excellent .health-score-ring { --ring-color: #3D8B6E; }
.health-band-good .health-score-ring { --ring-color: #6FA8DC; }
.health-band-fair .health-score-ring { --ring-color: #D4A62E; }
.health-band-needsAttention .health-score-ring { --ring-color: #C0392B; }

.health-factors { display: flex; flex-direction: column; gap: 8px; }
.health-factor-row { display: flex; align-items: center; gap: 10px; }
.health-factor-label { font-size: 11px; color: var(--muted); width: 110px; flex-shrink: 0; }
.health-factor-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--paper-dim);
  overflow: hidden;
}
.health-factor-fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* ============================================================
   Command Palette / AI Assistant (Phase 4)
   ============================================================ */
.palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 16px;
}
.palette-modal {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 440px;
  padding: 14px;
  max-height: 80vh;
  overflow-y: auto;
}
.palette-mode-switch {
  display: flex;
  gap: 4px;
  background: var(--paper-dim);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.palette-mode-btn {
  flex: 1;
  padding: 7px 6px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.palette-mode-btn.active { background: var(--card-bg); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.palette-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  margin-bottom: 10px;
}
.palette-result:not(:empty) { margin-bottom: 6px; }

.palette-not-understood { font-size: 12.5px; color: var(--muted); line-height: 1.5; padding: 8px 2px; }

.palette-confirm {
  background: var(--paper-dim);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.palette-confirm-row { display: flex; justify-content: space-between; font-size: 13px; }
.palette-confirm-row span { color: var(--muted); }
.palette-missing { color: #C0392B; font-style: normal; font-weight: 600; }
body.theme-dark .palette-missing { color: #E8935C; }
.palette-confirm-btn {
  margin-top: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.palette-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.palette-answer {
  background: var(--paper-dim);
  border-radius: 8px;
  padding: 12px;
}
.palette-answer-kind {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.palette-kind-data { background: #E4EFEA; color: #2D6A4F; }
.palette-kind-calculation { background: #E4EAF5; color: #3B4E9C; }
.palette-kind-estimate { background: #F5EEDD; color: #8A6410; }
.palette-kind-recommendation { background: #F5E4E0; color: #A14F1F; }
body.theme-dark .palette-kind-data { background: #1E3229; color: #6FBE9E; }
body.theme-dark .palette-kind-calculation { background: #202840; color: #8FA3E8; }
body.theme-dark .palette-kind-estimate { background: #3A2E10; color: #E8C05C; }
body.theme-dark .palette-kind-recommendation { background: #3D2515; color: #E8935C; }
.palette-answer-text { font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.palette-answer-action {
  margin-top: 8px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.palette-examples { margin-top: 4px; }
.palette-examples-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-bottom: 6px;
}
.palette-example-chip {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 6px 11px;
  font-size: 11.5px;
  margin: 0 5px 5px 0;
  cursor: pointer;
}
body.rtl .palette-example-chip { margin: 0 0 5px 5px; }
.palette-example-chip:hover { background: var(--paper-dim); }

/* ============================================================
   Recommendations (Home) + Monthly Summary card (Insights)
   ============================================================ */
.recs-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.rec-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--paper-dim);
  border-radius: 8px;
  padding: 11px 13px;
}
.rec-row-icon { font-size: 14px; flex-shrink: 0; }
.rec-row-body { flex: 1; }
.rec-row-text { font-size: 13px; line-height: 1.4; color: var(--ink); }
.rec-row-action {
  margin-top: 6px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.summary-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-bottom: 10px;
}
.summary-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.summary-line:last-child { margin-bottom: 0; }
.summary-line-kind {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 3px;
}
.summary-line-text { font-size: 13px; line-height: 1.4; color: var(--ink); }

/* ============================================================
   Onboarding (Phase 5)
   ============================================================ */
.onboarding-card { max-width: 340px; }
.onboarding-subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  margin: -4px 0 16px;
}
.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}
.onboarding-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}
.onboarding-dot.active { background: var(--accent); width: 18px; border-radius: 3px; }

.onboarding-currency-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.onboarding-currency-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
}
body.rtl .onboarding-currency-btn { text-align: right; }
.onboarding-currency-btn.selected { border-color: var(--accent); background: var(--paper-dim); }
.onboarding-currency-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 15px;
  width: 28px;
  text-align: center;
  color: var(--ink);
  flex-shrink: 0;
}
.onboarding-currency-label { font-size: 13.5px; color: var(--ink); }

.onboarding-field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
}
.onboarding-field-label:first-child { margin-top: 0; }

.onboarding-category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  max-height: 280px;
  overflow-y: auto;
}
.onboarding-category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}
.onboarding-category-row:hover { background: var(--paper-dim); }
.onboarding-category-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }

/* ============================================================
   PIN lock toggle inline confirmation (Settings)
   ============================================================ */
.recur-checkbox-row-disabled { opacity: 0.5; cursor: not-allowed; }
.recur-checkbox-row-disabled input[type="checkbox"] { cursor: not-allowed; }
.pin-lock-confirm-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: var(--paper-dim);
  border-radius: 8px;
}
.pin-lock-confirm-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 2px;
}
.pin-lock-warn { color: #A32D1F; margin-bottom: 2px; }
body.theme-dark .pin-lock-warn { color: #E8935C; }
.pin-lock-form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }


/* Ledger V6 — subcategory controls, preserving the existing visual language */
.subcategory-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.subcategory-chip{display:inline-flex;align-items:center;gap:4px;padding:4px 8px;border:1px solid var(--border,#ddd);border-radius:999px;font-size:12px;opacity:.9}
.subcategory-chip button{border:0;background:transparent;padding:0;cursor:pointer;font-size:14px;line-height:1}
.subcategory-add-form{display:flex;gap:6px;margin-top:8px;max-width:360px}
.subcategory-add-form input{min-width:0;flex:1}

/* V8 subcategory display */
.receipt-subcategory{opacity:.65;font-size:.86em;margin-inline-start:4px}
