:root {
  --bg: #fafaf9;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f4;
  --bg-modal: #ffffff;
  --text: #0f0f0f;
  --text-2: #57534e;
  --text-3: #a8a29e;
  --border: #e7e5e4;
  --accent: #ef4444;
  --accent-soft: #fef2f2;
  --accent-text: #991b1b;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --green-text: #166534;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-text: #92400e;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --blue-text: #1e40af;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'DM Mono', monospace;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222;
  --bg-modal: #1a1a1a;
  --text: #fafaf9;
  --text-2: #a8a29e;
  --text-3: #57534e;
  --border: #2a2a2a;
  --accent-soft: #2a1515;
  --accent-text: #fca5a5;
  --green-soft: #0a200e;
  --green-text: #86efac;
  --amber-soft: #1f1a0a;
  --amber-text: #fcd34d;
  --blue-soft: #0a1628;
  --blue-text: #93c5fd;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 90px;
  position: relative;
  z-index: 1;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.pro-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon:hover { background: var(--bg-card-hover); }

.header-right { display: flex; gap: 8px; }

#toggleNotif { position: relative; }
#toggleNotif .bell-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
  opacity: 0;
  transition: opacity 0.2s;
}
#toggleNotif.active .bell-dot { opacity: 1; }
#toggleNotif.active { color: var(--accent); border-color: var(--accent); }

/* ── Notification modal ── */
.notif-blurb {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 18px;
}

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.notif-row:first-of-type { border-top: none; padding-top: 0; }

.notif-row-label { font-size: 14px; font-weight: 500; color: var(--text); }
.notif-row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.notif-hint {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--amber-text);
  font-size: 12px;
  line-height: 1.5;
}

/* ── Switch toggle ── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: 0.4; cursor: not-allowed; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-main { grid-column: 1 / -1; position: relative; overflow: hidden; }
.stat-main .stat-value { font-size: 36px; color: var(--accent); position: relative; z-index: 1; }

/* Sparkline overlay on the main stat card */
.sparkline {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 130px;
  height: 36px;
  opacity: 0.9;
  pointer-events: none;
}
.sparkline path { transition: d 0.4s ease; }
@media (max-width: 380px) {
  .sparkline { width: 100px; height: 28px; }
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
}

/* ── Streak Card ── */
.streak-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.streak-header { display: flex; justify-content: space-between; align-items: center; }
.streak-info { display: flex; align-items: baseline; gap: 6px; }
.streak-count { font-size: 24px; font-weight: 700; color: var(--accent); }
.streak-label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.streak-icon { font-size: 20px; }
.streak-body { display: flex; flex-direction: column; gap: 10px; }
.streak-body p { font-size: 13px; color: var(--text-3); }
.btn-streak {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.alert-card {
  background: var(--amber-soft);
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--amber-text);
  animation: slideIn 0.3s ease;
}

.alert-card svg { flex-shrink: 0; margin-top: 1px; }
.alert-card strong { font-weight: 600; }
.alert-card.alert-danger {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.categories {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.categories::-webkit-scrollbar { display: none; }

.cat-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.cat-btn:hover { border-color: var(--text-3); }
.cat-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

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

.sub-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideIn 0.3s ease;
}

.sub-item-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.19, 1, 0.22, 1), background 0.15s;
  position: relative;
  z-index: 2;
}

.sub-item-content:hover { background: var(--bg-card-hover); }
.sub-item:active .sub-item-content { transform: scale(0.99); }

/* Swipe-to-delete red background revealed under the row */
.sub-swipe-bg {
  position: absolute;
  inset: 0;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 24px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius);
  z-index: 1;
  cursor: pointer;
}
.sub-swipe-bg span {
  opacity: 0;
  transition: opacity 0.15s;
}
.sub-item.swiped-partial .sub-swipe-bg span,
.sub-item.swiped .sub-swipe-bg span { opacity: 1; }

.sub-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.sub-icon.branded {
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  font-family: var(--font);
}
[data-theme="dark"] .sub-icon.branded {
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.sub-info { flex: 1; min-width: 0; }
.sub-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }

.sub-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-trial { background: var(--amber-soft); color: var(--amber-text); }
.badge-due { background: var(--accent-soft); color: var(--accent-text); }
.badge-paused { background: var(--bg-card-hover); color: var(--text-3); }
.badge-zombie { background: #44403c; color: #fafaf9; }
[data-theme="dark"] .badge-zombie { background: #a8a29e; color: #0f0f0f; }

.sub-item.is-paused .sub-item-content { opacity: 0.55; }
.sub-item.is-paused .sub-amount { text-decoration: line-through; text-decoration-color: var(--text-3); }

.sub-price { text-align: right; flex-shrink: 0; }
.sub-amount { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.sub-amount-converted {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 1px;
}

.sub-cycle { font-size: 11px; color: var(--text-3); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state p { margin-top: 12px; font-weight: 500; }
.empty-sub { font-size: 13px; margin-top: 4px !important; }

.fab {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: calc(50% - 260px + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(239,68,68,0.4);
  transition: all 0.2s;
  z-index: 50;
}

.fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(239,68,68,0.5); }
.fab:active { transform: scale(0.95); }

@media (max-width: 552px) {
  .fab { right: 20px; }
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-btn {
  flex: 1;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 12px 12px;
  background: none;
  border: none;
  color: var(--text-3);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-btn:hover { color: var(--text-2); }
.nav-btn.active { color: var(--accent); }
.nav-btn svg { opacity: 0.9; }

.bottom-actions {
  display: none; /* legacy — replaced by menu modal */
}

/* ── Insights view ── */
.insight-hero {
  background: linear-gradient(135deg, var(--accent), #dc2626);
  color: white;
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(239,68,68,0.2);
}
.insight-hero-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  opacity: 0.85;
}
.insight-hero-value {
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 700;
  margin: 6px 0 2px;
}
.insight-hero-sub { font-size: 13px; opacity: 0.85; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  height: 120px;
  gap: 6px;
}
.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), rgba(239,68,68,0.4));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.chart-bar-label {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
}
.chart-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-3);
}
.chart-foot span:last-child { color: var(--text); font-family: var(--mono); font-weight: 600; }

/* ── Category breakdown ── */
.cat-breakdown { display: flex; flex-direction: column; gap: 14px; }
.cat-bar-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}
.cat-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.cat-dot { width: 10px; height: 10px; border-radius: 50%; }
.cat-bar-amount {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}
.cat-bar-pct {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font);
  font-weight: 500;
}
.cat-bar-track {
  height: 6px;
  background: var(--bg-card-hover);
  border-radius: 3px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ── Suggestions ── */
.suggestions { margin-bottom: 16px; }
.suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: slideIn 0.3s ease;
}
.suggestion-card.sev-high { border-color: var(--accent); background: var(--accent-soft); }
.suggestion-card.sev-medium { border-color: var(--amber); background: var(--amber-soft); }
.suggestion-icon { font-size: 22px; line-height: 1; }
.suggestion-body { flex: 1; }
.suggestion-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.suggestion-text { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.suggestion-text strong { color: var(--text); font-family: var(--mono); }

.empty-state-mini {
  text-align: center;
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-3);
}

/* ── Share CTA ── */
.share-cta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.share-cta-text { flex: 1; }
.share-cta-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.share-cta-text span { font-size: 12px; color: var(--text-3); }

/* ── Menu modal ── */
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-row {
  background: transparent;
  border: none;
  text-align: left;
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font);
  color: var(--text);
  width: 100%;
}
.menu-row:hover { background: var(--bg-card-hover); }
.menu-row-main { display: flex; align-items: center; gap: 14px; flex: 1; }
.menu-row-icon { font-size: 22px; line-height: 1; width: 28px; text-align: center; }
.menu-row-label { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.menu-row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.menu-row-danger .menu-row-label { color: var(--accent); }
.menu-row svg { color: var(--text-3); }

.menu-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── Pro modal ── */
.pro-hero {
  text-align: center;
  padding: 14px 0 18px;
}
.pro-price {
  font-family: var(--mono);
  font-size: 54px;
  font-weight: 700;
  color: var(--accent);
}
.pro-price span {
  font-size: 18px;
  color: var(--text-3);
  font-weight: 500;
}
.pro-price-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.pro-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}
.pro-features li {
  padding: 8px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.pro-features li:last-child { border-bottom: none; }
.pro-features li > span:first-child {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.pro-note {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 8px;
}

.pro-error {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.pro-active-hero { text-align: center; padding: 8px 0 18px; }
.pro-active-icon { font-size: 48px; }
.pro-active-hero h3 { font-size: 20px; margin: 6px 0 4px; }
.pro-active-hero p { font-size: 13px; color: var(--text-2); }

.pro-key-display {
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.pro-key-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.pro-key-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

a.btn-primary {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Import modal ── */
.import-blurb {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 14px;
}
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
}
.form-group textarea:focus { outline: none; border-color: var(--accent); }

.import-preview-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 16px 0 8px;
}
.import-preview-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.import-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
}
.import-row .sub-icon { width: 34px; height: 34px; font-size: 14px; }
.import-row-info { flex: 1; min-width: 0; }
.import-row-name { font-size: 14px; font-weight: 600; }
.import-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green-text);
  border-radius: 4px;
}
.import-row-meta { font-size: 12px; color: var(--text-3); }
.import-row-price {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
}
.import-row-price span {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font);
}

