/* ================================================================
   PLATAFORMA PROYECTO DE INVERSIÓN — Estilos principales
   Bootstrap 5 + UI moderna con animaciones
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --sidebar-bg:       #0f172a;
  --sidebar-bg2:      #1e293b;
  --sidebar-accent:   #6366f1;
  --sidebar-text:     #94a3b8;
  --sidebar-text-hov: #f1f5f9;
  --sidebar-width:    272px;
  --sidebar-collapsed:72px;

  --topbar-h:         64px;
  --topbar-bg:        #ffffff;

  --body-bg:          #f1f5f9;
  --card-bg:          #ffffff;

  --primary:          #6366f1;
  --primary-dark:     #4f46e5;
  --success:          #10b981;
  --warning:          #f59e0b;
  --danger:           #ef4444;
  --info:             #06b6d4;
  --orange:           #f97316;
  --purple:           #8b5cf6;

  --text-main:        #0f172a;
  --text-muted:       #64748b;
  --border:           #e2e8f0;

  --radius:           12px;
  --radius-sm:        8px;
  --radius-lg:        16px;

  --shadow-sm:        0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:           0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:        0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.07);
  --shadow-primary:   0 8px 24px rgba(99,102,241,.35);

  --transition:       all .25s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Scrollbar personalizada ────────────────────────────────── */
::-webkit-scrollbar          { width: 6px; height: 6px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Tipografía ─────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--text-main); }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #131e35 100%);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: 72px;
  text-decoration: none;
}
.sidebar-brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
}
.sidebar-brand-icon svg { width: 22px; height: 22px; }
.sidebar-brand-text { overflow: hidden; }
.sidebar-brand-title {
  font-size: 13px; font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  line-height: 1.3;
}
.sidebar-brand-sub {
  font-size: 10px; color: #64748b;
  text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px; }
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 16px 8px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
}
.nav-link::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sidebar-accent);
  border-radius: 0 4px 4px 0;
  transform: scaleY(0);
  transition: transform .2s;
}
.nav-link .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: .7;
  transition: var(--transition);
}
.nav-link .nav-label { flex: 1; overflow: hidden; }
.nav-link .nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  flex-shrink: 0;
  animation: pulse-badge 2s infinite;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(99,102,241,.12);
  color: var(--sidebar-text-hov);
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { opacity: 1; }
.nav-link.active::before { transform: scaleY(1); }
.nav-link.active { color: #c7d2fe; font-weight: 600; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.05); }
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { overflow: hidden; flex: 1; }
.user-name {
  font-size: 13px; font-weight: 600;
  color: #f1f5f9; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 11px; color: #64748b;
  white-space: nowrap;
}
.sidebar-user .logout-btn {
  color: #64748b; flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-user:hover .logout-btn { color: var(--danger); }

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 999;
  transition: left .3s cubic-bezier(.4,0,.2,1);
}

.topbar-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  background: var(--body-bg);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  padding: 8px 16px 8px 40px;
  font-size: 13.5px;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}
.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.topbar-search .search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px; height: 15px;
}

.topbar-right {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  width: 38px; height: 38px;
  border: none;
  background: var(--body-bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.topbar-btn:hover {
  background: var(--border);
  color: var(--primary);
  transform: translateY(-1px);
}
.topbar-btn .badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--topbar-bg);
  animation: pulse-dot 2s infinite;
}

.topbar-divider {
  width: 1px; height: 24px;
  background: var(--border);
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid transparent;
}
.topbar-user:hover {
  background: var(--body-bg);
  border-color: var(--border);
}
.topbar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.topbar-user-info { display: none; }
@media (min-width: 768px) { .topbar-user-info { display: block; } }
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.topbar-user-role { font-size: 11px; color: var(--text-muted); }

/* Sidebar toggle */
.sidebar-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--body-bg); color: var(--primary); }
@media (max-width: 991px) { .sidebar-toggle { display: flex; } }

