/* === SpendStride Design System === */
/* ADHD-friendly: high contrast, calming colors, clear hierarchy, generous whitespace */

:root {
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --color-bg: #f7f5f0;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-muted: #6b6b80;
  --color-primary: #2d6a4f;
  --color-primary-light: #40916c;
  --color-primary-dark: #1b4332;
  --color-accent: #e9c46a;
  --color-accent-dark: #d4a843;
  --color-danger: #d62828;
  --color-danger-light: #fde8e8;
  --color-warn: #f77f00;
  --color-warn-light: #fff3e0;
  --color-success: #2d6a4f;
  --color-success-light: #e8f5e9;
  --color-info: #264653;
  --color-info-light: #e3f2fd;
  --color-border: #e0ddd5;
  --color-border-light: #eae8e2;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(26,26,46,0.06);
  --shadow-md: 0 4px 12px rgba(26,26,46,0.08);
  --shadow-lg: 0 8px 24px rgba(26,26,46,0.1);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --max-w: 1200px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; }
h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; }

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-dark); }

img { max-width: 100%; display: block; }

/* === HEADER === */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.site-header__inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.site-header__logo { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-family: var(--font-display); color: var(--color-text); }
.logo-icon { font-size: 1.5rem; }
.logo-text strong { color: var(--color-primary); }
.site-header__actions { display: flex; align-items: center; gap: 0.75rem; }
.header-greeting { font-size: 0.875rem; color: var(--color-text-muted); }
.tier-badge { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.tier-badge--1 { background: var(--color-border-light); color: var(--color-text-muted); }
.tier-badge--2 { background: #dbeafe; color: #1e40af; }
.tier-badge--3 { background: #fde68a; color: #92400e; }
.inline-form { display: inline; }

/* === NAV === */
.main-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  padding: 0 1.5rem;
  max-width: var(--max-w); margin: 0 auto;
}
.main-nav__list { list-style: none; display: flex; gap: 0.25rem; overflow-x: auto; }
.main-nav__link {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 0.85rem; font-size: 0.875rem; font-weight: 500;
  color: var(--color-text-muted); border-bottom: 2px solid transparent;
  transition: all var(--transition); white-space: nowrap;
}
.main-nav__link:hover { color: var(--color-text); background: var(--color-border-light); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.main-nav__link.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.nav-icon { font-size: 1.1rem; }
.main-nav__divider { width: 1px; background: var(--color-border); margin: 0.5rem 0; }

/* === MAIN CONTENT === */
.main-content { max-width: var(--max-w); margin: 0 auto; padding: 2rem 1.5rem; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.25rem; font-size: 0.875rem; font-weight: 600;
  font-family: var(--font-body); border: none; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn--outline { background: transparent; border: 1.5px solid var(--color-primary); color: var(--color-primary); }
.btn--outline:hover { background: var(--color-primary); color: #fff; }
.btn--ghost { background: transparent; color: var(--color-text-muted); }
.btn--ghost:hover { background: var(--color-border-light); color: var(--color-text); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: #b71c1c; color: #fff; }
.btn--sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn--xs { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
.btn--lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn--block { width: 100%; }

/* === CARDS === */
.card {
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light); margin-bottom: 1.5rem;
}
.card--narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

/* === FORMS === */
.form-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.65rem 0.85rem; font-size: 0.95rem; font-family: var(--font-body);
  border: 1.5px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-bg); color: var(--color-text);
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}
.form-group textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-inline { display: flex; gap: 0.5rem; align-items: end; margin-top: 0.75rem; }
.form-inline select { flex: 1; padding: 0.5rem; border: 1.5px solid var(--color-border); border-radius: var(--radius); font-family: var(--font-body); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.hint { font-weight: 400; text-transform: none; letter-spacing: 0; }

/* === FLASH MESSAGES === */
.flash {
  padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem;
  font-size: 0.875rem; font-weight: 500; display: flex; align-items: center; gap: 0.5rem;
}
.flash__icon { font-weight: 700; }
.flash--success { background: var(--color-success-light); color: var(--color-success); border: 1px solid #a5d6a7; }
.flash--error { background: var(--color-danger-light); color: var(--color-danger); border: 1px solid #ef9a9a; }
.flash--info { background: var(--color-info-light); color: var(--color-info); border: 1px solid #90caf9; }

/* === ALERTS === */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.875rem; }
.alert--warn { background: var(--color-warn-light); color: #e65100; border: 1px solid #ffcc80; }
.alert a { font-weight: 600; text-decoration: underline; }

/* === STATS ROW === */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--color-surface); padding: 1.25rem; border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 0.25rem;
}
.stat-card__label { font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card__value { font-size: 1.75rem; font-family: var(--font-display); font-weight: 700; color: var(--color-text); }

/* === PAGE HEADER === */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem; }
.page-header__actions { display: flex; gap: 0.5rem; }

/* === TABLES === */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { text-align: left; padding: 0.65rem 0.75rem; font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--color-border); }
.table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--color-border-light); }
.table tr:hover { background: rgba(45,106,79,0.03); }
.clickable-row { cursor: pointer; }

/* === BUDGET CARDS === */
.budget-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.budget-card {
  display: block; background: var(--color-surface); padding: 1.25rem;
  border-radius: var(--radius-lg); border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm); transition: all var(--transition); color: var(--color-text);
}
.budget-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary-light); transform: translateY(-2px); }
.budget-card__header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.75rem; }
.budget-card__name { font-family: var(--font-display); font-size: 1.1rem; }
.budget-card__bar { height: 8px; background: var(--color-border-light); border-radius: 4px; overflow: hidden; margin-bottom: 0.5rem; }
.budget-card__fill { height: 100%; border-radius: 4px; transition: width 600ms ease; }
.budget-card__fill--ok { background: var(--color-primary); }
.budget-card__fill--warn { background: var(--color-warn); }
.budget-card__fill--over { background: var(--color-danger); }
.budget-card__meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--color-text-muted); }
.budget-card__remaining { font-weight: 600; }
.budget-card__remaining.over { color: var(--color-danger); }
.budget-card__freq { font-size: 0.7rem; color: var(--color-text-muted); text-transform: uppercase; margin-top: 0.25rem; display: block; }