/* ── Share modal ── */
.share-preview {
  background: var(--bg-card-hover);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}
.share-preview canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.share-note {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 8px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  max-width: 90%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Onboarding ── */
.onboard-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.onboard-card {
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.onboard-step { animation: fadeIn 0.3s ease; }
.onboard-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: inline-block;
  animation: bounce 1.5s ease infinite;
}
.onboard-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.onboard-card p { font-size: 14px; color: var(--text-2); line-height: 1.55; margin-bottom: 24px; }
.onboard-card .btn-primary { width: 100%; padding: 12px; font-size: 15px; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { background: var(--bg-card-hover); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-modal);
  border-radius: 20px 20px 16px 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 { font-size: 18px; font-weight: 600; }

.presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.preset {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.preset:hover { transform: scale(1.08); }

.form-divider {
  text-align: center;
  margin: 16px 0;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--accent);
}

.form-row { display: flex; gap: 10px; }
.flex-1 { flex: 1; }

.input-prefix {
  position: relative;
}
.input-prefix .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
}
/* Override the generic .form-group input padding (which has higher specificity)
   so the currency/unit prefix doesn't overlap the input value. 48px fits the
   widest symbol we ship ("Mex$"); single-char ones look fine in the breathing room. */
.form-group .input-prefix input[type="number"],
.form-group .input-prefix input[type="text"] {
  padding-left: 36px;
}

.input-with-currency {
  display: flex;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.2s;
}

.input-with-currency:focus-within {
  border-color: var(--accent);
}

.currency-select-inline {
  background: var(--bg-card-hover);
  border: none !important;
  border-right: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 0 8px !important;
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  width: auto !important;
  color: var(--text-2) !important;
  cursor: pointer;
}

.input-with-currency input {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 10px 12px !important;
  margin: 0 !important;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  align-items: center;
}

.btn-primary {
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn-danger {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.currency-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 8px;
}

.currency-btn {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.currency-btn:hover { background: var(--bg-card-hover); border-color: var(--accent); }

/* ── Language picker ── */
.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 8px;
}
.lang-btn {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: all 0.15s;
}
.lang-btn:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.lang-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.lang-flag { font-size: 20px; line-height: 1; }

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.search-bar svg { color: var(--text-3); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}
.search-bar input::placeholder { color: var(--text-3); }
.search-clear {
  background: var(--bg-card-hover);
  border: none;
  color: var(--text-2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.search-clear:hover { background: var(--accent-soft); color: var(--accent-text); }

/* ── Cancel-this-sub link ── */
.btn-cancel-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  width: 100%;
  text-align: center;
  justify-content: center;
}
.btn-cancel-link::before {
  content: '↗';
  font-size: 14px;
}
.btn-cancel-link:hover { background: var(--accent); color: white; }

/* ── Year-end report ── */
.year-modal { max-width: 460px; }
.yearend-slide {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: white;
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: 0 10px 32px rgba(239,68,68,0.25);
  position: relative;
  overflow: hidden;
}
.yearend-slide::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.yearend-slide::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -30px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.yearend-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}
.yearend-value {
  font-family: var(--mono);
  font-size: 52px;
  font-weight: 700;
  margin: 8px 0 4px;
  position: relative;
  z-index: 1;
  letter-spacing: -1px;
  animation: countUp 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}
@keyframes countUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.yearend-sub { font-size: 14px; opacity: 0.85; position: relative; z-index: 1; }

.yearend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.yearend-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
}
.yearend-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.yearend-card-value {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}
.yearend-card-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
}

.yearend-count {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  padding: 8px 0;
}

.yearend-empty-icon {
  font-size: 56px;
  text-align: center;
  padding: 20px 0 8px;
}
#yearendEmpty h3 {
  text-align: center;
  font-size: 18px;
  margin-bottom: 6px;
}
#yearendEmpty p {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  padding: 0 20px 12px;
}

