/* Estilos personalizados para FinanzApp */

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Generales */
body {
  background: #f8fafc;
  background-image:
    radial-gradient(at 0% 0%, rgba(219, 234, 254, 0.5) 0, transparent 50%),
    radial-gradient(at 50% 0%, rgba(237, 233, 254, 0.5) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(219, 234, 254, 0.5) 0, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}

.fadeIn {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.slideIn {
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tarjetas */
.card-zoom:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease-in-out;
}

/* Etiquetas */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  line-height: 1;
  font-weight: 500;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* Campos de formulario con validación */
input:invalid:not(:placeholder-shown),
select:invalid:not(:placeholder-shown) {
  border-color: #EF4444;
}

input:invalid:focus,
select:invalid:focus {
  border-color: #EF4444;
  box-shadow: 0 0 0 1px #EF4444;
}

.form-error {
  color: #EF4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}




/* Tablas */
table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.05);
}

/* Toast/Notificaciones */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 50;
  transition: all 0.3s ease-in-out;
  animation: slideIn 0.3s ease-in-out;
}

.toast-success {
  background-color: #D1FAE5;
  border-left: 4px solid #10B981;
  color: #065F46;
}

.toast-error {
  background-color: #FEE2E2;
  border-left: 4px solid #EF4444;
  color: #B91C1C;
}

.toast-info {
  background-color: #DBEAFE;
  border-left: 4px solid #3B82F6;
  color: #1E40AF;
}

/* Responsive */
@media (max-width: 640px) {
  .toast {
    left: 1rem;
    right: 1rem;
  }

  .fc-header-toolbar {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem;
  }
}

