/* DoFinancial — CSS puro, blanco y negro, DM Sans */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* Variables */
:root {
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5F5F5;
  --color-border: #CCCCCC;
  --color-border-strong: #999999;
  --color-text: #000000;
  --color-text-secondary: #333333;
  --color-text-muted: #666666;
  --color-text-placeholder: #999999;
  --color-accent: #111111;
  --color-accent-hover: #333333;
  --color-input-bg: #FFFFFF;
  --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --transition: 150ms ease;
}

[data-theme="dark"] {
  --color-bg: #121212;
  --color-surface: #1E1E1E;
  --color-surface-alt: #2D2D2D;
  --color-border: #333333;
  --color-border-strong: #555555;
  --color-text: #E0E0E0;
  --color-text-secondary: #B0B0B0;
  --color-text-muted: #888888;
  --color-text-placeholder: #555555;
  --color-accent: #E0E0E0;
  --color-accent-hover: #FFFFFF;
  --color-input-bg: #222222;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.875rem; letter-spacing: -0.015em; }
h3 { font-size: 1.375rem; letter-spacing: -0.01em; }
h4 { font-size: 1.125rem; }

p { color: var(--color-text-secondary); }
small { font-size: 0.8125rem; color: var(--color-text-muted); }

a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover { color: var(--color-accent); }

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Components */

/* Card */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-sm {
  padding: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background-color: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-bg);
}

.btn-secondary {
  background-color: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-surface-alt);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-surface-alt);
  color: var(--color-text);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-full { width: 100%; }

/* Input */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  color: var(--color-text);
  background-color: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

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

.form-input:focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
}

/* Progress bar */
.progress {
  height: 6px;
  background-color: var(--color-surface-alt);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--color-text);
  border-radius: 100px;
  transition: width 0.6s ease;
}

.progress-bar.warning { background-color: #666666; }
.progress-bar.danger { background-color: #333333; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  gap: 1rem;
  padding: 1.5rem 0;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Account cards scroll */
.accounts-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}

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

/* Account card styles are defined in the enhanced section below */

/* Stats */
.stat-card { text-align: left; }

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.375rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--color-text);
}

.stat-change {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* Transaction list */
.tx-list { list-style: none; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--color-border);
}

.tx-item:last-child { border-bottom: none; }

.tx-icon {
  width: 40px;
  height: 40px;
  background: var(--color-surface-alt);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

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

.tx-desc {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.tx-amount {
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: right;
  flex-shrink: 0;
}

.tx-amount.income { color: var(--color-text); }
.tx-amount.expense { color: var(--color-text); }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  font-size: 0.9375rem;
}

/* PIN pad */
.pin-display {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  transition: all var(--transition);
}

.pin-dot.filled {
  background: var(--color-text);
  border-color: var(--color-text);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
}

.pin-key {
  aspect-ratio: 1;
  font-family: var(--font-family);
  font-size: 1.125rem;
  font-weight: 500;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text);
}

.pin-key:hover { background: var(--color-border); }
.pin-key:active { transform: scale(0.95); }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
  gap: 0;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
  color: var(--color-text);
  border-bottom-color: var(--color-text);
}

/* Charts */
.chart-container {
  position: relative;
  height: 220px;
}

/* Savings goal */
.goal-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.goal-item:last-child { border-bottom: none; }

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.goal-name {
  font-weight: 500;
  font-size: 0.9375rem;
}

.goal-amounts {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Alert */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert.error {
  border-color: #333333;
  color: #111111;
}

/* Loading */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.w-full { width: 100%; }
.hidden { display: none; }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* Period filter */
.period-select {
  padding: 0.375rem 0.75rem;
  font-family: var(--font-family);
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  outline: none;
}

.period-select:focus {
  border-color: var(--color-text);
}

/* Section */
.section { margin-bottom: 2rem; }

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

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Big balance number */
.balance-hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.balance-hero .balance-label {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.balance-hero .balance-amount {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--color-text);
}

.balance-hero .balance-date {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 0 1rem; }
  h1 { font-size: 1.875rem; }
  .card { padding: 1rem; }
  .form-row { flex-direction: column; }
  .site-nav > span { display: none; }
}

