/* ═══════════════════════════════════════════════════════════════
   Sistema de Investigación Académica - FIIS
   Estilos globales
═══════════════════════════════════════════════════════════════ */

/* ── Variables de tema ── */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Light theme */
  --bg: #f8f9fc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e1b4b;
  --bg-sidebar-hover: rgba(255,255,255,0.08);
  --bg-sidebar-active: rgba(99,102,241,0.3);
  --sidebar-text: rgba(255,255,255,0.85);
  --sidebar-text-muted: rgba(255,255,255,0.5);

  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-focus: #6366f1;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --transition: 0.2s ease;

  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.theme-dark {
  --bg: #0f0e1a;
  --bg-card: #1a1827;
  --bg-sidebar: #12101f;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #2d2b45;
}

/* ── Reset y base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14.5px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); transition: background var(--transition), color var(--transition); min-height: 100vh; letter-spacing: -0.01em; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; letter-spacing: inherit; }
input, textarea, select { font-family: var(--font); letter-spacing: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.text-right { text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════════════════════ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }
#app-screen { display: none; }
#app-screen.active { display: flex; overflow: hidden; height: 100vh; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════════ */
#login-screen {
  position: relative; justify-content: center; align-items: center;
  background-image: url(../img/fondo.jpg);
  background-size: cover;
  overflow: hidden;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.login-glow {
  position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, transparent 70%);
  top: -100px; left: 50%; transform: translateX(-50%);
  animation: pulse-glow 4s ease-in-out infinite alternate;
}
@keyframes pulse-glow { from { opacity: 0.5; transform: translateX(-50%) scale(1); } to { opacity: 1; transform: translateX(-50%) scale(1.15); } }

.login-card {
  position: relative; z-index: 1; background: rgba(255,255,255,0.97);
  border-radius: var(--radius-lg); padding: 2rem;
  width: 100%; max-width: 440px; box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}
.theme-dark .login-card { background: rgba(26,24,39,0.97); }

.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-bottom: 2rem; text-align: center; }
.brand-owl-wrap { display: flex; justify-content: center; }
.brand-owl-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(99,102,241,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  border: 2px solid rgba(99,102,241,0.2);
}
.brand-text-block { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.brand-name { font-size: 2rem; font-weight: 800; color: var(--text); }
.brand-name-accent { color: var(--primary); }
.brand-sub { font-size: 0.68rem; color: var(--text-muted); line-height: 1.4; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }

.login-title { font-size: 1.3rem; font-weight: 700; }
.login-desc { color: var(--text-muted); font-size: 0.85rem; }

.quick-access {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--bg); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem;
  margin-bottom: 1.2rem; border: 1px solid var(--border);
}
.qa-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.qa-btn {
  font-size: 0.73rem; padding: 0.25rem 0.65rem; border-radius: 20px;
  border: 1px solid var(--primary); color: var(--primary); background: none;
  transition: all var(--transition); font-weight: 600;
}
.qa-btn:hover { background: var(--primary); color: white; }

.login-form-wrap { display: flex; flex-direction: column; gap: 1rem; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.73rem; color: var(--text-light); }

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.form-input {
  width: 100%; padding: 0.65rem 0.9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text);
  background: var(--bg-card); transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: var(--text-light); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 1.1rem; padding-right: 2.2rem; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }
.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 2.5rem; }
.toggle-pass { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 0.9rem; opacity: 0.6; }
.toggle-pass:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; transition: all var(--transition);
  border: 1.5px solid transparent; white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: rgba(99,102,241,0.08); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 0.95rem; }
.btn-full { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary); font-size: 0.82rem; font-weight: 600; padding: 0; cursor: pointer; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════ */
.alert { padding: 0.7rem 1rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  position: relative; z-index: 100; overflow: hidden;
  box-shadow: 4px 0 16px rgba(0,0,0,0.15);
}
.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer span:not(.toggle-icon),
.sidebar.collapsed .theme-label { display: none; }
.sidebar.collapsed .toggle-icon { transform: rotate(180deg); }

.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; }
.sidebar-owl { font-size: 1.3rem; line-height: 1; }
.sidebar-brand-text { font-size: 1rem; font-weight: 700; color: white; letter-spacing: -0.02em; }
.sidebar-toggle { color: var(--sidebar-text-muted); padding: 0.3rem; border-radius: var(--radius-sm); transition: all var(--transition); }
.sidebar-toggle:hover { color: white; background: var(--bg-sidebar-hover); }
.toggle-icon { display: inline-block; transition: transform 0.3s ease; font-size: 1.1rem; }