/* === BUDGET DETAIL BAR === */
.budget-detail-bar { margin-bottom: 1.25rem; }
.budget-detail-bar__track { height: 12px; background: var(--color-border-light); border-radius: 6px; overflow: hidden; }
.budget-detail-bar__fill { height: 100%; border-radius: 6px; transition: width 600ms ease; }
.budget-detail-bar__fill--ok { background: var(--color-primary); }
.budget-detail-bar__fill--warn { background: var(--color-warn); }
.budget-detail-bar__fill--over { background: var(--color-danger); }
.budget-detail-bar__meta { display: flex; justify-content: space-between; font-size: 0.85rem; margin-top: 0.4rem; }
.over { color: var(--color-danger); font-weight: 600; }

/* === BUDGET META ROW === */
.budget-meta-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem; font-size: 0.85rem; color: var(--color-text-muted); }

/* === BADGES === */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; background: var(--color-border-light); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.badge--sm { font-size: 0.65rem; padding: 0.15rem 0.5rem; }
.badge--muted { background: var(--color-border-light); color: var(--color-text-muted); }

/* === TAG LIST === */
.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.75rem; background: var(--color-border-light); border-radius: 20px; font-size: 0.8rem; }
.tag__remove { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--color-text-muted); line-height: 1; }
.tag__remove:hover { color: var(--color-danger); }

/* === DETAIL GRID === */
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; }
.detail-grid dt { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-grid dd { font-size: 0.95rem; }

/* === TRANSACTION LIST === */
.txn-list { list-style: none; }
.txn-item { display: flex; justify-content: space-between; align-items: center; padding: 0.65rem 0; border-bottom: 1px solid var(--color-border-light); }
.txn-item__info { display: flex; flex-direction: column; gap: 0.1rem; }
.txn-item__name { font-weight: 500; font-size: 0.9rem; }
.txn-item__date { font-size: 0.75rem; color: var(--color-text-muted); }
.txn-item__amount { font-weight: 600; font-size: 0.95rem; font-family: var(--font-display); }

/* === DASHBOARD GRID === */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.dashboard-section { background: var(--color-surface); padding: 1.5rem; border-radius: var(--radius-lg); border: 1px solid var(--color-border-light); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--color-text-muted); }
.empty-state h2 { margin-bottom: 0.5rem; }
.empty-state .btn { margin-top: 1rem; }

