/* 
   ZeWma WFM - Design System
   Dark Premium UI
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
:root {
  --bg-base:       #030f1c;
  --bg-surface:    #0a1a2e;
  --bg-elevated:   #102640;
  --bg-hover:      #163252;
  --border:        #1d3b5e;
  --border-focus:  #00aaff;
  
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;

  --accent:        #00aaff;
  --accent-hover:  #33bbff;
  --accent-glow:   rgba(0, 170, 255, 0.3);

  --success:       #3fb950;
  --warning:       #d29922;
  --danger:        #f85149;
  --info:          #58a6ff;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.6);

  --font:          'Inter', -apple-system, sans-serif;
  --transition:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 💡 SILICON VALLEY PREMIUM LIGHT THEME OVERRIDES */
[data-theme="light"] {
  --bg-base:       #f6f8fa;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f0f3f6;
  --bg-hover:      #e1e4e8;
  --border:        #d1d5da;
  --border-focus:  #0969da;
  
  --text-primary:  #1f2328;
  --text-secondary:#57606a;
  --text-muted:    #8c959f;

  --accent:        #0969da;
  --accent-hover:  #0856b8;
  --accent-glow:   rgba(9, 105, 218, 0.12);

  --shadow:        0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-lg:     0 12px 32px rgba(0, 0, 0, 0.07);

  /* 💎 Colores complementarios para el diseño de cristal */
  --glass-card:    rgba(255, 255, 255, 0.85);
  --glass-border:  rgba(0, 0, 0, 0.06);
  --buk-blue-glow: rgba(9, 105, 218, 0.04);
}

/* 💎 COMPONENTES COMPLEMENTARIOS OPTIMIZADOS EN MODO CLARO */
[data-theme="light"] .sidebar-brand h1 { 
  color: var(--text-primary); 
}
[data-theme="light"] .sidebar-brand .brand-text img {
  filter: invert(1) brightness(0.1) contrast(1.2);
  opacity: 0.85;
}
[data-theme="light"] .sidebar-brand .logo {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
[data-theme="light"] .sidebar-footer {
  background: rgba(0,0,0,0.02);
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Disable transitions globally during page load */
.no-transition,
.no-transition * {
  transition: none !important;
}
html { 
  font-size: 14px; 
  scroll-behavior: smooth; 
  zoom: 0.82; /* ✨ Compact Viewport Tuning for Laptops (Scales full layout correctly) */
}
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

a { color: var(--accent); text-decoration: none; transition: all var(--transition); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  top: 20px; left: 20px; bottom: 20px; /* 🌟 Harmonious 20px Margin Grid */
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 24px; /* 🌟 Premium High Curvature */
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 1000;
  transition: width var(--transition), padding var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.sidebar-brand .logo {
  width: 80px;
  height: 80px;
  background: transparent;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: none;
  transition: all 0.3s;
}

/* Logo image scaling handled in HTML/Inline for precision */

.brand-text {
  text-align: center;
}

.sidebar-brand h1 { 
  font-size: 2.2rem; 
  font-weight: 900; 
  letter-spacing: -1.5px; 
  color: #fff;
  margin: 0;
  line-height: 1;
}

.sidebar-brand .brand-text { 
  width: 100%; overflow: hidden; height: 45px; display: flex; align-items: center; justify-content: center;
}
.sidebar-brand .brand-text img {
  height: 180px; object-fit: contain; transform: translateY(-2px);
}

.sidebar-brand small { 
  margin-top: -5px; display: block; text-align: center; width: 100%;
  font-size: 8px; 
  text-transform: uppercase; 
  letter-spacing: 2.5px; 
  color: var(--text-secondary); 
  font-weight: 700; 
  opacity: 0.8;
}

.sidebar-nav { flex: 1; padding: 0 14px 20px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-section-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); padding: 0 12px 10px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px;
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500; transition: all var(--transition);
  margin-bottom: 2px; position: relative; text-decoration: none;
}

.nav-item svg { width: 18px; height: 18px; stroke-width: 2.2px; opacity: 0.7; }
.nav-item:hover:not(.disabled) { background: var(--bg-hover); color: var(--text-primary); transform: translateX(4px); }
.nav-item:hover svg { opacity: 1; color: var(--accent); }

.nav-item.active { background: var(--bg-elevated); color: var(--accent); font-weight: 700; }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px;
  background: var(--accent); border-radius: 0 4px 4px 0; box-shadow: 4px 0 12px var(--accent-glow);
}

.nav-item.disabled { opacity: 0.3; cursor: not-allowed; }

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  background: var(--bg-elevated); border-radius: 12px; border: 1px solid var(--border);
}