/* ── Savings Goal (Piggy Bank) ── */
.goal-card {
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.goal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.goal-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(236, 72, 153, 0.1);
  border-radius: var(--radius-sm);
}
.goal-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}
.goal-progress-wrap {
  margin-bottom: 12px;
}
.goal-progress-bar {
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.goal-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.goal-progress-text {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
.goal-estimate {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid #10b981;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}
.goal-estimate strong {
  color: #059669;
}

/* ── Backup & Restore cards ── */
.backup-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card-hover);
  border-radius: var(--radius);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.backup-card-icon {
  font-size: 28px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.backup-card-body { flex: 1; min-width: 160px; }
.backup-card-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.backup-card-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.backup-card .btn-primary,
.backup-card .btn-outline {
  padding: 8px 16px;
  font-size: 13px;
}

/* ── Autocomplete suggestions ── */
.suggest-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
  animation: fadeIn 0.15s ease;
}
.suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--bg-card-hover); }
.suggest-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.suggest-name { flex: 1; font-size: 14px; font-weight: 500; }
.suggest-price {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
}
.suggest-price span { font-size: 11px; color: var(--text-3); font-family: var(--font); }

/* ── Tracked since label ── */
.tracked-since {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  padding: 6px 0;
  font-style: italic;
}

/* ── Donut chart ── */
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px 0 14px;
}
.donut {
  width: 160px;
  height: 160px;
  transform: rotate(0deg);
}
.donut circle {
  transition: stroke-dasharray 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}
.donut-center-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-3);
  text-transform: uppercase;
}
.donut-center-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

/* ── Income ratio card ── */
.ratio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 10px;
}
.ratio-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-card-hover);
  border-radius: 5px;
  overflow: hidden;
}
.ratio-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
.ratio-fill.sentiment-fine { background: var(--green); }
.ratio-fill.sentiment-high { background: var(--amber); }
.ratio-fill.sentiment-crisis { background: var(--accent); }
.ratio-value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.ratio-sentiment {
  font-size: 13px;
  font-weight: 500;
}
.ratio-sentiment.sentiment-fine { color: var(--green); }
.ratio-sentiment.sentiment-high { color: var(--amber); }
.ratio-sentiment.sentiment-crisis { color: var(--accent); }

/* Textarea inside add modal */
#subNotes {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
  min-height: 50px;
}
#subNotes:focus { outline: none; border-color: var(--accent); }

