/* FinanzaApp — Modern Financial Dashboard */
:root {
  --bg-primary: #050711;
  --bg-secondary: #0b1020;
  --bg-card: rgba(21, 29, 46, 0.6);
  --bg-card-solid: #151d2e;
  --bg-card-hover: rgba(26, 36, 56, 0.8);
  --bg-elevated: #1e293b;
  --border: rgba(148, 163, 184, 0.08);
  --border-light: rgba(148, 163, 184, 0.16);
  --border-glow: rgba(99, 102, 241, 0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #ec4899;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-glow-strong: rgba(99, 102, 241, 0.5);
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
  --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(139, 92, 246, 0.04) 50%, rgba(236, 72, 153, 0.04) 100%);
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.12);
  --purple: #8b5cf6;
  --pink: #ec4899;
  --cyan: #06b6d4;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --font: 'DM Sans', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --sidebar-w: 260px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bouncy: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated Background Orbs */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}

body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -150px;
  left: -100px;
  animation: floatOrb1 20s ease-in-out infinite;
}

body::after {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  bottom: -200px;
  right: -150px;
  animation: floatOrb2 25s ease-in-out infinite;
}

@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(100px, 80px) scale(1.1); }
  66% { transform: translate(-50px, 120px) scale(0.9); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-150px, -100px) scale(1.15); }
}

#app {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(11, 16, 32, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.75rem 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--accent-glow) 20%, var(--accent-glow) 80%, transparent);
  opacity: 0.5;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.75rem;
  margin-bottom: 2.5rem;
}

.brand-logo {
  filter: drop-shadow(0 0 12px var(--accent-glow-strong));
  animation: pulseGlow 3s ease-in-out infinite, spinSlow 20s linear infinite;
  transform-origin: center;
}

@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 12px var(--accent-glow-strong)); }
  50% { filter: drop-shadow(0 0 24px var(--accent-glow-strong)); }
}

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

.sidebar-brand:hover .brand-logo {
  animation-duration: 3s, 2s;
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0.875rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.8rem 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transition: transform var(--transition);
  border-radius: 0 3px 3px 0;
}

.nav-link:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.05));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.nav-link.active::before { transform: scaleY(1); }

.nav-link.active svg {
  stroke: url(#iconGradient);
  stroke: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow-strong));
}

.nav-link svg { transition: all var(--transition); }
.nav-link:hover svg { transform: scale(1.1); }

.sidebar-footer {
  padding: 1rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-connect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem;
  background: var(--gradient-primary);
  background-size: 200% 200%;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-connect::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.8s;
}

.btn-connect:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
  background-position: 100% 100%;
}

.btn-connect:hover::before { transform: translateX(100%); }

.btn-connect:active { transform: translateY(0); }

.btn-seed {
  padding: 0.6rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-seed:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.btn-seed--danger:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-bg);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.5rem;
  max-width: 1280px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mobile-header {
  display: none;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(11, 16, 32, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform var(--transition);
}

.hamburger:hover { transform: rotate(90deg); }

/* Page Header */
.page-header {
  margin-bottom: 2rem;
  animation: slideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: cardFadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card:hover::before { opacity: 1; }

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

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

.card-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  animation: cardFadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover::after { opacity: 0.3; }

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-value[style*="var(--green)"] {
  background: var(--gradient-success);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-value[style*="var(--red)"] {
  background: var(--gradient-danger);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-value[style*="var(--orange)"] {
  background: var(--gradient-warning);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.5rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  transition: all var(--transition);
}

.stat-change.up { color: var(--red); background: var(--red-bg); }
.stat-change.down { color: var(--green); background: var(--green-bg); }

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}

.chart-container {
  position: relative;
  height: 290px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: -0.25rem;
  padding: 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.8rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

td {
  padding: 0.85rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background var(--transition);
}

tbody tr {
  transition: all var(--transition);
}

tbody tr:hover td {
  background: rgba(99, 102, 241, 0.06);
}

tbody tr:hover td:first-child {
  border-left: 2px solid var(--accent);
  padding-left: calc(0.85rem - 2px);
}

.amount-positive { color: var(--green); font-family: var(--mono); font-weight: 600; }
.amount-negative { color: var(--red); font-family: var(--mono); font-weight: 600; }

/* Category Badges */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  transition: all var(--transition);
}

.cat-badge:hover {
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

/* Budget Progress */
.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.1rem;
}

.budget-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: cardFadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.budget-grid > .budget-card:nth-child(1) { animation-delay: 0.05s; }
.budget-grid > .budget-card:nth-child(2) { animation-delay: 0.1s; }
.budget-grid > .budget-card:nth-child(3) { animation-delay: 0.15s; }
.budget-grid > .budget-card:nth-child(4) { animation-delay: 0.2s; }
.budget-grid > .budget-card:nth-child(5) { animation-delay: 0.25s; }
.budget-grid > .budget-card:nth-child(6) { animation-delay: 0.3s; }
.budget-grid > .budget-card:nth-child(7) { animation-delay: 0.35s; }
.budget-grid > .budget-card:nth-child(8) { animation-delay: 0.4s; }

.budget-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
}

.budget-card.alert {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.1);
}

.budget-card.exceeded {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.15);
  animation: cardFadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards, shakeAlert 0.5s ease-in-out 0.6s 2;
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

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

.budget-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}

