/* MoneyMind AI — dark theme */

:root {
  /* Design system */
  --bg-primary: #0A0A0A;
  --bg-card: #141414;
  --bg-card-hover: #1A1A1A;
  --border: #1E1E1E;
  --gold: #C9A84C;
  --gold-light: #D4B96A;
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-muted: #6B7280;
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  /* Aliases kept so existing rules resolve to the design system */
  --bg: var(--bg-primary);
  --card: var(--bg-card);
  --card-2: #1C1C1C;
  --gold-hover: var(--gold-light);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --error: var(--danger);
  --warn: var(--warning);

  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand em { color: var(--gold); font-style: normal; }
.brand:hover { color: var(--text); }

.lang-toggle { display: flex; align-items: center; gap: 6px; }
.lang-toggle form { display: inline; }
.lang-sep { color: var(--border); }
.lang-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--gold); }

/* ---------- Layout ---------- */
.app-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.app-main.with-nav { padding-bottom: 96px; }

/* ---------- Flash messages ---------- */
.flash-container {
  max-width: 560px;
  margin: 12px auto 0;
  padding: 0 20px;
}
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  border: 1px solid;
}
.flash-error   { background: rgba(239, 68, 68, 0.12);  border-color: rgba(239, 68, 68, 0.4);  color: #FCA5A5; }
.flash-success { background: rgba(34, 197, 94, 0.12);  border-color: rgba(34, 197, 94, 0.4);  color: #86EFAC; }
.flash-info    { background: rgba(201, 168, 76, 0.12); border-color: rgba(201, 168, 76, 0.4); color: var(--gold); }

/* ---------- Auth card ---------- */
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 28px;
  margin-top: 24px;
}
.auth-logo { font-size: 2.4rem; text-align: center; margin-bottom: 4px; }
.auth-card h1 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 4px;
}
.auth-card h1 em { color: var(--gold); font-style: normal; }
.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 28px;
}
.auth-alt {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 24px;
}

/* ---------- Floating-label fields ---------- */
.field { position: relative; margin-bottom: 20px; }
.field-row { display:flex; gap:10px; }
.field-half { flex:1; min-width:0; }

.field input,
.field textarea {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 22px 14px 8px;
  outline: none;
  transition: border-color 0.15s;
}
.field textarea {
  resize: vertical;
  min-height: 100px;
}
.field textarea::placeholder { color: var(--text-muted); }
.field input:focus,
.field textarea:focus { border-color: var(--gold); }

.field label {
  position: absolute;
  left: 14px;
  top: 15px;
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
  transition: all 0.15s ease;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gold);
}

.field.has-toggle input { padding-right: 46px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.5;
  padding: 6px;
}
.pw-toggle:hover, .pw-toggle.on { opacity: 1; }

.hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin: -12px 0 16px 2px;
}

/* ---------- Password strength ---------- */
.strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -12px 0 16px 2px;
}
.strength-track {
  flex: 1;
  height: 5px;
  background: var(--card-2);
  border-radius: 3px;
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width 0.2s ease, background 0.2s ease;
}
.strength-bar.weak   { background: var(--error); }
.strength-bar.fair   { background: var(--warn); }
.strength-bar.strong { background: var(--success); }
.strength-label { font-size: 0.75rem; min-width: 48px; text-align: right; }
.strength-label.weak   { color: var(--error); }
.strength-label.fair   { color: var(--warn); }
.strength-label.strong { color: var(--success); }

/* ---------- Checkboxes / form rows ---------- */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 20px;
}
.checkbox input {
  accent-color: var(--gold);
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex-shrink: 0;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.form-row .checkbox { margin-bottom: 0; }
.muted-link { color: var(--muted); font-size: 0.88rem; }
.muted-link:hover { color: var(--gold); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 13px 22px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  border: 1px solid transparent;
  touch-action: manipulation;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--gold);
  color: #0A0A0A;
}
.btn-primary:hover { background: var(--gold-hover); color: #0A0A0A; }
.btn-secondary {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}
.btn-secondary:hover { background: rgba(201, 168, 76, 0.1); }
.btn-block { display: block; width: 100%; }

/* ---------- Onboarding ---------- */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 20px;
}
.onboarding-lang {
  position: absolute; top: 16px; left: 16px;
  display: flex; align-items: center; gap: 6px; z-index: 1;
}
.ob-lang-btn {
  background: none; border: none; color: var(--muted);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  padding: 4px 6px; letter-spacing: 0.5px; transition: color 0.2s;
}
.ob-lang-btn.active { color: var(--gold); }
.ob-lang-btn:hover { color: var(--text); }
.ob-lang-sep { color: var(--border); font-size: 0.85rem; }
.onboarding-skip {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--muted);
  font-size: 1.3rem; cursor: pointer; padding: 8px; line-height: 1;
}
.onboarding-skip:hover { color: var(--text); }
.onboarding-progress {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--border);
}
.onboarding-bar {
  height: 100%; background: var(--gold);
  transition: width 0.3s ease;
}
.onboarding-slides { position: relative; width: 100%; max-width: 380px; text-align: center; }
.onboarding-slide {
  display: flex; flex-direction: column; align-items: center;
  position: absolute; top: 0; left: 0; right: 0;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.onboarding-slide.active { opacity: 1; pointer-events: auto; position: relative; }
.onboarding-phone {
  max-width: 260px; max-height: 50vh; margin: 0 auto 20px;
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(201,168,76,0.2), 0 0 0 1px rgba(201,168,76,0.1);
}
.onboarding-phone img { width: 100%; display: block; }
.onboarding-title { font-size: 1.35rem; color: var(--text); margin: 0 0 10px; }
.onboarding-desc { color: var(--muted); font-size: 0.95rem; line-height: 1.5; margin: 0; }
.onboarding-actions { width: 100%; max-width: 380px; margin-top: 28px; }
.onboarding-dots { display: flex; gap: 8px; margin-top: 28px; }
.onboarding-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background 0.2s;
}
.onboarding-dot.active { background: var(--gold); }