/* ── Star rating ── */
.star-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}
.star-rating .star {
  background: none;
  border: none;
  color: var(--border);
  font-size: 28px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
}
.star-rating .star:hover,
.star-rating .star.filled { color: #f59e0b; }
.star-rating .star:active { transform: scale(1.2); }
.star-rating .star-clear {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 20px;
  margin-left: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
}
.star-rating .star-clear:hover { background: var(--bg-card-hover); color: var(--text-2); }

/* ── Forecast widget ── */
.forecast-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.forecast-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.forecast-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.forecast-total {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.forecast-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ── Cancelled subs modal ── */
.cancelled-hero {
  text-align: center;
  padding: 18px 12px 14px;
  background: linear-gradient(135deg, var(--green-soft), transparent);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.cancelled-savings {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--green-text);
  letter-spacing: -0.5px;
}
.cancelled-savings-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 4px;
}
.cancelled-thisyear {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
}

.cancelled-list { max-height: 320px; overflow-y: auto; }
.activity-day { margin-bottom: 24px; }
.activity-day-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--bg-card-hover);
  flex-shrink: 0;
}
.event-added { background: rgba(16, 185, 129, 0.1); color: #059669; }
.event-edited { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.event-cancelled { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.event-paused { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.event-resumed { background: rgba(16, 185, 129, 0.1); color: #059669; }
.activity-text { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.activity-time { font-size: 12px; color: var(--text-3); font-family: var(--mono); }

/* ── What-If Hero ── */
.whatif-hero {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 28px 24px;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px rgba(37,99,235,0.2);
}
.whatif-savings {
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -1px;
}
.whatif-summary { font-size: 14px; opacity: 0.9; }
.whatif-invested {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  backdrop-filter: blur(4px);
}
.cancelled-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.cancelled-row:last-child { border-bottom: none; }
.cancelled-info { flex: 1; min-width: 0; }
.cancelled-name { font-size: 14px; font-weight: 600; }
.cancelled-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cancelled-actions { display: flex; gap: 6px; }
.cancelled-restore, .cancelled-purge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: all 0.15s;
}
.cancelled-restore:hover { background: var(--green-soft); color: var(--green-text); border-color: var(--green); }
.cancelled-purge:hover { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }

/* ── Theme picker ── */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.theme-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.theme-btn:hover { background: var(--bg-card-hover); border-color: var(--text-3); }
.theme-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.theme-icon { font-size: 28px; line-height: 1; }

/* ── Lowest-rated subs (insights) ── */
.chart-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: -8px;
  margin-bottom: 12px;
}
.lowest-list { display: flex; flex-direction: column; gap: 6px; }
.lowest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
}
.lowest-info { flex: 1; min-width: 0; }
.lowest-name { font-size: 14px; font-weight: 600; }
.lowest-stars { font-size: 13px; color: #f59e0b; }
.lowest-price {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
}
.lowest-price span { font-size: 11px; color: var(--text-3); font-family: var(--font); }

/* ── Field note ── */
.field-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Lifetime cost card (in edit modal) ── */
.lifetime-card {
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  animation: slideIn 0.3s ease;
}
.lifetime-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.lifetime-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-text);
}
.lifetime-value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 28px;
  color: var(--accent);
}
.lifetime-since {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.lifetime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.lifetime-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.lifetime-cell.green { border-color: var(--green); background: var(--green-soft); }
.lifetime-cell-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.lifetime-cell.green .lifetime-cell-label { color: var(--green-text); opacity: 0.8; }
.lifetime-cell-val {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
}
.lifetime-cell.green .lifetime-cell-val { color: var(--green-text); }
.lifetime-invest {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.lifetime-invest-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-text);
  margin-bottom: 2px;
}
.lifetime-invest-note {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* Lifetime aggregate card (insights view) */
.lifetime-aggregate { text-align: center; }
.lifetime-agg-value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 32px;
  color: var(--accent);
  padding: 10px 0 4px;
}

/* ── Playbook card ── */
.playbook-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
  animation: slideIn 0.3s ease;
}
.playbook-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.playbook-icon { font-size: 20px; }
.playbook-title-text {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}
.playbook-meta { display: flex; gap: 8px; align-items: center; }
.playbook-diff {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.playbook-diff.diff-easy { background: var(--green-soft); color: var(--green-text); }
.playbook-diff.diff-medium { background: var(--amber-soft); color: var(--amber-text); }
.playbook-diff.diff-hard { background: var(--accent-soft); color: var(--accent-text); }
.playbook-time {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
}
.playbook-steps {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.playbook-steps li {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}

/* ── Visual calendar ── */
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}
.cal-nav-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.calendar-title {
  font-size: 15px;
  font-weight: 600;
  text-transform: capitalize;
}
.calendar-grid { display: flex; flex-direction: column; gap: 2px; }
.cal-weekdays, .cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-weekday {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-cell {
  aspect-ratio: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  font-family: var(--font);
  color: var(--text);
  position: relative;
  padding: 0;
}
.cal-cell-empty { visibility: hidden; }
.cal-cell.has-renewals {
  cursor: pointer;
  background: var(--bg-card-hover);
  border-color: var(--border);
}
.cal-cell.has-renewals:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cal-cell.is-today {
  background: var(--accent);
  color: white;
  font-weight: 700;
}
.cal-cell.is-today.has-renewals {
  background: var(--accent);
  border-color: var(--accent);
}
.cal-day-num {
  font-size: 13px;
  font-weight: 500;
}
.cal-cell.is-today .cal-day-num { font-weight: 700; }
.cal-dot {
  position: absolute;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-cell.is-today .cal-dot { background: white; }
.calendar-sub {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}
.calendar-day-detail {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  animation: slideIn 0.2s ease;
}
.cal-detail-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.cal-detail-list { display: flex; flex-direction: column; gap: 6px; }
.cal-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cal-detail-name { flex: 1; font-size: 13px; font-weight: 500; }
.cal-detail-price {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
}

/* ── Bank import suggestions ── */
.bank-format-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}
.bank-found {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.bank-suggestion-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.bank-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.bank-row .sub-icon { width: 32px; height: 32px; font-size: 13px; }
.bank-row-info { flex: 1; min-width: 0; }
.bank-row-name { font-size: 14px; font-weight: 600; }
.bank-row-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.bank-row-price { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.bank-row-price span { font-size: 10px; color: var(--text-3); font-family: var(--font); }

/* ── Savings goal ── */
.goal-progress-wrap { padding: 4px 0 6px; }
.goal-progress-bar {
  height: 14px;
  background: var(--bg-card-hover);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 8px;
}
.goal-progress-fill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--green), #22c55e);
  transition: width 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}
.goal-progress-text {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
}

/* ── Bundle suggestions ── */
.bundle-card {
  background: linear-gradient(135deg, var(--green-soft), transparent);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.bundle-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.bundle-title { font-weight: 700; font-size: 14px; color: var(--text); }
.bundle-save {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--green-text);
}
.bundle-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.bundle-stat-new { font-weight: 600; color: var(--green-text); }
.bundle-replaces {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.bundle-note {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  line-height: 1.4;
}

/* ── Empty state actions ── */
.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
}
.empty-actions .btn-primary,
.empty-actions .btn-outline {
  width: 240px;
  max-width: 100%;
  padding: 12px 16px;
  font-size: 14px;
}

/* ── Health score card ── */
.health-card { padding: 18px; }
.health-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 0 4px;
}
.health-grade {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 44px;
  color: white;
  flex-shrink: 0;
  letter-spacing: -2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.health-grade.grade-a { background: linear-gradient(135deg, #22c55e, #16a34a); }
.health-grade.grade-b { background: linear-gradient(135deg, #84cc16, #65a30d); }
.health-grade.grade-c { background: linear-gradient(135deg, #f59e0b, #d97706); }
.health-grade.grade-d { background: linear-gradient(135deg, #fb923c, #ea580c); }
.health-grade.grade-f { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.health-detail { flex: 1; min-width: 0; }
.health-score {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.health-advice {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

/* ── Tour overlay ── */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.tour-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.tour-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  pointer-events: none;
}
.tour-spotlight {
  position: fixed;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.75), 0 0 24px rgba(255,255,255,0.2);
  transition: top 0.4s cubic-bezier(0.19, 1, 0.22, 1),
              left 0.4s cubic-bezier(0.19, 1, 0.22, 1),
              width 0.4s cubic-bezier(0.19, 1, 0.22, 1),
              height 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  pointer-events: none;
}
.tour-card {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  z-index: 501;
  transition: top 0.3s ease, left 0.3s ease;
}
.tour-progress {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.tour-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.tour-body {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 16px;
}
.tour-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.tour-skip {
  background: none;
  border: none;
  color: var(--text-3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
}
.tour-skip:hover { color: var(--text-2); }
.tour-next {
  background: var(--accent);
  border: none;
  color: white;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tour-next:hover { opacity: 0.9; }

/* ── Confetti animation ── */
.confetti-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 250;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  opacity: 0;
}
@keyframes confetti-fall {
  0% {
    transform: translate(0, -20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--horiz), 100vh) rotate(var(--rot));
    opacity: 0;
  }
}

/* ── Alternatives card ── */
.alt-card {
  background: linear-gradient(135deg, var(--blue-soft), transparent);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
  animation: slideIn 0.3s ease;
}
.alt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.alt-icon { font-size: 18px; }
.alt-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--blue-text);
}
.alt-list { display: flex; flex-direction: column; gap: 10px; }
.alt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}
.alt-row-main { flex: 1; min-width: 0; }
.alt-row-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.alt-row-why { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.alt-row-price {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  text-align: right;
}
.alt-row-price span { font-size: 10px; color: var(--text-3); font-family: var(--font); }
.alt-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.alt-badge.alt-cheaper { background: var(--green-soft); color: var(--green-text); }
.alt-badge.alt-free { background: var(--accent-soft); color: var(--accent-text); }

/* ── Command palette ── */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 600;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 100px 16px 16px;
}
.palette-overlay.active { display: flex; }
.palette {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  overflow: hidden;
  animation: paletteIn 0.18s cubic-bezier(0.19, 1, 0.22, 1);
}
@keyframes paletteIn {
  from { transform: translateY(-12px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.palette-input-wrap .palette-icon { color: var(--text-3); flex-shrink: 0; }
.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
}
.palette-input::placeholder { color: var(--text-3); }
.palette-kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}
.palette-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px 0;
}
.palette-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
}
.palette-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.palette-result:hover,
.palette-result.active { background: var(--bg-card-hover); }
.palette-result-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 14px;
}
.palette-icon-generic {
  background: var(--bg-card-hover);
  color: var(--text-2);
}
.palette-result-label { flex: 1; font-weight: 500; }
.palette-result-hint { font-size: 11px; color: var(--text-3); }

/* ── Shortcuts help overlay ── */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 550;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.shortcuts-overlay.active { display: flex; }
.shortcuts-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  animation: paletteIn 0.18s cubic-bezier(0.19, 1, 0.22, 1);
}
.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.shortcuts-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.shortcut-label {
  font-size: 13px;
  color: var(--text-2);
}
.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}
.shortcut-keys kbd {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 22px;
  text-align: center;
}
.kbd-plus { color: var(--text-3); font-size: 11px; }

/* ── Spending personality ── */
.personality-card {
  background: linear-gradient(135deg, var(--blue-soft), transparent);
  border-color: var(--blue);
}
.personality-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0 2px;
}
.personality-icon {
  font-size: 56px;
  line-height: 1;
  flex-shrink: 0;
  width: 72px;
  text-align: center;
}
.personality-detail { flex: 1; min-width: 0; }
.personality-label {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--blue-text);
}
.personality-tag {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}

/* ── Public benchmarks ── */
.bench-card {
  background: linear-gradient(135deg, var(--amber-soft), transparent);
  border-color: var(--amber);
}
.bench-body { padding: 6px 0 4px; }
.bench-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 12px;
}
.bench-label {
  font-size: 13px;
  color: var(--text-2);
}
.bench-verdict {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.bench-verdict.verdict-lower { background: var(--green-soft); color: var(--green-text); }
.bench-verdict.verdict-average { background: var(--bg-card-hover); color: var(--text-2); }
.bench-verdict.verdict-higher { background: var(--amber-soft); color: var(--amber-text); }
.bench-verdict.verdict-much-higher { background: var(--accent-soft); color: var(--accent-text); }
.bench-percentile {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  margin-top: 6px;
}

/* ── Activity log ── */
.activity-day {
  margin-bottom: 18px;
}
.activity-day-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
}
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--bg-card-hover);
  color: var(--text-2);
}
.activity-icon.event-added { background: var(--green-soft); color: var(--green-text); }
.activity-icon.event-cancelled { background: var(--accent-soft); color: var(--accent-text); }
.activity-icon.event-paused { background: var(--amber-soft); color: var(--amber-text); }
.activity-icon.event-resumed { background: var(--blue-soft); color: var(--blue-text); }
.activity-icon.event-restored { background: var(--green-soft); color: var(--green-text); }
.activity-icon.event-deleted { background: var(--accent-soft); color: var(--accent-text); }
.activity-icon.event-imported { background: var(--blue-soft); color: var(--blue-text); }
.activity-text { flex: 1; font-size: 13px; color: var(--text); }
.activity-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ── Sub notes inline on home list ── */
.sub-notes {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── What-If calculator modal ── */
.whatif-hero {
  background: linear-gradient(135deg, var(--green-soft), transparent);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  margin-bottom: 14px;
}
.whatif-savings {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  color: var(--green-text);
  letter-spacing: -1px;
  line-height: 1.1;
}
.whatif-savings-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
}
.whatif-invest-note {
  font-size: 12px;
  color: var(--green-text);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--green);
}

