/* ==========================================================================
   CSS DESIGN SYSTEM - NEXO GASTOS (PWA PRE-OPTIMIZED FOR iOS)
   ========================================================================== */

/* --- CSS VARIABLES & TOKENS --- */
:root {
  /* Hex Palette provided by user */
  --bg-primary: #0A0F1E;      /* Rich Deep Midnight */
  --card-bg: #1B2A41;         /* Deep Slate Blue */
  --accent-primary: #3B82F6;  /* Vibrant Neon Blue */
  --color-muted: #94A3B8;     /* Cool Slate Gray */
  --color-light: #E2E8F0;     /* Light Gray Text */
  
  /* Additional Functional Colors */
  --accent-secondary: #2563EB; /* Deep Accent Blue */
  --color-white: #FFFFFF;
  --color-income: #10B981;    /* Vibrant Emerald */
  --color-expense: #EF4444;   /* Vivid Coral/Red */
  --color-warning: #F59E0B;   /* Amber */
  
  /* Glassmorphism settings */
  --glass-bg: rgba(27, 42, 65, 0.65);
  --glass-border: rgba(148, 163, 184, 0.08);
  --glass-glow: rgba(59, 130, 246, 0.15);
  
  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

/* --- BASE STYLES & RESET --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* Disable default gray tap block on mobile Safari */
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--color-light);
  font-family: var(--font-sans);
  font-size: 16px;
  overflow-x: hidden;
  position: relative;
  /* Safe area settings for iOS */
  padding: 0;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Custom Scrollbar for modern feel */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--card-bg);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* --- VIEW CONTROLLER --- */
.view-screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  flex-direction: column;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-screen.active {
  display: flex;
}

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

/* ==========================================================================
   1. LOGIN SCREEN
   ========================================================================== */
#login-screen {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15) 0%, transparent 60%),
              radial-gradient(circle at bottom left, rgba(27, 42, 65, 0.4) 0%, transparent 80%),
              var(--bg-primary);
}

.login-container {
  width: 100%;
  max-width: 380px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 36px;
  padding: 40px 30px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
              0 0 40px -5px rgba(59, 130, 246, 0.05);
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  filter: drop-shadow(0 4px 20px rgba(59, 130, 246, 0.3));
}

.logo-svg {
  width: 100%;
  height: 100%;
}

.login-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  color: var(--color-white);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 32px;
  line-height: 1.4;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-muted);
}

.styled-input {
  width: 100%;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--color-white);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: all 0.25s ease;
  outline: none;
}

.styled-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
  background: rgba(10, 15, 30, 0.8);
}

.styled-textarea {
  width: 100%;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--color-white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.25s ease;
  outline: none;
  resize: none;
}

.styled-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
  background: rgba(10, 15, 30, 0.8);
}

/* --- BUTTONS --- */
.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border: none;
  border-radius: 16px;
  padding: 16px 24px;
  color: var(--color-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.4);
}

.primary-btn:active {
  transform: scale(0.97);
  box-shadow: 0 4px 10px -4px rgba(59, 130, 246, 0.4);
}

.pulse-glow {
  position: relative;
}

.pulse-glow::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 18px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.pulse-glow:hover::before {
  opacity: 0.4;
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.05); opacity: 0; }
  100% { transform: scale(1); opacity: 0.4; }
}

/* Quick Session Selector */
.section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 28px 0 20px;
}

.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.section-divider::before { margin-right: 12px; }
.section-divider::after { margin-left: 12px; }

.quick-users-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-user-card {
  background: rgba(27, 42, 65, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.quick-user-card:hover, .quick-user-card:active {
  background: var(--card-bg);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.quick-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.quick-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-light);
}

/* ==========================================================================
   2. MAIN DASHBOARD SCREEN & CORE LAYOUT
   ========================================================================== */

/* --- APP HEADER (Notch Safe-Area Adjusted) --- */
.app-header {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 20px;
  /* Top Notch Buffer on iOS */
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.greeting-subtitle {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.username {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-white);
  font-family: var(--font-display);
}

.icon-btn {
  background: rgba(148, 163, 184, 0.1);
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.logout-btn:active {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-expense);
}

/* --- APP CONTENT CONTAINER --- */
.app-content {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 100px; /* Large bottom padding for FAB bar spacing */
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- MONTH SELECTOR CARD --- */
.month-selector-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 12px 16px;
}

.chevron-btn {
  background: transparent;
  border: none;
  color: var(--color-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chevron-btn:active {
  background: rgba(148, 163, 184, 0.1);
  color: var(--color-white);
}

.active-month-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-white);
}

/* --- FINANCIAL SUMMARY CARD --- */
.summary-card {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(27, 42, 65, 0.4) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 24px;
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.glow-border::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.summary-balance-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.balance-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.balance-amount {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.25rem;
  color: var(--color-white);
  letter-spacing: -0.5px;
}

.summary-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 20px;
}

.split-column {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.split-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.split-icon-bg {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.income .split-icon-bg {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-income);
}

.expense .split-icon-bg {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-expense);
}

.split-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-white);
}