/* ---------- Landing ---------- */
.landing { text-align: center; padding-top: 4vh; position: relative; }
.landing-lang { position: absolute; top: 0; right: 0; }
body:has(.landing) .topbar { display: none; }
.landing h1 { font-size: 2.2rem; margin-bottom: 12px; }
.landing .tagline { color: var(--muted); margin-bottom: 36px; max-width: 400px; margin-left: auto; margin-right: auto; line-height: 1.55; }
.landing-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 360px;
  margin: 0 auto;
}
.landing-trust { color: var(--muted); font-size: 0.8rem; margin: 0; }
.landing-login { color: var(--muted); font-size: 0.85rem; }
.landing-login:hover { color: var(--gold); }

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(20, 20, 20, 0.96);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 1000;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 1.25rem;
  color: var(--muted);
  padding: 4px 10px;
}
.bottom-nav a span { font-size: 0.65rem; font-weight: 500; }
.bottom-nav a:hover { color: var(--gold); }
.bottom-nav a.active { color: var(--gold); }

/* ---------- Legal pages ---------- */
.legal p { color: var(--muted); }

/* ---------- Section headings ---------- */
.section-title { font-size: 1rem; font-weight: 600; margin: 28px 0 12px; }

/* ---------- Floating action button ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: #0A0A0A;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(201, 168, 76, 0.35);
  z-index: 60;
}
.fab:hover { background: var(--gold-hover); }

/* ---------- Modal ---------- */
body.modal-open { overflow: hidden; }
.modal-overlay[hidden], .celebrate-overlay[hidden] { display: none; }
#onboard-overlay[hidden],
.onboard-overlay[hidden] {
  display: none !important;
  visibility: hidden !important;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 20px calc(100px + env(safe-area-inset-bottom));
  animation: slideup 0.2s ease;
}
@keyframes slideup { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 18px; }
}

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 1.15rem; margin: 0; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
#m-submit, #inc-submit {
  position: sticky; bottom: 0; z-index: 1;
  margin-top: 16px;
  box-shadow: 0 -8px 16px var(--card);
}
.scan-actions {
  position: sticky; bottom: 0; z-index: 1;
  background: var(--card);
  padding-top: 12px;
  box-shadow: 0 -8px 16px var(--card);
}

.modal-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
}
.tab.active { color: #0A0A0A; background: var(--gold); border-color: var(--gold); }

/* ---------- Amount input ---------- */
.amount-field {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}
.amount-field .currency { font-size: 1.6rem; color: var(--muted); }
.amount-field input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 2.2rem;
  font-weight: 700;
  width: 60%;
  text-align: center;
}
.amount-field input:focus { color: var(--gold); }

/* ---------- Voice expense button ---------- */
.voice-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card-2); border: 1px solid var(--border);
  font-size: 1.2rem; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.voice-btn:hover { border-color: var(--gold); }
.voice-btn.listening {
  background: rgba(239, 83, 80, 0.15);
  border-color: #EF5350;
  animation: voice-pulse 1.2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 83, 80, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 83, 80, 0); }
}
.voice-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 0.8rem; color: var(--muted);
}
.voice-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #EF5350; animation: voice-pulse-dot 1s infinite;
}
@keyframes voice-pulse-dot {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}
.voice-status.parsing .voice-dot { background: var(--gold); }

/* ---------- Frequent merchants ---------- */
.freq-merchants { margin-bottom: 8px; }
.freq-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.freq-chip {
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 0.78rem; color: var(--text);
  cursor: pointer; transition: all 0.15s;
}
.freq-chip:hover { border-color: var(--gold); color: var(--gold); }

.field-label { font-size: 0.8rem; color: var(--muted); margin: 0 0 8px 2px; text-transform: uppercase; letter-spacing: 0.03em; }
.static-label { position: static; display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }

/* ---------- Category grid ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.cat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--card-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 4px;
  cursor: pointer;
  color: var(--text);
}
.cat-chip .cat-icon { font-size: 1.3rem; }
.cat-chip .cat-name { font-size: 0.62rem; text-align: center; line-height: 1.1; color: var(--muted); }
.cat-chip.selected { border-color: var(--chip); background: color-mix(in srgb, var(--chip) 16%, var(--card-2)); }
.cat-chip.selected .cat-name { color: var(--text); }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.cat-grid .cat-chip { flex-direction: row; gap: 6px; padding: 8px 10px; font-size: 0.82rem; }

/* ---------- Scan flow ---------- */
.scan-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 48px 20px;
  color: var(--muted);
  cursor: pointer;
}
.scan-drop:hover { border-color: var(--gold); color: var(--text); }
.scan-drop .scan-icon { font-size: 2.4rem; }
.scan-loading { text-align: center; padding: 40px 0; color: var(--muted); }
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-preview { width: 100%; max-height: 180px; object-fit: contain; border-radius: 12px; margin-bottom: 14px; background: var(--card-2); }
.scan-results h3 { font-size: 1rem; margin: 0 0 14px; }
.scan-items { list-style: none; padding: 0; margin: 0 0 18px; }
.scan-items li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.scan-actions { display: flex; gap: 10px; }
.scan-actions .btn { flex: 1; }

/* ---------- Expenses page ---------- */
.filters { display: flex; gap: 12px; margin: 16px 0; }
.filter { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--muted); }
.filter input, .filter select {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}
.total-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.total-bar span { color: var(--muted); }
.total-bar strong { font-size: 1.3rem; margin-right: auto; }
.btn-sm { padding: 8px 12px; font-size: 0.82rem; }