.whatif-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.whatif-actions button {
  flex: 1;
  font-size: 12px;
  padding: 8px;
}

.whatif-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.whatif-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
}
.whatif-row:hover { background: var(--bg-card-hover); }
.whatif-row.whatif-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  opacity: 0.75;
}
.whatif-row.whatif-selected .whatif-name {
  text-decoration: line-through;
  color: var(--text-3);
}
.whatif-row .sub-icon { width: 32px; height: 32px; font-size: 13px; }
.whatif-info { flex: 1; min-width: 0; }
.whatif-name { font-size: 14px; font-weight: 600; }
.whatif-meta { font-size: 12px; color: var(--text-3); }
.whatif-check {
  font-size: 18px;
  color: var(--text-3);
  font-weight: 700;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.whatif-row.whatif-selected .whatif-check { color: var(--accent); }

/* ── Sub tags (chips on home list) ── */
.sub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.sub-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-card-hover);
  color: var(--text-2);
  border: 1px solid var(--border);
  letter-spacing: 0.2px;
}

/* ── Inflation cells (amber tone) ── */
.lifetime-inflation {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.lifetime-cell.amber {
  background: var(--amber-soft);
  border-color: var(--amber);
}
.lifetime-cell.amber .lifetime-cell-label { color: var(--amber-text); opacity: 0.85; }
.lifetime-cell.amber .lifetime-cell-val { color: var(--amber-text); }

/* ── Compare modal ── */
.compare-pick-prompt {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.compare-pick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.compare-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
}
.compare-pick:hover { background: var(--bg-card-hover); }
.compare-pick.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.compare-pick .sub-icon { width: 28px; height: 28px; font-size: 12px; }
.compare-pick-name { flex: 1; font-size: 14px; font-weight: 500; }
.compare-pick-check {
  font-size: 16px;
  color: var(--accent);
  font-weight: 700;
  width: 16px;
  text-align: center;
}

.compare-grid-wrap {
  margin-top: 12px;
  overflow-x: auto;
}
.compare-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.compare-grid th, .compare-grid td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.compare-grid thead th {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-card-hover);
}
.compare-grid thead th:first-child { background: transparent; }
.compare-grid tbody th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--bg-card-hover);
}
.compare-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.compare-head .sub-icon { width: 28px; height: 28px; font-size: 12px; }
.compare-head span { font-size: 12px; font-weight: 600; }
.compare-worst {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
}
.compare-na { color: var(--text-3); font-size: 11px; }