/* Breadcrumb */
.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}
.topbar-breadcrumb .page-title {
  font-weight: 600; color: var(--text-main);
}
@media (min-width: 576px) { .topbar-breadcrumb { display: flex; align-items: center; gap: 6px; } }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
.content-inner {
  padding: 28px 28px;
  max-width: 1600px;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-left {}
.page-title-main {
  font-size: 24px; font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.page-subtitle {
  font-size: 13.5px; color: var(--text-muted);
  margin-top: 4px;
}
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-header-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--body-bg);
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .06;
  transition: var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.stat-card:hover::after { transform: scale(1.5); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; }

.stat-icon-primary { background: rgba(99,102,241,.12); color: var(--primary); }
.stat-icon-success { background: rgba(16,185,129,.12); color: var(--success); }
.stat-icon-warning { background: rgba(245,158,11,.12); color: var(--warning); }
.stat-icon-danger  { background: rgba(239,68,68,.12);  color: var(--danger); }
.stat-icon-info    { background: rgba(6,182,212,.12);  color: var(--info); }
.stat-icon-purple  { background: rgba(139,92,246,.12); color: var(--purple); }
.stat-icon-orange  { background: rgba(249,115,22,.12); color: var(--orange); }

.stat-card:hover .stat-icon-primary { background: rgba(99,102,241,.2); }
.stat-card:hover .stat-icon-success { background: rgba(16,185,129,.2); }
.stat-card:hover .stat-icon-warning { background: rgba(245,158,11,.2); }
.stat-card:hover .stat-icon-danger  { background: rgba(239,68,68,.2); }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 28px; font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 12.5px; color: var(--text-muted);
  font-weight: 500;
}
.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  display: flex; align-items: center; gap: 3px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Progress Card ──────────────────────────────────────────── */
.progress-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  transition: var(--transition);
}
.progress-card:hover { box-shadow: var(--shadow); }