.expense-list { list-style: none; padding: 0; margin: 0; }
.expense-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.expense-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.expense-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.expense-desc { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-meta { font-size: 0.78rem; color: var(--muted); }
.expense-amount { font-weight: 600; }
.expense-amount.income { color: var(--success); }
.row-delete { background: none; border: none; cursor: pointer; opacity: 0.5; font-size: 1rem; }
.row-delete:hover { opacity: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------- Dashboard ---------- */
.trial-banner {
  background: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.4);
  color: var(--gold);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.health-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}
.health-ring {
  width: 84px; height: 84px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  background: conic-gradient(var(--ring) calc(var(--score) * 1%), var(--card-2) 0);
  flex-shrink: 0;
}
.health-ring span {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
}
.health-red    { --ring: var(--error); }
.health-yellow { --ring: var(--warn); }
.health-green  { --ring: var(--success); }
.health-title { font-weight: 600; margin: 0 0 4px; }
.health-figures { color: var(--muted); font-size: 0.85rem; margin: 0; }

.summary-cards { display: flex; gap: 12px; margin-bottom: 8px; }
.summary-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.summary-label { font-size: 0.78rem; color: var(--muted); }
.summary-value { font-size: 1.4rem; font-weight: 700; }

.cat-breakdown { list-style: none; padding: 0; margin: 0; }
.cat-breakdown li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-label { font-size: 0.85rem; width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar { flex: 1; height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; }
.cat-bar span { display: block; height: 100%; border-radius: 3px; }
.cat-amount { font-size: 0.85rem; font-weight: 600; min-width: 64px; text-align: right; }

/* ---------- Chat with Maya ---------- */
.chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
}
/* ---------- Insight Cards ---------- */
.insight-cards {
  display: flex; gap: 10px; padding: 12px 0 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.insight-card {
  flex: 0 0 auto; width: 260px;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px;
  cursor: pointer; font: inherit; color: var(--text); text-align: left;
  transition: border-color 0.15s;
}
.insight-card:hover { border-color: var(--gold); }
.insight-icon { font-size: 1.5rem; flex-shrink: 0; line-height: 1; }
.insight-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.insight-title { font-weight: 600; font-size: 0.82rem; }
.insight-text { font-size: 0.75rem; color: var(--muted); line-height: 1.35; }
.insight-warn { border-left: 3px solid var(--warning); }
.insight-danger { border-left: 3px solid var(--danger); }
.insight-good { border-left: 3px solid var(--success); }
.insight-info { border-left: 3px solid var(--gold); }

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.maya-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.18);
  border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.maya-name { font-weight: 700; margin: 0; }
.maya-sub { color: var(--muted); font-size: 0.78rem; margin: 0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 2px 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 85%; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-maya { align-self: flex-start; }
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; flex-shrink: 0;
}
.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-maya .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-user .bubble {
  background: var(--gold);
  color: #0A0A0A;
  border-bottom-right-radius: 4px;
}

.chat-typing { display: flex; align-items: flex-end; gap: 8px; padding: 4px 2px; }
.chat-typing[hidden] { display: none; }
.bubble.typing { display: flex; gap: 4px; }
.bubble.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite both;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.chip {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }

.chat-quick-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 8px 44px;
}
.quick-reply {
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.quick-reply:hover {
  background: var(--gold);
  color: #000;
}

.chat-input {
  position: fixed;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #0A0A0A;
  border-top: 1px solid var(--border);
  z-index: 100;
}
.chat-input input {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  padding: 12px 16px;
  outline: none;
}
.chat-input input:focus { border-color: var(--gold); }
.mic-btn, .send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.mic-btn { background: var(--card-2); border: 1px solid var(--border); }
.mic-btn.listening { background: var(--error); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.send-btn { background: var(--gold); color: #0A0A0A; }
.send-btn:hover { background: var(--gold-hover); }

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  left: auto;
  bottom: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
@media (max-width: 767px) {
  #toast-container { left: 16px; align-items: center; }
}
.toast {
  background: var(--card);
  border: 1px solid var(--success);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Goals ---------- */
.goals-page h1 { margin-bottom: 16px; }
#new-goal-btn { margin-bottom: 20px; }

.goals-grid { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 560px) { .goals-grid { display: grid; grid-template-columns: 1fr 1fr; } }

.goal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.goal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.goal-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(201, 168, 76, 0.14);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.goal-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-menu { display: flex; gap: 2px; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 0.95rem; opacity: 0.6; padding: 4px; }
.icon-btn:hover { opacity: 1; }

.progress-track { height: 10px; background: var(--card-2); border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-hover));
  border-radius: 6px;
  transition: width 0.4s ease;
}
.goal-figures { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; }
.goal-figures strong { color: var(--gold); font-size: 1rem; }
.goal-deadline { font-size: 0.8rem; color: var(--muted); margin: 0 0 10px; }
.goal-deadline.overdue { color: var(--error); }
.goal-done { font-size: 0.82rem; color: var(--success); margin: 4px 0 0; }
.goal-addfunds { width: 100%; }

/* empty state */
.goals-empty { text-align: center; padding: 32px 16px; }
.goals-empty .piggy { margin: 0 auto 8px; display: block; }
.goals-empty h2 { font-size: 1.25rem; margin: 8px 0 6px; }
.goals-empty p { color: var(--muted); margin: 0 0 20px; }

/* completed section */
.completed-section { margin-top: 28px; }
.completed-section summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 0;
  list-style: none;
}
.completed-section summary::-webkit-details-marker { display: none; }
.completed-section summary::before { content: '▸ '; }
.completed-section[open] summary::before { content: '▾ '; }
.completed-section .goal-card { opacity: 0.85; }

/* icon picker */
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 18px; }
.icon-opt {
  background: var(--card-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 0;
  font-size: 1.3rem;
  cursor: pointer;
}
.icon-opt.selected { border-color: var(--gold); background: rgba(201, 168, 76, 0.16); }

.custom-emoji-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.emoji-hint {
  width: 100%;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -4px;
}
.emoji-kb-hint {
  width: 100%;
  font-size: 11px;
  color: var(--gold);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: -2px;
}
.emoji-kb-hint[hidden] { display: none; }
.field-label-inline {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.custom-emoji-input {
  width: 56px;
  text-align: center;
  font-size: 1.3rem;
  padding: 6px 0;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card-2);
  color: var(--text);
}
.custom-emoji-input:focus {
  border-color: var(--gold);
  outline: none;
}

/* ---------- Celebration ---------- */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  overflow: hidden;
}
.celebrate-card {
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 18px;
  padding: 32px 28px;
  text-align: center;
  max-width: 340px;
  margin: 0 20px;
  z-index: 2;
}
.celebrate-emoji { font-size: 3rem; margin-bottom: 8px; }
.celebrate-card h2 { margin: 0 0 10px; }
.celebrate-card p { color: var(--muted); margin: 0 0 22px; }

.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0.9; }
}

