@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap');

/* ==============================
   DESIGN TOKENS
============================== */
:root {
  --primary: #0D6E6E;
  --primary-light: #14A3A3;
  --primary-dark: #094F4F;
  --accent: #F59E0B;
  --accent-light: #FCD34D;
  --success: #059669;
  --success-light: #D1FAE5;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --info: #2563EB;
  --info-light: #DBEAFE;
  --purple: #7C3AED;
  --purple-light: #EDE9FE;

  /* Light Mode */
  --bg-base: #F0F4F8;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #E8F4F4;
  --bg-surface-3: #D1ECEC;
  --border: #C8DEDE;
  --border-strong: #90BFBF;
  --text-primary: #0A2323;
  --text-secondary: #3D6464;
  --text-muted: #7A9E9E;
  --shadow-sm: 0 1px 3px rgba(13,110,110,0.08), 0 1px 2px rgba(13,110,110,0.04);
  --shadow-md: 0 4px 12px rgba(13,110,110,0.10), 0 2px 6px rgba(13,110,110,0.06);
  --shadow-lg: 0 10px 30px rgba(13,110,110,0.14), 0 4px 12px rgba(13,110,110,0.08);
  --shadow-xl: 0 20px 50px rgba(13,110,110,0.18), 0 8px 24px rgba(13,110,110,0.10);

  --sidebar-w: 264px;
  --sidebar-collapsed-w: 64px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Fondos — azul marino profundo */
  --bg-base:      #060D1A;
  --bg-surface:   #0B1528;
  --bg-surface-2: #111E36;
  --bg-surface-3: #172540;

  /* Bordes — azul oscuro */
  --border:        #1A2D4A;
  --border-strong: #253F65;

  /* Texto */
  --text-primary:   #E4EDF8;
  --text-secondary: #7B9BC4;
  --text-muted:     #3A5070;

  /* Sombras más azuladas */
  --shadow-sm: 0 1px 3px rgba(6,13,26,0.5);
  --shadow-md: 0 4px 12px rgba(6,13,26,0.55);
  --shadow-lg: 0 10px 30px rgba(6,13,26,0.65);
  --shadow-xl: 0 20px 50px rgba(6,13,26,0.75);

  /* Acento primario más brillante sobre azul */
  --primary-light: #3DAADD;
  --primary:       #1A7AAA;

  /* Estados semánticos ajustados para azul oscuro */
  --success-light: rgba(5,150,105,0.15);
  --warning-light: rgba(217,119,6,0.15);
  --danger-light:  rgba(220,38,38,0.15);
  --info-light:    rgba(37,99,235,0.15);
  --purple-light:  rgba(124,58,237,0.15);
}

/* ==============================
   RESET & BASE
============================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Sora', sans-serif; font-weight: 600; letter-spacing: -0.02em; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* ==============================
   LAYOUT
============================== */
.hidden { display: none !important; }
#app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .nav-badge { display: none !important; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  margin: 1px 8px;
  border-radius: 10px;
}
.sidebar.collapsed .sidebar-user { justify-content: center; }

/* Iconos más grandes al colapsar */
.sidebar.collapsed .nav-icon {
  width: 22px;
  height: 22px;
}

/* Logo más pequeño al colapsar */
.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 16px 0;
}

/* Separador visual entre grupos al colapsar */
.sidebar.collapsed .nav-section-separator {
  display: block;
  height: 1px;
  background: var(--border);
  margin: 6px 12px;
  border-radius: 99px;
}

/* Ocultar separadores cuando está expandido */
.sidebar:not(.collapsed) .nav-section-separator { display: none; }
.sidebar:not(.collapsed) .nav-label,
.sidebar:not(.collapsed) .sidebar-logo-text,
.sidebar:not(.collapsed) .sidebar-user-info { animation: sidebarFadeIn 0.2s ease forwards; }
@keyframes sidebarFadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(13,110,110,0.3);
}
.sidebar-logo-text { flex: 1; min-width: 0; }
.app-name { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--primary-light); letter-spacing: -0.02em; }
.app-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

.sidebar-pin {
  position: absolute;
  right: -13px;
  top: 48px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  z-index: 102;
  flex-shrink: 0;
}
.sidebar-pin:hover { background: var(--bg-surface-2); color: var(--primary-light); box-shadow: var(--shadow-md); }

