/* =========================================================
   Base UI Theme – CristecnoViajes
   Paleta HSL dinámica + intensidades + fallbacks reales
   ========================================================= */

/* ======= Paleta controlada por variables HSL + intensidad ======= */
:root{
  /* Color de marca (HSL) */
  --brand-h: 212;     /* H: 0-360 (azul ~210-225) */
  --brand-s: 85%;     /* S: saturación */
  --brand-l: 46%;     /* L: luminosidad */

  /* Intensidad general y mezcla sidebar */
  --intensity: 0.18;  /* 0.10=suave · 0.18=media · 0.28=fuerte · 0.38=deep */
  --mix: 9%;         /* mezcla de color en la sidebar (con white). ↑ = más azul */

  /* Extras ajustables desde el customizer */
  --nav-blur: 8px;
  --shadow-alpha: 0.10;

  /* Derivadas */
  --primary-color: hsl(var(--brand-h) var(--brand-s) var(--brand-l));
  --secondary-color: hsl(calc(var(--brand-h) + 10) var(--brand-s) calc(var(--brand-l) + 6%));
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --light-bg: #f8fafc;

  /* Navbar con tinte azul dinámico */
  --navbar-bg:
    linear-gradient(
      180deg,
      hsla(var(--brand-h) var(--brand-s) var(--brand-l) / calc(var(--intensity) + 0.06)),
      hsla(var(--brand-h) var(--brand-s) var(--brand-l) / calc(max(var(--intensity) - 0.06, 0.04)))
    ),
    rgba(255,255,255,0.92);
  --navbar-border: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / calc(var(--intensity) + 0.15));

  /* Sidebar (la variable usa color-mix; el fallback real está en la regla .sidebar) */
  --sidebar-border: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.18);
  --sidebar-bg: color-mix(in srgb, white calc(100% - var(--mix)), var(--primary-color) var(--mix));
  --hover-bg: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / calc(var(--intensity) + 0.10));

  /* Sombras */
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-xl: 0 15px 35px rgba(0,0,0,0.15);
  --shadow-blue: 0 8px 20px hsla(var(--brand-h) var(--brand-s) var(--brand-l) / var(--shadow-alpha));

  /* Tamaños */
  --sidebar-width: 280px;
  --border-radius: 0.75rem;
  --radius-sm: 6px;
  --radius-md: 8px;
  --nav-height: 64px;

  /* Espaciado */
  --space-unit: 1rem;
  --space-xs: calc(0.5 * var(--space-unit));
  --space-sm: calc(0.75 * var(--space-unit));
  --space-md: var(--space-unit);
  --space-lg: calc(1.5 * var(--space-unit));
  --space-xl: calc(2 * var(--space-unit));

  /* Transiciones */
  --transition: 180ms ease;
}