/* ---------- Upgrade / Premium ---------- */
.upgrade h1 { text-align: center; margin-bottom: 20px; }
.plan-card {
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 8px 30px rgba(201, 168, 76, 0.12);
}
.plan-badge {
  display: inline-block;
  background: rgba(201, 168, 76, 0.16);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
}
.plan-price { margin: 14px 0 20px; }
.plan-price .price { font-size: 2.6rem; font-weight: 800; }
.plan-price .per { color: var(--muted); font-size: 1rem; }
.included-label { font-weight: 600; margin: 0 0 12px; }
.feature-list { list-style: none; padding: 0; margin: 0 0 24px; }
.feature-list li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.feature-list li:last-child { border-bottom: none; }
.plan-note { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 16px; }

/* ---------- Payment success ---------- */
.success-page { text-align: center; padding-top: 8vh; }
.success-page .success-emoji { font-size: 3.5rem; margin-bottom: 12px; }
.success-page h1 { font-size: 1.6rem; margin-bottom: 8px; }
.success-page .subtitle { color: var(--muted); margin-bottom: 28px; }

/* ---------- Profile ---------- */
.profile-page h1 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.mt { margin-top: 24px; }

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}
.avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.avatar-initials {
  display: flex; align-items: center; justify-content: center;
  background: rgba(201, 168, 76, 0.16);
  color: var(--gold);
  font-size: 1.6rem; font-weight: 700;
}
.profile-hero-info { flex: 1; min-width: 140px; }
.profile-hero-info h2 { margin: 0 0 2px; font-size: 1.2rem; }
.profile-hero-info p { margin: 0; }
.plan-badge-sm {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
}
.plan-badge-sm.plan-trial { background: rgba(201,168,76,0.16); color: var(--gold); }
.plan-badge-sm.plan-premium { background: rgba(34,197,94,0.16); color: var(--success); }
.plan-badge-sm.plan-cancelled { background: rgba(239,68,68,0.16); color: var(--error); }
.photo-form { width: 100%; }
.photo-label {
  display: inline-block;
  cursor: pointer;
  color: var(--gold);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}
.photo-label:hover { border-color: var(--gold); }

.card.section { margin-bottom: 16px; }
.section h3 { margin: 0 0 16px; font-size: 1.05rem; }
.section h3.mt { margin-top: 28px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pref-row.toggle { cursor: pointer; }
.pref-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); }
.seg { display: flex; gap: 6px; }
.seg-opt {
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.seg-opt.on { border-color: var(--gold); color: var(--gold); }
.seg-opt input { display: none; }
.select {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
}
.section form .btn { margin-top: 18px; }

.btn-danger { background: var(--error); color: #fff; border: 1px solid var(--error); }
.btn-danger:hover { background: #d32f2f; }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger-outline {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  font-size: 0.85rem;
  padding: 10px 16px;
}
.btn-danger-outline:hover { background: rgba(239, 68, 68, 0.1); }

.legal-links { display: flex; gap: 18px; margin: 16px 0; }
.legal-links a { font-size: 0.9rem; }
.logout-link { display: block; text-align: center; color: var(--muted); margin: 20px 0; font-size: 0.95rem; }
.logout-link:hover { color: var(--error); }

.danger-zone {
  margin-top: 12px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.danger-zone-toggle {
  display: block;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--error);
  cursor: pointer;
  list-style: none;
}
.danger-zone-toggle::-webkit-details-marker { display: none; }
.danger-zone-toggle::after { content: ' ▸'; }
.danger-zone[open] .danger-zone-toggle::after { content: ' ▾'; }
.danger-zone-body { padding: 0 16px 16px; }
.danger-zone-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ---------- Legal pages ---------- */
.legal-page { max-width: 640px; }
.legal-page h1 { font-size: 1.6rem; margin-bottom: 4px; }
.legal-updated { color: var(--muted); font-size: 0.82rem; margin: 0 0 24px; }
.legal-page h2 { font-size: 1.05rem; margin: 26px 0 10px; color: var(--gold); }
.legal-page p, .legal-page li { color: #D4D4CE; font-size: 0.94rem; line-height: 1.6; }
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 6px; }

/* ============================================================
   STEP 8 — Navigation (sidebar + bottom nav) & dashboard
   ============================================================ */

/* Card hover */
.card, .metric-card, .goal-card, .plan-card {
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.card:hover, .metric-card:hover { background: var(--bg-card-hover); border-color: #2A2A2A; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text-secondary);
}
.badge-gold { background: rgba(201,168,76,0.16); color: var(--gold); }
.badge-success { background: rgba(34,197,94,0.16); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.16); color: var(--danger); }

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-secondary); font-weight: 600; }
table.data tr:hover td { background: var(--bg-card-hover); }

/* ---------- Desktop sidebar ---------- */
.sidebar { display: none; }
.sidebar-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.sidebar-logo em { color: var(--gold); font-style: normal; }
.sidebar-add {
  margin: 20px 0 8px;
  background: var(--gold);
  color: #0A0A0A;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
}
.sidebar-add:hover { background: var(--gold-light); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-secondary);
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.sidebar-nav a .ico { font-size: 1.15rem; }
.sidebar-nav a:hover { background: var(--bg-card-hover); color: var(--text); }
.sidebar-nav a.active { border-left: 3px solid var(--gold); color: var(--gold); background: var(--bg-card-hover); padding-left: 9px; }
.sidebar-badge {
  background: #EF5350;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: auto;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.sidebar-logout { color: var(--text-secondary); font-size: 0.9rem; }
.sidebar-logout:hover { color: var(--danger); }

/* ---------- Bottom nav center + button ---------- */
.nav-add {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: #0A0A0A;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  margin-top: -18px;
  box-shadow: 0 6px 18px rgba(201,168,76,0.4);
  flex-shrink: 0;
}
.nav-add:hover { background: var(--gold-light); }
.bottom-nav { align-items: center; }

/* ---------- Responsive: desktop layout at >= 768px ---------- */
@media (min-width: 768px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 60;
  }
  .sidebar ~ .topbar { display: none; }
  .bottom-nav { display: none; }
  .app-main { max-width: 860px; padding-top: 32px; }
  .app-main.with-nav { margin-left: var(--sidebar-w); padding-bottom: 48px; }
  .sidebar ~ .flash-container { margin-left: var(--sidebar-w); }
  .chat-input { bottom: 0; left: var(--sidebar-w); max-width: 860px; margin: 0 auto; }
  .chat { height: calc(100vh - 80px); }
  .chat-messages { padding-bottom: 80px; }
}