/* --- COMMON CARD BOX --- */
.card-box {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 22px;
}

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

/* --- DONUT CHART WRAPPER --- */
.chart-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  margin-bottom: 20px;
}

.donut-chart-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Start circular sweep from top center */
}

.donut-bg {
  fill: none;
  stroke: rgba(27, 42, 65, 0.6);
  stroke-width: 18;
}

.donut-segment {
  fill: none;
  stroke-width: 18;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.donut-center-info {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-center-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  color: var(--color-white);
  line-height: 1;
}

.donut-center-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.category-legend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-light);
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.legend-value {
  font-weight: 700;
  color: var(--color-white);
}

/* --- HORIZONTAL PROGRESS BARS --- */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  padding-top: 18px;
}

.breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-row-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.breakdown-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-light);
  font-weight: 500;
}

.row-icon-svg {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}

.breakdown-row-val {
  font-weight: 700;
  color: var(--color-white);
}

.breakdown-row-val span {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 400;
  margin-left: 4px;
}

.breakdown-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(27, 42, 65, 0.8);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- TRANSACTION FEED / HISTORY --- */
.feed-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.count-tag {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Empty State Box */
.empty-state {
  background: rgba(27, 42, 65, 0.25);
  border: 2px dashed rgba(148, 163, 184, 0.1);
  border-radius: 24px;
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.empty-icon-container {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* Day Grouping container */
.day-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.day-header {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 6px;
  margin-top: 8px;
}

/* Elegant Cards for lists */
.transaction-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.3s ease forwards;
}

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

.transaction-card:active {
  background: rgba(27, 42, 65, 0.8);
  border-color: rgba(148, 163, 184, 0.15);
}

.card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  flex: 1;
}

.card-icon-bg {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  flex-shrink: 0;
}

.card-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-white);
}

.card-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.card-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.card-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.card-value.val-expense {
  color: var(--color-white);
}

.card-value.val-income {
  color: var(--color-income);
}

/* Inline action button to delete, styled sleekly */
.delete-action-btn {
  background: rgba(239, 68, 68, 0.1);
  border: none;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-expense);
  cursor: pointer;
  opacity: 0;
  transition: all 0.25s ease;
}

.transaction-card:hover .delete-action-btn, 
.transaction-card:active .delete-action-btn,
.delete-action-btn:focus {
  opacity: 1;
}

/* For mobile devices, we always display the delete action button but slightly smaller/lighter */
@media (max-width: 600px) {
  .delete-action-btn {
    opacity: 0.6;
  }
}

/* ==========================================================================
   3. BOTTOM FLOATING NAVIGATION BAR
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, var(--bg-primary) 80%, transparent 100%);
  padding: 10px 24px calc(12px + env(safe-area-inset-bottom)); /* Dynamic spacing to prevent iPhone Home indicator bar overlap */
  z-index: 99;
  display: flex;
  justify-content: center;
}

.nav-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fab-btn {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px -4px rgba(59, 130, 246, 0.6),
              0 0 20px -2px rgba(59, 130, 246, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-top: -30px; /* Offset the button upwards for modern floating tab look */
  border: 4px solid var(--bg-primary);
}

.fab-btn:active {
  transform: scale(0.92) translateY(2px);
  box-shadow: 0 5px 12px -3px rgba(59, 130, 246, 0.6);
}

/* ==========================================================================
   4. BOTTOM SHEET MODAL (ADD RECORD)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: flex-end; /* Align sheet at the bottom for iOS feeling */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--card-bg);
  border-top: 1px solid var(--glass-border);
  border-radius: 36px 36px 0 0;
  padding: 16px 24px calc(24px + env(safe-area-inset-bottom)); /* Add extra padding to respect bottom iPhone bar */
  box-shadow: 0 -15px 40px -10px rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 40px;
  height: 5px;
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
  margin: 0 auto 16px;
}

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