/* === ACCOUNT CARDS === */
.account-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.account-card { background: var(--color-surface); padding: 1.25rem; border-radius: var(--radius-lg); border: 1px solid var(--color-border-light); }
.account-card__header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.5rem; }
.account-card__mask { font-size: 0.85rem; color: var(--color-text-muted); }
.account-card__balance { font-size: 1.5rem; font-family: var(--font-display); font-weight: 700; margin: 0.25rem 0; }
.account-card__actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

/* === TIER CARDS === */
.tier-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tier-card { background: var(--color-surface); padding: 1.5rem; border-radius: var(--radius-lg); border: 1.5px solid var(--color-border); text-align: center; }
.tier-card--current { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(45,106,79,0.15); }
.tier-card__price { font-size: 2rem; font-family: var(--font-display); font-weight: 700; margin: 0.5rem 0; }
.tier-card__price span { font-size: 0.85rem; font-weight: 400; color: var(--color-text-muted); }
.tier-card__features { list-style: none; text-align: left; margin: 1rem 0; font-size: 0.85rem; }
.tier-card__features li { padding: 0.35rem 0; border-bottom: 1px solid var(--color-border-light); }

/* === STRATEGY CARDS === */
.strategy-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.strategy-card { background: var(--color-surface); padding: 1.5rem; border-radius: var(--radius-lg); border: 1px solid var(--color-border-light); }
.strategy-card--soon { opacity: 0.6; }
.strategy-card h3 { margin-bottom: 0.5rem; }
.strategy-card p { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 1rem; }

/* === ONBOARDING === */
.onboarding { max-width: 640px; margin: 0 auto; text-align: center; }
.onboarding h1 { margin-bottom: 0.5rem; }
.onboarding p { color: var(--color-text-muted); margin-bottom: 2rem; }
.onboarding-steps { display: flex; flex-direction: column; gap: 1.5rem; text-align: left; }
.onboarding-step { background: var(--color-surface); padding: 1.25rem; border-radius: var(--radius-lg); border: 1px solid var(--color-border-light); display: flex; align-items: start; gap: 1rem; }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; }
.onboarding--done { padding: 3rem 0; }

/* === AUTH === */
.auth-page { background: var(--color-bg); min-height: 100vh; }
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 70vh; padding: 2rem 1.5rem; }
.auth-card { background: var(--color-surface); padding: 2.5rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 100%; max-width: 420px; }
.auth-card--wide { max-width: 540px; }
.auth-card__title { font-family: var(--font-display); margin-bottom: 0.25rem; }
.auth-card__subtitle { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.15rem; }
.auth-card__footer { margin-top: 1.5rem; text-align: center; font-size: 0.85rem; color: var(--color-text-muted); }
.auth-card__footer a { color: var(--color-primary); font-weight: 600; }
.divider { margin: 0 0.5rem; }

/* === PREVIEW SPLITS (50/30/20) === */
.preview-splits { display: flex; gap: 1rem; }
.split-item { flex: 1; background: var(--color-border-light); padding: 0.75rem; border-radius: var(--radius); text-align: center; }
.split-item span { display: block; font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; }
.split-item strong { font-family: var(--font-display); font-size: 1.15rem; }

/* === ENVELOPE / ZB ROWS === */
.envelope-row, .zb-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.envelope-row input, .zb-row input { flex: 1; padding: 0.5rem; border: 1.5px solid var(--color-border); border-radius: var(--radius); font-family: var(--font-body); }

/* === ERROR PAGE === */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 5rem; font-family: var(--font-display); color: var(--color-primary); margin-bottom: 0.5rem; }
.error-page p { color: var(--color-text-muted); margin-bottom: 1.5rem; font-size: 1.1rem; }

/* === CURRENT PLAN === */
.current-plan { border-left: 4px solid var(--color-primary); }

/* === FOOTER === */
.site-footer { border-top: 1px solid var(--color-border); padding: 1.5rem; margin-top: 3rem; }
.site-footer__inner { max-width: var(--max-w); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--color-text-muted); }
.site-footer__links { display: flex; gap: 1.25rem; }
.site-footer__links a { color: var(--color-text-muted); }
.site-footer__links a:hover { color: var(--color-primary); }

/* === MUTED === */
.muted { color: var(--color-text-muted); font-size: 0.85rem; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .site-header__inner { padding: 0.5rem 1rem; }
  .main-content { padding: 1.25rem 1rem; }
  .site-footer__inner { flex-direction: column; gap: 0.5rem; text-align: center; }
  .preview-splits { flex-direction: column; }
  h1 { font-size: 1.5rem; }
}