/* ═══════════════════════════════════════════════════════════════ */
/*  MODAL SYSTEM                                                   */
/* ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-sm { max-width: 420px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
}

/* Modal transitions */
.modal-transition { transition: all 200ms ease-out; }
.modal-hidden { opacity: 0; transform: scale(0.95); }
.modal-visible { opacity: 1; transform: scale(1); }

/* ═══════════════════════════════════════════════════════════════ */
/*  ACCOUNT CARDS — Enhanced                                       */
/* ═══════════════════════════════════════════════════════════════ */
.account-card {
  flex: 0 0 240px;
  background: var(--color-text);
  color: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

/* Removed hover shadow and transform as requested */

.account-card-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 200ms ease;
}

.account-card:hover .account-card-actions { opacity: 1; }

.account-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  color: white;
  transition: background 150ms ease;
  backdrop-filter: blur(4px);
}

.account-action-btn:hover { background: rgba(255, 255, 255, 0.3); }

.account-icon-badge {
  font-size: 1.75rem;
  margin-bottom: 0.625rem;
  line-height: 1;
}

.account-card .account-name {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.7;
  margin-bottom: 0.375rem;
}

.account-card .account-balance {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.account-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.625rem;
}

.account-card .account-type {
  font-size: 0.75rem;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.account-currency-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.125rem 0.5rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  opacity: 0.7;
}

/* Preview card in modal */
.account-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.account-card-preview {
  flex: 0 0 260px;
  pointer-events: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════════════════════ */
/*  COLOR PICKER                                                   */
/* ═══════════════════════════════════════════════════════════════ */
.color-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-swatch-active {
  border-color: var(--color-text) !important;
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-text);
  transform: scale(1.1);
}

.color-swatch-custom {
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red) !important;
  cursor: pointer;
  overflow: hidden;
}

.color-preview-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════════════════════════ */
/*  ICON PICKER                                                    */
/* ═══════════════════════════════════════════════════════════════ */
.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.375rem;
}

.icon-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 150ms ease;
}

.icon-swatch:hover {
  background: var(--color-border);
  transform: scale(1.05);
}

.icon-swatch-active {
  border-color: var(--color-text);
  background: var(--color-text);
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-text);
}

