/* ============================================================
   GESTIÓN DE TRANSPORTE — Hoja de estilos
   Paleta: Azul corporativo (#1a56db / #1e3a8a) + Blanco
   ============================================================ */

/* ---- Variables ---- */
:root {
  /* Azul corporativo */
  --blue-900:  #1e3a8a;
  --blue-800:  #1e40af;
  --blue-700:  #1d4ed8;
  --blue-600:  #2563eb;
  --blue-500:  #3b82f6;
  --blue-100:  #dbeafe;
  --blue-50:   #eff6ff;

  /* Semánticos */
  --primary:   var(--blue-600);
  --primary-d: var(--blue-700);
  --primary-dk:var(--blue-900);

  /* Estado */
  --success:   #16a34a;
  --danger:    #dc2626;
  --warning:   #d97706;
  --info:      #0891b2;

  /* Grises */
  --white:     #ffffff;
  --gray-50:   #f8fafc;
  --gray-100:  #f1f5f9;
  --gray-200:  #e2e8f0;
  --gray-300:  #cbd5e1;
  --gray-400:  #94a3b8;
  --gray-500:  #64748b;
  --gray-600:  #475569;
  --gray-700:  #334155;
  --gray-900:  #0f172a;

  /* Layout */
  --topbar-h:  60px;
  --radius:    6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
img { max-width: 100%; }

/* ============================================================
   TOPBAR / NAVEGACIÓN SUPERIOR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--blue-900);
  height: var(--topbar-h);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 0;
  max-width: 100%;
}

/* Marca / logo */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-weight: 700;
  font-size: .95rem;
  white-space: nowrap;
  text-decoration: none;
  margin-right: 32px;
  flex-shrink: 0;
}
.topbar-brand svg { opacity: .95; }
.topbar-brand:hover { text-decoration: none; opacity: .9; }

/* Navegación principal */
.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.topnav-link {
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 18px;
  color: rgba(255,255,255,.78);
  font-size: .875rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
  text-decoration: none;
}
.topnav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,.08);
  text-decoration: none;
}
.topnav-link.active {
  color: var(--white);
  border-bottom-color: var(--blue-500);
  background: rgba(255,255,255,.1);
}

/* Zona derecha del topbar */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ---- Dropdown de navegación (Administración) ---- */
.topnav-dropdown { position: relative; display: flex; align-items: center; }

.topnav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}
.dropdown-chevron {
  transition: transform .2s;
  opacity: .7;
  flex-shrink: 0;
}
.topnav-dropdown.open .dropdown-chevron { transform: rotate(180deg); }

.topnav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 210px;
  overflow: hidden;
  z-index: 300;
  animation: fadeDown .15s ease;
}
.topnav-dropdown.open .topnav-dropdown-menu { display: block; }

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.topnav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: .875rem;
  color: var(--gray-700);
  font-weight: 500;
  transition: background .12s, color .12s;
  text-decoration: none;
}
.topnav-dropdown-item:hover { background: var(--blue-50); color: var(--primary); text-decoration: none; }
.topnav-dropdown-item.active { background: var(--blue-50); color: var(--primary); font-weight: 600; }
.topnav-dropdown-item svg { color: var(--gray-400); flex-shrink: 0; }
.topnav-dropdown-item:hover svg,
.topnav-dropdown-item.active svg { color: var(--primary); }

.topnav-dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