/* Sidebar necesita overflow visible para que el botón pin no se corte */
.sidebar { overflow: visible; }
/* Pero el nav interno sí necesita scroll */
.sidebar-nav { overflow-y: auto; overflow-x: hidden; }

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-section-label {
  padding: 12px 10px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--bg-surface-2); color: var(--primary-light); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(13,110,110,0.12), rgba(20,163,163,0.06));
  color: var(--primary-light);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 8px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-surface-2); }
.sidebar-user-info { min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Avatar */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
  flex-shrink: 0;
}

/* Tooltip */
.nav-tooltip {
  position: fixed;
  left: calc(var(--sidebar-collapsed-w) + 10px);
  background: #0a2323;
  color: #e8f5f5;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.12s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.nav-tooltip.visible { opacity: 1; }
.nav-tooltip::before {
  content: '';
  position: absolute;
  left: -5px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border: 5px solid transparent;
  border-right-color: #0a2323;
  border-left-width: 0;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed-w); }

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface-2);
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Page Content */
.page-content {
  flex: 1;
  padding: 28px;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==============================
   BUTTONS
============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 12px rgba(13,110,110,0.35); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); color: #0A2323; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.btn-icon { padding: 8px; }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ==============================
   CARDS
============================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.card-title { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 0.95rem; }
.card-body { padding: 18px 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

/* Stat cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.teal { background: linear-gradient(135deg, rgba(13,110,110,0.15), rgba(20,163,163,0.1)); color: var(--primary-light); }
.stat-icon.amber { background: rgba(245,158,11,0.12); color: var(--accent); }
.stat-icon.green { background: rgba(5,150,105,0.12); color: var(--success); }
.stat-icon.red { background: rgba(220,38,38,0.12); color: var(--danger); }
.stat-icon.purple { background: rgba(124,58,237,0.12); color: var(--purple); }
.stat-icon.blue { background: rgba(37,99,235,0.12); color: var(--info); }
.stat-info { flex: 1; }
.stat-value { font-family: 'Sora', sans-serif; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.stat-change { font-size: 0.75rem; margin-top: 6px; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ==============================
   TABLES
============================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-surface-2); }
tbody td { padding: 12px 14px; color: var(--text-primary); vertical-align: middle; }

/* ==============================
   FORMS
============================== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(20,163,163,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ==============================
   BADGES / STATUS
============================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-pending   { background: var(--warning-light); color: var(--warning); }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-purple    { background: var(--purple-light);  color: var(--purple); }
.badge-muted     { background: var(--bg-surface-3);  color: var(--text-muted); }
.badge-teal      { background: rgba(20,163,163,0.12); color: var(--primary-light); }

/* Role badges */
.role-badge { padding: 2px 7px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; }
.role-superuser { background: rgba(124,58,237,0.12); color: var(--purple); }
.role-admin     { background: rgba(13,110,110,0.12); color: var(--primary-light); }
.role-agent     { background: var(--info-light);      color: var(--info); }
.role-supervisor{ background: rgba(245,158,11,0.12); color: var(--accent); }

/* ==============================
   MODAL
============================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,21,21,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(4px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.modal-lg { max-width: 860px; }
.modal.modal-xl { max-width: 960px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1rem; }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* ==============================
   TOAST
============================== */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px) scale(0.9); } to { opacity: 1; transform: none scale(1); } }
.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); }
.toast-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.85rem; }
.toast-msg { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ==============================
   LOGIN — Split panel design
============================== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 15% 50%, rgba(20,60,120,0.5) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 30%, rgba(10,40,90,0.4) 0%, transparent 55%),
    linear-gradient(145deg, #070E1A 0%, #0A1628 40%, #0C1E38 100%);
  background-attachment: fixed;
  padding: 24px;
}

/* Fondo con puntos sutiles */
#login-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* Tarjeta centrada */
.login-split {
  display: flex;
  width: 100%;
  max-width: 860px;
  min-height: 520px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
  position: relative;
  z-index: 1;
  animation: slideUp 0.35s cubic-bezier(0.34,1.2,0.64,1);
}
@keyframes slideUp {
  from { opacity:0; transform: translateY(20px) scale(0.98); }
  to   { opacity:1; transform: none; }
}

