/* ============================================================
   styles.css – FinTrack PWA · Mobile-first design system
   Tipografía: Outfit (display) + JetBrains Mono (números)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design Tokens ── */
:root {
  --bg:          #0D1117;
  --surface:     #161B22;
  --card:        #1C2230;
  --card-hover:  #212A3A;
  --border:      rgba(255,255,255,0.07);
  --border-soft: rgba(255,255,255,0.04);

  --text:        #E6EDF3;
  --text-muted:  #8B949E;
  --text-faint:  #484F58;

  --income:      #3FB950;
  --income-bg:   rgba(63,185,80,0.12);
  --expense:     #F85149;
  --expense-bg:  rgba(248,81,73,0.12);
  --savings:     #D29922;
  --savings-bg:  rgba(210,153,34,0.12);
  --transfer:    #A371F7;
  --transfer-bg: rgba(163,113,247,0.12);

  --primary:     #58A6FF;
  --primary-bg:  rgba(88,166,255,0.12);

  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-xl:   28px;

  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.6);

  --nav-h:       72px;
  --header-h:    56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);

  --font:  'Outfit', system-ui, sans-serif;
  --mono:  'JetBrains Mono', monospace;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, select, textarea, button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Splash Screen ── */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
#splash.hidden { opacity: 0; pointer-events: none; transform: scale(1.05); }
.splash-logo {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  box-shadow: 0 0 40px rgba(59,130,246,0.4);
  animation: splash-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes splash-pulse {
  from { box-shadow: 0 0 20px rgba(59,130,246,0.3); }
  to   { box-shadow: 0 0 50px rgba(59,130,246,0.6); }
}
.splash-name {
  font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #58A6FF, #A371F7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.splash-sub { color: var(--text-muted); font-size: 14px; }
.splash-dots { display: flex; gap: 6px; margin-top: 8px; }
.splash-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); opacity: 0.3;
  animation: dot-pulse 1s ease-in-out infinite;
}
.splash-dot:nth-child(2) { animation-delay: 0.2s; }
.splash-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.3); }
}

/* ── App Shell ── */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
#app.visible { opacity: 1; pointer-events: all; }

/* ── Header ── */
#main-header {
  height: var(--header-h);
  padding-top: var(--safe-top);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding-left: 16px; padding-right: 16px;
  gap: 12px;
  flex-shrink: 0;
  position: relative; z-index: 10;
}
#header-title {
  font-size: 17px; font-weight: 700;
  flex: 1;
}

/* Month navigation */
#month-nav {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 8px;
}
#month-nav-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  min-width: 80px; text-align: center;
  text-transform: capitalize;
}
.month-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  transition: background var(--transition), color var(--transition);
}
.month-btn:hover, .month-btn:active {
  background: var(--border);
  color: var(--text);
}

/* ── Main Content ── */
#main-content {
  flex: 1; overflow: hidden;
  position: relative;
}

/* ── Views ── */
.view {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 16px);
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.view.active {
  opacity: 1; pointer-events: all;
  transform: translateY(0);
}
.view::-webkit-scrollbar { display: none; }

/* ── Bottom Navigation ── */
#bottom-nav {
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  position: relative; z-index: 10;
}
.nav-item {
  flex: 1; height: var(--nav-h);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  color: var(--text-faint);
  transition: color var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.nav-item:active { transform: scale(0.92); }
.nav-item.active { color: var(--primary); }
.nav-icon {
  font-size: 22px; line-height: 1;
  transition: transform var(--transition);
}
.nav-item.active .nav-icon { transform: translateY(-1px); }
.nav-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px;
}

/* ── FAB ── */
#fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  z-index: 20;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: white;
  font-size: 28px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(59,130,246,0.5);
  transition: transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}
#fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 10px rgba(59,130,246,0.3);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-size: 14px; font-weight: 700;
  color: var(--text);
}
.card-row {
  display: flex; align-items: center; justify-content: space-between;
}
.card-label { font-size: 13px; color: var(--text-muted); }