/* ---------- Dashboard ---------- */
.dash-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.greeting { font-size: 1.4rem; margin: 0 0 2px; }
.dash-date { margin: 0; text-transform: capitalize; }
.dash-header-actions { display: flex; align-items: center; gap: 10px; }
.bell {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer;
}
.bell:hover { border-color: var(--gold); }

.trial-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(120deg, #C9A84C, #8A7333);
  color: #1A1400;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.trial-hero strong { font-size: 1.05rem; }
.trial-hero p { margin: 2px 0 0; font-size: 0.82rem; opacity: 0.85; }
.btn-dark { background: #0A0A0A; color: var(--gold); border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600; white-space: nowrap; }
.btn-dark:hover { background: #1A1A1A; color: var(--gold-light); }
.btn-lg { padding: 15px 28px; font-size: 1.05rem; }

/* Summary grid */
.summary-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; margin-bottom: 20px; }
.summary-grid.single-account-grid { grid-template-columns: 1fr; }
.summary-grid.single-account-grid .full-width { text-align: center; }
@media (min-width: 480px) {
  .summary-grid.single-account-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid.single-account-grid .full-width { grid-column: 1 / -1; }
}
.summary-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
  display: flex; flex-direction: column; gap: 4px; min-height: 108px;
  min-width: 0; overflow: hidden;
}
.metric-icon { font-size: 1.2rem; }
.metric-label { color: var(--text-secondary); font-size: 0.8rem; }
.metric-value { font-size: 1.5rem; font-weight: 700; }
.metric-value.income { color: var(--success); }
.metric-value.expense { color: var(--danger); }
.metric-value.gold { color: var(--gold); }

/* Financial Score card */
.score-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px;
}
.score-arc-wrap { position: relative; width: 90px; height: 90px; flex-shrink: 0; }
.score-arc { width: 90px; height: 90px; }
.score-arc-fill { transition: stroke-dasharray 0.6s ease; }
.score-arc-fill.score-excellent { stroke: var(--success); }
.score-arc-fill.score-good { stroke: #3B82F6; }
.score-arc-fill.score-fair { stroke: var(--warning); }
.score-arc-fill.score-low { stroke: var(--danger); }
.score-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.score-of { font-size: 0.65rem; color: var(--text-secondary); }
.score-info { display: flex; flex-direction: column; gap: 2px; }
.score-title { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.score-status { font-size: 1rem; font-weight: 700; }
.score-status.score-excellent { color: var(--success); }
.score-status.score-good { color: #3B82F6; }
.score-status.score-fair { color: var(--warning); }
.score-status.score-low { color: var(--danger); }

/* Donut metric card */
.donut-metric { align-items: center; }
.donut-metric canvas { display: block; margin: 0 auto; }
.donut-legend { display: flex; flex-wrap: wrap; gap: 2px 8px; justify-content: center; margin-top: 4px; }
.donut-legend-item { display: flex; align-items: center; gap: 3px; font-size: 0.6rem; color: var(--text-secondary); }
.donut-legend-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Legacy gauge (kept for other pages) */
.gauge-card { align-items: center; justify-content: center; position: relative; }
.gauge { width: 88px; height: 88px; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--card-2); stroke-width: 8; }
.gauge-fill { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.gauge-fill.gauge-red { stroke: var(--danger); }
.gauge-fill.gauge-yellow { stroke: var(--warning); }
.gauge-fill.gauge-green { stroke: var(--success); }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-score { font-size: 1.6rem; font-weight: 800; }
.gauge-label { font-size: 0.58rem; color: var(--text-secondary); text-align: center; max-width: 80px; }

/* Card head */
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 1rem; }
.link-sm { font-size: 0.82rem; color: var(--gold); }

/* Donut */
.chart-card { margin-bottom: 16px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-canvas-box { position: relative; width: 180px; height: 180px; flex-shrink: 0; margin: 0 auto; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-total { font-size: 1.3rem; font-weight: 800; }
.donut-legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 180px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.85rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-val { color: var(--text-secondary); font-size: 0.8rem; }

/* Transactions list */
.list-card { margin-bottom: 16px; }
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tx-row:last-child { border-bottom: none; }
.tx-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.tx-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tx-desc { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 0.76rem; }
.tx-amount { font-weight: 600; white-space: nowrap; }
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--text-primary); }
.empty-line { text-align: center; padding: 14px 0; }

/* Plaid connected accounts */
.plaid-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.plaid-row:last-child { border-bottom: none; }
.plaid-info { display: flex; align-items: center; gap: 8px; }
.plaid-name { font-size: 0.92rem; font-weight: 500; }
.plaid-badge { font-size: 0.72rem; background: rgba(34,197,94,.15); color: var(--success); padding: 2px 8px; border-radius: 10px; }
.plaid-del { background: none; border: none; color: var(--text-muted); font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.plaid-del:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* Goals mini list */
.goal-mini-list { list-style: none; padding: 0; margin: 0; }
.goal-mini-list li { padding: 8px 0; }
.goal-mini-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 0.88rem; }

/* Dashboard empty state */
.dash-empty { text-align: center; padding: 36px 16px; }
.dash-empty .empty-illo { margin: 0 auto 6px; display: block; }
.dash-empty h2 { font-size: 1.3rem; margin: 8px 0 6px; }
.dash-empty p { margin: 0 0 22px; }

/* ---------- Expense streak banner ---------- */
.streak-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--warning);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

/* ---------- Maya insight card ---------- */
.insight-card {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
}
.insight-dismiss {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.insight-dismiss:hover { border-color: var(--gold); color: var(--gold); }
.insight-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-primary);
}

/* ---------- Quick add shortcuts ---------- */
.quick-add-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.quick-add-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  min-width: 90px;
  flex-shrink: 0;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s;
}
.quick-add-btn:hover { border-color: var(--gold); }
.quick-add-btn:active { background: rgba(201, 168, 76, 0.12); }
.qa-icon { font-size: 1.3rem; }
.qa-label { font-size: 0.72rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; }
.qa-amount { font-size: 0.82rem; font-weight: 700; color: var(--gold); }