/* Panel izquierdo oscuro */
.login-left {
  width: 340px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #0D1B2A 0%, #0A2342 60%, #0D2D4A 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 36px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 20%, rgba(20,100,180,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(13,110,110,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.login-left::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.login-left-content { position: relative; z-index: 1; }

.login-brand-logo {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: #fff;
  backdrop-filter: blur(8px);
}

.login-brand-name {
  font-family: 'Sora', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.login-brand-sub {
  font-size: 0.8rem;
  color: rgba(180,210,240,0.55);
  margin-bottom: 36px;
}

.login-features { display: flex; flex-direction: column; gap: 14px; }

.login-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.login-feature-icon {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(180,220,255,0.8);
  flex-shrink: 0;
  margin-top: 1px;
}

.login-feature-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 2px;
}

.login-feature-desc {
  font-size: 0.74rem;
  color: rgba(180,210,240,0.45);
  line-height: 1.4;
}

.login-left-footer {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
  line-height: 1.6;
}

/* Panel derecho blanco */
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 40px 36px;
}

[data-theme="dark"] .login-right {
  background: #0B1528;
}

[data-theme="dark"] .login-form-title { color: #E4EDF8; }
[data-theme="dark"] .login-form-sub   { color: #7B9BC4; }

.login-form-wrap {
  width: 100%;
  max-width: 360px;
}

.login-form-header { margin-bottom: 32px; }

.login-form-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: #0D1B2A;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

[data-theme="dark"] .login-form-title { color: #E8F5F5; }

.login-form-sub {
  font-size: 0.875rem;
  color: #6B7A8D;
}

[data-theme="dark"] .login-form-sub { color: var(--text-muted); }

/* Campos del formulario */
.login-field { margin-bottom: 20px; }

.login-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

[data-theme="dark"] .login-field-label { color: var(--text-secondary); }

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 13px 44px 13px 42px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #0D1B2A;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.login-input:focus {
  border-color: #2563EB;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-input::placeholder { color: #CBD5E1; }

[data-theme="dark"] .login-input {
  background: rgba(17,30,54,0.8);
  border-color: #1A2D4A;
  color: #E4EDF8;
}

[data-theme="dark"] .login-input:focus {
  border-color: #3DAADD;
  background: rgba(61,170,221,0.06);
  box-shadow: 0 0 0 3px rgba(61,170,221,0.15);
}

.login-eye-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  padding: 4px;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.login-eye-btn:hover { opacity: 0.8; }

/* Error */
.login-error {
  background: #FEE2E2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* Botón submit */
.login-submit-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.login-submit-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.45);
}

.login-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-form-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 0.78rem;
  color: #9CA3AF;
  line-height: 1.6;
}

/* Spinner */
.auth-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(37,99,235,0.15);
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive — en mobile se apila */
@media (max-width: 768px) {
  #login-screen { padding: 16px; align-items: flex-start; padding-top: 40px; }
  .login-split { flex-direction: column; max-width: 100%; min-height: auto; border-radius: 16px; }
  .login-left { width: 100%; padding: 28px 24px 24px; min-height: auto; }
  .login-brand-sub { margin-bottom: 20px; }
  .login-features { display: none; }
  .login-left-footer { display: none; }
  .login-right { padding: 28px 24px; }
}

/* ==============================
   PAGE ELEMENTS
============================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left { flex: 1; }
.page-h1 { font-family: 'Sora', sans-serif; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.page-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Grid */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px; height: 16px;
  pointer-events: none;
}
.search-input-wrap .form-control { padding-left: 36px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-sub { font-size: 0.85rem; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-surface-3) 50%, var(--bg-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary-light);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Call result badges */
.result-efectiva    { background: rgba(5,150,105,0.12); color: var(--success); }
.result-noc         { background: rgba(245,158,11,0.12); color: var(--accent); }
.result-buzon        { background: rgba(37,99,235,0.1); color: var(--info); }
.result-ocupado     { background: rgba(220,38,38,0.1); color: var(--danger); }
.result-no-contesta { background: var(--bg-surface-3); color: var(--text-muted); }
.result-equivocado  { background: rgba(124,58,237,0.1); color: var(--purple); }

/* Priority */
.priority-alta   { background: rgba(220,38,38,0.1); color: var(--danger); }
.priority-media  { background: rgba(245,158,11,0.1); color: var(--accent); }
.priority-baja   { background: var(--bg-surface-3); color: var(--text-muted); }

/* Theme toggle */
.theme-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface-2);
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.theme-toggle:hover { border-color: var(--primary-light); color: var(--primary-light); }

/* Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}
.chip:hover, .chip.active { background: var(--primary-light); color: #fff; border-color: var(--primary-light); }

/* Responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { margin-left: 0 !important; }
}