.sheet-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-white);
}

.close-btn {
  background: rgba(148, 163, 184, 0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
}

.transaction-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Income/Expense Toggle Tabs */
.transaction-type-selector {
  display: flex;
  background: rgba(10, 15, 30, 0.5);
  border-radius: 14px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.type-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 12px 10px;
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.type-tab.active[data-type="gasto"] {
  background: var(--accent-primary);
  color: var(--color-white);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.type-tab.active[data-type="ingreso"] {
  background: var(--color-income);
  color: var(--color-white);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

/* Currency input size */
.amount-input-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 12px 0;
  position: relative;
}

.currency-symbol {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.5rem;
  color: var(--color-white);
}

.amount-input {
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.75rem;
  color: var(--color-white);
  width: 180px;
  outline: none;
  text-align: left;
}

.amount-input::placeholder {
  color: rgba(226, 232, 240, 0.2);
}

/* Custom form labels */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-muted);
}

/* Categories Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
}

.category-select-card {
  background: rgba(10, 15, 30, 0.4);
  border: 1.5px solid rgba(148, 163, 184, 0.1);
  border-radius: 14px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.category-select-card:active {
  transform: scale(0.95);
}

.category-select-card.selected {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.select-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-size: 1.1rem;
}

.select-card-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-light);
  white-space: nowrap;
}

.submit-form-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--color-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 12px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.4);
  transition: all 0.3s ease;
}

.submit-form-btn:active {
  transform: scale(0.98);
}

.submit-form-btn.income-mode {
  background: linear-gradient(135deg, var(--color-income) 0%, #059669 100%);
  box-shadow: 0 8px 20px -6px rgba(16, 185, 129, 0.4);
}

/* Utility Hidden */
.hidden {
  display: none !important;
}

/* --- LOCKED USER & PASSWORD FLOW --- */
.locked-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(10, 15, 30, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 20px;
  padding: 16px 20px;
  margin-bottom: 8px;
  animation: fadeIn 0.3s ease;
}

.locked-avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.2);
}

.locked-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.locked-label {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.locked-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-white);
}

.auth-helper-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.auth-link {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.auth-link:hover, .auth-link:active {
  color: var(--accent-primary);
}

/* --- SPLASH SCREEN --- */
.splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-primary);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
}

.splash-screen.active {
  display: flex;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: zoomIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.splash-logo {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.35));
}

.splash-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.25rem;
  color: var(--color-white);
  letter-spacing: -0.5px;
  margin-top: 8px;
}

.splash-loader {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(148, 163, 184, 0.1);
  border-top: 3px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-top: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes zoomIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- RESPONSIVE DATE PICKER (iOS SAFARI OVERRIDES) --- */
input[type="date"].styled-input {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  font-family: var(--font-sans);
  color-scheme: dark; /* Force native iOS date wheel/popup into premium dark mode styling */
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"].styled-input::-webkit-calendar-picker-indicator {
  background: transparent;
  bottom: 0;
  color: transparent;
  cursor: pointer;
  height: auto;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
}

/* Add custom calendar icon representation at the end */
input[type="date"].styled-input::after {
  content: '';
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8' stroke-width='2.5'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  position: absolute;
  right: 20px;
  pointer-events: none;
}

/* ==========================================================================
   5. RESPONSIVE OPTIMIZATIONS (LARGE SCREEN FALLBACKS)
   ========================================================================== */
@media (min-width: 600px) {
  body {
    background-image: radial-gradient(circle at 10% 20%, rgba(27, 42, 65, 0.15) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  }
  
  .app-header {
    border-radius: 0 0 24px 24px;
    max-width: 600px;
    margin: 0 auto;
  }
  
  .bottom-nav {
    background: transparent;
    padding-bottom: 24px;
  }
  
  .nav-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    height: 70px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .fab-btn {
    margin-top: -34px;
    border-color: var(--bg-primary);
  }
  
  .modal-overlay {
    align-items: center; /* Center sheet modal on desktops */
  }
  
  .bottom-sheet {
    border-radius: 28px;
    transform: scale(0.9) translateY(40px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 0;
  }
  
  .modal-overlay.active .bottom-sheet {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
