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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout helpers ───────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.center-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 24px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #475569; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-large { font-size: 1rem; padding: 14px 28px; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ── Hero / Landing ───────────────────────────────────────────────────────── */
.hero-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
}
.hero-icon { font-size: 3rem; margin-bottom: 12px; }
.hero-card h1 { font-size: 1.8rem; margin-bottom: 10px; }
.subtitle { color: var(--muted); margin-bottom: 28px; }

.features {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.feature-icon { font-size: 1.1rem; }

/* ── Spinner (syncing page) ───────────────────────────────────────────────── */
.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-wrap {
  background: var(--border);
  border-radius: 99px;
  height: 8px;
  margin: 20px 0 12px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  width: 5%;
  transition: width 0.6s ease;
}
.count-msg { color: var(--success); font-weight: 600; font-size: 0.9rem; min-height: 1.4em; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-logo { font-size: 1.1rem; font-weight: 700; }
.topbar-inner nav { display: flex; gap: 10px; }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.dashboard-main { padding: 32px 20px 60px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.summary-card {
  text-align: center;
  padding: 24px 16px;
  cursor: default;
  transition: border-color 0.2s;
}
.summary-card:hover { border-color: var(--primary); }
.summary-icon { font-size: 2rem; margin-bottom: 8px; }
.summary-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.summary-amount { font-size: 1.6rem; font-weight: 700; }
.summary-count { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

.chart-card { margin-bottom: 24px; }
.chart-card h2 { margin-bottom: 20px; font-size: 1.1rem; }
.chart-wrap { max-height: 300px; }

/* ── Collapsible transaction tables ──────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; margin-bottom: 16px; }

.collapsible-header {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: 18px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}
.collapsible-header:hover { background: rgba(255,255,255,.04); }
.chevron { color: var(--muted); font-size: 0.8rem; }

.collapsible-body { padding: 0 0 8px; }

.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.tx-table th {
  padding: 8px 16px;
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tx-table td { padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,.05); }
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: rgba(255,255,255,.03); }
.amount-col { text-align: right; font-variant-numeric: tabular-nums; }
.date-col { white-space: nowrap; color: var(--muted); }
.desc-col { color: var(--muted); max-width: 280px; }
.debit { color: #fca5a5; font-weight: 600; }

.empty-state { text-align: center; color: var(--muted); }
.empty-state a { color: var(--primary); }

/* ── Days selector ────────────────────────────────────────────────────────── */
.days-selector { margin-bottom: 16px; }
.days-label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.days-options { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.days-btn {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.days-btn:hover { border-color: var(--primary); color: var(--text); }
.days-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ── FOMO / Savings / SIP section ─────────────────────────────────────────── */
.fomo-card { margin-bottom: 24px; padding: 0; overflow: hidden; }

.fomo-alert-strip {
  background: linear-gradient(135deg, rgba(239,68,68,.18) 0%, rgba(234,88,12,.1) 100%);
  border-bottom: 1px solid rgba(239,68,68,.28);
  padding: 26px 32px;
}
.fomo-alert-badge {
  display: inline-block;
  background: rgba(239,68,68,.22);
  border: 1px solid rgba(239,68,68,.4);
  color: #fca5a5;
  font-size: 0.68rem; font-weight: 700; letter-spacing: .12em;
  padding: 3px 10px; border-radius: 99px; margin-bottom: 10px;
}
.fomo-alert-strip h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 5px; }
.fomo-alert-strip p  { color: var(--muted); font-size: 0.84rem; }

.fomo-body { padding: 28px 32px; display: flex; flex-direction: column; gap: 28px; }
.fomo-divider { height: 1px; background: var(--border); }
.fomo-section { display: flex; flex-direction: column; gap: 14px; }
.fomo-section-label {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
}

/* Category comparison rows */
.fomo-rows { display: flex; flex-direction: column; gap: 16px; }
.fomo-row {
  display: grid;
  grid-template-columns: 170px 1fr 140px;
  align-items: center;
  gap: 20px;
}
@media (max-width: 680px) { .fomo-row { grid-template-columns: 1fr; gap: 6px; } }
.fomo-row-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.92rem; }
.fomo-bar-col { display: flex; flex-direction: column; gap: 7px; }
.fomo-bar-track { height: 10px; border-radius: 99px; overflow: hidden; background: var(--border); }
.fomo-bar-fill  { height: 100%; border-radius: 99px; width: 100%; }
.fomo-bar-labels { display: flex; justify-content: space-between; font-size: 0.72rem; }
.fomo-bar-peer { color: #34d399; }
.fomo-bar-you  { color: #f87171; }
.fomo-overspend { text-align: right; }
.fomo-overspend-amt { color: #f87171; font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.fomo-overspend-sub { color: var(--muted); font-size: 0.72rem; margin-top: 3px; }

/* Savings chips */
.savings-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.saving-chip {
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.25);
  border-radius: 10px; padding: 13px 18px;
  display: flex; flex-direction: column; gap: 5px; min-width: 148px;
  transition: border-color 0.15s;
}
.saving-chip:hover { border-color: rgba(99,102,241,.55); }
.saving-label  { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.saving-amount { font-size: 1.1rem; font-weight: 800; color: #a78bfa; }
.savings-total-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(52,211,153,.07); border: 1px solid rgba(52,211,153,.2);
  border-radius: 10px; padding: 14px 20px;
  font-size: 0.88rem; color: var(--muted);
}
.savings-total-amount { font-size: 1.25rem; font-weight: 800; color: #34d399; }

/* SIP cards */
.sip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 600px) { .sip-grid { grid-template-columns: 1fr; } }
.sip-card { border-radius: 12px; padding: 24px; text-align: center; }
.sip-card.yr5  { background: linear-gradient(145deg,#0a2018,#081420); border: 1px solid rgba(52,211,153,.3); }
.sip-card.yr10 { background: linear-gradient(145deg,#120f2a,#0a0c1e); border: 1px solid rgba(139,92,246,.35); }
.sip-card.yr15 { background: linear-gradient(145deg,#221508,#140d04); border: 1px solid rgba(251,191,36,.35); }
.sip-years { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.sip-amount { font-size: 1.75rem; font-weight: 800; line-height: 1; margin-bottom: 8px; }
.sip-card.yr5  .sip-amount { color: #34d399; }
.sip-card.yr10 .sip-amount { color: #a78bfa; }
.sip-card.yr15 .sip-amount { color: #fbbf24; }
.sip-multiplier { font-size: 0.78rem; font-weight: 700; margin-bottom: 5px; }
.sip-card.yr5  .sip-multiplier { color: rgba(52,211,153,.75); }
.sip-card.yr10 .sip-multiplier { color: rgba(167,139,250,.75); }
.sip-card.yr15 .sip-multiplier { color: rgba(251,191,36,.75); }
.sip-note { font-size: 0.72rem; color: var(--muted); }

/* ── Shared utility classes (replaces inline styles across templates) ──────── */
.d-none { display: none !important; }
.brand-blue  { color: #3563E9; }
.brand-green { color: #15C47A; }
.footer-link { color: #3563E9; text-decoration: none; }
.btn-danger-ghost { color: #f87171 !important; border-color: rgba(248,113,113,.3) !important; }

/* Brand / logo */
.brand-link-col { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; }
.logo-64  { height: 64px; }
.logo-28  { height: 28px; }
.logo-22  { height: 22px; }
.brand-text-lg { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.brand-text-sm { font-weight: 800; font-size: .95rem; }
.icon-svg  { vertical-align: middle; margin-right: 8px; }

/* Topbar / nav brand link (syncing, dashboard) */
.topbar-brand    { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.nav-brand-link  { display: flex; align-items: center; gap: 6px; text-decoration: none; }

/* Footer bars */
.footer-links    { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); font-size: .76rem; color: #94a3b8; text-align: center; }
.syncing-footer  { text-align: center; padding: 12px 0 4px; font-size: .76rem; color: #94a3b8; }
.dash-footer     { text-align: center; padding: 12px 0 4px; font-size: .72rem; color: #94A3B8; border-top: 1px solid #F1F5F9; margin-top: 8px; }

/* Dashboard loading / content states */
.dash-loading { text-align: center; padding: 40px 0; color: #94A3B8; font-size: .85rem; }

/* Dashboard — stories CTA block */
.stories-cta-wrap  { padding: 10px 0 4px; }
.stories-cta-link  { display: flex; align-items: center; justify-content: space-between; text-decoration: none; background: linear-gradient(135deg,#0F172A,#1E3A5F); border-radius: 14px; padding: 13px 16px; }
.stories-cta-left  { display: flex; align-items: center; gap: 10px; }
.stories-cta-icon  { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,#3563E9,#60A5FA); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.stories-cta-title { font-size: .78rem; font-weight: 700; color: #fff; line-height: 1.2; }
.stories-cta-sub   { font-size: .62rem; color: rgba(255,255,255,.38); margin-top: 2px; }
.stories-cta-arrow { font-size: .8rem; color: rgba(255,255,255,.3); }

/* Dashboard — SIP section card */
.sip-card-body { background: #fff; border: 1px solid #E9EEF8; border-radius: 20px; padding: 20px; box-shadow: 0 2px 16px rgba(15,23,42,.05); }

/* POST-form buttons that look like <a> / btn elements */
.btn-form { background: none; border: none; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ── OTP Sign-in ─────────────────────────────────────────────────────────── */
.otp-form { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }

.input-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
  transition: border-color 0.15s;
}
.input-group:focus-within { border-color: var(--primary); }
.input-prefix {
  padding: 12px 14px;
  background: var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
}
.text-input {
  flex: 1;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
.text-input::placeholder { color: var(--muted); }

.otp-code-input {
  width: 100%;
  padding: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.6rem;
  letter-spacing: 0.35em;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.otp-code-input:focus { border-color: var(--primary); }
.otp-code-input::placeholder { font-size: 0.9rem; letter-spacing: normal; color: var(--muted); }

.error-msg { color: var(--danger); font-size: 0.83rem; margin-top: 2px; text-align: center; }
.success-msg { color: var(--success); font-size: 0.83rem; margin-top: 2px; text-align: center; }

.resend-wrap { color: var(--muted); font-size: 0.83rem; margin-top: 6px; text-align: center; }
.btn-link {
  background: none; border: none;
  color: var(--primary); cursor: pointer;
  font-size: 0.83rem; padding: 0;
  text-decoration: underline; font-family: inherit;
}
.btn-link:disabled { color: var(--muted); text-decoration: none; cursor: not-allowed; }

.step-subtitle { color: var(--muted); margin-bottom: 4px; font-size: 0.92rem; }
.step-subtitle strong { color: var(--text); }

@media (max-width: 480px) {
  .otp-code-input { font-size: 1.3rem; letter-spacing: 0.25em; }
}