.sidebar-user { display: flex; align-items: center; gap: 0.7rem; padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.user-avatar {
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; color: white;
}
.user-name { font-size: 0.82rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-role-badge {
  font-size: 0.65rem; padding: 0.15rem 0.5rem; border-radius: 20px;
  background: rgba(99,102,241,0.35); color: var(--primary-light); font-weight: 600; text-transform: capitalize;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.nav-section { margin-bottom: 0.25rem; }
.nav-section-title { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sidebar-text-muted); padding: 0.6rem 1rem 0.3rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 1rem;
  color: var(--sidebar-text); font-size: 0.83rem; font-weight: 500;
  border-radius: 0; cursor: pointer; transition: all var(--transition);
  border-left: 3px solid transparent; white-space: nowrap;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: white; }
.nav-item.active { background: var(--bg-sidebar-active); color: white; border-left-color: var(--primary-light); font-weight: 600; }
.nav-icon { font-size: 1rem; min-width: 20px; text-align: center; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.08); padding: 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.theme-toggle-btn, .logout-btn {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem;
  color: var(--sidebar-text-muted); font-size: 0.8rem; border-radius: var(--radius-sm);
  transition: all var(--transition); width: 100%;
}
.theme-toggle-btn:hover { color: white; background: var(--bg-sidebar-hover); }
.logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,0.1); }

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT & TOPBAR
═══════════════════════════════════════════════════════════════ */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  height: var(--topbar-h); background: var(--bg-card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  box-shadow: var(--shadow-sm); z-index: 50; flex-shrink: 0;
}
.mobile-menu-btn { display: none; font-size: 1.2rem; color: var(--text-muted); padding: 0.3rem; }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem; transition: all var(--transition);
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  background: var(--danger); color: white; border-radius: 8px;
  font-size: 0.6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 200; max-height: 420px; overflow-y: auto;
}
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.notif-item { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.82rem; transition: background var(--transition); }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(99,102,241,0.05); border-left: 3px solid var(--primary); }
.notif-item .notif-msg { color: var(--text); margin-bottom: 0.2rem; }
.notif-item .notif-time { color: var(--text-light); font-size: 0.73rem; }
.notif-list { max-height: 360px; overflow-y: auto; }

.view-container { flex: 1; overflow-y: auto; padding: 1.5rem; }
.view-container::-webkit-scrollbar { width: 4px; }
.view-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ═══════════════════════════════════════════════════════════════
   CARDS & KPI
═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.card-body { padding: 1.25rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm); display: flex; align-items: flex-start; gap: 0.9rem;
  transition: box-shadow var(--transition), transform var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.kpi-icon-blue { background: rgba(59,130,246,0.12); }
.kpi-icon-green { background: rgba(16,185,129,0.12); }
.kpi-icon-yellow { background: rgba(245,158,11,0.12); }
.kpi-icon-red { background: rgba(239,68,68,0.12); }
.kpi-icon-purple { background: rgba(139,92,246,0.12); }
.kpi-icon-cyan { background: rgba(6,182,212,0.12); }
.kpi-info { min-width: 0; }
.kpi-val { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.03em; }
.kpi-label { font-size: 0.73rem; color: var(--text-muted); margin-top: 0.2rem; font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 0.73rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); padding: 0.6rem 1rem;
  border-bottom: 1.5px solid var(--border); white-space: nowrap; background: var(--bg);
}
td { padding: 0.75rem 1rem; font-size: 0.83rem; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(99,102,241,0.03); }
tr:last-child td { border-bottom: none; }

.table-search { width: 100%; max-width: 260px; }
.table-toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg); }

