/* =============================================
   FinOrder — Styles
   Mobile first • Dark theme • Friendly finance
   ============================================= */

:root {
  /* Colors - Warm dark palette */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-elevated: #334155;
  --bg-modal: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6ee7b7;
  --accent-dim: rgba(110, 231, 183, 0.15);
  --accent-text: #064e3b;

  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.15);
  --green: #6ee7b7;
  --green-dim: rgba(110, 231, 183, 0.15);
  --blue: #60a5fa;

  /* Typography */
  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing */
  --nav-height: 72px;
  --fab-bottom: 88px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Radius */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

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

input, select, button, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

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

/* Lucide SVG icons defaults */
[data-lucide] { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }
svg.lucide { display: inline-block; vertical-align: middle; }

.hidden { display: none !important; }

/* ---- Screens ---- */
.screen {
  min-height: 100dvh;
  width: 100%;
}

.page {
  display: none;
  padding: 0 20px 120px;
  animation: fadeUp 0.3s ease;
}

.page.active { display: block; }

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

/* =============================================
   AUTH
   ============================================= */
.auth-container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), #34d399);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  color: var(--accent-text);
}

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-tagline {
  color: var(--text-secondary);
  margin-top: 6px;
  font-size: 1.05rem;
}

.auth-form {
  width: 100%;
  max-width: 360px;
  display: none;
}

.auth-form.active { display: flex; flex-direction: column; gap: 14px; }

.auth-switch {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 8px;
}

.error-msg {
  background: var(--red-dim);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 16px;
  text-align: center;
  width: 100%;
  max-width: 360px;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group input,
.form-group select {
  background: var(--bg-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

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

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-with-prefix {
  position: relative;
}

.input-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 600;
  z-index: 1;
}

.input-with-prefix input {
  padding-left: 36px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: var(--accent-text);
  font-weight: 700;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; }

.btn-outline {
  border: 2px solid var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.2s;
}

.btn-outline:hover { border-color: var(--accent); }

.btn-ghost {
  color: var(--text-secondary);
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: center;
}

.btn-ghost:hover { color: var(--text-primary); }

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.2s;
}

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

.btn-full { width: 100%; }
.btn-lg { padding: 16px 28px; font-size: 1.05rem; }
.btn-danger { color: var(--red); }

/* =============================================
   APP HEADER
   ============================================= */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.header-greeting {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.header-month {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: capitalize;
}

/* =============================================
   STATUS CARD (Semáforo)
   ============================================= */
.status-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.status-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--status-color, var(--text-muted));
  transition: background 0.4s;
}

.status-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--status-color, var(--text-muted));
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--status-color, transparent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.status-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.status-amount {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.status-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =============================================
   QUICK STATS
   ============================================= */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

/* =============================================
   SECTIONS
   ============================================= */
.section {
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

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

.section-header .section-title {
  margin-bottom: 0;
}

/* =============================================
   INCOME SECTION
   ============================================= */
.income-summary {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.income-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.income-value {
  font-weight: 700;
  color: var(--text-primary);
}

.income-extra {
  color: var(--green);
}

.income-total-row {
  border-top: 1px solid var(--bg-elevated);
  padding-top: 8px;
  font-weight: 700;
  color: var(--text-primary);
}

.income-entry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.income-entry-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.income-entry-amount {
  font-weight: 700;
  color: var(--green);
  font-size: 0.9rem;
}

.income-entry-delete {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.income-entry-delete:hover { color: var(--red); }

/* =============================================
   CATEGORY CHART (bars)
   ============================================= */
.category-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.cat-info { flex: 1; min-width: 0; }

.cat-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.cat-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.cat-amount {
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
}

/* =============================================
   CARDS
   ============================================= */
.cards-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.cards-scroll::-webkit-scrollbar { display: none; }

.credit-card-widget {
  min-width: 260px;
  background: var(--card-color, var(--bg-card));
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
}

.credit-card-widget::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.cc-brand {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 16px;
}

.cc-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
}

.cc-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
}

.cc-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.7);
  transition: width 0.5s ease, background 0.3s;
}

