/* ==========================================================================
   SALA 9 - Enterprise Financial Management System
   Design System & Modern Corporate Styling
   ========================================================================== */

:root {
  /* Color Palette - Default Dark Enterprise */
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #283548;
  --bg-input: #111827;
  --border-subtle: #1f293d;
  --border-medium: #374151;
  --border-focus: #38bdf8;

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-inverse: #0f172a;

  /* Brand Accents - Celeste Corporativo & Amarillo */
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-light: rgba(14, 165, 233, 0.14);
  --primary-glow: rgba(14, 165, 233, 0.35);

  --income: #10b981;
  --income-bg: rgba(16, 185, 129, 0.12);
  --income-border: rgba(16, 185, 129, 0.3);

  --expense: #ef4444;
  --expense-bg: rgba(239, 68, 68, 0.12);
  --expense-border: rgba(239, 68, 68, 0.3);

  --accent-cyan: #00b4d8;
  --accent-sky: #38bdf8;
  --accent-yellow: #fbbf24;
  --accent-amber: #f59e0b;

  /* Shadows & Glass */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.25);

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-full: 0px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
  
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #f3f4f6;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafb;
  --bg-input: #ffffff;
  --border-subtle: #e5e7eb;
  --border-medium: #d1d5db;
  --border-focus: #0284c7;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: rgba(2, 132, 199, 0.1);
  --primary-glow: rgba(2, 132, 199, 0.25);

  --income: #059669;
  --income-bg: rgba(16, 185, 129, 0.1);
  --income-border: rgba(16, 185, 129, 0.3);

  --expense: #dc2626;
  --expense-bg: rgba(220, 38, 38, 0.1);
  --expense-border: rgba(220, 38, 38, 0.3);

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* Base Reset: 100% 90-Degree Sharp Corners */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   App Layout (Sidebar + Main Content)
   ========================================================================== */

#app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: var(--transition);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.logo-badge {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0284c7 0%, #00b4d8 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

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

/* Sidebar Nav */
.sidebar-nav {
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: rgba(14, 165, 233, 0.35);
  font-weight: 600;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
  background-color: rgba(0, 0, 0, 0.1);
}

.backend-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--income);
  box-shadow: 0 0 8px var(--income);
  display: inline-block;
}

.status-dot.offline {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.user-mini-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
}

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

.user-info .name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: var(--bg-card);
  color: var(--expense);
}

.mobile-menu-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 38;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