/* Gradient stat cards */
.stat-card-gradient-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none; color: #fff;
}
.stat-card-gradient-success {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  border: none; color: #fff;
}
.stat-card-gradient-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  border: none; color: #fff;
}
.stat-card-gradient-primary .stat-value,
.stat-card-gradient-success .stat-value,
.stat-card-gradient-warning .stat-value { color: #fff; }
.stat-card-gradient-primary .stat-label,
.stat-card-gradient-success .stat-label,
.stat-card-gradient-warning .stat-label { color: rgba(255,255,255,.8); }
.stat-card-gradient-primary .stat-icon,
.stat-card-gradient-success .stat-icon,
.stat-card-gradient-warning .stat-icon {
  background: rgba(255,255,255,.2);
  color: #fff;
}

/* ================================================================
   BADGES / STATUS
   ================================================================ */
.badge {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  display: inline-flex; align-items: center; gap: 5px;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.badge-primary   { background: rgba(99,102,241,.12); color: #6366f1; }
.badge-success   { background: rgba(16,185,129,.12); color: #059669; }
.badge-warning   { background: rgba(245,158,11,.12); color: #d97706; }
.badge-danger    { background: rgba(239,68,68,.12);  color: #dc2626; }
.badge-info      { background: rgba(6,182,212,.12);  color: #0891b2; }
.badge-secondary { background: rgba(100,116,139,.1); color: #64748b; }
.badge-orange    { background: rgba(249,115,22,.12); color: #ea580c; }

.badge-pulse::before { animation: pulse-dot 2s infinite; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  display: inline-flex; align-items: center; gap: 7px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background .15s;
}
.btn:hover::after { background: rgba(255,255,255,.1); }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99,102,241,.5);
  transform: translateY(-1px);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff; border-color: #059669;
  box-shadow: 0 4px 14px rgba(16,185,129,.3);
}
.btn-success:hover {
  box-shadow: 0 6px 20px rgba(16,185,129,.45);
  transform: translateY(-1px); color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff; border-color: #dc2626;
  box-shadow: 0 4px 14px rgba(239,68,68,.3);
}
.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239,68,68,.45);
  transform: translateY(-1px); color: #fff;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff; border-color: #d97706;
  box-shadow: 0 4px 14px rgba(245,158,11,.3);
}
.btn-warning:hover { transform: translateY(-1px); color: #fff; }

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.btn-light {
  background: var(--body-bg);
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-light:hover { background: var(--border); color: var(--text-main); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--radius); }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0; justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ================================================================
   FORMS
   ================================================================ */
.form-label {
  font-size: 13px; font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  display: block;
}
.form-control, .form-select {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-main);
  background: var(--card-bg);
  transition: var(--transition);
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--danger);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
textarea.form-control { resize: vertical; min-height: 100px; }
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.invalid-feedback { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.input-group .form-control { border-radius: 0; }
.input-group > *:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important; }
.input-group > *:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }
.input-group-text {
  background: var(--body-bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 9px 12px;
}

/* Form section header */
.form-section-title {
  font-size: 13px; font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(99,102,241,.15);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

/* ================================================================
   TABLES
   ================================================================ */
.table-responsive { border-radius: var(--radius); overflow: hidden; }
.table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th {
  background: var(--body-bg);
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(99,102,241,.03); }
.table-actions { display: flex; gap: 6px; }

/* ================================================================
   ALERTS / FLASH
   ================================================================ */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  border: 1.5px solid transparent;
  display: flex; align-items: flex-start; gap: 10px;
  animation: slideDown .3s ease;
}
.alert-success {
  background: rgba(16,185,129,.08);
  border-color: rgba(16,185,129,.25);
  color: #065f46;
}
.alert-danger {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.25);
  color: #7f1d1d;
}
.alert-warning {
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.25);
  color: #78350f;
}
.alert-info {
  background: rgba(6,182,212,.08);
  border-color: rgba(6,182,212,.25);
  color: #164e63;
}
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
#toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast-item {
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  pointer-events: all;
  max-width: 340px;
  animation: toastIn .3s ease;
  border-left: 3px solid transparent;
}
.toast-item.success { border-color: var(--success); }
.toast-item.error   { border-color: var(--danger); }
.toast-item.warning { border-color: var(--warning); }
.toast-item.info    { border-color: var(--primary); }
.toast-item.removing { animation: toastOut .3s ease forwards; }
.toast-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-item.success svg { color: var(--success); }
.toast-item.error   svg { color: var(--danger); }
.toast-item.warning svg { color: var(--warning); }
.toast-item.info    svg { color: var(--primary); }

/* ================================================================
   MODAL PERSONALIZADO
   ================================================================ */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  gap: 10px;
}

/* ================================================================
   ALERTAS DEL SISTEMA (módulo 5)
   ================================================================ */
.alert-system {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  border-left: 4px solid transparent;
  background: var(--card-bg);
  transition: var(--transition);
  animation: fadeInUp .3s ease;
}
.alert-system:hover { box-shadow: var(--shadow); }
.alert-system.critica    { border-color: var(--danger); }
.alert-system.advertencia{ border-color: var(--warning); }
.alert-system.informativa{ border-color: var(--info); }

.alert-level-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.critica    .alert-level-icon { background: rgba(239,68,68,.12);  color: var(--danger); }
.advertencia .alert-level-icon{ background: rgba(245,158,11,.12); color: var(--warning); }
.informativa .alert-level-icon{ background: rgba(6,182,212,.12);  color: var(--info); }

/* ================================================================
   MATRIZ DE ESTADO (módulo 5)
   ================================================================ */
.estado-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.estado-dot.verde    { background: rgba(16,185,129,.15); color: var(--success); }
.estado-dot.amarillo { background: rgba(245,158,11,.15); color: var(--warning); }
.estado-dot.rojo     { background: rgba(239,68,68,.15);  color: var(--danger); }
.estado-dot.gris     { background: rgba(100,116,139,.1); color: #94a3b8; }
.estado-dot.rojo     { animation: pulse-dot 2s infinite; }

/* ================================================================
   PROGRESS BAR
   ================================================================ */
.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.progress-bar {
  border-radius: 99px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
  background: linear-gradient(90deg, var(--primary) 0%, var(--purple) 100%);
}
.progress-bar.success {
  background: linear-gradient(90deg, var(--success) 0%, #06b6d4 100%);
}
.progress-bar.warning {
  background: linear-gradient(90deg, var(--warning) 0%, var(--orange) 100%);
}
.progress-bar.danger {
  background: linear-gradient(90deg, var(--danger) 0%, #f97316 100%);
}

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination { gap: 4px; }
.page-item .page-link {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  transition: var(--transition);
}
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.page-item .page-link:hover {
  background: var(--body-bg);
  color: var(--primary);
  border-color: var(--primary);
}

/* ================================================================
   AVATAR / INICIALES
   ================================================================ */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }

/* ================================================================
   TIMELINE / HISTORIAL
   ================================================================ */
.timeline { position: relative; }
.timeline-item {
  display: flex; gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0;
}
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
  flex-shrink: 0;
}
.timeline-dot svg { width: 14px; height: 14px; color: #fff; }
.timeline-line {
  width: 2px;
  background: var(--border);
  flex: 1; margin-top: 4px;
}
.timeline-item:last-child .timeline-line { display: none; }
.timeline-content {
  flex: 1;
  background: var(--body-bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.timeline-date {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
}
.timeline-text { font-size: 13px; color: var(--text-main); margin-top: 2px; }

/* ================================================================
   LOADING / SKELETON
   ================================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--body-bg) 25%, #e2e8f0 50%, var(--body-bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}

.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
}

/* ================================================================
   CHART CONTAINERS
   ================================================================ */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}
.chart-container-sm { height: 180px; }
.chart-container-lg { height: 360px; }

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 32px; text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--body-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty-state-icon svg { width: 32px; height: 32px; color: #94a3b8; }
.empty-state h5 { font-size: 16px; font-weight: 700; color: var(--text-main); }
.empty-state p { font-size: 13.5px; margin-top: 6px; }

/* ================================================================
   FILTER BAR
   ================================================================ */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: .7; }
}
@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  70%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* Entrada de elementos al aparecer */
.animate-in { animation: fadeInUp .4s ease both; }
.animate-in-delay-1 { animation-delay: .1s; }
.animate-in-delay-2 { animation-delay: .2s; }
.animate-in-delay-3 { animation-delay: .3s; }
.animate-in-delay-4 { animation-delay: .4s; }

/* ================================================================
   LOGIN / AUTH LAYOUT
   ================================================================ */
.auth-layout {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-layout::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 20% 20%, rgba(99,102,241,.15) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(139,92,246,.12) 0%, transparent 50%);
}
/* Floating particles */
.auth-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(99,102,241,.15);
  animation: float 6s ease-in-out infinite;
}

.auth-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px 44px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
  animation: fadeInUp .6s cubic-bezier(.4,0,.2,1);
}
.auth-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}
.auth-logo-icon svg { width: 28px; height: 28px; color: #fff; }
.auth-logo-text { }
.auth-logo-title { font-size: 17px; font-weight: 800; color: var(--text-main); }
.auth-logo-sub { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-subtitle { font-size: 13.5px; color: var(--text-muted); margin-bottom: 28px; }

/* ================================================================
   SIDEBAR OVERLAY (móvil)
   ================================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  backdrop-filter: blur(4px);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .content-inner { padding: 20px 16px; }
}
@media (max-width: 576px) {
  .auth-card { padding: 28px 24px; }
  .page-title-main { font-size: 20px; }
  .stat-value { font-size: 22px; }
}

/* ================================================================
   UTILIDADES EXTRA
   ================================================================ */
.text-primary  { color: var(--primary)  !important; }
.text-success  { color: var(--success)  !important; }
.text-danger   { color: var(--danger)   !important; }
.text-warning  { color: var(--warning)  !important; }
.text-muted    { color: var(--text-muted)!important; }
.bg-primary-soft { background: rgba(99,102,241,.08); }
.bg-success-soft { background: rgba(16,185,129,.08); }
.bg-danger-soft  { background: rgba(239,68,68,.08);  }
.bg-warning-soft { background: rgba(245,158,11,.08); }
.rounded-xl { border-radius: var(--radius); }
.rounded-2xl{ border-radius: var(--radius-lg); }
.shadow-primary { box-shadow: var(--shadow-primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-xs  { font-size: 11.5px; }
.fs-sm  { font-size: 12.5px; }
.cursor-pointer { cursor: pointer; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* DataTable override */
.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  outline: none;
  font-size: 13px;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
}