.cc-bar-fill.danger { background: var(--red); }
.cc-bar-fill.warning { background: var(--yellow); }

.cc-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.cc-stats span:first-child { color: rgba(255, 255, 255, 0.6); }
.cc-stats span:last-child { font-weight: 700; }

/* =============================================
   EXPENSE LIST
   ============================================= */
.expense-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  transition: background 0.15s;
  cursor: pointer;
}

.expense-item:active { background: var(--bg-card-hover); }

.exp-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.exp-info {
  flex: 1;
  min-width: 0;
}

.exp-category {
  font-weight: 600;
  font-size: 0.9rem;
}

.exp-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exp-right {
  text-align: right;
  flex-shrink: 0;
}

.exp-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.exp-method {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =============================================
   FILTERS
   ============================================= */
.expense-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 16px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.filter-chip.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* =============================================
   MONTH SELECTOR
   ============================================= */
.month-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-selector span {
  font-weight: 600;
  min-width: 120px;
  text-align: center;
  text-transform: capitalize;
}

/* =============================================
   FAB (Floating Action Button)
   ============================================= */
.fab {
  position: fixed;
  bottom: var(--fab-bottom);
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: var(--accent-text);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(110, 231, 183, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 50;
}

.fab:active {
  transform: scale(0.92);
}

/* =============================================
   BOTTOM NAV
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: var(--bg-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item i { font-size: 1.2rem; }
.nav-item svg { width: 22px; height: 22px; }

.nav-item.active {
  color: var(--accent);
}

/* =============================================
   MODAL (Bottom Sheet style)
   ============================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-modal);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 12px 24px 36px;
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(0);
  animation: sheetUp 0.3s ease;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  margin: 0 auto 16px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Amount input big */
.amount-input-group {
  position: relative;
  margin-bottom: 8px;
}

.amount-prefix {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-muted);
}

.amount-input {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  padding: 12px 0 12px 36px;
  width: 100%;
  background: none;
  border-bottom: 3px solid var(--bg-elevated);
  transition: border-color 0.2s;
}

.amount-input:focus {
  border-color: var(--accent);
}

/* Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.cat-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.cat-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.cat-option-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.cat-option-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* Payment toggle */
.payment-toggle {
  display: flex;
  gap: 8px;
}

.pay-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  color: var(--text-secondary);
}

.pay-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* Installment picker */
.installment-picker {
  display: flex;
  gap: 8px;
}

.inst-option {
  width: 48px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.inst-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* =============================================
   PROFILE & AVATAR
   ============================================= */
.profile-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-wrapper {
  position: relative;
  display: inline-block;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--accent-dim), var(--bg-elevated));
  border: 3px solid var(--bg-elevated);
  user-select: none;
}

.avatar-edit-btn {
  position: absolute;
  bottom: 0;
  right: -4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--bg-card);
}

.avatar-edit-btn svg { width: 14px; height: 14px; }

.profile-display-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
}

.profile-display-email {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.avatar-picker {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: fadeUp 0.2s ease;
}

.avatar-picker-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-align: center;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  justify-items: center;
}

.avatar-option {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  background: var(--bg-elevated);
  border: 2px solid transparent;
  transition: all 0.2s;
}

.avatar-option:hover {
  transform: scale(1.1);
}

.avatar-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Header avatar (small) */
.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg-elevated);
  flex-shrink: 0;
  cursor: pointer;
}

.plan-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-badge-free {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.plan-badge-pro {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  color: #fbbf24;
}

.plan-badge-familia {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(168, 85, 247, 0.2));
  color: #a855f7;
}

/* =============================================
   ONBOARDING
   ============================================= */
.onboarding-container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 40px 24px;
  max-width: 420px;
  margin: 0 auto;
}

.onboarding-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

#onb-step-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.onb-step {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.onb-step.active {
  display: flex;
  animation: fadeUp 0.3s ease;
}

.onb-emoji {
  font-size: 3rem;
}

.onb-step h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.onb-step p {
  color: var(--text-secondary);
  line-height: 1.5;
}