/* ═══════════════════════════════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-blue { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.badge-green { background: rgba(16,185,129,0.12); color: #065f46; }
.badge-yellow { background: rgba(245,158,11,0.12); color: #92400e; }
.badge-red { background: rgba(239,68,68,0.12); color: #991b1b; }
.badge-purple { background: rgba(139,92,246,0.12); color: #5b21b6; }
.badge-gray { background: rgba(107,114,128,0.12); color: #374151; }
.badge-cyan { background: rgba(6,182,212,0.12); color: #0e7490; }
.badge::before { content: '●'; font-size: 0.55rem; }

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BAR
═══════════════════════════════════════════════════════════════ */
.progress-wrap { display: flex; align-items: center; gap: 0.75rem; }
.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
}
.progress-fill.green { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-fill.yellow { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-fill.red { background: linear-gradient(90deg, var(--danger), #f87171); }
.progress-pct { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); min-width: 36px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  backdrop-filter: blur(3px); animation: fade-in 0.15s ease;
}
.modal-overlay.hidden { display: none !important; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card); border-radius: var(--radius-lg);
  width: 100%; max-width: 580px; max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slide-up 0.2s ease;
  border: 1px solid var(--border);
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { color: var(--text-muted); width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; transition: all var(--transition); }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.4rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════════ */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 1.1rem; min-width: 280px; max-width: 360px;
  display: flex; align-items: flex-start; gap: 0.75rem; box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease; font-size: 0.85rem;
}
.toast.exit { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(50px); } }
.toast-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title { font-weight: 700; color: var(--text); margin-bottom: 0.1rem; }
.toast-msg { color: var(--text-muted); font-size: 0.8rem; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

/* ═══════════════════════════════════════════════════════════════
   SECTION EDITOR (para investigaciones)
═══════════════════════════════════════════════════════════════ */
.section-editor { display: flex; gap: 1.25rem; align-items: flex-start; }
.section-list { width: 220px; min-width: 220px; display: flex; flex-direction: column; gap: 0.3rem; }
.section-item {
  padding: 0.55rem 0.8rem; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.8rem; color: var(--text-muted); transition: all var(--transition);
  border: 1px solid transparent; display: flex; align-items: center; gap: 0.5rem;
}
.section-item:hover { background: var(--bg); color: var(--text); }
.section-item.active { background: rgba(99,102,241,0.1); color: var(--primary); border-color: rgba(99,102,241,0.2); font-weight: 600; }
.section-item.done .section-check { color: var(--success); }
.section-item.sec-aprobada { border-color: #6ee7b7; background: rgba(16,185,129,0.07); color: var(--success, #065f46); }
.section-item.sec-aprobada.active { background: rgba(16,185,129,0.15); border-color: var(--success); }
.section-item.sec-rechazada { border-color: #fca5a5; background: rgba(239,68,68,0.07); color: var(--danger, #991b1b); }
.section-item.sec-rechazada.active { background: rgba(239,68,68,0.14); border-color: var(--danger); }
.section-item.sec-en-revision { border-color: #fcd34d; background: rgba(245,158,11,0.07); color: #92400e; }
.section-item.sec-en-revision.active { background: rgba(245,158,11,0.14); border-color: var(--warning); }
.section-check { font-size: 0.75rem; margin-left: auto; }
.section-panel { flex: 1; min-width: 0; }
.section-panel .card { height: 100%; display: flex; flex-direction: column; }
.section-panel .card .card-body { flex: 1; display: flex; flex-direction: column; }
.section-content { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   CHAT
═══════════════════════════════════════════════════════════════ */
.chat-layout { display: flex; gap: 1rem; height: calc(100vh - var(--topbar-h) - 3rem); }
.chat-contacts { width: 240px; min-width: 240px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; }
.chat-contact-item { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; gap: 0.75rem; transition: background var(--transition); }
.chat-contact-item:hover, .chat-contact-item.active { background: rgba(99,102,241,0.06); }
.chat-contact-name { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.chat-contact-role { font-size: 0.72rem; color: var(--text-muted); }
.chat-main { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-width: 0; }
.chat-header { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.75rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.chat-messages::-webkit-scrollbar { width: 3px; }
.msg { max-width: 72%; display: flex; flex-direction: column; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 0.6rem 0.9rem; border-radius: 14px; font-size: 0.83rem; line-height: 1.5; }
.msg.mine .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg.theirs .msg-bubble { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-time { font-size: 0.68rem; color: var(--text-light); margin-top: 0.2rem; padding: 0 0.2rem; }
.chat-input-area { border-top: 1px solid var(--border); padding: 0.85rem 1rem; display: flex; gap: 0.6rem; }
.chat-input { flex: 1; padding: 0.55rem 0.9rem; border: 1.5px solid var(--border); border-radius: 20px; font-size: 0.85rem; outline: none; background: var(--bg); color: var(--text); transition: border-color var(--transition); }
.chat-input:focus { border-color: var(--border-focus); }
.chat-send-btn { background: var(--primary); color: white; border-radius: 20px; padding: 0.55rem 1rem; font-size: 0.82rem; font-weight: 600; transition: background var(--transition); }
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }
.chat-empty-icon { font-size: 2.5rem; }

/* ═══════════════════════════════════════════════════════════════
   CANVAS CHARTS
═══════════════════════════════════════════════════════════════ */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm); }
.chart-card h4 { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem; }
.chart-card canvas { display: block; }

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADERS
═══════════════════════════════════════════════════════════════ */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header-text h2 { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; letter-spacing: -0.02em; }
.page-header-text p { font-size: 0.82rem; color: var(--text-muted); font-weight: 400; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.4rem; }
.empty-desc { font-size: 0.83rem; max-width: 320px; margin: 0 auto 1rem; }

/* ═══════════════════════════════════════════════════════════════
   AUDIT LOG
═══════════════════════════════════════════════════════════════ */
.audit-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.audit-text { flex: 1; }
.audit-action { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.audit-detail { font-size: 0.78rem; color: var(--text-muted); }
.audit-time { font-size: 0.72rem; color: var(--text-light); white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════
   FLOW VIEW (admin)
═══════════════════════════════════════════════════════════════ */
.flow-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; display: grid;
  grid-template-columns: 1fr 2fr 1fr 80px 80px 90px;
  gap: 0.75rem; align-items: center; transition: box-shadow var(--transition);
}
.flow-item:hover { box-shadow: var(--shadow); }
.flow-arrow { color: var(--text-light); font-size: 0.8rem; }
.flow-name { font-size: 0.83rem; font-weight: 600; }
.flow-sub { font-size: 0.73rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ═══════════════════════════════════════════════════════════════
   ASESOR REVIEW
═══════════════════════════════════════════════════════════════ */
.obs-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.obs-item { background: rgba(245,158,11,0.08); border-left: 3px solid var(--warning); padding: 0.65rem 0.85rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.82rem; }
.obs-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }
.obs-asesor-input { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.obs-asesor-input input { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   ASESOR SELECTOR (alumno)
═══════════════════════════════════════════════════════════════ */
.asesor-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.asesor-card {
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem; cursor: pointer; transition: all var(--transition); text-align: center;
}
.asesor-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.asesor-card.selected { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.asesor-avatar { width: 50px; height: 50px; border-radius: 50%; margin: 0 auto 0.75rem; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; color: white; }
.asesor-name { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.25rem; }
.asesor-spec { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.asesor-count { font-size: 0.73rem; color: var(--primary); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   TIMELINE / HISTORY
═══════════════════════════════════════════════════════════════ */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 1rem; padding-bottom: 1.5rem; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; flex-shrink: 0; margin-top: 2px; z-index: 1; }
.timeline-dot-blue { background: rgba(59,130,246,0.15); color: var(--info); border: 2px solid var(--info); }
.timeline-dot-green { background: rgba(16,185,129,0.15); color: var(--success); border: 2px solid var(--success); }
.timeline-dot-yellow { background: rgba(245,158,11,0.15); color: var(--warning); border: 2px solid var(--warning); }
.timeline-dot-red { background: rgba(239,68,68,0.15); color: var(--danger); border: 2px solid var(--danger); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.timeline-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.timeline-time { font-size: 0.72rem; color: var(--text-light); margin-top: 0.2rem; }

/* ═══════════════════════════════════════════════════════════════
   FILE ATTACH
═══════════════════════════════════════════════════════════════ */
.attach-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; cursor: pointer;
  transition: all var(--transition); color: var(--text-muted); font-size: 0.85rem;
}
.attach-drop:hover, .attach-drop.drag { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.attach-drop input[type="file"] { display: none; }
.attach-list { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.attach-file { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; }
.attach-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-rm { color: var(--danger); font-size: 0.8rem; cursor: pointer; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  .sidebar { position: fixed; height: 100vh; z-index: 200; transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .section-editor { flex-direction: column; }
  .section-list { width: 100%; min-width: 0; flex-direction: row; flex-wrap: wrap; }
  .chat-contacts { display: none; }
  .chat-layout { flex-direction: column; }
  .flow-item { grid-template-columns: 1fr 1fr; }
  .asesor-list { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}
@media (max-width: 480px) {
  .view-container { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .toast { min-width: 240px; }
}

/* ═══════════════════════════════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.73rem; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.p-0 { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Spinner */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: white; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Overview row stats */
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.stat-pill { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 0.35rem 0.85rem; font-size: 0.78rem; display: flex; align-items: center; gap: 0.4rem; }
.stat-pill b { font-weight: 700; color: var(--text); }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; gap: 0; }
.tab-btn { padding: 0.65rem 1.1rem; font-size: 0.83rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* ═══════════════════════════════════════════════════════════════
   ADJUNTOS POR SECCIÓN
═══════════════════════════════════════════════════════════════ */
.section-attach-block {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.5rem;
}
.attach-file {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.8rem;
  transition: box-shadow var(--transition);
}
.attach-file:hover { box-shadow: var(--shadow-sm); }
.attach-file-name {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}
.attach-rm {
  color: var(--danger); font-size: 0.8rem;
  cursor: pointer; padding: 0.1rem 0.3rem;
  border-radius: 4px; transition: background var(--transition);
}
.attach-rm:hover { background: rgba(239,68,68,0.1); }