/* ---------- Budget limits ---------- */
.budget-list { list-style: none; margin: 0; padding: 0; }
.budget-row { padding: 10px 0; }
.budget-row + .budget-row { border-top: 1px solid var(--border); }
.budget-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.9rem; }
.budget-status { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.budget-over { background: rgba(239,68,68,0.15); color: var(--danger); }
.budget-near { background: rgba(245,158,11,0.15); color: var(--warning); }
.budget-fill-over { background: var(--danger) !important; }
.budget-fill-near { background: var(--warning) !important; }
.budget-figures { display: flex; justify-content: space-between; margin-top: 4px; font-size: 0.78rem; }
.budget-modal-list { list-style: none; margin: 0 0 16px; padding: 0; max-height: 55vh; overflow-y: auto; }
.budget-modal-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; }
.budget-modal-row + .budget-modal-row { border-top: 1px solid var(--border); }
.budget-modal-cat { flex: 1; font-size: 0.9rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-modal-input-wrap { display: flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
.budget-modal-dollar { color: var(--muted); font-size: 0.85rem; }
.budget-modal-input { width: 70px; background: transparent; border: none; color: var(--text); font-size: 0.9rem; text-align: right; outline: none; -moz-appearance: textfield; }
.budget-modal-input::-webkit-inner-spin-button,
.budget-modal-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.budget-modal-suffix { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.budget-modal-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 4px; line-height: 1; }
.budget-modal-remove:hover { color: var(--danger); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; cursor: pointer; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Recurring expenses ---------- */
.recurring-list { list-style: none; margin: 0; padding: 0; }
.recurring-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.recurring-row + .recurring-row { border-top: 1px solid var(--border); }
.recurring-info { flex: 1; min-width: 0; }
.recurring-desc { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recurring-meta { font-size: 0.75rem; color: var(--muted); }
.recurring-amount { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.recurring-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 4px; }
.recurring-del:hover { color: var(--danger); }
.select-label { position: absolute; top: -8px; left: 10px; font-size: 0.72rem; color: var(--muted); background: var(--card); padding: 0 4px; }

/* ---------- Autopilot ---------- */
.autopilot-field { margin-top: 8px; }
.autopilot-row { display: flex; align-items: center; gap: 10px; }
.autopilot-slider { flex: 1; accent-color: var(--gold); }
.autopilot-val { font-weight: 700; color: var(--gold); min-width: 36px; text-align: right; }
.autopilot-badge { display: inline-block; font-size: 0.72rem; background: rgba(201,168,76,0.12); color: var(--gold); padding: 3px 8px; border-radius: 6px; margin-top: 6px; }

/* ---------- Health history chart ---------- */
.health-chart-box { position: relative; height: 180px; }

/* ---------- Your Money Today ---------- */
.money-today-card { margin-bottom: 16px; }
.money-today-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.money-today-head h3 { margin: 0; font-size: 1rem; }
.money-today-amount { font-size: 2.2rem; font-weight: 800; color: var(--success); text-align: center; margin: 8px 0 14px; }
.money-today-amount.over { color: var(--danger); }
.money-today-bar { height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.money-today-fill { height: 100%; background: var(--success); border-radius: 4px; transition: width 0.4s ease; }
.money-today-fill.fill-tight { background: var(--warning); }
.money-today-fill.fill-over { background: var(--danger); }
.money-today-stats { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-secondary); }
.money-today-stats strong { color: var(--text); }
.money-today-sub { text-align: center; margin: 8px 0 0; }

/* ---------- Financial Simulator ---------- */
.sim-card { margin-bottom: 16px; }
.sim-inputs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sim-input { background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; font-size: 0.88rem; padding: 10px 12px; outline: none; }
.sim-input:focus { border-color: var(--gold); }
.sim-inputs .sim-input:first-child { flex: 1; min-width: 120px; }
.sim-amount-wrap { display: flex; align-items: center; background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 0 0 0 10px; }
.sim-amount-wrap:focus-within { border-color: var(--gold); }
.sim-dollar { color: var(--muted); font-weight: 600; }
.sim-amount { border: none !important; background: none !important; width: 90px; padding-left: 4px !important; }
.sim-results { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.sim-result-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.9rem; }
.sim-label { color: var(--text-secondary); }
.sim-value { font-weight: 700; }
.sim-value.positive { color: var(--success); }
.sim-value.negative { color: var(--danger); }
.sim-value.warning { color: var(--warning); }
.sim-verdict { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; font-weight: 500; }
.sim-verdict.good { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.sim-verdict.warn { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.sim-verdict.bad { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

/* ---------- Smart Predictions ---------- */
.pred-card { margin-bottom: 16px; }
.pred-big { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; color: var(--success); margin-bottom: 8px; }
.pred-big.pred-negative { color: var(--danger); }
.pred-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pred-bar { flex: 1; height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; }
.pred-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.pred-fill-great { background: var(--success); }
.pred-fill-good { background: var(--info); }
.pred-fill-tight { background: var(--warning); }
.pred-fill-over { background: var(--danger); }
.pred-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pred-stat { background: var(--card-2); border-radius: 10px; padding: 10px 14px; }
.pred-stat-label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 2px; }
.pred-stat-value { font-size: 1.05rem; font-weight: 700; }
.pred-verdict { font-size: 0.85rem; padding: 10px 14px; border-radius: 10px; margin: 0; }
.pred-verdict-great { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.pred-verdict-good { background: rgba(59,130,246,0.1); color: var(--info); border: 1px solid rgba(59,130,246,0.3); }
.pred-verdict-tight { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.pred-verdict-over { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.pred-outlook { font-size: 1.1rem; }

/* ---------- Weekly Challenge ---------- */
.challenge-card { margin-bottom: 16px; }
.xp-badge { font-size: 0.78rem; font-weight: 600; color: var(--gold); background: rgba(201,168,76,0.12); padding: 4px 10px; border-radius: 20px; }
.xp-bar { height: 6px; background: var(--card-2); border-radius: 3px; margin: 8px 0 14px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 3px; transition: width 0.4s ease; }
.challenge-body { }
.challenge-desc { font-size: 0.95rem; font-weight: 500; margin: 0 0 10px; }
.challenge-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.challenge-progress-bar { flex: 1; height: 10px; background: var(--card-2); border-radius: 5px; overflow: hidden; }
.challenge-progress-fill { height: 100%; background: var(--info); border-radius: 5px; transition: width 0.4s ease; }
.challenge-progress-fill.challenge-done { background: var(--success); }
.challenge-progress-text { font-size: 0.82rem; font-weight: 700; color: var(--muted); min-width: 36px; text-align: right; }
.challenge-claim { width: 100%; }
.challenge-claimed { font-size: 0.85rem; color: var(--success); margin: 0; text-align: center; }

/* ---------- Upcoming Bills ---------- */
.bills-card { margin-bottom: 16px; }
.bills-list { list-style: none; padding: 0; margin: 0; }
.bill-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.bill-row:last-child { border-bottom: none; }
.bill-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.bill-main { flex: 1; min-width: 0; }
.bill-desc { display: block; font-weight: 500; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-meta { display: block; font-size: 0.78rem; }
.bill-right { text-align: right; flex-shrink: 0; }
.bill-amount { display: block; font-weight: 700; font-size: 0.95rem; }
.bill-due { display: block; font-size: 0.72rem; font-weight: 600; border-radius: 8px; padding: 2px 8px; margin-top: 2px; }
.bill-due-soon { background: rgba(239,68,68,0.12); color: var(--danger); }
.bill-due-upcoming { background: rgba(245,158,11,0.12); color: var(--warning); }
.bill-due-later { background: rgba(59,130,246,0.1); color: var(--info); }
.bill-row.bill-soon { background: rgba(239,68,68,0.04); border-radius: 8px; padding: 10px 8px; margin: 0 -8px; }

/* ---------- Income button (sidebar + bottom nav) ---------- */
.sidebar-income {
  margin: 6px 0 0;
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-income:hover { background: rgba(34,197,94,0.1); }
.nav-income {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(34,197,94,0.15);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-income:hover { background: rgba(34,197,94,0.25); }
.income-select {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 14px;
  font: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.income-select:focus { border-color: var(--gold); }
.dash-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.dash-actions .btn { flex: 1; }

/* ---------- Skeleton loading ---------- */
.skeleton { background: var(--card-2); border-radius: 8px; position: relative; overflow: hidden; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.skeleton-text { height: 14px; margin-bottom: 8px; width: 60%; }
.skeleton-chart { height: 180px; border-radius: 12px; }
.skeleton-card { height: 108px; border-radius: var(--radius-md); }
.skeleton-row { display: flex; gap: 12px; margin-bottom: 12px; }
.skeleton-row .skeleton { flex: 1; }

/* ---------- Scan stages ---------- */
.scan-stages { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; }
.scan-step { width: 28px; height: 28px; border-radius: 50%; background: var(--card-2); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); transition: all 0.3s; }
.scan-step.active { border-color: var(--gold); color: var(--gold); background: rgba(201,168,76,0.12); }
.scan-step.done { border-color: var(--success); color: var(--success); background: rgba(34,197,94,0.12); }
.scan-step-line { width: 24px; height: 2px; background: var(--border); transition: background 0.3s; }
.scan-step-line.done { background: var(--success); }

/* ---------- Onboarding tour ---------- */
.onboard-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 400; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.onboard-card { background: var(--card); border: 1px solid var(--gold); border-radius: 18px; padding: 36px 28px; text-align: center; max-width: 380px; margin: 0 20px; animation: slideup 0.3s ease; }
.onboard-step-icon { font-size: 3rem; margin-bottom: 12px; }
.onboard-card h2 { font-size: 1.3rem; margin: 0 0 8px; }
.onboard-card p { color: var(--muted); margin: 0 0 24px; font-size: 0.94rem; line-height: 1.5; }
.onboard-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; }
.onboard-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--border); transition: all 0.3s; }
.onboard-dot.active { background: var(--gold); border-color: var(--gold); }
.onboard-actions { display: flex; gap: 10px; }
.onboard-actions .btn { flex: 1; }

/* ---------- Share button ---------- */
.share-btn { margin-top: 12px; }

/* ---------- Empty state preview ---------- */
.empty-preview { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin: 20px 0; opacity: 0.5; pointer-events: none; }
.empty-preview-label { text-align: center; font-size: 0.78rem; color: var(--gold); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.empty-preview .summary-grid { margin-bottom: 12px; }
.empty-preview .metric-card { min-height: 64px; padding: 10px; }
.empty-preview .metric-value { font-size: 1.1rem; }

/* ---------- QR install page ---------- */
.qr-page { text-align: center; }
.qr-page h1 { margin-bottom: 20px; }
.qr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  max-width: 340px;
  margin: 0 auto;
}
.qr-img {
  width: 240px; height: 240px;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: block;
  margin: 0 auto 18px;
}
.qr-instructions { font-size: 1rem; margin: 0 0 6px; }
.qr-url { word-break: break-all; }

/* ── Income Dashboard Card ── */
.income-dash-card { margin-bottom: 16px; }
.income-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.income-stat {
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.income-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
}
.income-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Quick Income Repeat Buttons ── */
.income-repeat-section { margin-bottom: 12px; }
.income-repeat-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.income-repeat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
  font-size: 0.9rem;
}
.income-repeat-btn:hover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
}
.ir-label { font-weight: 500; }
.ir-amount { color: var(--gold); font-weight: 700; }

/* ── Income Chart Card (expenses page) ── */
.income-chart-card { margin-bottom: 16px; }
.income-chart-box {
  position: relative;
  height: 180px;
}

/* ── Streak Card (improvement 1) ── */
.streak-card {
  text-align: center;
  padding: 16px;
}
.streak-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.streak-fire { font-size: 2rem; }
.streak-number {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.streak-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}
.streak-milestone {
  margin: 8px 0 0;
  padding: 6px 12px;
  background: rgba(201,168,76,0.1);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--gold);
}

/* ── Dynamic Message Banner (improvement 4) ── */
.dyn-msg-banner {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border-left: 3px solid var(--gold);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ── Smart Summary Card (improvement 3) ── */
.smart-summary-card { padding: 16px; }
.summary-lines {
  list-style: none;
  padding: 0;
  margin: 0;
}
.summary-lines li {
  padding: 6px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.summary-lines li:last-child { border-bottom: none; }

/* ── Quick Stats Card (improvement 7) ── */
.qstats-card { padding: 16px; }
.qstats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.qstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qstat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.qstat-value {
  font-size: 1rem;
  font-weight: 600;
}

/* ── Health Tier & Explanation (improvement 5) ── */
.health-tier {
  display: block;
  font-size: 0.7rem;
  margin-top: 2px;
}
.health-expl {
  font-size: 0.75rem;
  text-align: center;
  margin: 6px 0 0;
  color: var(--text-muted);
}

/* ── Income vs Expenses Chart (improvement 2) ── */
.bar-chart-box {
  position: relative;
  height: 180px;
}
.compare-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-top: 10px;
  color: var(--text-muted);
}

/* ── Micro-animations (improvement 8) ── */
@keyframes mm-check {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(0deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes mm-coin {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-12px) scale(1.15); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes mm-trophy {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.anim-check {
  display: inline-block;
  animation: mm-check 0.5s ease forwards;
}
.anim-coin {
  display: inline-block;
  animation: mm-coin 0.5s ease;
}
.anim-trophy {
  display: inline-block;
  animation: mm-trophy 0.5s ease forwards;
}

/* Toast icon animation */
.toast.show .toast-icon {
  display: inline-block;
  animation: mm-check 0.4s ease forwards;
}

/* ---------- Feedback page ---------- */
.feedback-page {
  max-width: 520px;
  margin: 0 auto;
}
.feedback-page h1 { margin-bottom: 4px; }
.feedback-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.feedback-form { display: flex; flex-direction: column; gap: 16px; }
.fb-type-group {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fb-type-group legend {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.fb-type-opt {
  cursor: pointer;
}
.fb-type-opt input { display: none; }
.fb-type-label {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s;
}
.fb-type-opt input:checked + .fb-type-label {
  border-color: var(--gold);
  background: rgba(201,168,76,0.1);
  color: var(--gold);
}
.fb-char-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.fb-error {
  display: block;
  width: 100%;
  font-size: 0.8rem;
  color: #EF5350;
  margin-top: 4px;
}
.fb-error[hidden] { display: none; }

/* ---------- More button (bottom nav) ---------- */
.nav-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 1.25rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
}
.nav-more span { font-size: 0.65rem; font-weight: 500; }
.nav-more:hover { color: var(--gold); }
.nav-more.active { color: var(--gold); }

/* ---------- More slide-up menu ---------- */
.more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  touch-action: none;
}
.more-overlay.open { display: block; }
.more-menu {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  z-index: 91;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.more-menu.open {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}
.more-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 12px;
}
.more-menu a,
.more-menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.more-menu a:hover,
.more-menu-btn:hover { background: rgba(201,168,76,0.08); }
.more-menu a.active { color: var(--gold); }
.more-menu .ico { font-size: 1.2rem; width: 28px; text-align: center; }
@media (min-width: 768px) {
  .more-overlay, .more-menu { display: none !important; }
}

/* ---------- Session timeout modal ---------- */
.timeout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timeout-overlay[hidden] { display: none; }
.timeout-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}
.timeout-modal h3 { margin: 0 0 12px; font-size: 1.2rem; }
.timeout-modal p { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.timeout-actions { display: flex; flex-direction: column; gap: 10px; }

/* =============== Debt Management =============== */
.debts-page { max-width: 800px; margin: 0 auto; }
.debts-page h1 { font-size: 1.5rem; margin: 0 0 20px; }

/* Summary cards */
.debt-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dsum-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dsum-icon { font-size: 1.3rem; }
.dsum-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.dsum-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Add row */
.debt-add-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

/* Debt grid */
.debts-grid { display: flex; flex-direction: column; gap: 12px; }

/* Debt card */
.debt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color 0.15s;
}
.debt-card:hover { border-color: var(--gold); }
.debt-paid { opacity: 0.6; }

.debt-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.debt-icon { font-size: 1.5rem; flex-shrink: 0; }
.debt-info { flex: 1; min-width: 0; }
.debt-name { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-lender { font-size: 0.8rem; color: var(--text-secondary); display: block; }
.debt-menu { display: flex; gap: 4px; }

.debt-amounts { margin-bottom: 6px; }
.debt-balance { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.debt-original { font-size: 0.8rem; color: var(--text-secondary); margin-left: 6px; }

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.progress-debt { background: var(--gold); }

.debt-figures {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.debt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 8px;
}
.debt-payment { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.debt-due { padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.due-overdue { background: rgba(239,68,68,0.15); color: var(--danger); }
.due-today { background: rgba(245,158,11,0.15); color: var(--warning); }
.due-soon { background: rgba(59,130,246,0.15); color: var(--info); }
.debt-done { color: var(--success); font-weight: 600; }

.debt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

.debt-fee-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 8px;
  line-height: 1.4;
  padding: 8px 10px;
  background: rgba(201,168,76,0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
}

/* Empty state */
.debts-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.debts-empty .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.debts-empty h2 { font-size: 1.2rem; margin: 0 0 8px; color: var(--text-primary); }

/* Strategies */
.strategies-section { margin-top: 32px; }
.strategies-section h2 { font-size: 1.15rem; margin: 0 0 12px; }
.strat-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.strat-tab {
  padding: 8px 18px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.strat-tab.active { background: var(--gold); color: #000; border-color: var(--gold); }
.strat-panel { display: none; }
.strat-panel.active { display: block; }
.strat-total { font-size: 0.9rem; color: var(--text-secondary); margin: 0 0 12px; }
.strat-order { padding-left: 20px; margin: 0; }
.strat-order li { margin-bottom: 10px; }
.strat-name { font-weight: 600; display: block; }
.strat-detail { font-size: 0.8rem; color: var(--text-secondary); }

/* Completed section */
.completed-section { margin-top: 24px; }
.completed-section summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
}

/* Simulator modal */
.sim-body { padding: 8px 0; }
.sim-debt-name { font-weight: 600; font-size: 1.05rem; margin: 0 0 16px; }
.sim-slider-wrap { margin-bottom: 20px; }
.sim-slider-wrap label { font-size: 0.85rem; color: var(--text-secondary); display: block; margin-bottom: 8px; }
.sim-slider-wrap input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}
.sim-slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}
.sim-results { display: flex; flex-direction: column; gap: 12px; }
.sim-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.sim-row span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-hint { font-size: 0.8rem; color: var(--text-muted); margin: 12px 0 0; text-align: center; }
.sim-hint[hidden] { display: none; }