.main-wrapper {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar Header */
.topbar {
  height: 68px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-heading {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.content-body {
  padding: 2rem;
  flex: 1;
}

/* ==========================================================================
   Cards, Grid & KPI Widgets
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

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

.kpi-card.income-card::before {
  background: var(--income);
}

.kpi-card.expense-card::before {
  background: var(--expense);
}

.kpi-card.balance-card::before {
  background: linear-gradient(90deg, #6366f1, #06b6d4);
}

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

.kpi-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kpi-icon.blue { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.kpi-icon.green { background: var(--income-bg); color: var(--income); }
.kpi-icon.red { background: var(--expense-bg); color: var(--expense); }
.kpi-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.5rem;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-income {
  background-color: var(--income-bg);
  color: var(--income);
  border: 1px solid var(--income-border);
}

.badge-expense {
  background-color: var(--expense-bg);
  color: var(--expense);
  border: 1px solid var(--expense-border);
}

.badge-neutral {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
}

/* Charts Section */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

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

.chart-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-container {
  position: relative;
  flex: 1;
  min-height: 280px;
  width: 100%;
}

/* ==========================================================================
   Data Tables & Controls
   ========================================================================== */

.table-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-toolbar {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-left, .toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Tab Switcher */
.tab-group {
  display: flex;
  background-color: var(--bg-surface);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  padding: 0.45rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Inputs & Form Controls */
.input-search-wrapper {
  position: relative;
  min-width: 240px;
}

.input-search-wrapper svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.form-control {
  background-color: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-search-wrapper .form-control {
  padding-left: 2.25rem;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-income {
  background-color: var(--income);
  color: #ffffff;
}

.btn-income:hover {
  background-color: #059669;
}

.btn-expense {
  background-color: var(--expense);
  color: #ffffff;
}

.btn-expense:hover {
  background-color: #dc2626;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-medium);
  color: var(--text-primary);
}

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

.btn-excel {
  background-color: #107c41;
  color: #ffffff;
}

.btn-excel:hover {
  background-color: #0b5a2f;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Table Style */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.amount-cell {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

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

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

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.action-btn.delete:hover {
  background-color: var(--expense-bg);
  color: var(--expense);
  border-color: var(--expense-border);
}

/* Pagination Bar */
.pagination-bar {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.page-numbers {
  display: flex;
  gap: 0.25rem;
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
}

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

.page-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

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

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 1rem;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.2s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

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

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

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

/* ==========================================================================
   Login Screen
   ========================================================================== */

#login-view {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--bg-main);
  position: relative;
  overflow-x: hidden;
}

/* Panel Izquierdo: Formulario Minimalista y Serio (50%) */
.login-panel-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3.5rem 4rem;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  position: relative;
  z-index: 2;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  width: 100%;
}

.login-form-body {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.login-form-header {
  margin-bottom: 2.5rem;
}

.login-form-header h2 {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  line-height: 1.15;
}

.login-form-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.login-minimal-form .form-group {
  margin-bottom: 1.6rem;
  width: 100%;
}

.login-minimal-form .form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
  display: block;
}

.login-minimal-form .form-control {
  width: 100% !important;
  box-sizing: border-box !important;
  height: 52px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  font-size: 0.98rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
  display: block;
}

.login-minimal-form .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  background-color: var(--bg-surface);
}

.password-input-wrapper {
  position: relative;
  width: 100%;
  display: block;
}

.password-input-wrapper .form-control {
  padding-right: 3.25rem !important;
}

.password-input-wrapper .toggle-pwd-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

.password-input-wrapper .toggle-pwd-btn:hover {
  color: var(--text-primary);
}

.login-submit-btn {
  width: 100%;
  height: 52px;
  padding: 0 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin-top: 0.75rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  transition: all 0.25s ease;
}

.login-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(79, 70, 229, 0.5);
}

/* Panel Derecho: Visual & SVG (Full-Bleed / Sin Padding) */
.login-panel-visual {
  background: #02050d;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
}

.login-svg-full {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

/* Responsividad */
@media (max-width: 960px) {
  #login-view {
    grid-template-columns: 1fr;
  }
  .login-panel-visual {
    display: none;
  }
  .login-panel-form {
    min-height: 100vh;
    border-right: none;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    box-shadow: none;
  }
}

/* ==========================================================================
   Toasts & Alerts
   ========================================================================== */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 200;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 450px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.85rem;
}

.toast.success { border-left: 4px solid var(--income); }
.toast.error { border-left: 4px solid var(--expense); }
.toast.info { border-left: 4px solid var(--primary); }

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

/* ==========================================================================
   Responsive & Print Styles
   ========================================================================== */

/* Tablets Landscape & Small Desktops (<= 1024px) */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    padding: 0 1.25rem;
  }
}

/* Tablets Portrait & Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    width: 280px;
    max-width: 85vw;
    z-index: 50;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0 !important;
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 0.6rem 1rem;
    height: auto;
    min-height: 60px;
  }

  .page-heading {
    font-size: 1.15rem;
  }

  .content-body {
    padding: 1.25rem 1rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1rem;
  }

  .toolbar-left, .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 0.6rem;
  }

  .toolbar-left > *, .toolbar-right > * {
    flex: 1 1 auto;
  }

  .tab-group {
    width: 100%;
    display: flex;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }

  .input-search-wrapper {
    width: 100%;
    min-width: 0;
  }

  .form-control {
    width: 100%;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .data-table {
    min-width: 620px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .pagination-bar {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    text-align: center;
    padding: 1rem;
  }

  #toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
}

/* Small SmartPhones & Compact Screens (<= 520px) */
@media (max-width: 520px) {
  .topbar {
    padding: 0.5rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topbar-title {
    width: 100%;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .page-heading {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .topbar-actions .btn {
    flex: 1;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    justify-content: center;
  }

  .content-body {
    padding: 0.85rem 0.5rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .kpi-card {
    padding: 1.15rem;
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .chart-card {
    padding: 1rem;
  }

  .chart-container {
    min-height: 220px;
  }

  .login-card {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-md);
  }

  .modal-backdrop {
    padding: 0.75rem;
  }

  .modal-content {
    width: 100%;
    max-height: 94vh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
    gap: 0.85rem;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .sidebar, .sidebar-backdrop, .topbar, .table-toolbar, .pagination-bar, .action-btn, .btn, .mobile-menu-toggle {
    display: none !important;
  }
  .main-wrapper {
    margin: 0 !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .table-card, .chart-card, .kpi-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}