.budget-name .icon {
  font-size: 1.35rem;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.3));
}

.budget-amounts {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-family: var(--mono);
}

.budget-spent { font-size: 1.15rem; font-weight: 600; }
.budget-limit { color: var(--text-muted); font-size: 0.85rem; }

.progress-bar {
  height: 10px;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.6rem;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 12px currentColor;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.budget-edit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.budget-edit input {
  width: 110px;
  padding: 0.45rem 0.65rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 0.85rem;
  transition: all var(--transition);
}

.budget-edit input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.budget-edit button {
  padding: 0.45rem 0.9rem;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.budget-edit button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
}

/* Recurring */
.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.recurring-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.recurring-list .recurring-item:nth-child(1) { animation-delay: 0.05s; }
.recurring-list .recurring-item:nth-child(2) { animation-delay: 0.1s; }
.recurring-list .recurring-item:nth-child(3) { animation-delay: 0.15s; }
.recurring-list .recurring-item:nth-child(4) { animation-delay: 0.2s; }
.recurring-list .recurring-item:nth-child(5) { animation-delay: 0.25s; }
.recurring-list .recurring-item:nth-child(6) { animation-delay: 0.3s; }
.recurring-list .recurring-item:nth-child(7) { animation-delay: 0.35s; }
.recurring-list .recurring-item:nth-child(8) { animation-delay: 0.4s; }
.recurring-list .recurring-item:nth-child(n+9) { animation-delay: 0.45s; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.recurring-item:hover {
  border-color: var(--border-light);
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

.recurring-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.recurring-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all var(--transition);
}

.recurring-item:hover .recurring-icon {
  transform: scale(1.1) rotate(-5deg);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.recurring-name { font-weight: 600; }
.recurring-cat { font-size: 0.8rem; color: var(--text-muted); }

.recurring-amount {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.1rem;
}

.recurring-freq {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

.recurring-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}

/* Export */
.export-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}

.export-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardFadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.export-options .export-card:nth-child(1) { animation-delay: 0.05s; }
.export-options .export-card:nth-child(2) { animation-delay: 0.1s; }
.export-options .export-card:nth-child(3) { animation-delay: 0.15s; }

.export-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: -1;
}

.export-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.25);
}

.export-card:hover .export-icon {
  transform: scale(1.15) rotate(5deg);
}

.export-icon {
  font-size: 2.75rem;
  margin-bottom: 0.85rem;
  display: inline-block;
  transition: transform var(--transition-bouncy);
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.export-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  font-size: 1.02rem;
}

.export-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.export-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.export-filters > div { display: flex; flex-direction: column; gap: 0.3rem; }

.export-filters label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.export-filters input, .export-filters select {
  padding: 0.55rem 0.8rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  transition: all var(--transition);
}

.export-filters input:focus, .export-filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Alerts */
.alert-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  transition: all var(--transition);
  animation: alertPulse 0.5s ease;
}

.alert-item.exceeded {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border-color: rgba(239, 68, 68, 0.25);
  border-left-color: var(--red);
}

.alert-item:hover {
  transform: translateX(4px);
}