/* ========== Base ========== */
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body {
  background-color: #ffffff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
  color: #333;
  line-height: 1.6;
  padding-bottom: 80px;
}
h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--text-dark); margin-bottom: 1.5rem; }
h1 { font-size: 2.25rem; line-height: 1.2; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* ========== Layout con Sidebar ========== */
.layout.has-sidebar .main-shell { transition: margin-left var(--transition); }

/* Sidebar fija (desktop) */
.sidebar{
  background: var(--sidebar-bg);
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 1029;
  padding: calc(var(--nav-height) + 8px) 0 var(--space-lg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 3px 0 12px rgba(50,120,173,0.06);
  transition: transform var(--transition);
  overflow-y: auto;
}

/* Header de la sidebar */
.sidebar .sidebar-header{
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex; align-items: center;
  border-bottom: 1px solid var(--sidebar-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(244,248,253,0.9));
}

/* Links sidebar */
.sidebar .nav-link{
  color: #0f172a;
  padding: 0.85rem 1rem;
  margin: 0.25rem 0.75rem;
  border-radius: var(--border-radius);
  display: flex; align-items: center; gap: .5rem;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  position: relative;
}
.sidebar .nav-link .bi{ font-size: 1.2rem; width: 24px; color: #334155; }
.sidebar .nav-link:hover{ background: var(--hover-bg); color: #0b1220; transform: translateX(2px); }
.sidebar .nav-link.active{
  background: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.14);
  color: #0b1220;
  box-shadow: var(--shadow-xs) inset;
}
.sidebar .nav-link.active::before{
  content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 2px; background: var(--primary-color);
}
.sidebar .section-label{ letter-spacing: .08em; color: #3f4c5a; }

/* Ocultar totalmente la sidebar cuando se elige hidden */
.sidebar-hidden .sidebar { transform: translateX(-100%); pointer-events: none; }
@media (min-width: 768px){
  .layout.has-sidebar .main-shell { margin-left: var(--sidebar-width); }
  .sidebar-hidden.layout.has-sidebar .main-shell { margin-left: 0; }
}

/* En móvil, la sidebar fija no se usa (offcanvas manda) */
@media (max-width: 767.98px){
  .sidebar { transform: translateX(-100%); pointer-events: none; }
  .layout.has-sidebar .main-shell { margin-left: 0 !important; }
}

/* ========== Offcanvas móvil ========== */
.offcanvas-nav{
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
}
.offcanvas-nav .offcanvas-header{
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(244,248,253,0.95));
  border-bottom: 1px solid var(--sidebar-border);
}
.offcanvas-nav .section-title{
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 1rem 0 .25rem;
}
.offcanvas-nav .list-group-item{ border: 0; border-radius: .6rem; margin-bottom: .25rem; }
.offcanvas-nav .list-group-item.active,
.offcanvas-nav .list-group-item:hover{ background: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.14); color: #0b1220; }

/* ========== Tarjetas ========== */
.card{
  border: none; border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  background: #fff; overflow: hidden; position: relative;
}

.card-header{
  background: linear-gradient(45deg, #f8f9fa, #ffffff);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: var(--space-md) var(--space-lg);
}
.card-footer{ background: var(--light-bg); border-top: 1px solid rgba(0,0,0,0.05); }

/* ========== Botones ========== */
.btn{ font-weight: 500; border-radius: var(--border-radius); transition: var(--transition); display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-primary{ background: linear-gradient(135deg, var(--primary-color), #1f4a6e); border: none; }
.btn-primary:hover{ transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-hover-scale{ transition: transform 0.2s ease; }
.btn-hover-scale:hover{ transform: scale(1.05); }

/* ========== Formularios ========== */
.form-control{ border-radius: calc(var(--border-radius) * 0.75); border: 1px solid #e9ecef; transition: var(--transition); }
.form-control:focus{ border-color: var(--primary-color); box-shadow: 0 0 0 3px hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.15); }
.select2-container .select2-selection{ border-radius: calc(var(--border-radius) * 0.75) !important; min-height: 42px; }

/* ========== Dropdowns ========== */
.dropdown-menu{ border: none; box-shadow: var(--shadow-md); border-radius: var(--border-radius); margin-top: var(--space-xs); padding: var(--space-xs); }
.dropdown-menu .dropdown-item{ border-radius: calc(var(--border-radius) * 0.5); padding: var(--space-sm) var(--space-md); transition: var(--transition); }
.dropdown-menu .dropdown-item:hover{ background: var(--light-bg); }

/* ========== Interactivos ========== */
.interactive{ transition: var(--transition); cursor: pointer; }
.interactive:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ========== Overlay de Carga ========== */
.loading-overlay{ position: absolute; inset: 0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; border-radius: var(--border-radius); z-index: 10; }

/* ========== Modales ========== */
.modal-content{ border: none; border-radius: calc(var(--border-radius) * 1.5); overflow: hidden; }
.modal-header{ background: var(--light-bg); border-bottom: 1px solid rgba(0,0,0,0.05); padding: var(--space-lg); }
.modal-footer{ background: var(--light-bg); border-top: 1px solid rgba(0,0,0,0.05); }

/* ========== Avatares ========== */
.avatar-xs { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-sm { width: 36px; height: 36px; font-size: 0.9rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }

/* ========== Paginación ========== */
.pagination .page-item{ margin: 0 0.25rem; }
.pagination .page-link{
  border-radius: var(--border-radius);
  border: none; min-width: 38px; text-align: center; transition: var(--transition);
}
.pagination .page-link:hover{ background: var(--light-bg); }
.pagination .page-item.active .page-link{ background: var(--primary-color); color: white; }

/* ========== Subrayado hover para nav genérica ========== */
.nav-link::after{
  content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px;
  background: var(--secondary-color); transition: width var(--transition);
}
.nav-link:hover::after{ width: 100%; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--light-bg); }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 10px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 575.98px){
  body{ font-size: 0.925rem; }
  .main-content{ padding: 1rem !important; }
  .btn{ font-size: 0.9rem; padding: 0.5rem 1rem; }
}
@media (max-width: 767.98px){
  .main-content{ margin-left: 0 !important; padding: 1.5rem; padding-bottom: 80px; }
  .table-responsive{ margin-left: -1rem; margin-right: -1rem; width: calc(100% + 2rem); }
  .table-responsive::after{ content: ''; display: block; width: 1rem; flex: 0 0 1rem; }
}
@media (min-width: 768px){
  body{ padding-bottom: 0; }
  .main-content{ padding: 2.5rem; }
}
@media (min-width: 1600px){
  .sidebar{ --sidebar-width: 320px; }
  .main-content{ padding: 3rem 4rem; }
}

/* ========== SweetAlert2 ========== */
.custom-swal-container { font-family: 'Segoe UI', system-ui, sans-serif; }
.custom-swal-popup { border-radius: 12px !important; box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15); border: 1px solid rgba(255, 255, 255, 0.1); }
.custom-swal-title { font-size: 1.5rem !important; font-weight: 600 !important; color: var(--text-dark) !important; margin-bottom: 1rem !important; }
.custom-swal-html { font-size: 1rem !important; color: #475569 !important; line-height: 1.6 !important; text-align: left !important; max-height: 60vh; overflow-y: auto; padding: 0 0.5rem; }
.custom-swal-confirm-btn { font-size: 1rem !important; font-weight: 500 !important; padding: 0.75rem 1.5rem !important; border-radius: 8px !important; transition: all 0.2s ease !important; margin-top: 1.5rem !important; }
.error-swal .swal2-icon { font-size: 1.5rem !important; margin: 1rem auto 0.5rem !important; }
.error-swal .swal2-x-mark-line { background-color: #dc2626 !important; }
.error-confirm-btn { background: #2563eb !important; border: none !important; }
.error-confirm-btn:hover { background: #1d4ed8 !important; transform: translateY(-1px); }
.success-swal .swal2-success { border-color: #22c55e !important; }
.success-swal .swal2-success-ring { border-color: rgba(34, 197, 94, 0.3) !important; }
.success-confirm-btn { background: #22c55e !important; border: none !important; }
.success-confirm-btn:hover { background: #16a34a !important; transform: translateY(-1px); }

.custom-alert-content { max-width: 100%; word-wrap: break-word; }
.custom-alert-content ul { list-style-type: disc; margin-left: 1.5rem; padding-left: 0.5rem; margin-top: 0.5rem; }
.custom-alert-content li { margin-bottom: 0.5rem; }
.custom-alert-content p { margin-bottom: 0.75rem; }

/* ========== Theme Customizer (offcanvas) ========== */
.theme-customizer{ width: 360px; border-left: 1px solid rgba(0,0,0,0.08); }
.theme-customizer .offcanvas-header{
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(244,248,253,0.7));
}
.swatch-btn{
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.1);
  background: var(--swatch, #2563eb);
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.swatch-btn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* =========================================================
   Fallbacks reales y prioridad para sidebar y offcanvas
   (pegar al final del archivo para máximo efecto)
   ========================================================= */

/* --- Fallbacks reales y prioridad para la sidebar y el offcanvas --- */
.sidebar{
  /* Fallback para navegadores sin color-mix */
  background: #f4f8fd;
  /* Valor principal controlado por variables → si color-mix es válido, se aplica; si no, queda el fallback */
  background: var(--sidebar-bg) !important;

  /* Nuestro borde con prioridad (por si queda alguna clase de BS rondando) */
  border-right: 1px solid var(--sidebar-border) !important;
}

/* El offcanvas móvil debe verse igual que la sidebar */
.offcanvas-nav{
  background: #f4f8fd;
  background: var(--sidebar-bg) !important;
  border-right: 1px solid var(--sidebar-border) !important;
}

/* Para los items activos/hover en sidebar/offcanvas usamos el tinte de marca */
.sidebar .nav-link.active,
.offcanvas-nav .list-group-item.active,
.offcanvas-nav .list-group-item:hover{
  background: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.14) !important;
  color: #0b1220;
}

/* Si el navegador NO soporta color-mix, aseguramos el fallback */
@supports not (background: color-mix(in srgb, black, white)) {
  :root { --sidebar-bg: #f4f8fd; }
}

.shadow-sm-hover{ transition: box-shadow .15s ease; }
.shadow-sm-hover:hover{ box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.app-breadcrumb .breadcrumb{ --bs-breadcrumb-divider: "›"; }
.app-breadcrumb .breadcrumb a{ text-decoration: none; }

.dropzone{
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; gap: 12px; align-items: center;
  cursor: pointer; transition: .15s ease;
}
.dropzone:hover{ background:#f1f5f9; }
.dropzone.dragover{ background:#e2e8f0; border-color:#94a3b8; }
.dropzone .dz-icon{
  width: 40px; height: 40px; border-radius: 10px;
  display:flex; align-items:center; justify-content:center;
  background: #eef2ff; color:#4f46e5;
  font-size: 20px;
}
.dropzone .dz-title{ font-weight: 600; }

/* Badges de filtros activos con contraste */
.badge.bg-primary-subtle { background: #e9f2ff; color: #0b5ed7; }
.badge.bg-success-subtle { background: #eaf9f0; color: #1f8b4c; }
.badge.bg-secondary-subtle { background: #f1f5f9; color: #334155; }
.badge.bg-info-subtle { background: #e8f7fb; color: #0aa2c0; }
.badge.bg-warning-subtle { background: #fff4e5; color: #a36100; }
.badge.text-decoration-none:hover { filter: brightness(0.97); }

/* =========================================================
   Mejoras globales para consistencia
   ========================================================= */

/* Mejorar consistencia de avatares */
.avatar, .avatar-fallback, .employee-avatar {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar:hover, .employee-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mejorar consistencia de breadcrumbs */
.app-breadcrumb .breadcrumb {
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(13, 110, 253, 0.02));
  border-radius: 999px;
  padding: .65rem 1.25rem;
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.app-breadcrumb .breadcrumb-item a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #0d6efd;
  text-decoration: none;
  font-weight: 500;
}

.app-breadcrumb .breadcrumb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
  font-size: .9rem;
}

/* Toast consistente */
#liveToast .toast-body .toast-icon {
  font-size: 1.1rem;
}

/* Agrega al final de static/common/css/base.css */

/* Mejoras para select2 global */
.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 1060 !important; /* Mayor que modales */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #3b82f6 !important;
    color: white !important;
}

.select2-container--bootstrap-5 .select2-results__option[aria-selected=true] {
    background-color: #f3f4f6;
    color: #111827;
}

/* Mejoras para placeholders */
::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

:-ms-input-placeholder {
    color: #9ca3af !important;
}

::-ms-input-placeholder {
    color: #9ca3af !important;
}

/* Scrollbar mejorado para tablas */
.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ================================================================
   NAV ENHANCED — CristecnoViajes
   Mejoras visuales para sidebar, topbar y offcanvas móvil
   ================================================================ */

/* ─── 1. TOPBAR ─────────────────────────────────────────────── */

.navbar-clean {
  height: var(--nav-height);
  backdrop-filter: saturate(200%) blur(var(--nav-blur, 10px));
  -webkit-backdrop-filter: saturate(200%) blur(var(--nav-blur, 10px));
}

/* Botones de ícono más refinados */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: #374151;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(15, 23, 42, 0.07);
  border-color: rgba(15, 23, 42, 0.09);
  color: #0f172a;
}
.icon-btn:active {
  background: rgba(15, 23, 42, 0.12);
}

/* Avatar con mejor anillo */
.avatar,
.avatar-fallback {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 3.5px rgba(15, 23, 42, 0.1);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.avatar:hover,
.avatar-fallback:hover {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 4px var(--primary-color);
  transform: scale(1.04);
}

/* Brand tipografía refinada */
.brand-fallback {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

/* ─── 2. SIDEBAR — estructura general ───────────────────────── */

/* Quitar subrayado hover (herencia de nav-link::after en base.css) */
.sidebar .nav-link::after,
.sidebar button.nav-link::after {
  display: none !important;
}

/* Ajuste de scroll y padding */
.sidebar {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.12) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.12);
  border-radius: 4px;
}

/* ─── 3. SIDEBAR — cabecera ─────────────────────────────────── */

.sidebar .sidebar-header {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.80) 0%,
    rgba(244, 248, 253, 0.92) 100%
  );
  border-bottom: 1px solid var(--sidebar-border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sidebar-brand-name {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.15;
}
.sidebar-brand-tagline {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--primary-color);
  text-transform: uppercase;
  opacity: 0.75;
}

/* ─── 4. SIDEBAR — etiquetas de sección ────────────────────── */

.sidebar .section-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0 0.9rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}
.sidebar .section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(148, 163, 184, 0.35), transparent);
  border-radius: 1px;
}

/* Sub-etiqueta dentro de Contabilidad */
.sidebar .nav-subgroup-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #b0bec7;
  padding: 0.7rem 1.1rem 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sidebar .nav-subgroup-label::before {
  content: '';
  width: 14px;
  height: 1px;
  background: rgba(148, 163, 184, 0.4);
  border-radius: 1px;
}

/* ─── 5. SIDEBAR — nav items ────────────────────────────────── */

.sidebar .nav-link {
  padding: 0.575rem 0.85rem;
  margin: 0.1rem 0.6rem;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.855rem;
  font-weight: 500;
  color: #1e293b;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
  position: relative;
  line-height: 1.3;
  /* Quitar el translate del base.css */
  transform: none !important;
}

.sidebar .nav-link .bi {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: #64748b;
  transition: color 0.14s ease;
}

.sidebar .nav-link:hover {
  background: var(--hover-bg);
  color: #0f172a;
}
.sidebar .nav-link:hover .bi {
  color: var(--primary-color);
}

/* Estado activo */
.sidebar .nav-link.active {
  background: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.11);
  color: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 8%));
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.sidebar .nav-link.active .bi {
  color: var(--primary-color);
}

/* Indicador activo — barra izquierda */
.sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  height: 56%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary-color);
}

/* ─── 6. SIDEBAR — dropdown toggle (Notas, etc.) ────────────── */

.sidebar button.nav-link.dropdown-toggle {
  border: none;
  background: none;
  width: calc(100% - 1.2rem);
  text-align: left;
  cursor: pointer;
  /* Corregir para que sea consistente con links */
  padding: 0.575rem 0.85rem;
  margin: 0.1rem 0.6rem;
}

/* Ocultar flecha nativa de Bootstrap */
.sidebar button.nav-link.dropdown-toggle::after { display: none !important; }

/* Flecha rotable */
.sidebar .snav-arrow {
  margin-left: auto;
  font-size: 0.72rem;
  color: #94a3b8;
  transition: transform 0.2s ease, color 0.14s ease;
  flex-shrink: 0;
}
.sidebar button.nav-link[aria-expanded="true"] .snav-arrow {
  transform: rotate(90deg);
  color: var(--primary-color);
}
.sidebar button.nav-link[aria-expanded="true"] {
  color: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 5%));
}
.sidebar button.nav-link[aria-expanded="true"] .bi:first-child {
  color: var(--primary-color);
}

/* Sub-items (dentro del collapse, ej. Notas > Proveedores, Clientes) */
.sidebar .collapse .nav,
.sidebar .collapsing .nav {
  border-left: 2px solid hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.18);
  margin-left: 1.5rem;
  padding-left: 0.25rem;
}
.sidebar .collapse .nav .nav-link,
.sidebar .collapsing .nav .nav-link {
  font-size: 0.82rem;
  font-weight: 400;
  color: #475569;
  padding: 0.45rem 0.65rem;
  margin: 0.05rem 0.35rem;
}
.sidebar .collapse .nav .nav-link.active,
.sidebar .collapsing .nav .nav-link.active {
  color: var(--primary-color);
  font-weight: 600;
}
.sidebar .collapse .nav .nav-link::before { display: none; }

/* ─── 7. SIDEBAR — pie de página ────────────────────────────── */

.sidebar > div:last-child {
  border-top: 1px solid var(--sidebar-border);
  background: linear-gradient(0deg, rgba(255,255,255,0.7), transparent);
}

/* ─── 8. OFFCANVAS — navegación móvil ───────────────────────── */

/* Quitar subrayado de hover */
.offcanvas-nav .list-group-item-action::after { display: none !important; }

.offcanvas-nav .section-title {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 1rem 0 0.3rem;
  padding: 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.offcanvas-nav .section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(148, 163, 184, 0.3), transparent);
}

.offcanvas-nav .nav-subgroup-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #b0bec7;
  padding: 0.6rem 0.25rem 0.1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.offcanvas-nav .nav-subgroup-label::before {
  content: '';
  width: 12px;
  height: 1px;
  background: rgba(148, 163, 184, 0.4);
}

.offcanvas-nav .list-group-item {
  border: 0;
  border-radius: 9px;
  margin-bottom: 0.15rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #1e293b;
  transition: background 0.13s ease, color 0.13s ease;
}
.offcanvas-nav .list-group-item .bi {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  color: #64748b;
  flex-shrink: 0;
}
.offcanvas-nav .list-group-item.active,
.offcanvas-nav .list-group-item:hover {
  background: hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.10);
  color: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 8%));
}
.offcanvas-nav .list-group-item.active .bi,
.offcanvas-nav .list-group-item:hover .bi {
  color: var(--primary-color);
}
.offcanvas-nav .list-group-item.active {
  font-weight: 600;
}

/* Sub-items en offcanvas (ej. Notas) */
.offcanvas-nav .list-group.ms-2.mt-2 {
  border-left: 2px solid hsla(var(--brand-h) var(--brand-s) var(--brand-l) / 0.18);
  padding-left: 0.3rem;
}
.offcanvas-nav .list-group.ms-2.mt-2 .list-group-item {
  font-size: 0.83rem;
  font-weight: 400;
  padding: 0.5rem 0.75rem;
  color: #475569;
}

/* Dropdown toggle en offcanvas */
.offcanvas-nav button.list-group-item.dropdown-toggle::after { display: none !important; }
.offcanvas-nav button.list-group-item[aria-expanded="true"] .snav-arrow {
  transform: rotate(90deg);
}

/* ─── 9. SIDEBAR — separadores entre secciones ──────────────── */

.sidebar .nav-section-gap {
  height: 0.65rem;
}

/* ─── 10. ANIMACIÓN de apertura del collapse ────────────────── */

.sidebar .collapse.show + .nav-subgroup-label,
.sidebar .collapsing + .nav-subgroup-label {
  margin-top: 0.25rem;
}

/* ─── 11. Offcanvas header refinado ─────────────────────────── */

.offcanvas-nav .offcanvas-header {
  padding: 1rem 1.1rem;
}

.offcanvas-nav .offcanvas-title {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

/* ─── 12. Estado de focus mejorado ──────────────────────────── */

.sidebar .nav-link:focus-visible,
.offcanvas-nav .list-group-item:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
  box-shadow: none;
}