/* --- Premium Enhancements --- */

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Glassmorphism Utility */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Enhanced Card Hover */
.card-zoom {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-zoom:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Gradient Text */
.text-gradient {
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(to right, #2563eb, #9333ea);
}

/* Modern Buttons */
.btn-premium {
  background-image: linear-gradient(to right, #2563eb, #1d4ed8);
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-premium:hover {
  background-image: linear-gradient(to right, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

/* ========================================
   BANK CARDS SYSTEM - Premium Design
   ======================================== */

/* Bank Color Variables */
:root {
  --bcp-primary: #003d7a;
  --bcp-accent: #0058a3;
  --interbank-primary: #00aeef;
  --interbank-accent: #0095d5;
  --bbva-primary: #004481;
  --bbva-accent: #004481;
  --scotiabank-primary: #ed1c24;
  --scotiabank-accent: #c71a24;
  --banbif-primary: #ff6600;
  --banbif-accent: #e65500;
}

/* Bank Card Container */
.bank-card {
  position: relative;
  width: 100%;
  /* aspect-ratio: 1.586; */
  /* Removido - causaba que los botones se cortaran */
  min-height: 220px;
  /* Altura mínima para asegurar que todo el contenido sea visible */
  border-radius: 16px;
  padding: 24px;
  color: white;
  overflow: visible;
  /* Cambiado de hidden a visible para mostrar los botones */
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.bank-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Bank-specific backgrounds */
.bank-card.bcp {
  background: linear-gradient(135deg, var(--bcp-primary) 0%, var(--bcp-accent) 100%);
}

.bank-card.interbank {
  background: linear-gradient(135deg, var(--interbank-primary) 0%, var(--interbank-accent) 100%);
}

.bank-card.bbva {
  background: linear-gradient(135deg, var(--bbva-primary) 0%, var(--bbva-accent) 100%);
}

.bank-card.scotiabank {
  background: linear-gradient(135deg, var(--scotiabank-primary) 0%, var(--scotiabank-accent) 100%);
}

.bank-card.banbif {
  background: linear-gradient(135deg, var(--banbif-primary) 0%, var(--banbif-accent) 100%);
}

.bank-card.otro {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* Card decorative elements */
.bank-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* Card type badge */
.card-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
}

/* Card number styling */
.card-number {
  font-family: 'Courier New', monospace;
  font-size: 1.125rem;
  letter-spacing: 0.1em;
  margin: 20px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Card balance */
.card-balance {
  font-size: 1.875rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-top: auto;
}

/* Credit card specific */
.credit-limit-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.credit-limit-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ef4444 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Grid layout for cards */
.bank-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .bank-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Card icons */
.card-chip {
  width: 48px;
  height: 38px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 6px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Botones de editar y eliminar en tarjetas */
.edit-btn,
.delete-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.edit-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: scale(1.1);
}

.bank-card .edit-btn,
.bank-card .delete-btn {
  color: white;
  opacity: 0.9;
}

.bank-card .edit-btn:hover,
.bank-card .delete-btn:hover {
  opacity: 1;
}

/* =====================================================
   PAGOS RECURRENTES - Estilos Premium
   ===================================================== */

/* Tarjeta de pago recurrente */
.recurring-payment-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-left: 4px solid #3b82f6;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.recurring-payment-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Estados de pago */
.recurring-payment-card.upcoming {
  border-left-color: #f59e0b;
}

.recurring-payment-card.overdue {
  border-left-color: #ef4444;
}

.recurring-payment-card.paid {
  border-left-color: #10b981;
}

.recurring-payment-card.inactive {
  opacity: 0.6;
  border-left-color: #9ca3af;
}

/* Badge de frecuencia */
.frequency-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badge de estado */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.upcoming {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.overdue {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.paid {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.inactive {
  background: #e5e7eb;
  color: #374151;
}

/* Monto destacado */
.recurring-amount {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin: 8px 0;
}

/* Contador de días */
.days-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.days-counter.urgent {
  background: #fef3c7;
  color: #92400e;
}

/* Botones de acción */
.recurring-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.recurring-action-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.recurring-action-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.recurring-action-btn.primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: scale(1.02);
}

.recurring-action-btn.secondary {
  background: #f3f4f6;
  color: #374151;
}

.recurring-action-btn.secondary:hover {
  background: #e5e7eb;
}

.recurring-action-btn.danger {
  background: #fee2e2;
  color: #991b1b;
}

.recurring-action-btn.danger:hover {
  background: #fecaca;
}

/* Estado vacío */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
}

/* Grid responsivo */
.recurring-payments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Animaciones */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recurring-payment-card {
  animation: slideInUp 0.3s ease;
}

/* --- Pulido Final Premium --- */

/* Header Navigation */
.nav-link {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 12px;
  right: 12px;
  height: 3px;
  background: white;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  animation: fadeIn 0.3s ease;
}

/* Sections Glassmorphism */
.section {
  animation: fadeIn 0.5s ease-out;
}

.bg-white.rounded-lg.shadow {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
  border-radius: 16px !important;
}

/* FullCalendar Specific Polish */
.fc .fc-toolbar-chunk:first-child .fc-button-group {
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  display: flex;
  gap: 2px;
}

.fc .fc-button-primary {
  border: none !important;
}

.fc .fc-list-sticky .fc-list-day>* {
  background: #f8fafc !important;
  font-weight: 700;
}

/* --- Scope Selector Premium --- */

#scopeDropdownBtn {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#scopeDropdownMenu {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.scope-option {
  font-family: inherit;
  cursor: pointer;
}

.scope-option:active {
  background-color: #dbeafe;
}

/* Efecto de anillo para el botón del dropdown */
/* Botones de ámbito en móvil */
/* Mobile Scope Options - High Contrast Premium */
.mobile-scope-option {
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
}

.mobile-scope-option.active {
  background: white !important;
  border-color: white !important;
  color: #1e40af !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.mobile-scope-option span:first-child {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.mobile-scope-option.active span:first-child {
  color: #2563eb;
}

/* --- P&L Section Styles --- */

#pnlTable th,
#pnlTable td {
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  text-align: center;
}

#pnlTable input {
  width: 100%;
  background: transparent;
  border: none;
  text-align: center;
  font-weight: 500;
  color: #1e293b;
  outline: none;
  padding: 4px;
  border-radius: 4px;
}

/* --- P&L Web Format Styles --- */

#pnlDashboard .bg-gradient-to-br {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#pnlDashboard .bg-gradient-to-br:hover {
  transform: translateY(-5px) scale(1.02);
}

.pnl-report-card {
  background: white;
  border-radius: 24px;
  border: 1px solid #f1f5f9;
  padding: 24px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.pnl-report-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #3b82f633;
}

.pnl-metric-badge {
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pnl-metric-badge.ventas {
  background: #dcfce7;
  color: #166534;
}

.pnl-metric-badge.bruta {
  background: #dbeafe;
  color: #1e40af;
}

.pnl-metric-badge.neta {
  background: #fef9c3;
  color: #854d0e;
}

/* Ajuste de color */

.pnl-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  background: #f8fafc;
  padding: 20px;
  border-radius: 16px;
  margin-top: 16px;
}

.pnl-detail-item p:first-child {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.pnl-detail-item p:last-child {
  font-size: 14px;
  font-weight: 800;
  color: #334155;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pnl-report-card {
  animation: slideUp 0.4s ease forwards;
}

/* Modal specific tweaks */
#pnlEntryModal input:focus {
  border-color: #3b82f6;
  background-color: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

#pnlEntryModal select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* ========================================
   MOBILE UI OPTIMIZATION (Fase final)
   ======================================== */

@media (max-width: 768px) {

  /* Ocultar elementos redundantes en el header móvil */
  header .hidden.md\:flex,
  #settingsBtn,
  #logoutBtn {
    display: none !important;
  }

  /* Barra de Navegación Inferior (Estilo App) */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.05);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    height: 100%;
  }

  .mobile-nav-item i {
    font-size: 18px;
    transition: transform 0.3s ease;
  }

  .mobile-nav-item.active {
    color: #2563eb;
  }

  .mobile-nav-item.active i {
    transform: translateY(-2px);
  }

  /* Ajustar el padding inferior del body para no tapar contenido */
  body.dashboard-page {
    padding-bottom: 90px;
  }

  /* Ajustes para pantallas muy pequeñas */
  @media (max-width: 480px) {
    .card-zoom {
      padding: 1.25rem !important;
    }

    .card-zoom p.text-xl {
      font-size: 1.125rem !important;
    }

    .bank-card {
      padding: 1rem !important;
      min-height: 180px !important;
    }

    .bank-card .card-balance {
      font-size: 1.5rem !important;
    }

    header h1 {
      font-size: 1.25rem !important;
    }
  }

  /* Tablas Responsivas */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  .overflow-x-auto::-webkit-scrollbar {
    display: none;
  }

  /* Drawer Lateral */
  #mobileMenu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    height: 100vh;
    z-index: 200;
    background: linear-gradient(180deg, #172554 0%, #0f172a 100%);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.8);
    overflow-y: auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
  }

  #mobileMenu.show {
    transform: translateX(0);
  }

  .drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .drawer-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* Botones de acción en transacciones (Mobile Optimization) */
  #transactions .flex.justify-between.items-center {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem;
    margin-bottom: 2rem !important;
  }

  #transactions .space-x-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
    margin-left: 0 !important;
  }

  #transactions .space-x-2 button {
    margin: 0 !important;
    width: 100% !important;
    padding: 1rem 0.5rem !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    justify-content: center !important;
    border-radius: 16px !important;
    display: flex !important;
    align-items: center;
  }

  #transactions .space-x-2 button#addTransferBtn {
    grid-column: span 2 !important;
  }
}