@keyframes alertPulse {
  0% { opacity: 0; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

.alert-icon { font-size: 1.3rem; }

.alert-text {
  flex: 1;
  font-size: 0.88rem;
}

.alert-amount {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--orange);
}

.alert-item.exceeded .alert-amount { color: var(--red); }

/* Transactions Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.2rem;
  padding: 1rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: cardFadeUp 0.5s ease backwards;
}

.filter-bar input, .filter-bar select {
  padding: 0.55rem 0.85rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  min-width: 150px;
  transition: all var(--transition);
}

.filter-bar input:focus, .filter-bar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(30, 41, 59, 0.8);
}

.filter-bar input::placeholder { color: var(--text-muted); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.pagination button {
  padding: 0.5rem 0.9rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

.pagination button:disabled { opacity: 0.4; cursor: default; }

.pagination span {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 1000;
}

.toast {
  padding: 0.9rem 1.35rem;
  background: rgba(21, 29, 46, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 260px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--orange); }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Loading & Spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.85rem;
  box-shadow: 0 0 20px var(--accent-glow);
}

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.05) 25%, rgba(148, 163, 184, 0.12) 50%, rgba(148, 163, 184, 0.05) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4.5rem 2rem;
  color: var(--text-muted);
  animation: fadeIn 0.5s ease;
}

.empty-state .icon {
  font-size: 3.5rem;
  margin-bottom: 1.25rem;
  display: inline-block;
  animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
  transition: background var(--transition);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Selection */
::selection {
  background: var(--accent-glow-strong);
  color: var(--text-primary);
}

/* Focus */
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* View transitions */
.main-content > * {
  animation: viewFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ─── Boot Loader ──────────────────────────────────────────── */
.boot-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 3000;
}

/* ─── Login Screen ─────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at center, rgba(11, 16, 32, 0.4), var(--bg-primary) 70%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  animation: fadeIn 0.4s ease;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.15);
  position: relative;
  overflow: hidden;
  animation: loginCardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.login-brand svg {
  filter: drop-shadow(0 0 16px var(--accent-glow-strong));
  animation: pulseGlow 3s ease-in-out infinite;
}

.login-brand h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-form label span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-form input {
  padding: 0.85rem 1rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: all var(--transition);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-btn {
  margin-top: 0.5rem;
  padding: 0.95rem;
  background: var(--gradient-primary);
  background-size: 200% 200%;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.8s;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
  background-position: 100% 100%;
}

.login-btn:hover:not(:disabled)::before { transform: translateX(100%); }
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: 0.7; cursor: wait; }

.login-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-btn-spinner[hidden] { display: none; }

/* Sidebar auth buttons */
.btn-change-pwd,
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-change-pwd:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.btn-logout:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-bg);
}

.btn-change-pwd svg,
.btn-logout svg { flex-shrink: 0; }

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 7, 17, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2500;
  animation: fadeIn 0.2s ease;
}

.modal {
  width: 100%;
  max-width: 440px;
  padding: 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.15);
  position: relative;
  overflow: hidden;
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  color: var(--red);
  background: var(--red-bg);
  transform: rotate(90deg);
}

.modal h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
  background: linear-gradient(135deg, #f1f5f9 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-form label span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-form input {
  padding: 0.75rem 0.9rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.modal-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.password-strength {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: -0.3rem;
  animation: fadeIn 0.2s ease;
}

.password-strength-bar {
  flex: 1;
  height: 5px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 5px;
  transition: width 0.35s ease, background-color 0.35s ease;
  box-shadow: 0 0 8px currentColor;
}

.password-strength-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  min-width: 90px;
  text-align: right;
  transition: color 0.3s ease;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.modal-actions button {
  flex: 1;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.modal-btn-primary {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.modal-btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.8s;
}

.modal-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
  background-position: 100% 100%;
}

.modal-btn-primary:hover:not(:disabled)::before { transform: translateX(100%); }
.modal-btn-primary:disabled { opacity: 0.7; cursor: wait; }

.modal-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.modal-btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: rgba(148, 163, 184, 0.05);
}

/* Variante larga per il modal di import CSV */
.modal.modal-wide {
  max-width: 640px;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.modal-form textarea {
  padding: 0.75rem 0.9rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 0.85rem;
  resize: vertical;
  min-height: 120px;
  transition: all var(--transition);
}

.modal-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-form input[type="file"] {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.import-file-status {
  display: block;
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.import-file-status--ok {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.3);
}

.import-file-status--err {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.import-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.import-stat {
  padding: 0.9rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.import-stat--ok {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--green-bg);
}

.import-stat-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.import-stat--ok .import-stat-value {
  color: var(--green);
}

.import-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.import-detected {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.import-detected code {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.1rem 0.35rem;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 4px;
  color: var(--text-primary);
}

.import-errors {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.import-errors ul {
  margin: 0.4rem 0 0 1.2rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .main-content { padding: 2rem; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 1.25rem;
  }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .recurring-summary { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.6rem; }
  body::before, body::after { opacity: 0.2; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .budget-grid { grid-template-columns: 1fr; }
  .filter-bar { padding: 0.75rem; }
  .filter-bar input, .filter-bar select { min-width: 100%; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body::before, body::after { display: none; }
}