/* ── Budgets ── */
.budget-row {
  width: 100%;
  background: var(--bg-card-hover);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  transition: all 0.15s;
  display: block;
}
.budget-row:hover { background: var(--bg-card); border-color: var(--border); }
.budget-row.is-locked { opacity: 0.5; cursor: not-allowed; }
.budget-row.is-locked:hover { background: var(--bg-card-hover); border-color: transparent; }

.budget-row-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.budget-row-cat {
  font-size: 14px;
  font-weight: 600;
}
.budget-row-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
}
.budget-row-add {
  color: var(--accent);
  font-weight: 600;
}
.budget-row-amount {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.budget-row-amount.status-over { color: var(--accent); }
.budget-row-amount.status-warn { color: var(--amber); }
.budget-row-amount.status-ok { color: var(--green); }
.budget-row-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.budget-row-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.budget-row-fill.status-ok { background: var(--green); }
.budget-row-fill.status-warn { background: var(--amber); }
.budget-row-fill.status-over { background: var(--accent); }

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 553px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 20px; }
}

/* ── Leak Effect ── */
#leak-overlay {
  --leak-color: #ef4444;
  --leak-opacity: 0.2;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  /* Stable height: `lvh` = large viewport height (URL bar collapsed). Doesn't
     re-flow when the mobile URL bar slides in/out during scroll, so the
     liquid level stays put. `vh` fallback for very old browsers. */
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.leak-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  transition: height 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.leak-fill {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: -100px; /* Bleed off bottom */
  background: linear-gradient(to top, var(--leak-color), transparent);
  opacity: var(--leak-opacity);
}