.onb-nav {
  display: flex;
  justify-content: space-between;
  padding-top: 24px;
  margin-top: auto;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* =============================================
   TOAST
   ============================================= */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  white-space: nowrap;
}

.toast.success { background: var(--green); color: var(--accent-text); }
.toast.error { background: var(--red); color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-12px); }
}

/* =============================================
   PLANS PAGE
   ============================================= */
.plans-hero {
  text-align: center;
  margin-bottom: 24px;
}

.plans-hero-text {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
}

.plans-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.plan-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  border: 2px solid var(--bg-elevated);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

.plan-card.current {
  border-color: var(--accent);
}

.plan-card.highlighted {
  border-color: var(--yellow);
}

.plan-card-popular {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--yellow);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-card-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.plan-card-price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.plan-card-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-card-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

.plan-features-check {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.plan-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.plan-feature-item .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.plan-feature-item .check.yes {
  background: var(--green-dim);
  color: var(--green);
}

.plan-feature-item .check.no {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.plan-feature-item .feature-text {
  color: var(--text-secondary);
}

.plan-feature-item .check.yes + .feature-text {
  color: var(--text-primary);
}

.plan-card-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.plan-card-btn.current-btn {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: default;
}

.plan-card-btn.upgrade-btn {
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: var(--accent-text);
}

.plan-card-btn.upgrade-btn:active { transform: scale(0.97); }

.plan-card-btn.coming-soon {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: default;
  font-style: italic;
}

.plan-upgrade-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.btn-upgrade-plans {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  margin-top: 14px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(168, 85, 247, 0.15));
  border: 2px solid rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-upgrade-plans:hover {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(168, 85, 247, 0.25));
}

.btn-upgrade-plans svg { width: 18px; height: 18px; }

.subscription-info-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.sub-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--bg-elevated);
}

.sub-info-row:last-child { border-bottom: none; }
.sub-info-value { color: var(--text-primary); font-weight: 600; }

/* =============================================
   TOGGLE SWITCH
   ============================================= */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.toggle-check {
  display: none;
}

.toggle-slider {
  width: 48px;
  height: 26px;
  background: var(--bg-elevated);
  border-radius: 13px;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 3px;
  left: 3px;
  transition: transform 0.3s, background 0.3s;
}

.toggle-check:checked + .toggle-slider {
  background: var(--accent-dim);
}

.toggle-check:checked + .toggle-slider::after {
  transform: translateX(22px);
  background: var(--accent);
}

/* =============================================
   LOAN PROGRESS BAR
   ============================================= */
.loan-progress {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.loan-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.loan-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.loan-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.loan-pay-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  border: none;
}

.loan-pay-btn:hover { background: var(--accent); color: var(--accent-text); }

.debt-summary {
  background: var(--red-dim);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.debt-summary-label {
  font-size: 0.85rem;
  color: var(--red);
}

.debt-summary-amount {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--red);
}

/* =============================================
   PLAN FEATURES & UPGRADE
   ============================================= */
.plan-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.plan-feature-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-feature-value {
  font-size: 0.85rem;
  font-weight: 700;
}

.plan-feature-value.available { color: var(--green); }
.plan-feature-value.locked { color: var(--text-muted); }

.upgrade-card {
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-top: 24px;
}

.upgrade-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}

.upgrade-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.export-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 600;
  font-size: 0.9rem;
  width: 100%;
  text-align: center;
  color: var(--text-primary);
  text-decoration: none;
}

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

.export-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================
   RECURRING SUMMARY
   ============================================= */
.recurring-summary {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rec-summary-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.rec-summary-amount {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.rec-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.rec-item-actions button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
  font-size: 0.85rem;
}

.rec-item-actions button:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.rec-item-actions .btn-rec-delete:hover {
  color: var(--red);
}

.rec-frequency-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
}

.rec-next-due {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =============================================
   RESPONSIVE — Tablets+
   ============================================= */
@media (min-width: 768px) {
  .page { max-width: 600px; margin: 0 auto; }
  .bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .fab { right: calc(50% - 280px); }
  .modal-sheet { max-width: 500px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-lg); bottom: 10%; }
}