/* ---- Menú de usuario ---- */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--white);
  cursor: pointer;
  transition: background .15s;
}
.user-menu-btn:hover { background: rgba(255,255,255,.18); }
.user-menu-name { font-size: .82rem; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar {
  width: 28px; height: 28px;
  background: var(--blue-500);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: var(--white);
  flex-shrink: 0;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  overflow: hidden;
  z-index: 300;
}
.user-dropdown.open { display: block; }
.user-dropdown-header {
  padding: 14px 16px;
  background: var(--blue-50);
  border-bottom: 1px solid var(--gray-200);
}
.user-dropdown-header strong { display: block; font-size: .875rem; color: var(--gray-900); }
.user-dropdown-header span   { font-size: .78rem; color: var(--gray-500); }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: .875rem;
  color: var(--gray-700);
  transition: background .12s;
}
.user-dropdown-item:hover { background: var(--gray-100); text-decoration: none; }
.user-dropdown-item.logout { color: var(--danger); }
.user-dropdown-item.logout:hover { background: #fee2e2; }

/* Hamburger (móvil) */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menú móvil desplegable */
.topnav.mobile-open {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  background: var(--blue-800);
  padding: 8px 0;
  box-shadow: var(--shadow-md);
  z-index: 199;
  align-items: stretch;
  gap: 0;
}
.topnav.mobile-open .topnav-link {
  height: auto;
  padding: 14px 24px;
  border-bottom: none;
  border-left: 3px solid transparent;
}
.topnav.mobile-open .topnav-link.active {
  border-left-color: var(--blue-500);
  background: rgba(255,255,255,.1);
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-layout { min-height: 100vh; }
.main-content { padding: 28px 24px; }
.content-wrapper { max-width: 100%; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  background: linear-gradient(150deg, var(--blue-900) 0%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; color: var(--primary); margin-bottom: 20px; }
.login-card h1 { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--gray-500); font-size: .85rem; margin-bottom: 28px; }
.login-note { text-align: center; color: var(--gray-400); font-size: .75rem; margin-top: 20px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header h3 { font-size: .95rem; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  border-top: 4px solid var(--gray-200);
}
.stat-card.stat-primary { border-top-color: var(--primary); }
.stat-card.stat-success  { border-top-color: var(--success); }
.stat-card.stat-warning  { border-top-color: var(--warning); }
.stat-card.stat-info     { border-top-color: var(--info); }
.stat-icon { color: var(--primary); opacity: .7; flex-shrink: 0; }
.stat-value { display: block; font-size: 2.1rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { display: block; font-size: .78rem; color: var(--gray-500); margin-top: 5px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-weight: 600; font-size: .875rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); opacity: 1; }
.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-danger  { background: var(--danger);  color: var(--white); border-color: var(--danger);  }
.btn-warning { background: var(--warning); color: var(--white); border-color: var(--warning); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--blue-50); opacity: 1; }
.btn-outline-gray {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-300);
}
.btn-outline-gray:hover { background: var(--gray-100); opacity: 1; }
.btn-sm  { padding: 5px 12px; font-size: .8rem; }
.btn-lg  { padding: 12px 28px; font-size: .95rem; }
.btn-xs  { padding: 3px 8px; font-size: .75rem; border-radius: 4px; }
.btn-block { display: flex; width: 100%; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px; border-radius: var(--radius); color: var(--gray-500);
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-900); }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control:disabled { background: var(--gray-100); color: var(--gray-400); cursor: not-allowed; }
.form-control-sm { padding: 5px 9px; font-size: .8rem; }
textarea.form-control { resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--gray-200); }
.required { color: var(--danger); }
.input-group { display: flex; }
.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn-icon {
  border: 1px solid var(--gray-300); border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--gray-50);
}
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; cursor: pointer; font-size: .875rem;
  text-transform: none; letter-spacing: normal;
}

/* ============================================================
   TABLAS
   ============================================================ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table thead tr {
  background: var(--blue-900);
}
.table th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 600;
  font-size: .78rem;
  color: rgba(255,255,255,.85);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
  color: var(--gray-700);
}
.table tbody tr:hover td { background: var(--blue-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table-sm th, .table-sm td { padding: 8px 12px; }
.row-inactive td { opacity: .45; }
.text-nowrap { white-space: nowrap; }
.actions { white-space: nowrap; }
.actions .btn + .btn,
.actions form + .btn,
.actions .btn + form { margin-left: 4px; }
.actions form { display: inline; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  white-space: nowrap;
}
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-info      { background: #cffafe; color: #164e63; }
.badge-primary   { background: var(--blue-100); color: var(--blue-900); }
.badge-secondary { background: var(--gray-100); color: var(--gray-500); }

/* ============================================================
   ALERTAS
   ============================================================ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .875rem;
  position: relative;
}
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fff1f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
.alert-dismissible { padding-right: 40px; }
.btn-close {
  position: absolute; right: 12px; top: 12px;
  background: none; border: none; font-size: 1.1rem;
  cursor: pointer; color: inherit; opacity: .5; line-height: 1;
}
.btn-close:hover { opacity: 1; }
.alert ul { margin: 0; padding-left: 18px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--blue-900);
}

/* ============================================================
   DETAIL GRID + DL
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}
.detail-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 16px;
  font-size: .875rem;
}
.detail-list dt { font-weight: 700; color: var(--gray-500); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.detail-list dd { color: var(--gray-900); }

/* ============================================================
   FILTROS
   ============================================================ */