.leak-wave {
  position: absolute;
  top: -27px;
  left: 0;
  width: 200%;
  height: 28px;
  animation: leakWaveAnim 10s linear infinite;
  opacity: var(--leak-opacity);
}

.leak-wave path {
  fill: var(--leak-color);
}

@keyframes leakWaveAnim {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

[data-theme="dark"] #leak-overlay {
  --leak-opacity: 0.15;
}

/* ── Streak Card ── */
.streak-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

.streak-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.streak-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.streak-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
}

.streak-label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

.streak-icon {
  font-size: 24px;
}

.streak-body p {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 12px;
  line-height: 1.4;
}

.btn-streak {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-streak:hover:not(:disabled) {
  background: var(--accent);
  color: white;
}

.streak-card.is-checked .btn-streak {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-text);
  cursor: default;
}

.streak-card.is-checked .streak-count {
  color: var(--green);
}


/* ── Panic Button ── */
.panic-cta {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
  animation: panicPulse 2s infinite;
}

@keyframes panicPulse {
  0% { box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25); }
  50% { box-shadow: 0 15px 45px rgba(239, 68, 68, 0.45); }
  100% { box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25); }
}

.btn-panic {
  background: #ef4444;
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 40px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-panic:hover {
  background: #dc2626;
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.btn-panic:active {
  transform: scale(0.95);
}

.panic-icon {
  font-size: 24px;
  animation: shake 0.5s infinite;
}

@keyframes shake {
  0% { transform: rotate(0); }
  25% { transform: rotate(10deg); }
  50% { transform: rotate(0); }
  75% { transform: rotate(-10deg); }
  100% { transform: rotate(0); }
}

.panic-sub {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
  opacity: 0.8;
}

/* ── Panic Modal ── */
.panic-modal {
  border: 2px solid var(--accent) !important;
}

.panic-intro {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
  margin-bottom: 20px;
}

.panic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panic-row {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.panic-row .sub-icon {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

.panic-info {
  flex: 1;
}

.panic-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.panic-meta {
  font-size: 12px;
  color: var(--text-3);
}

.btn-panic-cancel {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
}

.btn-panic-cancel:hover { background: #dc2626; }

/* ── Cloud sync (Pro) ────────────────────────────────────── */
.pro-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.sync-status {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
}
.sync-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.sync-status-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
  flex-shrink: 0;
}
.sync-dot.active { background: #10b981; }
.sync-dot.locked { background: #f59e0b; }
.sync-dot.error  { background: #ef4444; }
.sync-section-title {
  font-weight: 600;
  margin: 14px 0 6px;
}
.sync-section-help {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 10px;
  line-height: 1.4;
}
.sync-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 10px;
}
@media (prefers-color-scheme: dark) {
  .sync-warning { color: #fbbf24; }
}
.sync-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
}