/* ═══════════════════════════════════════════════════════════════ */
/*  FORM                                                           */
/* ═══════════════════════════════════════════════════════════════ */
.form-row {
  display: flex;
  gap: 1rem;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 12 12'%3E%3Cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════ */
/*  TOAST                                                          */
/* ═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  min-width: 250px;
}

.toast.success {
  background: #111;
  color: #fff;
}

.toast.error {
  background: #c62828;
  color: #fff;
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toast.success .toast-icon { background: rgba(255,255,255,0.2); }
.toast.error .toast-icon { background: rgba(255,255,255,0.2); }

/* Toast transitions */
.toast-enter { transition: all 300ms ease-out; }
.toast-enter-start { opacity: 0; transform: translateX(100px); }
.toast-enter-end { opacity: 1; transform: translateX(0); }
.toast-leave { transition: all 200ms ease-in; }

/* ═══════════════════════════════════════════════════════════════ */
/*  DELETE CONFIRMATION                                            */
/* ═══════════════════════════════════════════════════════════════ */
.btn-danger {
  background-color: #c62828;
  color: #fff;
  border-color: #c62828;
}

.btn-danger:hover:not(:disabled) {
  background-color: #b71c1c;
  border-color: #b71c1c;
}

.delete-warning {
  text-align: center;
  padding: 1rem 0;
}

.delete-warning-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.delete-warning p {
  color: var(--color-text);
  font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════ */
/*  EMPTY STATE                                                    */
/* ═══════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--color-surface-alt);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--color-border);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.empty-text {
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════ */
/*  STAT COLORS                                                    */
/* ═══════════════════════════════════════════════════════════════ */
.stat-income { color: #2e7d32; }
.stat-expense { color: #c62828; }
.stat-positive { color: #2e7d32; }
.stat-negative { color: #c62828; }

/* ═══════════════════════════════════════════════════════════════ */
/*  SPINNER SMALL                                                  */
/* ═══════════════════════════════════════════════════════════════ */
.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════ */
/*  INCOME / EXPENSE BUTTONS                                       */
/* ═══════════════════════════════════════════════════════════════ */
.btn-income {
  background-color: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}

.btn-income:hover:not(:disabled) {
  background-color: #1b5e20;
  border-color: #1b5e20;
}

.btn-expense {
  background-color: #c62828;
  color: #fff;
  border-color: #c62828;
}

.btn-expense:hover:not(:disabled) {
  background-color: #b71c1c;
  border-color: #b71c1c;
}

.btn-action-icon {
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1;
}

/* Hero action buttons */
.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.hero-actions .btn {
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════ */
/*  TRANSACTION MODAL — Type toggle & Amount                       */
/* ═══════════════════════════════════════════════════════════════ */
.tx-type-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.tx-type-btn {
  flex: 1;
  padding: 0.625rem 1rem;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--color-surface);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text-muted);
}

.tx-type-btn:first-child {
  border-right: 1px solid var(--color-border);
}

.tx-type-active-income {
  background: #2e7d32;
  color: #fff;
}

.tx-type-active-expense {
  background: #c62828;
  color: #fff;
}

.amount-input-wrapper {
  position: relative;
}

.amount-prefix {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.amount-input {
  padding-left: 4.5rem !important;
  font-size: 1.25rem !important;
  font-weight: 600 !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/*  FILTER BAR                                                     */
/* ═══════════════════════════════════════════════════════════════ */
.filter-bar {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.875rem;
  margin-bottom: 1rem;
}

.filter-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-bar-row + .filter-bar-row {
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--color-border);
}

.filter-presets {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.filter-preset-btn {
  padding: 0.3rem 0.75rem;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text-secondary);
}

.filter-preset-btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

.filter-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.form-input-sm {
  padding: 0.4rem 0.625rem;
  font-size: 0.8125rem;
}

/* Filter summary */
.filter-summary {
  margin-bottom: 1rem;
}

.filter-summary-stats {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.filter-stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* ═══════════════════════════════════════════════════════════════ */
/*  COMPARISON TOOL                                                */
/* ═══════════════════════════════════════════════════════════════ */
.compare-presets {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.compare-ranges {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.compare-range-box {
  flex: 1;
  min-width: 200px;
}

.compare-range-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compare-vs {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-muted);
  padding: 0 0.25rem;
  flex-shrink: 0;
}

.compare-summary-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.compare-summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.625rem;
}

.compare-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

/* Change pills */
.compare-changes {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.compare-change-pill {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
}

.change-positive {
  background: #e8f5e9;
  color: #2e7d32;
}

.change-negative {
  background: #ffebee;
  color: #c62828;
}

/* Alpine cloak to prevent flashing */
[x-cloak] {
  display: none !important;
}

@media (max-width: 640px) {
  .container { padding: 0 1rem; }
  h1 { font-size: 1.875rem; }
  .card { padding: 1rem; }
  .form-row { flex-direction: column; }
  
  .compare-ranges { flex-direction: column; }
  .compare-vs { display: none; }
  .filter-inputs { flex-direction: column; align-items: stretch; }
  .filter-inputs .form-input-sm { max-width: none !important; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-actions .btn { width: 100%; max-width: 200px; }

  /* Full screen for all modals */
  .modal-overlay {
    padding: 0;
  }
  
  .modal {
    margin: 0;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    max-width: none;
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }

  .filter-expanded-row {
    flex-direction: column;
  }
}

/* ─── AI Insights ─────────────────────────────────────── */

.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.insight-item {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* ─── Compact Filter Bar ──────────────────────────────── */

.filter-bar-compact {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.filter-compact-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-expanded-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}