.filter-form .filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-form .form-group { margin-bottom: 0; min-width: 160px; flex: 1; }
.filter-form .form-group label { margin-bottom: 5px; }
.filter-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.pagination-nav { display: flex; justify-content: center; }
.pagination { display: flex; gap: 4px; }
.page-item .page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .84rem;
  color: var(--gray-600);
  background: var(--white);
  transition: all .12s;
}
.page-item.active .page-link { background: var(--primary); color: var(--white); border-color: var(--primary); }
.page-item .page-link:hover { background: var(--blue-50); border-color: var(--primary); text-decoration: none; }

/* ============================================================
   RADIO GROUPS (Tipo transporte, Entrega fácil)
   ============================================================ */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
  transition: border-color .15s, background .15s;
}
.radio-option:hover { border-color: var(--primary); background: var(--blue-50); }
.radio-option input[type="radio"] { margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.radio-option input[type="radio"]:checked + .radio-label { color: var(--primary); }
.radio-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--blue-50);
}
.radio-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  line-height: 1.3;
}
.radio-label small {
  font-weight: 400;
  color: var(--gray-500);
  font-size: .78rem;
}

/* Hint bajo campos de formulario */
.field-hint {
  display: block;
  font-size: .78rem;
  color: var(--gray-500);
  margin-top: 5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

/* ============================================================
   AUTOCOMPLETADO CHIPS
   ============================================================ */
.location-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.location-chip {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: .82rem;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.location-chip:hover  { border-color: var(--primary); background: var(--blue-50); }
.location-chip.active { border-color: var(--primary); background: var(--blue-100); color: var(--blue-900); }
.chip-count { background: var(--gray-200); border-radius: 999px; padding: 1px 6px; font-size: .7rem; color: var(--gray-500); }

/* ============================================================
   PARADAS DE RUTA
   ============================================================ */
.stop-list { padding: 0; }
.stop-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--gray-200);
  cursor: grab;
  transition: background .12s;
}
.stop-item:hover   { background: var(--blue-50); }
.stop-item:last-child { border-bottom: none; }
.stop-handle { color: var(--gray-400); font-size: 1.1rem; cursor: grab; user-select: none; }
.stop-order {
  width: 26px; height: 26px;
  background: var(--primary); color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; flex-shrink: 0;
}
.stop-content { flex: 1; min-width: 0; }
.stop-title { font-weight: 600; font-size: .875rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stop-meta  { font-size: .8rem; color: var(--gray-500); margin-top: 3px; }
.stop-actions { flex-shrink: 0; }

/* ============================================================
   ROUTE CARD (conductor en dashboard)
   ============================================================ */
.route-card-link { display: block; text-decoration: none; }
.route-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  transition: background .12s;
}
.route-card:hover { background: var(--blue-50); }
.route-card-title { font-weight: 700; font-size: .95rem; color: var(--gray-900); }
.route-card-meta  { font-size: .82rem; color: var(--gray-500); margin-top: 4px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.py-4 { padding-top: 16px !important; padding-bottom: 16px !important; }

/* ============================================================
   MODAL (auditoría)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%; max-width: 680px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}

/* Modal auditoría rediseñado */
.audit-modal-box { padding: 0; overflow: hidden; }
.audit-modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  gap: 12px;
}
.audit-modal-subtitle {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-400); margin: 0 0 2px;
}
.audit-modal-header h3 {
  font-size: 1.05rem; font-weight: 700; color: var(--blue-900); margin: 0;
}
.audit-modal-body { padding: 20px 24px 24px; }