/* ── Hero Card (Dashboard) ── */
.hero-card {
  background: linear-gradient(135deg, #1a2845 0%, #1C2230 60%, #1a1d2e 100%);
  border: 1px solid rgba(88,166,255,0.15);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  margin-bottom: 12px;
  position: relative; overflow: hidden;
  text-align: center;
}
.hero-card::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(88,166,255,0.15) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-label {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.8px;
}
.hero-amount {
  font-family: var(--mono);
  font-size: 36px; font-weight: 600;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.1;
}
.hero-amount.negative { color: var(--expense); }
.hero-period {
  font-size: 12px; color: var(--text-muted);
  margin-top: 6px; text-transform: capitalize;
}

/* ── KPI Row ── */
.kpi-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 12px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  display: flex; align-items: center; gap: 8px;
}
.kpi-card.income  { border-color: rgba(63,185,80,0.2); }
.kpi-card.expense { border-color: rgba(248,81,73,0.2); }
.kpi-card.savings { border-color: rgba(210,153,34,0.2); }
.kpi-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.income .kpi-icon  { background: var(--income-bg);  color: var(--income); }
.expense .kpi-icon { background: var(--expense-bg); color: var(--expense); }
.savings .kpi-icon { background: var(--savings-bg); color: var(--savings); }
.kpi-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-family: var(--mono); font-size: 12px; font-weight: 600; margin-top: 1px; }

/* ── Progress bar ── */
.progress-bar-wrap {
  height: 6px; border-radius: 100px;
  background: rgba(255,255,255,0.06);
  overflow: hidden; margin: 8px 0 4px;
}
.progress-bar-fill {
  height: 100%; border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  background: var(--primary);
}
.progress-bar-fill.ok     { background: var(--income); }
.progress-bar-fill.warn   { background: var(--savings); }
.progress-bar-fill.danger { background: var(--expense); }

/* ── Accounts list ── */
.accounts-list { display: flex; flex-direction: column; gap: 4px; }
.account-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.account-row:last-child { border-bottom: none; }
.account-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.account-icon.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.account-name { font-size: 14px; font-weight: 600; }
.account-balance { font-family: var(--mono); font-size: 14px; font-weight: 600; flex-shrink: 0; }

/* ── Charts ── */
.chart-donut-wrap { max-width: 260px; margin: 0 auto; padding: 8px 0; }
.chart-bar-wrap   { height: 180px; }
.chart-hbar-wrap  { height: 200px; }
.empty-chart {
  text-align: center; padding: 24px;
  color: var(--text-muted); font-size: 13px;
}

/* ── Section header ── */
.section-header {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.5px;
}

/* ── Transactions ── */
.search-bar-wrap {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.search-bar {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  height: 42px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); }
.search-icon { font-size: 14px; color: var(--text-muted); }
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 14px;
}
.search-bar input::placeholder { color: var(--text-muted); }

.filter-chips {
  display: flex; gap: 6px; overflow-x: auto;
  margin-bottom: 10px; padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  height: 30px; padding: 0 12px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition);
}
.chip.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.tx-stats {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding: 0 2px;
}
.tx-groups { display: flex; flex-direction: column; gap: 16px; }
.tx-date-header {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px; padding: 0 4px;
}
.tx-list { display: flex; flex-direction: column; gap: 2px; }
.tx-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.tx-row:active { background: var(--card-hover); }
.tx-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-desc {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta { margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.tx-date { margin-top: 1px; }

/* ── Budget ── */
.budget-summary .budget-summary-row {
  display: flex; justify-content: space-between; gap: 8px;
}
.budget-list { display: flex; flex-direction: column; gap: 10px; }
.budget-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color var(--transition);
}
.budget-card.over-budget { border-color: rgba(248,81,73,0.4); }
.budget-card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.budget-cat { display: flex; align-items: center; gap: 6px; }
.cat-icon { font-size: 18px; }
.budget-cat-name { font-size: 14px; font-weight: 700; }
.budget-amounts {
  display: flex; gap: 6px; align-items: baseline;
  margin-bottom: 6px;
}

/* ── Reports: Fixed vs Variable ── */
.fixed-var-row { display: flex; gap: 20px; margin-bottom: 12px; }
.fixed-var-item { display: flex; gap: 10px; align-items: flex-start; }
.fv-dot {
  width: 10px; height: 10px; border-radius: 50%;
  margin-top: 3px; flex-shrink: 0;
}
.fv-dot.fixed    { background: var(--primary); }
.fv-dot.variable { background: var(--savings); }
.fv-bar { display: flex; height: 8px; border-radius: 100px; overflow: hidden; gap: 2px; }
.fv-bar-fixed    { background: var(--primary); transition: width 0.6s ease; }
.fv-bar-variable { background: var(--savings); flex: 1; }

/* ── Goals ── */
.goal-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.goal-card:last-child { border-bottom: none; }
.goal-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.goal-icon { font-size: 20px; }
.goal-name { font-size: 14px; font-weight: 700; }
.goal-amounts { font-size: 13px; margin-bottom: 6px; }

/* ── Settings ── */
.settings-list { display: flex; flex-direction: column; gap: 4px; }
.settings-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-name { font-size: 14px; font-weight: 600; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px 4px 8px;
  font-size: 12px; font-weight: 600;
}
.chip-del {
  color: var(--text-faint); font-size: 10px;
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition);
}
.chip-del:active { color: var(--expense); }