/* Utilitarios */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
}

/* ========================================
   DESKTOP SIDEBAR EVOLUTION (lg: 1024px+)
   ======================================== */

@media (min-width: 1024px) {

  /* Layout Grid para Sidebar */
  body.dashboard-page {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    grid-template-areas: "sidebar main" !important;
    height: 100vh;
    height: 100dvh;
    overflow: hidden !important;
    /* El scroll lo maneja el wrapper */
    padding-bottom: 0 !important;
  }

  /* Contenedor Principal de Contenido */
  .main-wrapper {
    grid-area: main;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    /* Scroll interno */
    background: #f8fafc;
  }

  /* Sidebar Estilos */
  .desktop-sidebar {
    grid-area: sidebar;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #1e40af 0%, #172554 100%);
    color: white;
    position: sticky;
    top: 0;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 120;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Evita scrolls internos raros */
  }

  .desktop-sidebar.collapsed {
    width: 85px;
  }

  /* Logo Area */
  .sidebar-logo-area {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .sidebar-logo-area span {
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: -0.05em;
    white-space: nowrap;
    transition: opacity 0.3s ease;
  }

  .collapsed .sidebar-logo-area span {
    opacity: 0;
    pointer-events: none;
  }

  /* Sidebar Links */
  .sidebar-nav-container {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .sidebar-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
  }

  .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
  }

  .sidebar-link.active-nav-link {
    background: white;
    color: #1e40af;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }

  .sidebar-link i {
    font-size: 20px;
    width: 24px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
  }

  .sidebar-link span {
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .collapsed .sidebar-link span {
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
  }

  /* Footer & Toggle */
  .sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .sidebar-toggle {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .collapsed .sidebar-toggle i {
    transform: rotate(180deg);
  }

  /* Header en Desktop (Top Bar Premium) */
  header {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    position: sticky !important;
    top: 0;
    z-index: 110;
  }

  /* Ajustar Main y Secciones para grid */
  main {
    max-width: 100% !important;
    margin: 0 !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100% !important;
  }

  .section {
    padding: 24px 40px !important;
    width: 100% !important;
    flex: 1;
  }

  /* Budget Styles */
  .budget-card {
    background: white;
    border-radius: 24px;
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
  }

  .budget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
  }

  .progress-bg {
    height: 10px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
  }

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

  .progress-ok {
    background: linear-gradient(90deg, #10b981, #34d399);
  }

  .progress-warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
  }

  .progress-danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
  }

  .budget-status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}