/* Tabla de diferencias */
.audit-diff-table {
  width: 100%; border-collapse: collapse; font-size: .875rem;
}
.audit-diff-table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-400); font-weight: 600;
  padding: 0 10px 8px; text-align: left; border-bottom: 1px solid var(--gray-200);
}
.audit-diff-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--gray-100); }
.audit-diff-table td { padding: 8px 10px; vertical-align: top; }
.audit-field {
  font-weight: 600; color: var(--gray-700); width: 30%;
  white-space: nowrap;
}
.audit-val-old { color: var(--gray-500); text-decoration: line-through; width: 28%; }
.audit-arrow   { color: var(--gray-300); font-size: .85rem; width: 4%; text-align: center; }
.audit-val-new { color: var(--blue-700); font-weight: 500; width: 38%; }

/* Cuando no hay "antes" (solo nuevo), la columna valor se expande */
.audit-diff-table tr td.audit-val-new:nth-child(2) { color: var(--gray-700); font-weight: 400; }

/* ============================================================
   TABLA DE PETICIONES — barra de herramientas
   ============================================================ */

/* Barra superior del card */
.req-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--gray-200);
}

/* Pestañas de estado */
.req-status-tabs {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.req-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.req-tab:hover  { color: var(--gray-700); }
.req-tab.active { color: var(--blue-700); border-bottom-color: var(--blue-600); font-weight: 600; }
.req-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: .72rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-500);
}
.req-tab.active .req-tab-count { background: var(--blue-100); color: var(--blue-700); }