.about-card {
  text-align: center; padding: 24px;
  margin-top: 8px;
}
.about-logo { font-size: 40px; margin-bottom: 8px; }
.about-name { font-size: 20px; font-weight: 800; }
.about-ver  { font-size: 13px; margin: 4px 0 12px; }
.about-desc { font-size: 12px; line-height: 1.6; max-width: 280px; margin: 0 auto; }

/* ── Modals (Bottom Sheets) ── */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: none;
}
.modal.open .modal-overlay { opacity: 1; }
.modal.open .modal-sheet   { transform: translateY(0); }

.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  max-height: 92dvh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 100px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body {
  flex: 1; overflow-y: auto;
  padding: 16px 18px;
  -webkit-overflow-scrolling: touch;
}
.modal-body::-webkit-scrollbar { display: none; }
.modal-footer {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 18px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Type Tabs (Transaction modal) ── */
.type-tabs {
  display: flex; padding: 10px 18px 0;
  gap: 4px; overflow-x: auto;
  scrollbar-width: none; flex-shrink: 0;
}
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab {
  flex: 1; min-width: fit-content;
  height: 32px; padding: 0 12px;
  border-radius: 100px;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all var(--transition);
}
.type-tab.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Amount input ── */
.amount-input-wrap {
  display: flex; align-items: center; gap: 4px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}
.amount-input-wrap:focus-within { border-color: var(--primary); }
.amount-currency {
  font-size: 24px; font-weight: 700;
  color: var(--text-muted);
  font-family: var(--mono);
}
.amount-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--mono);
  font-size: 32px; font-weight: 600;
  color: var(--text);
  min-width: 0;
}
.amount-input::placeholder { color: var(--text-faint); }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--primary); }
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238B949E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-group input[type="date"] { color-scheme: dark; }
.form-toggle {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-direction: row;
}
.form-toggle label:first-child {
  font-size: 14px; font-weight: 500;
  color: var(--text); text-transform: none; letter-spacing: 0;
}

/* ── Toggle switch ── */
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  inset: 0; border-radius: 100px;
  background: var(--border);
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary-bg); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--primary);
}

/* ── Buttons ── */
.btn {
  height: 46px; padding: 0 20px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: white;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}
.btn-primary:active { box-shadow: none; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost {
  background: var(--card);
  color: var(--text-muted);
}
.btn-danger {
  background: rgba(248,81,73,0.1);
  color: var(--expense);
  border: 1px solid rgba(248,81,73,0.2);
}
.btn.w-full { width: 100%; }
.btn.flex-1 { flex: 1; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.92); background: var(--card-hover); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; font-size: 11px; }
.icon-btn.danger { color: var(--expense); }

.text-btn {
  font-size: 13px; font-weight: 700;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.text-btn:active { background: var(--primary-bg); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 100px;
  font-size: 11px; font-weight: 700;
}
.badge-outline {
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}

/* ── Utility classes ── */
.mono { font-family: var(--mono); }
.text-income   { color: var(--income); }
.text-expense  { color: var(--expense); }
.text-savings  { color: var(--savings); }
.text-muted    { color: var(--text-muted); }
.text-sm       { font-size: 12px; }
.text-xs       { font-size: 11px; }
.font-600      { font-weight: 600; }
.font-700      { font-weight: 700; }
.flex-1        { flex: 1; }
.mt-4          { margin-top: 4px; }
.mt-8          { margin-top: 8px; }
.mb-12         { margin-bottom: 12px; }
.form-row      { display: flex; gap: 8px; }
.negative      { color: var(--expense); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 80px);
  left: 50%; transform: translateX(-50%) translateY(12px);
  background: #2D3748;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 14px; font-weight: 600;
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-color: rgba(63,185,80,0.3); }
.toast-error   { border-color: rgba(248,81,73,0.3); }
.toast-info    { border-color: rgba(88,166,255,0.3); }

/* ── iOS safe areas & overscroll ── */
@supports (padding-top: env(safe-area-inset-top)) {
  #main-header { padding-top: calc(var(--safe-top) + 8px); height: calc(var(--header-h) + var(--safe-top)); }
}
html, body { overscroll-behavior: none; }

/* ── Scrollbar (non-iOS) ── */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
*::-webkit-scrollbar { width: 3px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 100px; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeUp 0.3s ease both; }
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.10s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }

/* ── No select on interactive elements ── */
.nav-item, .chip, .type-tab, .btn, .tx-row, .budget-card { -webkit-user-select: none; user-select: none; }