.user-avatar {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #1d3b5e, #102640);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--accent); font-size: 14px; border: 1px solid var(--border);
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; margin-top: 1px; }

/* MAIN LAYOUT */
.main-wrap { 
  margin-left: calc(var(--sidebar-w) + 40px); /* ✨ Symmetrical: 20px Screen Left + 20px Sidebar Gap */
  margin-right: 20px; /* ✨ 20px Screen Right Symmetrical Margin */
  margin-bottom: 20px; /* ✨ 20px Screen Bottom Symmetrical Margin (Floating Canvas) */
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  min-height: calc(100vh - 20px); /* ✨ Perfectly offsets bottom margin to prevent ghost scrollbars */
  transition: margin-left var(--transition); 
}

.topbar {
  height: var(--topbar-h); 
  background: var(--bg-surface); 
  border: 1px solid var(--border); /* ✨ Full border to create floating island */
  border-radius: 20px; /* ✨ Premium Rounded Silhouette */
  box-shadow: var(--shadow); /* ✨ Soft Floating Depth */
  display: flex; 
  align-items: center; 
  padding: 0 24px; 
  gap: 20px; 
  margin-top: 20px; /* ✨ Symmetrical Gap */
  transition: box-shadow var(--transition);
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.page-content { 
  padding: 20px 0; 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
}

/* BUTTONS - STANDARDIZED */
.btn {
  height: 40px; padding: 0 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; cursor: pointer; border: 1px solid transparent; transition: all var(--transition);
  font-family: inherit; text-decoration: none; white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; stroke-width: 2.2px; }

.btn-primary { 
  background: linear-gradient(135deg, var(--accent), #0055ff); 
  color: white; 
  box-shadow: 0 4px 15px rgba(0, 170, 255, 0.25); 
}
.btn-primary:hover { 
  background: linear-gradient(135deg, var(--accent-hover), #3388ff); 
  transform: translateY(-2px); 
  box-shadow: 0 8px 25px rgba(0, 170, 255, 0.4); 
}

.btn-secondary { 
  background: rgba(255, 255, 255, 0.02); 
  color: var(--text-primary); 
  border: 1px solid var(--border); 
}
.btn-secondary:hover { 
  background: var(--bg-hover); 
  border-color: var(--accent); 
  color: var(--accent); 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 170, 255, 0.15);
}

.btn-danger { 
  background: rgba(248, 81, 73, 0.08); 
  color: var(--danger); 
  border: 1px solid rgba(248, 81, 73, 0.2); 
}
.btn-danger:hover { 
  background: var(--danger); 
  color: white; 
  border-color: var(--danger);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(248, 81, 73, 0.2);
}

.btn-sm { height: 34px; padding: 0 14px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 15px; height: 15px; }

.btn-xs { 
  height: 28px; 
  padding: 0 10px; 
  font-size: 11px; 
  border-radius: 6px; 
  font-weight: 600; 
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.btn-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-hover); transform: scale(1.05); }

.w-100 { width: 100% !important; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.align-center { align-items: center; }
.d-flex { display: flex; }

/* CARDS & TABLES */
.card { 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  overflow: hidden; 
  box-shadow: var(--shadow); 
  display: flex; 
  flex-direction: column; 
}
.card-header { 
  padding: 20px 24px; 
  border-bottom: 1px solid var(--border); 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  flex-shrink: 0; /* Prevent header from shrinking */
}
.card-body { 
  padding: 24px; 
  flex: 1; /* ✨ Elastic body stretches to fill available card height */
}

/* ✨ GLOBAL ELASTIC CANVAS SYMMETRY ✨ 
   Forces the main cards of any dashboard page to automatically stretch vertically 
   and align perfectly at the 20px bottom gap, mirroring the floating sidebar! */
.page-content > .card:only-of-type,
.page-content > .card:last-of-type,
.page-content > .card-premium:only-of-type,
.page-content > .card-premium:last-of-type {
  flex: 1;
}

.table-wrap { 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  overflow: hidden; 
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
tr { transition: background 0.2s ease; }
tr:hover:not(thead tr) { background: rgba(255, 255, 255, 0.02); }
th { 
  background: var(--bg-elevated); 
  padding: 16px; 
  text-align: left; 
  font-size: 11px; 
  text-transform: uppercase; 
  color: var(--text-primary); 
  letter-spacing: 1.2px; 
  border-bottom: 1px solid var(--border);
}
td { 
  padding: 16px; 
  border-bottom: 1px solid var(--border); 
  font-size: 13px; 
  color: var(--text-primary);
}


/* FORMS */
.form-control {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-hover);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

select.form-control option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Unified Shift Card Design */
.shift-card {
  width: 96px;
  height: 60px;
  margin: 0 auto;
  padding: 6px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  cursor: pointer;
  box-sizing: border-box;
  text-align: center;
}

.shift-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  filter: brightness(1.15);
}

.shift-time { font-size: 11px; font-weight: 800; line-height: 1.1; letter-spacing: -0.1px; }
.shift-code { font-size: 9px; opacity: 0.6; font-weight: 700; margin-top: 2px; }
.shift-status { font-size: 11px; font-weight: 800; letter-spacing: 0.4px; }

.estado-Libre { background: rgba(63, 185, 80, 0.1) !important; color: #3fb950 !important; border: 1px solid rgba(63, 185, 80, 0.3) !important; }
.estado-NP { background: rgba(248, 81, 73, 0.1) !important; color: #f85149 !important; border: 1px solid rgba(248, 81, 73, 0.3) !important; }
.estado-Vacaciones { background: rgba(137, 87, 229, 0.1) !important; color: #a371f7 !important; border: 1px solid rgba(137, 87, 229, 0.3) !important; }
.estado-Festivo { background: rgba(243, 156, 18, 0.1) !important; color: #f39c12 !important; border: 1px solid rgba(243, 156, 18, 0.3) !important; }

/* UTILS */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.badge-info { background: rgba(0, 170, 255, 0.15); color: var(--accent); }

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

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.flash { position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 16px 24px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; }

/* Collapsible Sidebar Groups */
.nav-section.collapsed .nav-group {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.nav-section.collapsed i.fa-chevron-down {
  transform: rotate(-90deg);
}
.nav-section:not(.collapsed) .nav-group {
  max-height: 500px;
  opacity: 1;
}

/* Agent Avatars in Grid - Balanced Floating Style */
.nombre-cell { 
  position: relative !important; 
  padding-top: 20px !important; /* Más aire arriba */
  padding-bottom: 20px !important; /* Más aire abajo */
  padding-right: 12px !important; 
  min-height: 100px !important; /* Altura más armónica */
} 
.agent-photo {
  position: absolute;
  bottom: 44px;
  right: 8px;
  width: 50px; /* Tamaño exacto de tu imagen */
  height: 50px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg-elevated);
  object-fit: cover;
  opacity: 0.85;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.agente-nombre {
  transform: translateY(-10px); /* Elevación final para liberar la foto */
  display: block;
}
.nombre-cell:hover .agent-photo {
  opacity: 1;
  transform: scale(1.1);
  border-color: var(--accent);
}
.agent-info-wrap {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   SISTEMA DE CONFIGURACION GENERAL (CONFIG TABS & INFO BOXES)
   ───────────────────────────────────────────── */
.config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.config-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.config-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border);
  transform: translateY(-1px);
}

.config-tab.active {
  color: var(--accent);
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: inset 0 0 10px rgba(0, 170, 255, 0.1);
  font-weight: 700;
}

.info-box {
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

.info-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  margin-top: 8px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.page-header p {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   FORM GRID & DIVIDER SYSTEM
   ───────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: 1fr;
  }
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
  opacity: 0.5;
}

.form-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ─────────────────────────────────────────────
   PREMIUM COLLAPSIBLE SIDEBAR SYSTEM (60FPS FLUID)
   ───────────────────────────────────────────── */
body.sidebar-collapsed {
  --sidebar-w: 70px;
}

/* Base transitions on all sidebar text & layout elements (60FPS Optimized) */
.sidebar {
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important; /* ✨ Smooth, Premium Slide */
  will-change: width;
}

.main-wrap {
  transition: margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: margin-left;
}

.sidebar-brand .logo,
.brand-text,
.sidebar-brand small,
.nav-section-label,
.nav-item,
.user-card,
.user-info,
.sidebar-footer,
.sidebar-footer .btn {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease !important;
}

/* Ensure no text wraps or causes vertical jumpiness during transitions */
.brand-text,
.sidebar-brand small,
.nav-section-label span,
.nav-item span,
.user-info,
.sidebar-footer .btn span {
  white-space: nowrap;
}

/* Collapsed State - Non Hovered (Controlled via Javascript for Hover Intent Delay) */
body.sidebar-collapsed .sidebar:not(.expanded-hover) {
  width: 70px;
  overflow-x: hidden;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-brand {
  padding: 24px 10px;
  gap: 0;
  justify-content: center;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-brand .logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

/* Smoothly hide all text and non-icon elements when collapsed and not hovered */
body.sidebar-collapsed .sidebar:not(.expanded-hover) .brand-text,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-brand small,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label i.fa-chevron-down,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label > span > span,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-item span:not(.nav-icon),
body.sidebar-collapsed .sidebar:not(.expanded-hover) .user-info,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-footer .btn span {
  display: none !important;
}

/* Center and align both .nav-item and .nav-section-label symmetrically when collapsed */
body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-nav {
  padding: 10px 0 !important;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section {
  margin: 0 !important;
  padding: 0 !important;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-item {
  justify-content: center !important;
  align-items: center !important;
  padding: 12px 0 !important;
  margin: 0 8px 8px 8px !important;
  border-radius: 10px !important;
  display: flex !important;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label > span {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label svg,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-item svg {
  transform: scale(1.2) !important;
  opacity: 0.9 !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-group {
  display: none !important;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .user-card {
  padding: 6px;
  justify-content: center;
  border-color: transparent;
  background: transparent;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-footer {
  padding: 15px 10px;
  align-items: center;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-footer .btn {
  padding: 0;
  width: 44px !important;
  height: 44px;
  margin: 0 auto;
  justify-content: center;
  border-radius: 12px;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .sidebar-footer .btn svg {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
}

/* Active Highlights on Collapsed Icons */
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label.active {
  background: var(--bg-elevated) !important;
  position: relative;
}

body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-section-label.active::before,
body.sidebar-collapsed .sidebar:not(.expanded-hover) .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  box-shadow: 4px 0 12px var(--accent-glow);
}

.nav-section-label.active {
  color: var(--text-primary) !important;
}

/* Hover expanded state (Triggered after JS Hover Intent timeout) */
body.sidebar-collapsed .sidebar.expanded-hover {
  width: 260px !important;
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.55), 0 0 50px rgba(0, 170, 255, 0.15);
}

/* ZËWMA DRIFT-STYLE FLOATING COPILOT WIDGET */
.copilot-trigger-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2100;
}

.copilot-trigger-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #0055ff);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 170, 255, 0.4), 0 0 20px rgba(0, 170, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.copilot-trigger-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 30px rgba(0, 170, 255, 0.5), 0 0 30px rgba(0, 170, 255, 0.4);
}

.trigger-pulse-glow {
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.5;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.copilot-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  height: 540px;
  background: rgba(10, 26, 46, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), inset 0 0 30px rgba(0, 170, 255, 0.05);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.copilot-widget.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.copilot-widget-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(3, 15, 28, 0.8), rgba(10, 26, 46, 0.8));
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

.copilot-widget-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px rgba(0, 170, 255, 0.3);
}

.copilot-widget-minimize {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-widget-minimize:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.copilot-widget-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Drift-Style Message Group with Avatars */
.message-group {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.message-group.ai {
  align-self: flex-start;
}

.message-group.user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 75%;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-sender {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.45;
}

.message-group.ai .message-bubble {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-top-left-radius: 2px;
}

.message-group.user .message-bubble {
  background: linear-gradient(135deg, var(--accent), #0055ff);
  color: white;
  border-top-right-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 170, 255, 0.2);
}

.copilot-widget-quick-actions {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(255,255,255,0.02);
}

.widget-action-btn {
  background: rgba(0, 170, 255, 0.04);
  border: 1px solid rgba(0, 170, 255, 0.12);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.widget-action-btn:hover {
  background: rgba(0, 170, 255, 0.1);
  border-color: var(--accent);
  transform: translateX(3px);
}

.copilot-widget-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: rgba(3, 15, 28, 0.4);
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
}

.copilot-widget-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  font-size: 12.5px;
  outline: none;
  transition: all 0.2s;
}

.copilot-widget-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.copilot-widget-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #0055ff);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.copilot-widget-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 170, 255, 0.3);
}

/* Typing Indicator Animation */
.typing .dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--text-secondary);
  border-radius: 50%;
  margin-right: 3px;
  animation: wave-widget 1.3s linear infinite;
}

.typing .dot:nth-child(2) { animation-delay: -1.1s; }
.typing .dot:nth-child(3) { animation-delay: -0.9s; }

@keyframes wave-widget {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-3px); }
}

/* 📱 UNIVERSAL MOBILE DASHBOARD RESPONSIVENESS */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 260px; /* Restores original drawer width for mobile swipe */
  }

  /* 1. Scale up container with symmetrical margins to leave space for collapsed sidebar */
  .main-wrap {
    margin: 12px 12px 12px 94px !important;
    width: auto !important;
    max-width: none !important;
    overflow-x: hidden;
    padding: 0 !important;
  }
  /* 2. Style sidebar as a neat left-aligned floating bar */
  .sidebar {
    left: 12px !important;
    top: 12px !important;
    bottom: 12px !important;
    border-radius: 16px !important;
    height: auto !important; /* Stretch perfectly to the bottom of the viewport using top/bottom! */
    z-index: 2000 !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  /* When collapsed on mobile (default) */
  body.sidebar-collapsed .sidebar {
    width: 70px !important;
    transform: translateX(0) !important; /* Force visibility! */
    box-shadow: var(--shadow-sm) !important;
  }

  /* When expanded on mobile */
  body:not(.sidebar-collapsed) .sidebar {
    width: 260px !important;
    transform: translateX(0) !important;
    z-index: 3000 !important; /* Overlay on top of content */
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.4) !important;
    border-radius: 20px !important;
  }

  /* 3. Add full viewport backdrop overlay when sidebar drawer is open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(3, 15, 28, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2500;
    pointer-events: auto;
    animation: fadeInOverlay 0.2s ease-out forwards;
  }
  
  body:not(.sidebar-collapsed) .sidebar-backdrop {
    display: block;
  }
  
  @keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* 4. Optimize Navigation Topbar spacing */
  .topbar {
    margin: 0 0 16px 0 !important; /* Align perfectly with cards and remove double gap */
    border-radius: 14px !important;
    height: 56px !important;
    padding: 0 12px !important;
    gap: 10px;
    display: flex !important;
    justify-content: space-between;
  }
  
  .topbar-left {
    gap: 10px;
  }
  
  .topbar-sub {
    display: none !important; /* Hide sub-titles to allow horizontal breathing room */
  }
  
  .topbar-title {
    font-size: 15px !important;
    white-space: nowrap;
  }

  /* 5. General Content Paddings */
  .page-content {
    padding: 0 !important; /* Align perfectly with topbar edge */
  }

  /* Mobile AI Copilot Fitment */
  .copilot-widget {
    right: 12px;
    left: 12px;
    width: calc(100% - 24px);
    bottom: 80px;
    height: 60vh;
    max-height: 500px;
  }
}

/* Global Theme-Aware Combobox Fix */
select, 
.custom-select, 
.form-select {
  color-scheme: light; /* El navegador dibuja menús nativos claros */
}

[data-theme="dark"] select, 
[data-theme="dark"] .custom-select, 
[data-theme="dark"] .form-select {
  color-scheme: dark; /* El navegador dibuja menús nativos oscuros */
}

select option, 
.custom-select option, 
.form-select option {
  background-color: var(--bg-surface) !important; 
  color: var(--text-primary) !important;
}