/* Colores específicos de tabs */
.req-tab.tab-pendiente.active  { color: var(--warning);  border-bottom-color: var(--warning); }
.req-tab.tab-pendiente.active .req-tab-count  { background: #fef3c7; color: var(--warning); }
.req-tab.tab-asignada.active   { color: var(--info);     border-bottom-color: var(--info); }
.req-tab.tab-asignada.active .req-tab-count   { background: #cffafe; color: var(--info); }
.req-tab.tab-en-curso.active   { color: var(--primary);  border-bottom-color: var(--primary); }
.req-tab.tab-en-curso.active .req-tab-count   { background: var(--blue-100); color: var(--primary); }
.req-tab.tab-completada.active { color: var(--success);  border-bottom-color: var(--success); }
.req-tab.tab-completada.active .req-tab-count { background: #dcfce7; color: var(--success); }
.req-tab.tab-cancelada.active  { color: var(--gray-400); border-bottom-color: var(--gray-400); }
.req-tab.tab-cancelada.active .req-tab-count  { background: var(--gray-100); color: var(--gray-400); }

/* Zona derecha: buscador + tipo */
.req-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-left: 1px solid var(--gray-200);
}
.req-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.req-search-icon {
  position: absolute;
  left: 9px;
  color: var(--gray-400);
  pointer-events: none;
  flex-shrink: 0;
}
.req-search-input {
  width: 240px;
  height: 34px;
  padding: 0 30px 0 32px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .85rem;
  background: var(--gray-50);
  color: var(--gray-800);
  transition: border-color .15s, box-shadow .15s, width .2s;
}
.req-search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  background: var(--white);
  width: 280px;
}
.req-search-clear {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border: none; background: none; cursor: pointer;
  color: var(--gray-400); font-size: 1rem; line-height: 1;
  padding: 0;
}
.req-search-clear:hover { color: var(--gray-700); }
.req-type-select {
  height: 34px;
  font-size: .82rem;
  min-width: 130px;
}

/* Tabla */
.req-table .th-id       { width: 50px; }
.req-table .th-date     { width: 130px; }
.req-table .th-goods    { max-width: 200px; }
.req-table .th-sortable { cursor: pointer; }
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.sort-link:hover { color: var(--blue-600); }
.sort-icon { font-size: .9rem; color: var(--blue-500); }

.td-muted  { color: var(--gray-500); font-size: .85rem; }
.td-goods  { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-addr   { font-size: .875rem; }
.td-date   { white-space: nowrap; }
.td-driver { font-size: .85rem; }
.req-id-link { font-weight: 600; color: var(--blue-600); text-decoration: none; }
.req-id-link:hover { text-decoration: underline; }

/* Indicador de urgencia en la fila */
.req-row { border-left: 3px solid transparent; }
.req-row.req-overdue { border-left-color: var(--danger); background: #fff5f5; }
.req-row.req-today   { border-left-color: var(--warning); background: #fffbeb; }
.req-row.req-soon    { border-left-color: #f59e0b; }

/* Badges de días */
.days-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.days-overdue { background: #fee2e2; color: var(--danger); }
.days-today   { background: #fef3c7; color: #b45309; }
.days-soon    { background: #fef9c3; color: #92400e; }
.days-ok      { background: var(--gray-100); color: var(--gray-500); }

/* Barra de filtros secundarios */
.req-filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.req-filter-sep {
  width: 1px;
  height: 28px;
  background: var(--gray-200);
  align-self: center;
}
.req-filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.req-filter-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
}
.req-filter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 1px;
}

/* Pie del card */
.req-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.flex-row    { display: flex; align-items: center; flex-wrap: wrap; }
.gap-2       { gap: 8px; }
.text-muted  { color: var(--gray-500); }
.text-sm     { font-size: .8rem; }
.text-center { text-align: center; }
.text-white  { color: var(--white); }
code {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .8rem;
  color: var(--blue-800);
}
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin: 20px 0 10px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .topnav { display: none; }
  .hamburger { display: flex; }
  .user-menu-name { display: none; }
  .topbar-inner { padding: 0 16px; }
}

@media (max-width: 768px) {
  .main-content { padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .audit-detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-form .form-group { min-width: 100%; }
  .req-toolbar { flex-direction: column; align-items: stretch; }
  .req-toolbar-right { border-left: none; border-top: 1px solid var(--gray-200); flex-wrap: wrap; }
  .req-search-input { width: 100%; }
  .req-search-input:focus { width: 100%; }
  .req-status-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .req-filter-bar { gap: 8px; }
  .req-filter-sep { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .btn-lg { width: 100%; justify-content: center; }
}

/* ============================================================
   ASIGNACIONES (admin)
   ============================================================ */
.assignments-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Tarjeta de petición pendiente */
.pending-req-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.pending-req-card:last-child { border-bottom: none; }

.pending-req-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pending-req-goods {
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-800);
  margin-bottom: 3px;
}
.pending-req-dest {
  font-size: .85rem;
  color: var(--gray-600);
  margin-bottom: 3px;
}
.pending-req-meta {
  font-size: .78rem;
  color: var(--gray-400);
  margin-bottom: 8px;
}

/* Controles de asignación */
.assign-form { margin-top: 8px; }
.assign-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.assign-controls .form-control-sm { flex: 1; min-width: 100px; }
.assign-controls .btn { white-space: nowrap; }

/* Grupo de conductor en panel derecho */
.driver-group {
  border-bottom: 1px solid var(--gray-100);
}
.driver-group:last-child { border-bottom: none; }

.driver-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
  background: var(--gray-50);
  flex-wrap: wrap;
}
.ml-auto { margin-left: auto; }

/* Petición asignada */
.assigned-req {
  padding: 10px 16px 10px 20px;
  border-bottom: 1px solid var(--gray-100);
  border-left: 3px solid transparent;
  transition: background .1s;
}
.assigned-req:last-child { border-bottom: none; }

/* Fila alternada */
.assigned-req-alt { background: #f8fafc; }

/* Borde izquierdo por estado */
.assigned-req-status-asignada   { border-left-color: #2563eb; }
.assigned-req-status-en_curso   { border-left-color: #7c3aed; }
.assigned-req-status-completada { border-left-color: #16a34a; }
.assigned-req-status-cancelada  { border-left-color: #9ca3af; }

.assigned-req-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.assigned-req-num {
  width: 20px; height: 20px;
  background: var(--blue-100, #dbeafe);
  color: var(--blue-700, #1d4ed8);
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.assigned-req-goods {
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 3px;
}
.assigned-req-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.assigned-req-meta a { color: var(--blue-600); }
.assigned-req-note {
  font-size: .78rem;
  color: var(--gray-500);
  font-style: italic;
  background: #fffbeb;
  border-radius: 4px;
  padding: 4px 6px;
  margin-top: 4px;
}
.assigned-req-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}
/* Para que el <form> no afecte al layout flex */
.assigned-req-actions form { display: contents; }

/* Botón Desasignar */
.btn-outline-danger {
  border: 1px solid #ef4444;
  color: #dc2626;
  background: transparent;
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.5;
  transition: background .15s, color .15s;
}
.btn-outline-danger:hover { background: #fee2e2; }
/* Tamaño idéntico al btn-xs normal */
.btn.btn-xs,
.btn-xs,
.btn-outline-danger {
  font-size: .75rem;
  padding: 3px 10px;
  line-height: 1.5;
}

/* Fila inferior de petición pendiente */
.pending-req-footer {
  margin-top: 6px;
}

/* ── Vista próximos días (conductor dashboard) ── */
.upcoming-day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  color: var(--gray-800);
  transition: background .15s;
}
.upcoming-day-row:hover { background: var(--gray-50); }
.upcoming-day-row:last-child { border-bottom: none; }
.upcoming-day-date { font-weight: 600; font-size: .9rem; flex: 1; }

/* Barra de navegación de fecha */
.assignments-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.assignments-nav-date form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.assignments-nav-date .form-control-sm {
  height: 32px;
  padding: 0 8px;
  line-height: 32px;
}

/* ── Responsive asignaciones ── */
@media (max-width: 900px) {
  .assignments-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .assignments-nav { flex-direction: column; align-items: flex-start; }
  .assignments-nav-date form { flex-wrap: wrap; }
}

/* ============================================================
   DRAWER — Panel lateral deslizante de detalle
   ============================================================ */
.req-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.req-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.req-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 440px;
  max-width: 95vw;
  background: var(--white);
  box-shadow: -6px 0 32px rgba(15,23,42,.15);
  z-index: 601;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.req-drawer.open {
  transform: translateX(0);
}

.req-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}
.req-drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--blue-900);
  margin: 2px 0 0;
}
.req-drawer-header .text-sm { color: var(--gray-400); font-size: .75rem; }

.req-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--gray-400);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.req-drawer-close:hover { background: var(--gray-200); color: var(--gray-700); }

.req-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.req-drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.req-drawer-footer:empty { display: none; }

/* Lista de datos dentro del drawer */
.drawer-detail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.drawer-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-100);
  align-items: start;
}
.drawer-row:last-child { border-bottom: none; }
.drawer-row dt {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: 2px;
}
.drawer-row dd {
  font-size: .875rem;
  color: var(--gray-800);
  line-height: 1.45;
}
.drawer-row dd a { color: var(--blue-600); }

/* ============================================================
   SSO — Botón de Microsoft + divider en login
   ============================================================ */

.btn-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  border: none;
  margin-bottom: 4px;
}
.btn-sso-microsoft {
  background: #fff;
  color: #3c3c3c;
  border: 1.5px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.btn-sso-microsoft:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  color: #1a1a1a;
}

.sso-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--gray-400);
  font-size: .8125rem;
}
.sso-divider::before,
.sso-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ============================================================
   SSO — Panel de administración (admin/sso/index.php)
   ============================================================ */

.sso-steps {
  margin: 0;
  padding-left: 1.4rem;
  line-height: 1.9;
  color: var(--gray-700);
}
.sso-steps li { margin-bottom: 4px; }
.sso-uri {
  display: inline-block;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: .85rem;
  word-break: break-all;
  color: var(--blue-800);
}

/* ============================================================
   Nav badge (solicitudes pendientes)
   ============================================================ */

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
}

/* ============================================================
   Solicitudes de acceso (admin/access_requests)
   ============================================================ */

.req-status-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}
.req-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.req-tab:hover { color: var(--gray-800); }
.req-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.req-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 600;
}
.req-tab.active .req-tab-count {
  background: var(--blue-100);
  color: var(--blue-700);
}
.req-toolbar {
  padding: 0 4px;
}

/* ============================================================
   Importación de centros de coste
   ============================================================ */

.import-steps {
  margin: 0;
  padding-left: 1.4rem;
  line-height: 2;
  color: var(--gray-700);
}
.import-steps li { margin-bottom: 4px; }
.import-steps ul  { margin: 4px 0 0; line-height: 1.8; }

.import-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: default;
}
.import-drop-zone.drop-active,
.import-drop-zone:focus-within {
  border-color: var(--primary);
  background: var(--blue-50);
}
.import-drop-text {
  margin: 0;
  font-size: .9375rem;
  color: var(--gray-500);
}
.import-drop-hint {
  margin: 0;
  font-size: .8125rem;
  color: var(--gray-400);
}

/* Estadísticas de resultado */
.import-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.import-stat {
  flex: 1;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
}
.import-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.import-stat-label {
  font-size: .8125rem;
  color: var(--gray-500);
  margin-top: 6px;
}
.import-stat-created  { border-color: #bbf7d0; background: #f0fdf4; }
.import-stat-created  .import-stat-value { color: #16a34a; }
.import-stat-updated  { border-color: #bfdbfe; background: #eff6ff; }
.import-stat-updated  .import-stat-value { color: #2563eb; }
.import-stat-skipped  { border-color: var(--gray-200); background: var(--gray-50); }
.import-stat-skipped  .import-stat-value { color: var(--gray-400); }

/* ── Ayuda / manual ──────────────────────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 768px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc    { display: none; }
}

/* Índice lateral */
.help-toc {
  position: sticky;
  top: 80px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 18px 0;
}
.help-toc-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  padding: 0 18px 10px;
  margin: 0;
  border-bottom: 1px solid var(--gray-100);
}
.help-toc ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.help-toc li { margin: 0; }
.help-toc-link {
  display: block;
  padding: 7px 18px;
  font-size: .8125rem;
  color: var(--gray-600);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.help-toc-link:hover,
.help-toc-link.toc-active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: var(--blue-50);
}

/* Secciones de contenido */
.help-content { min-width: 0; }
.help-section {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
  scroll-margin-top: 80px;
}
.help-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 18px 24px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}
.help-section-title svg { color: var(--primary); flex-shrink: 0; }

.help-body {
  padding: 20px 24px;
  font-size: .9375rem;
  color: var(--gray-700);
  line-height: 1.65;
}
.help-body p  { margin: 0 0 12px; }
.help-body p:last-child { margin-bottom: 0; }
.help-body ul,
.help-body ol { margin: 0 0 12px 20px; }
.help-body li { margin-bottom: 6px; }
.help-body h4 { font-size: .9rem; color: var(--gray-900); margin: 16px 0 8px; }
.help-body code {
  font-family: 'Courier New', monospace;
  font-size: .85em;
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--gray-800);
}
.help-body a { color: var(--primary); }

/* Tip */
.help-tip {
  display: flex;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .875rem;
  color: #1e40af;
  margin: 12px 0;
}
.help-tip::before {
  content: '💡';
  flex-shrink: 0;
  line-height: 1.4;
}

/* Estados */
.help-states { display: flex; flex-direction: column; gap: 12px; }
.help-state  { display: flex; align-items: flex-start; gap: 12px; }
.help-state .badge { flex-shrink: 0; margin-top: 2px; }
.help-state p { margin: 0; font-size: .9rem; }

/* Tabla de campos */
.help-table-wrap { overflow-x: auto; }
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.help-table th {
  background: var(--gray-50);
  padding: 9px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-200);
}
.help-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}
.help-table tr:last-child td { border-bottom: none; }
.help-table tr:hover td { background: var(--gray-50); }

/* ── Buscador de centros de coste (cc-picker) ─────────────────────── */
.cc-picker { position: relative; }
.cc-picker-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: .9375rem;
  color: var(--gray-900);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.868-3.833zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.cc-picker-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.cc-picker-search.cc-has-value {
  background-image: none;
  padding-right: 32px;
}
.cc-picker-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--gray-400);
  font-size: 1rem;
  line-height: 1;
  display: none;
}
.cc-picker-clear:hover { color: var(--gray-700); }
.cc-has-value ~ .cc-picker-clear { display: block; }
.cc-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.cc-picker-dropdown.open { display: block; }
.cc-picker-item {
  padding: 9px 14px;
  font-size: .875rem;
  cursor: pointer;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .1s;
}
.cc-picker-item:hover,
.cc-picker-item.active { background: var(--blue-50); color: var(--primary); }
.cc-picker-item strong { font-weight: 600; color: var(--gray-900); }
.cc-picker-empty {
  padding: 12px 14px;
  font-size: .875rem;
  color: var(--gray-400);
  text-align: center;
}
