/* =========================================
   SISTEMA DE COMPRAS Y PROCURA
   UI Framework — Mobile-first, Intuitive
   ========================================= */

/* === Transición entre páginas (mata el destello blanco al cambiar de módulo) ===
   El parpadeo blanco se ve en PRODUCCIÓN por la latencia de red al navegar entre
   páginas (app MPA): el navegador pinta blanco mientras llega la nueva página.
   1) fondo en <html> = fondo de la app, para que el instante de carga NO sea blanco
      (funciona en todos los navegadores);
   2) View Transitions entre documentos: mantiene la página vieja y hace cross-fade
      a la nueva, eliminando el hueco (progresivo; sin soporte navega normal). */
html { background-color: #f0f4f8; }
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .18s; }

/* === VARIABLES === */
:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;

  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --primary-light: #dbeafe;
  --primary-mid: #3b82f6;

  --success: #15803d;
  --success-bg: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --info: #0369a1;
  --info-bg: #e0f2fe;

  --sidebar-bg: #0f172a;
  --sidebar-active: #1d4ed8;
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-text: rgba(255,255,255,.82);

  --nav-h: 66px;
  --side-w: 220px;
  --side-w-compact: 84px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 2px 16px rgba(15,23,42,.07);
  --shadow-md: 0 6px 30px rgba(15,23,42,.13);
}

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

/* Anti-parpadeo al cambiar de modulo (app MPA: cada modulo recarga la pagina):
   background en <html> para que el instante entre pagina y pagina no muestre el
   lienzo BLANCO del navegador; scrollbar-gutter reserva el ancho de la barra
   para que el contenido no salte al pasar de un modulo con scroll a uno sin.
   (El flash blanco de fondo lo ataca el Navigation Preload del service worker.) */
html {
  background: var(--bg);
  scrollbar-gutter: stable;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* === NAVBAR === */
.navbar {
  position: fixed; top: 0; left: var(--side-w); right: 0; z-index: 50;
  height: var(--nav-h);
  transition: left .22s ease;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
  box-shadow: 0 1px 10px rgba(15,23,42,.07);
}

/* ── Campana de pendientes (navbar) — portada del sistema hijo ─────────── */
.inv-notif-wrap { position: relative; display: flex; align-items: center; flex-shrink: 0; }
button.inv-notif-btn {
  position: relative !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  width: 40px !important; height: 40px !important; padding: 0 !important;
  border: 1.5px solid var(--border) !important; border-radius: 10px !important;
  background: #fff !important; color: var(--muted, #64748b) !important;
  cursor: pointer; transition: color .15s, background .15s, border-color .15s; box-shadow: none !important;
}
button.inv-notif-btn:hover,
button.inv-notif-btn.has-notif { background: #eff6ff !important; color: #1d4ed8 !important; border-color: #bfdbfe !important; }
.inv-notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--danger, #dc2626); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 18px; text-align: center; pointer-events: none;
  border: 2px solid #fff;
}
.inv-notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-height: 480px;
  background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14); z-index: 9999;
  display: flex; flex-direction: column; overflow: hidden;
}
.inv-notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid #f1f5f9; flex-shrink: 0;
}
.inv-notif-header strong { font-size: 14px; color: #0f172a; }
button.inv-notif-close {
  width: 26px !important; height: 26px !important; padding: 0 !important;
  border: 0 !important; border-radius: 8px !important;
  background: #f1f5f9 !important; color: #64748b !important; cursor: pointer; font-size: 16px !important;
  display: flex !important; align-items: center !important; justify-content: center !important; transition: background .15s; box-shadow: none !important;
}
button.inv-notif-close:hover { background: #e2e8f0 !important; color: #0f172a !important; }
.inv-notif-body { overflow-y: auto; flex: 1; padding: 8px 0; }
.inv-notif-section { padding: 4px 0 2px; }
.inv-notif-section + .inv-notif-section { border-top: 1px solid #f1f5f9; margin-top: 4px; padding-top: 8px; }
.inv-notif-section-title {
  display: flex; align-items: center; gap: 6px; padding: 4px 16px 6px;
  font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8;
}
.inv-notif-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.inv-notif-dot--warn { background: #f59e0b; }
.inv-notif-dot--red  { background: #dc2626; }
.inv-notif-dot--blue { background: #3b82f6; }
.inv-notif-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  text-decoration: none !important; color: #0f172a !important; font-size: 13px; transition: background .12s; cursor: pointer;
}
.inv-notif-item:hover { background: #f8fafc; text-decoration: none !important; }
.inv-notif-item svg { color: #64748b; }
.inv-notif-item--danger { background: #fff5f5; }
.inv-notif-item--danger svg { color: #dc2626; }
.inv-notif-item--danger:hover { background: #fee2e2; }
.inv-notif-item-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.inv-notif-item-title { font-size: 13px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-notif-item-sub { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-notif-count {
  flex-shrink: 0; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: #fef3c7; color: #b45309; font-size: 11px; font-weight: 800; text-align: center; line-height: 22px;
}
.inv-notif-count--red { background: #fee2e2; color: #dc2626; }
.inv-notif-loading, .inv-notif-empty { padding: 24px 16px; font-size: 13px; color: #94a3b8; text-align: center; }
@media (max-width: 640px) {
  /* En móvil la campana NO queda pegada al borde derecho (el bloque de usuario
     va a su derecha), así que anclar el panel a la campana con right:-8px lo
     empujaba fuera de la pantalla por la izquierda y se recortaba el contenido.
     Se fija al viewport para que siempre quede completo y centrado bajo el nav. */
  .inv-notif-panel {
    position: fixed;
    top: calc(var(--nav-h) + var(--safe-top, 0px) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--nav-h) - 32px);
  }
}

.hamburger {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 40px; height: 40px;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; flex-shrink: 0;
}
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

.sidebar-compact-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text);
  padding: 0;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-compact-btn .bi { font-size: 18px; }

.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 800; color: var(--primary);
  flex-shrink: 0; text-decoration: none;
}
.navbar-brand:hover { text-decoration: none; }

.navbar-brand-mark {
  width: 54px;
  height: 40px;
  padding: 6px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(241,245,249,.96));
  border: 1px solid rgba(148,163,184,.24);
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.navbar-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.brand-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-icon svg { width: 21px; height: 21px; color: white; }

.nav-spacer { flex: 1; }

.nav-page-action {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-weight: 700; font-size: .85rem;
  text-decoration: none; white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.nav-page-action:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.nav-page-action .bi { font-size: 16px; }

.nav-context-chip {
  flex: 0 1 360px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid #dbeafe;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  min-width: 0;
  max-width: 360px;
}

.nav-context-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.nav-context-item-rates {
  color: var(--primary);
}

.nav-context-item-branch {
  color: #166534;
}

.nav-context-label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-context-value {
  font-size: .82rem;
  white-space: nowrap;
}

.nav-context-meta {
  font-size: .65rem;
  color: #60a5fa;
  letter-spacing: .02em;
}

.nav-context-item-branch .nav-context-value {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-context-divider {
  width: 1px;
  align-self: stretch;
  background: linear-gradient(180deg, transparent, #cbd5e1, transparent);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}
.nav-user[role="button"] { cursor: default; }
.nav-avatar-link {
  display: inline-flex;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}
.nav-avatar-link:hover,
.nav-avatar-link:focus-visible {
  text-decoration: none;
}

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem; flex-shrink: 0;
}

.nav-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
  max-width: 220px;
}
.nav-name {
  font-size: .88rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-name-link {
  color: inherit;
  text-decoration: none;
  width: fit-content;
}
.nav-name-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nav-role { font-size: .74rem; color: var(--muted); }

.solicitud-catalog-item-desc {
  display: block;
  margin-top: 2px;
  font-size: .72rem;
  color: rgba(148,163,184,.9);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-logout {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  background: var(--danger-bg); color: var(--danger);
  font-size: .82rem; font-weight: 600; transition: background .18s;
}
.nav-logout-form {
  display: inline-flex;
  flex-shrink: 0;
}
.nav-logout {
  border: 0;
  appearance: none;
  cursor: pointer;
}
.nav-logout:hover { background: #fecaca; text-decoration: none; color: var(--danger); }
.nav-logout svg { width: 15px; height: 15px; }

/* === SIDEBAR === */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--side-w); z-index: 40;
  background:
    linear-gradient(180deg, #111827 0%, #0f172a 100%);
  border-right: 1px solid rgba(255,255,255,.04);
  overflow-y: auto; padding: 18px 10px 24px;
  transition: transform .25s ease, width .22s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.55) rgba(255,255,255,.04);
}
.sidebar::-webkit-scrollbar {
  width: 10px;
}
.sidebar::-webkit-scrollbar-track {
  background: rgba(255,255,255,.04);
  border-radius: 999px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(148,163,184,.62), rgba(100,116,139,.82));
  border-radius: 999px;
  border: 2px solid rgba(15,23,42,.72);
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(191,219,254,.72), rgba(96,165,250,.82));
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }

/* Cambio de sede desde el drawer. En desktop la sede vive en el chip de la
   navbar (nav-context-chip), que se oculta ≤900px; por eso este acceso solo
   aparece en móvil, si no un usuario multi-sede queda atrapado. */
.sidebar-branch { display: none; }
@media (max-width: 900px) {
  .sidebar-branch {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: calc(100% - 24px); margin: 4px 12px 12px; padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.16); border-radius: 12px;
    background: rgba(255,255,255,.06); color: #e2e8f0; cursor: pointer; text-align: left;
    font: inherit;
  }
  .sidebar-branch:hover,
  .sidebar-branch:active { background: rgba(255,255,255,.12); }
  .sidebar-branch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  .sidebar-branch-info { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
  .sidebar-branch-label {
    font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #94a3b8;
  }
  .sidebar-branch-value {
    font-size: 13.5px; font-weight: 700; color: #fff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .sidebar-branch svg { flex: none; width: 16px; height: 16px; opacity: .75; }
}
.sidebar-brand-mark {
  width: 54px;
  height: 42px;
  padding: 4px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid rgba(148,163,184,.24);
  box-shadow: 0 8px 18px rgba(2,6,23,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: width .22s ease, height .22s ease, padding .22s ease;
}
.sidebar-brand-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.sidebar-brand-text {
  display: block;
  min-width: 0;
}
.sidebar-brand-text strong {
  display: block;
  font-weight: 900;
  line-height: 1.05;
  color: #f8fafc;
  font-size: 1rem;
}
.sidebar-brand-text span {
  display: block;
  margin-top: 4px;
  color: rgba(226,232,240,.72);
  font-size: 12px;
  line-height: 1.1;
}
body.sidebar-compact .sidebar-brand {
  justify-content: center;
  padding: 6px 0 12px;
}
body.sidebar-compact .sidebar-brand-mark {
  width: 46px;
  height: 38px;
}
body.sidebar-compact .sidebar-brand-text { display: none; }

.sidebar-section {
  padding: 16px 12px 8px;
  font-size: .66rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: rgba(148,163,184,.62);
  transition: opacity .18s ease, height .18s ease, padding .18s ease;
}
.sidebar-section:first-of-type {
  padding-top: 6px;
}

.sidebar-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  margin: 3px 6px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,.9);
  font-size: .9rem; font-weight: 600;
  transition: background .18s, color .18s, padding .18s ease, transform .18s ease, box-shadow .18s ease;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
}
.sidebar-link svg {
  width: 18px; height: 18px; flex-shrink: 0;
  opacity: .72;
  color: rgba(191,219,254,.86);
  margin-top: 1px;
}
.sidebar-badge {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(220,38,38,.45);
  animation: sidebar-badge-pulse 2s ease-in-out infinite;
}
.sidebar-link.active .sidebar-badge {
  background: #fff;
  color: #dc2626;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
@keyframes sidebar-badge-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(220,38,38,.45); }
  50% { box-shadow: 0 2px 14px rgba(220,38,38,.75); }
}
.sidebar-link:hover {
  background: rgba(255,255,255,.055);
  color: white;
  text-decoration: none;
  transform: translateX(2px);
}
.sidebar-link:hover svg { opacity: 1; }
.sidebar-link.active {
  background: linear-gradient(135deg, #2563eb 0%, #3156d3 100%);
  color: white;
  box-shadow: 0 10px 24px rgba(37,99,235,.28);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
}
.sidebar-link.active svg { opacity: 1; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 35;
  background: rgba(0,0,0,.55);
}

/* === LAYOUT === */
.content {
  margin-left: var(--side-w);
  padding-top: var(--nav-h);
  min-height: 100vh;
  transition: margin-left .22s ease;
}
.page { padding: 24px 28px; max-width: 1380px; }
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 28px 22px;
  color: #94a3b8;
  font-size: .74rem;
}
.app-footer small {
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

@media (min-width: 1440px) {
  .page {
    max-width: 1540px;
    padding-left: 32px;
    padding-right: 32px;
  }

  .app-footer {
    padding-left: 32px;
    padding-right: 32px;
  }

  .modal-xxl {
    width: min(1440px, 100%);
    max-width: 1540px;
  }

  th {
    padding-left: 22px;
    padding-right: 22px;
  }

  td {
    padding-left: 22px;
    padding-right: 22px;
  }
}

@media (min-width: 1200px) {
  .page-bandeja-procura {
    max-width: 100%;
    padding-left: 34px;
    padding-right: 34px;
  }

  .page-bandeja-procura .almacen-page-header {
    margin-bottom: 18px;
  }

  .page-bandeja-procura .bandeja-procura-card {
    overflow: hidden;
  }

  .page-bandeja-procura .almacen-hero {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    align-items: center;
    padding: 16px 0 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }

  .page-bandeja-procura .almacen-hero-main {
    max-width: 820px;
  }

  .page-bandeja-procura .almacen-hero-main h2 {
    margin: 6px 0 8px;
    font-size: 18px;
    line-height: 1.15;
  }

  .page-bandeja-procura .almacen-hero-main p {
    margin: 0;
    color: var(--muted, #64748b);
    font-size: 13px;
    line-height: 1.55;
  }

  .page-bandeja-procura .almacen-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 12px;
    min-width: 390px;
  }

  .page-bandeja-procura .almacen-stat {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    background: #fff;
    padding: 14px 16px;
  }

  .page-bandeja-procura .almacen-stat span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted, #64748b);
    font-weight: 700;
    margin-bottom: 6px;
  }

  .page-bandeja-procura .almacen-stat strong {
    display: block;
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: var(--text, #0f172a);
  }

  .page-bandeja-procura .almacen-filters {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    background: #fff;
    margin-bottom: 16px;
    overflow: hidden;
  }

  .page-bandeja-procura .almacen-filters > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
  }

  .page-bandeja-procura .almacen-filters > summary::-webkit-details-marker {
    display: none;
  }

  .page-bandeja-procura .almacen-filters > summary strong {
    display: block;
    font-size: 14px;
    color: var(--text, #0f172a);
  }

  .page-bandeja-procura .almacen-filters > summary span {
    display: block;
    font-size: 12px;
    color: var(--muted, #64748b);
    margin-top: 2px;
  }

  .page-bandeja-procura .almacen-filters-toggle {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }

  .page-bandeja-procura .almacen-filters .pagos-filters {
    padding: 0 16px 16px;
    margin: 0;
    border-top: 1px solid var(--border, #e2e8f0);
  }

  .page-bandeja-procura .pagos-filters-grid.bandeja-procura-filters-grid {
    grid-template-columns: minmax(240px, 1.3fr) repeat(4, minmax(160px, 1fr));
    gap: 16px 18px;
  }

  .page-bandeja-procura .pagos-filters-grid.bandeja-procura-filters-grid .field {
    min-width: 0;
  }

  .page-bandeja-procura .bandeja-procura-table {
    min-width: 1360px;
  }

  .page-bandeja-procura .bandeja-procura-table th {
    padding: 18px 22px;
  }

  .page-bandeja-procura .bandeja-procura-table td {
    padding: 22px 22px;
  }

  .page-bandeja-procura .bandeja-procura-table .td-actions {
    gap: 10px;
  }

  .page-bandeja-procura .bandeja-action-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .page-bandeja-procura .bandeja-action-form .btn-sm {
    padding: 7px 11px;
    min-height: 34px;
    white-space: nowrap;
  }
}

@media (max-width: 1199px) {
  .page-bandeja-procura .almacen-hero {
    flex-direction: column;
  }

  .page-bandeja-procura .almacen-hero-stats {
    min-width: 0;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .page-bandeja-procura .almacen-hero-stats {
    grid-template-columns: 1fr;
  }

  .page-bandeja-procura .almacen-filters > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-bandeja-procura .almacen-filters-toggle {
    align-self: flex-start;
  }
}

.page-bandeja-procura .almacen-scope {
  display: grid;
  gap: 20px;
}

.page-bandeja-procura .almacen-panel {
  padding: 22px;
  display: grid;
  gap: 20px;
}

.page-bandeja-procura .almacen-hero.compact {
  margin-bottom: 0;
}

.page-bandeja-procura .almacen-section-head {
  align-items: flex-end;
  gap: 14px;
}

.page-bandeja-procura .almacen-search {
  min-width: 280px;
  max-width: 380px;
  width: 100%;
}

.page-bandeja-procura .almacen-search input {
  width: 100%;
}

.page-bandeja-procura .almacen-pending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.page-bandeja-procura .almacen-pending-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
  display: grid;
  gap: 14px;
}

.page-bandeja-procura .almacen-pending-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.page-bandeja-procura .almacen-pending-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.page-bandeja-procura .almacen-pending-main h4 {
  margin: 4px 0 4px;
  font-size: 17px;
  line-height: 1.2;
  color: var(--text, #0f172a);
}

.page-bandeja-procura .almacen-pending-main p {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 13px;
}

.page-bandeja-procura .almacen-pending-qty {
  min-width: 108px;
  text-align: right;
}

.page-bandeja-procura .almacen-pending-qty strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  color: var(--text, #0f172a);
}

.page-bandeja-procura .almacen-pending-qty small {
  display: block;
  margin-top: 4px;
  color: var(--muted, #64748b);
}

.page-bandeja-procura .almacen-pending-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.page-bandeja-procura .almacen-pending-meta strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text, #0f172a);
}

.page-bandeja-procura .almacen-pending-actions {
  padding-top: 4px;
  border-top: 1px solid var(--border, #e2e8f0);
}

.page-bandeja-procura .almacen-pending-actions .bandeja-action-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-bandeja-procura .almacen-stock-groups {
  display: grid;
  gap: 14px;
}

.page-bandeja-procura .almacen-stock-group {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.page-bandeja-procura .almacen-stock-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.page-bandeja-procura .almacen-stock-group-head h4 {
  margin: 4px 0 0;
  font-size: 16px;
}

.page-bandeja-procura .almacen-stock-list {
  display: grid;
}

.page-bandeja-procura .almacen-stock-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft, #edf2f7);
}

.page-bandeja-procura .almacen-stock-row:last-child {
  border-bottom: 0;
}

.page-bandeja-procura .almacen-stock-row-main strong {
  display: block;
  font-size: 15px;
  color: var(--text, #0f172a);
}

.page-bandeja-procura .almacen-stock-row-main small {
  display: block;
  margin-top: 4px;
  color: var(--muted, #64748b);
}

.page-bandeja-procura .almacen-stock-row-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.page-bandeja-procura .almacen-stock-row-meta strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text, #0f172a);
}

.page-bandeja-procura .almacen-empty {
  margin: 0;
}

@media (max-width: 980px) {
  .page-bandeja-procura .almacen-section-head,
  .page-bandeja-procura .almacen-pending-top,
  .page-bandeja-procura .almacen-pending-main,
  .page-bandeja-procura .almacen-stock-group-head,
  .page-bandeja-procura .almacen-stock-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .page-bandeja-procura .almacen-search {
    max-width: none;
    min-width: 0;
  }

  .page-bandeja-procura .almacen-pending-qty {
    text-align: left;
  }

  .page-bandeja-procura .almacen-stock-row-meta {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1680px) {
  .page {
    max-width: 1680px;
  }
}

body.sidebar-compact .sidebar { width: var(--side-w-compact); }
body.sidebar-compact .content { margin-left: var(--side-w-compact); }
body.sidebar-compact .navbar { left: var(--side-w-compact); }
body.sidebar-compact .sidebar-section {
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}
body.sidebar-compact .sidebar-link {
  justify-content: center;
  gap: 0;
  margin-left: 8px;
  margin-right: 8px;
  padding-left: 0;
  padding-right: 0;
  font-size: 0;
  white-space: nowrap;
  overflow: hidden;
}
body.sidebar-compact .sidebar-link svg {
  width: 19px;
  height: 19px;
}
body.sidebar-compact .sidebar-link.active::before {
  left: 50%;
  right: auto;
  top: auto;
  bottom: -4px;
  width: 24px;
  height: 3px;
  transform: translateX(-50%);
}
/* Grupos desplegables (p. ej. Reportes) en compacto: solo icono centrado. Se
   ocultan el texto, el caret y la sublista (que no cabe en los 84px y bleedeaba
   como "Rep"). Al hacer clic, el JS navega al indice de la seccion. */
body.sidebar-compact .sidebar-group { margin: 3px 8px; }
body.sidebar-compact .sidebar-group > summary {
  justify-content: center;
  gap: 0;
  padding-left: 0;
  padding-right: 0;
}
body.sidebar-compact .sidebar-group > summary > span { display: none; }
body.sidebar-compact .sidebar-group > summary .sg-caret { display: none; }
body.sidebar-compact .sidebar-group > summary .sg-icon { width: 19px; height: 19px; opacity: .82; }
body.sidebar-compact .sidebar-group .sidebar-sublist { display: none; }

body[data-user-role="solicitante"] .sidebar,
body[data-user-role="solicitante"].sidebar-compact .sidebar {
  display: none !important;
}

body[data-user-role="solicitante"] .content,
body[data-user-role="solicitante"].sidebar-compact .content {
  margin-left: 0 !important;
}

body.role-solicitante .content--full,
body.role-solicitante .content {
  margin-left: 0 !important;
}

body[data-user-role="solicitante"] .navbar {
  left: 0 !important;
}

body[data-user-role="solicitante"] .sidebar-overlay {
  display: none !important;
}

body[data-user-role="solicitante"] .sidebar-section,
body[data-user-role="solicitante"] .sidebar-link,
body[data-user-role="solicitante"].sidebar-compact .sidebar-section,
body[data-user-role="solicitante"].sidebar-compact .sidebar-link {
  opacity: 1 !important;
  pointer-events: auto !important;
  height: auto !important;
  padding-top: initial !important;
  padding-bottom: initial !important;
  overflow: visible !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  font-size: 14px !important;
}

body[data-user-role="solicitante"] .sidebar-link svg,
body[data-user-role="solicitante"].sidebar-compact .sidebar-link svg {
  width: 18px !important;
  height: 18px !important;
}

body[data-user-role="solicitante"] .sidebar-compact-btn {
  display: none !important;
}

body[data-user-role="solicitante"] .hamburger {
  display: none !important;
}

body[data-user-role="solicitante"] .page {
  max-width: none;
}

body[data-user-role="solicitante"] .app-footer {
  padding-left: 28px;
  padding-right: 28px;
}

/* ── Auth wrapper ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-image: url(../img/background.jpg);
  background-size: cover;
  background-position: center;
  position: relative;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(15,25,50,.55), rgba(10,18,40,.40)),
    radial-gradient(circle at top right, rgba(25,118,210,.15), transparent 32%);
}
.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  display: grid;
  gap: 14px;
}
.auth-flash {
  margin: 0;
  border-radius: 16px;
  border-left-width: 5px;
  box-shadow: 0 16px 34px rgba(15,23,42,.12);
}

/* ── Login card ── */
.lp-card {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 40px 90px rgba(0,0,0,.40),
    0 10px 28px rgba(0,0,0,.22);
  background: #0d1526;
  min-height: 560px;
}

/* ── Left panel — dark brand ── */
.lp-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
  background: transparent;
}
.lp-panel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  text-align: center;
}
.lp-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.img-logo{
  width: 78%;
  height: 78%;
  object-fit: contain;
  object-position: center;
  display: block;
  transform: none;
}

.lp-logo-circle {
  width: 132px; height: 92px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 10px;
  color: white;
  backdrop-filter: blur(10px);
  box-shadow:
    0 18px 36px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.12);
}
.lp-brand-name {
  font-size: 1.9rem;
  font-weight: 900;
  color: white;
  letter-spacing: .07em;
}
.lp-panel-tagline {
  font-size: .74rem;
  color: rgba(255,255,255,.40);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0;
}
.lp-dots {
  display: flex;
  gap: 10px;
  align-items: center;
}
.lp-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
}
.lp-dot-r { background: #ef5350; }
.lp-dot-o { background: #ff9800; }
.lp-dot-g { background: #66bb6a; }

/* ── Right panel — white card ── */
.lp-form-panel {
  background: white;
  border-radius: 28px 0 0 28px;
  box-shadow: -14px 0 48px rgba(0,0,0,.20);
  display: flex;
  flex-direction: column;
}
.lp-form-topbrand {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 26px 40px 0;
}
.lp-form-topbrand-name {
  font-size: .92rem;
  font-weight: 800;
  color: #0d1526;
  letter-spacing: .02em;
}
.lp-form-topbrand .lp-brand-icon {
  background: linear-gradient(135deg, #1976d2, #1565c0);
  box-shadow: 0 4px 12px rgba(21,101,192,.30);
  border: none;
}
.lp-brand-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.20);
  border: 1px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lp-brand-icon svg { width: 18px; height: 18px; color: white; }
.lp-brand-icon--sm { width: 36px; height: 36px; border-radius: 10px; }
.lp-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 28px 28px 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0d1526;
}
.lp-mobile-brand .lp-brand-icon {
  background: linear-gradient(135deg, #1976d2, #1565c0);
  box-shadow: 0 4px 12px rgba(21,101,192,.30);
  border: none;
}
.lp-form-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 40px 40px;
}
.lp-form-head {
  margin-bottom: 26px;
}
.lp-form-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0d1526;
  line-height: 1.35;
  margin-bottom: 4px;
}
.lp-form-title span { color: #1565c0; }
.lp-form-sub {
  font-size: .84rem;
  color: #94a3b8;
}

/* Fields */
.lp-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.lp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.lp-label {
  font-size: .73rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.lp-field input,
.lp-field select {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1.5px solid #e2e8f0;
  border-radius: 0;
  font-size: .93rem;
  font-family: inherit;
  color: #0f172a;
  background: transparent;
  outline: none;
  transition: border-color .18s;
  appearance: none;
  -webkit-appearance: none;
}
.lp-field input::placeholder { color: #cbd5e1; }
.lp-field input:focus,
.lp-field select:focus {
  border-bottom-color: #1565c0;
  box-shadow: none;
  background: transparent;
}
.lp-lockout {
  margin-bottom: 18px;
  padding: 16px;
  border: 1.5px solid #fecaca;
  background: #fef2f2;
  border-radius: 12px;
  text-align: center;
}
.lp-lockout.is-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.lp-lockout-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .82rem;
  font-weight: 700;
  color: #b91c1c;
}
.lp-lockout.is-done .lp-lockout-head { color: #15803d; }
.lp-lockout-timer {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  margin: 6px 0 2px;
}
.lp-lockout-sub {
  font-size: .74rem;
  color: #64748b;
}
.lp-captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lp-captcha-q {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: .04em;
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  user-select: none;
  white-space: nowrap;
}
.lp-captcha-row input { flex: 1; }
.lp-captcha-hint {
  font-size: .72rem;
  color: #b45309;
}
.lp-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 50px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow:
    0 12px 28px rgba(15,23,42,.06),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.lp-select-wrap:focus-within {
  border-color: #1565c0;
  background: #ffffff;
  box-shadow:
    0 16px 34px rgba(21,101,192,.12),
    0 0 0 4px rgba(21,101,192,.10);
}
.lp-select-icon,
.lp-select-arrow {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.lp-select-icon {
  left: 14px;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #eff6ff;
  color: #1565c0;
  font-size: .95rem;
}
.lp-select-arrow {
  right: 14px;
  color: #64748b;
  font-size: .82rem;
  transition: transform .18s, color .18s;
}
.lp-select-wrap:focus-within .lp-select-arrow {
  color: #1565c0;
  transform: rotate(180deg);
}
.lp-branch-field select {
  min-height: 50px;
  padding: 0 44px 0 52px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
}
.lp-branch-field select:focus {
  border: 0;
  box-shadow: none;
}
.lp-branch-field select:disabled {
  color: #94a3b8;
  cursor: not-allowed;
}
.lp-select-wrap.is-disabled {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: none;
}
.lp-select-wrap.is-disabled .lp-select-icon,
.lp-select-wrap.is-disabled .lp-select-arrow {
  color: #94a3b8;
  background: #f1f5f9;
}
.lp-branch-field option {
  color: #0f172a;
  font-weight: 600;
}

/* Password toggle */
.lp-pass-wrap { position: relative; }
.lp-pass-wrap input { padding-right: 32px; }
.lp-eye {
  position: absolute;
  right: 0; bottom: 6px;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px;
  color: #94a3b8;
  cursor: pointer;
  display: flex; align-items: center;
  transition: color .15s;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
}
.lp-eye:hover { color: #1565c0; background: none !important; }

/* Submit */
.lp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  font-size: .82rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(21,101,192,.32);
  transition: opacity .18s, transform .15s, box-shadow .18s;
}
.lp-btn:hover {
  opacity: .92;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(21,101,192,.42);
}
.lp-btn:active { transform: translateY(0); }

/* Demo box */
.lp-demo {
  margin-top: 18px;
  border-radius: 10px;
  border: 1.5px dashed #e2e8f0;
  overflow: hidden;
}
.lp-demo-label {
  display: block;
  padding: 5px 12px;
  background: #f8fafc;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.lp-demo-body {
  padding: 9px 12px;
  font-size: .76rem;
  color: #64748b;
  line-height: 1.75;
}
.lp-demo-body strong { color: #374151; }
.lp-demo-body em { font-style: normal; color: #94a3b8; }
.lp-credit {
  margin-top: 14px;
  font-size: .68rem;
  line-height: 1.55;
  color: #94a3b8;
  text-align: center;
}
.lp-credit span {
  display: block;
  color: #64748b;
  letter-spacing: .04em;
}

/* === PAGE HEADER === */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-eyebrow {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--primary); margin-bottom: 3px;
}
.page-header h1 { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin: 0; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* === STAT CARDS === */
.stats-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
}
.cotizacion-stats-grid .stat-card {
  display: flex;
  flex-direction: column;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.ic-blue  { background: var(--primary-light); color: var(--primary); }
.ic-green { background: var(--success-bg); color: var(--success); }
.ic-red   { background: var(--danger-bg); color: var(--danger); }
.ic-yellow{ background: var(--warning-bg); color: var(--warning); }
.ic-purple{ background: #ede9fe; color: #6d28d9; }
.ic-teal  { background: #ccfbf1; color: #0f766e; }

/* === GENERIC CARD === */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 22px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.card-body { padding: 22px; }

/* === SEARCH BAR === */
.search-wrap {
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); flex: 1; max-width: 380px; overflow: hidden;
}
.search-box svg { margin: 0 10px; color: var(--muted); flex-shrink: 0; width: 16px; height: 16px; }
.search-box input {
  flex: 1; border: none; background: none;
  padding: 11px 12px 11px 0;
  font-size: .9rem; outline: none; color: var(--text); font-family: inherit;
}

/* Filtro por tipo (producto/servicio) en el catalogo de productos. */
.productos-tipo-filter {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; flex-wrap: wrap;
}
.productos-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 38px;
  border: 1.5px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--muted);
  font-size: .82rem; font-weight: 700; text-decoration: none;
  transition: all .14s ease; white-space: nowrap;
}
.productos-chip svg { opacity: .8; }
.productos-chip:hover { border-color: var(--primary, #1e40af); color: var(--primary, #1e40af); }
.productos-chip.is-active {
  background: var(--primary, #1e40af); border-color: var(--primary, #1e40af);
  color: #fff; box-shadow: 0 2px 8px rgba(30, 64, 175, .22);
}
.productos-chip.is-active svg { opacity: 1; }
@media (max-width: 640px) {
  .productos-tipo-filter { margin-left: 0; width: 100%; }
  .productos-chip { flex: 1; justify-content: center; padding: 8px 8px; }
}

/* === TABLES === */
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead { background: #f8fafc; }
th {
  padding: 14px 18px; text-align: left;
  font-size: .72rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
td {
  padding: 17px 18px; vertical-align: middle;
  border-bottom: 1px solid var(--border); font-size: .93rem;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
.td-mono { font-family: 'Courier New', monospace; font-weight: 700; color: var(--primary); font-size: .88rem; }
.td-bold { font-weight: 600; }
.td-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Las acciones destructivas van en <form method=post> (CSRF). display:contents hace
   que el form no cree caja propia: el <button> participa directo en el flex de
   .td-actions, quedando idéntico al antiguo <a>. */
.td-action-form { display: contents; }
.usuarios-action-btn {
  width: 118px;
  justify-content: center;
}
.td-muted { color: var(--muted); font-size: .88rem; }

.pagos-table-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: 0 16px 34px rgba(15,23,42,.08);
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.08), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
.pagos-table-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 18px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid #dbe5f0;
  background: linear-gradient(135deg, rgba(239,246,255,.96), rgba(255,255,255,.98));
}
.pagos-filters {
  display: grid;
  gap: 16px;
  padding: 18px 22px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.pagos-filters-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 360px);
  align-items: start;
  gap: 16px;
}
.pagos-filters-head h3 {
  margin: 6px 0 0;
  font-size: 1.05rem;
  line-height: 1.2;
}
.pagos-filters-head p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
.pagos-filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.pagos-filters-grid.pagos-filters-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .pagos-filters-grid.pagos-filters-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.pagos-filters .field input,
.pagos-filters .field select {
  min-height: 48px;
}
.pagos-filters-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.pagos-table-banner-copy {
  min-width: 0;
}
.pagos-table-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(30,64,175,.08);
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pagos-table-banner-copy h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  line-height: 1.2;
}
.pagos-table-banner-copy p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
}
.pagos-table-banner-metric {
  width: 150px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}
.pagos-table-banner-metric strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  color: var(--primary);
}
.pagos-table-banner-metric span {
  margin-top: 6px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pagos-table-scroll {
  background: #fff;
}
.pagos-table {
  width: 100%;
  min-width: 1290px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.pagos-table thead {
  background: linear-gradient(180deg, #f8fafc, #eef4ff);
}
.pagos-table th {
  padding: 18px 22px;
}
.pagos-table tbody tr {
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.pagos-table tbody tr:nth-child(even) {
  background: #fcfdff;
}
.pagos-table tbody tr:hover {
  background: #f3f7ff;
  box-shadow: inset 3px 0 0 rgba(30,64,175,.32);
}
.pagos-table tbody td {
  padding: 22px 22px;
  vertical-align: middle;
}
.pagos-table .td-mono {
  width: 130px;
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--primary-dark);
  line-height: 1.35;
  white-space: nowrap;
}
.pagos-order-cell,
.pagos-provider-cell,
.pagos-state-cell,
.pagos-currency-cell {
  white-space: nowrap;
}
.pagos-order-cell,
.pagos-provider-cell,
.pagos-factura-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}
.pagos-order-cell,
.pagos-provider-cell {
  line-height: 1.35;
}
.pagos-order-cell {
  width: 170px;
}
.pagos-provider-cell {
  width: 220px;
}
.pagos-state-cell {
  width: 120px;
  text-align: center;
}
.pagos-money-cell {
  width: 138px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.pagos-money-cell-paid {
  color: var(--success);
}
.pagos-money-cell-balance {
  font-size: .98rem;
}
.pagos-currency-cell {
  width: 112px;
  text-align: center;
}
.pagos-factura-cell {
  text-align: center;
}
.pagos-factura-cell .btn {
  min-width: 124px;
  justify-content: center;
  white-space: nowrap;
}
.pagos-actions-cell .td-actions {
  gap: 12px;
  justify-content: center;
}
.pagos-actions-cell .btn {
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
}
.pagos-table .badge {
  min-width: 82px;
  padding-left: 12px;
  padding-right: 12px;
  justify-content: center;
  white-space: nowrap;
}
.pagos-table .td-bold {
  line-height: 1.45;
}

.pagos-list {
  display: grid;
  gap: 14px;
  padding: 18px 22px 22px;
  background: #fff;
}
.pagos-empty {
  margin: 0;
}
.pagos-card {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.22);
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.06), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.pagos-card-top {
  display: grid;
  grid-template-columns: minmax(160px, .85fr) minmax(0, 1.25fr) auto;
  gap: 14px;
  align-items: start;
}
.pagos-card-order,
.pagos-card-provider {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.pagos-card-label {
  display: inline-flex;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pagos-card-code {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pagos-card-provider strong {
  font-size: 1.02rem;
  line-height: 1.35;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pagos-card-sub {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.pagos-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}
/* Observación (descripción de la solicitud) como vista rápida en la tarjeta.
   Se trunca a 2 líneas con "…"; el texto completo va en el title (tooltip). */
.pagos-card-obs {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbff;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}
.pagos-card-obs svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  opacity: .7;
}
.pagos-card-obs-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pagos-card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.pagos-card-stat {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f8fbff;
  min-width: 0;
}
.pagos-card-stat-label {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pagos-card-stat-value {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.pagos-card-stat-value--success {
  color: var(--success);
}
.pagos-card-stat-value--danger {
  color: var(--danger);
}
.pagos-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.pagos-card-footnote {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pagos-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
.pagos-card-actions .btn {
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
}

@media (min-width: 1440px) {
  .pagos-table-card {
    border-radius: 26px;
  }

  .pagos-table-banner {
    padding: 24px 28px 22px;
  }

  .pagos-filters {
    padding: 20px 28px 22px;
  }

  .pagos-table th {
    padding-left: 26px;
    padding-right: 26px;
  }

  .pagos-table tbody td {
    padding-left: 26px;
    padding-right: 26px;
  }

  .pagos-table {
    min-width: 1360px;
  }

  .pagos-table .pagos-money-cell {
    font-size: 1rem;
  }

  .pagos-list {
    padding: 20px 28px 24px;
  }

  .pagos-card {
    padding: 20px 22px;
  }
}

@media (min-width: 1680px) {
  .pagos-table th {
    padding-left: 28px;
    padding-right: 28px;
  }

  .pagos-table tbody td {
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 760px) {
  .pagos-filters {
    padding: 16px 18px 18px;
  }
  .pagos-filters-head {
    grid-template-columns: 1fr;
  }
  .pagos-filters-grid {
    grid-template-columns: 1fr;
  }
  .pagos-filters-actions {
    justify-content: flex-start;
  }
  .pagos-filters-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .pagos-table-banner {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .pagos-table-banner-metric {
    width: 100%;
  }

  .pagos-list {
    padding: 16px 18px 18px;
  }

  .pagos-card {
    padding: 16px;
  }
  .pagos-card-top {
    grid-template-columns: 1fr;
  }
  .pagos-card-badges {
    justify-content: flex-start;
  }
  .pagos-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pagos-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .pagos-card-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  .pagos-card-actions .btn,
  .pagos-card-footnote .btn {
    width: 100%;
    justify-content: center;
  }

  .payments-adjustment-panel {
    padding: 16px;
    border-radius: 16px;
  }
}

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; line-height: 1.15;
  border: 1px solid transparent; cursor: pointer;
  font-family: inherit; white-space: nowrap; text-decoration: none;
  user-select: none;
  transition: background .18s, border-color .18s, box-shadow .18s, color .18s, transform .06s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed; box-shadow: none; transform: none;
  pointer-events: none;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; box-shadow: 0 3px 10px rgba(37,99,235,.28); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 1px 2px rgba(22,101,52,.22); }
.btn-success:hover { background: #166534; color: #fff; box-shadow: 0 3px 10px rgba(22,101,52,.26); }
.btn-danger  { background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(220,38,38,.22); }
.btn-danger:hover  { background: #991b1b; color: #fff; box-shadow: 0 3px 10px rgba(220,38,38,.26); }
.btn-warning { background: var(--warning); color: #fff; box-shadow: 0 1px 2px rgba(146,64,14,.2); }
.btn-warning:hover { background: #92400e; color: #fff; box-shadow: 0 3px 10px rgba(146,64,14,.24); }
.btn-ghost {
  background: #fff; color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--muted); }
.btn-sm { padding: 7px 13px; font-size: .8rem; border-radius: 7px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn svg { width: 15px; height: 15px; }

/* Reset base para <button> SIN clase de componente.
   Usa :where() => especificidad (0,0,1): cualquier .btn-* o clase propia
   (.rpt-fac-link, etc.) lo sobrescribe sin pelear. Antes era
   button:not(.hamburger) (0,1,1), que pisaba a las clases y pintaba de azul
   "maldito" todo botón; de ahí venían los duplicados button.btn-* de abajo. */
button:where(:not(.hamburger)) {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; line-height: 1.15;
  border: none; cursor: pointer; transition: background .18s, box-shadow .18s;
  font-family: inherit; background: var(--primary); color: #fff;
}
/* Los estados van DENTRO del :where() a proposito. Escritos como
   button:where(...):hover la especificidad sube a (0,1,1) y le ganaba a
   cualquier `.mi-boton { background: #fff }` (0,1,0): al pasar el mouse por un
   boton con clase propia que solo tinta el borde en :hover, el fondo se
   pintaba de azul. Dentro del :where() quedan en (0,0,1) y la clase manda. */
button:where(:not(.hamburger):hover) { background: var(--primary-dark); }
button:where(:not(.hamburger):focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
button:where(:not(.hamburger):disabled) { opacity: .55; cursor: not-allowed; }
button.danger-btn { background: var(--danger); }
button.danger-btn:hover { background: #991b1b; }
button.ghost-btn { background: white; color: var(--text); border: 1.5px solid var(--border); }
button.ghost-btn:hover { background: var(--bg); }
button.btn-add {
  background: var(--success-bg); color: var(--success);
  border: 1.5px solid var(--success-bg);
}
button.btn-add:hover { background: #bbf7d0; }

/* Los duplicados button.btn-* se eliminaron: con el reset global en :where()
   las clases .btn-* (definidas arriba) ya ganan por sí solas. Fin de la guerra
   de especificidad. */

button.nav-logout,
.nav-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 0;
  appearance: none;
  background: var(--danger-bg);
  color: var(--danger);
  cursor: pointer;
  flex-shrink: 0;
}

button.nav-logout:hover,
.nav-logout:hover {
  background: #fecaca;
  color: var(--danger);
  text-decoration: none;
}

.nav-logout svg {
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 999px;
  font-size: .73rem; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap;
}
.badge-aprobado, .badge-aprobada, .badge-pagada, .badge-cerrado, .badge-recibida, .badge-entregada, .badge-completada,
.badge-aprobado-por-gerencia, .badge-aprobado-por-direccion, .badge-aprobado-por-coordinacion,
.badge-green { background: var(--success-bg); color: var(--success); }

.badge-rechazado, .badge-eliminado, .badge-cancelada,
.badge-red { background: var(--danger-bg); color: var(--danger); }

.badge-devuelto, .badge-parcial, .badge-en-pago, .badge-pendiente,
.badge-yellow { background: var(--warning-bg); color: var(--warning); }

.badge-blue { background: var(--primary-light); color: var(--primary); }
/* Comisión de nómina: no es una compra; se distingue del resto del pipeline. */
.badge-comision-de-nomina-generada { background: var(--primary-light); color: var(--primary); }
.badge-gray, .badge-inactivo { background: #f1f5f9; color: var(--muted); }
.badge-purple, .badge-entregado { background: #ede9fe; color: #6d28d9; }
.badge-anulada, .badge-anulado { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; }

/* Cambiar estado de recepción desde el listado de OC (analista/coordinador/admin) */
.oc-recepcion-form { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.oc-recepcion-label { font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #94a3b8; }
.oc-recepcion-select {
  min-height: 32px; padding: 4px 8px; border: 1px solid #dbe3ef; border-radius: 8px;
  background: #fff; color: #0f172a; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.oc-recepcion-select:focus { outline: 0; border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.15); }

/* Recepción en lote: barra de acción masiva sobre la tabla de órdenes */
.oc-bulk-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  margin: 0 0 14px; padding: 12px 16px;
  border: 1px solid #bfe3dd; border-radius: 12px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
}
.oc-bulk-count { font-size: 13px; font-weight: 700; color: #0f766e; margin-right: auto; }
.oc-bulk-count strong { font-size: 16px; }
.oc-bulk-field { display: flex; flex-direction: column; gap: 4px; }
.oc-bulk-field .field-label { font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #0f766e; }
.oc-bulk-field select {
  min-height: 34px; padding: 5px 10px; border: 1px solid #bfe3dd; border-radius: 8px;
  background: #fff; color: #0f172a; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.oc-bulk-field select:focus { outline: 0; border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.oc-bulk-cell { text-align: center; }
.oc-bulk-check, #ocCheckAll { width: 17px; height: 17px; cursor: pointer; accent-color: #0f766e; }

/* Auditoría: pestañas Registro / En línea */
.audit-tabs { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid #e5eaf1; }
.audit-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
.audit-tab svg { width: 16px; height: 16px; opacity: .85; }
.audit-tab:hover { color: #0f172a; background: rgba(15,23,42,.03); }
.audit-tab.is-active { color: #1d4ed8; border-bottom-color: #1d4ed8; }
.audit-tab-live { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #16a34a; color: #fff; font-size: 11px; font-weight: 800; }

/* Personas en línea (tiempo real) */
.audit-online-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #eef2f7; }
.audit-online-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.audit-online-total { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: #16a34a; }
.audit-online-total strong { font-size: 18px; }
.audit-online-dot, .audit-online-avatar-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; animation: audit-pulse 1.8s infinite; }
@keyframes audit-pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); } 70% { box-shadow: 0 0 0 6px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.audit-online-updated { font-size: 11.5px; color: #94a3b8; }
.audit-online-list { padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.inv-audit-empty { padding: 24px; text-align: center; color: #94a3b8; }
.audit-online-row { display: grid; grid-template-columns: auto 1.4fr 1fr 1.4fr auto; gap: 14px; align-items: center; padding: 12px 10px; border-radius: 10px; }
.audit-online-row:hover { background: #f8fafc; }
.audit-online-row + .audit-online-row { border-top: 1px solid #f1f5f9; }
.audit-online-avatar { position: relative; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }
.audit-online-avatar-dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid #fff; }
.audit-online-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.audit-online-id strong { font-size: 14px; color: #0f172a; }
.audit-online-id small { font-size: 12px; color: #64748b; }
.audit-online-where { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.audit-online-route { font-size: 12.5px; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-online-ago { font-size: 12px; font-weight: 700; color: #16a34a; white-space: nowrap; }
.audit-online-flag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; vertical-align: middle; }
.audit-online-kick { margin-left: 10px; padding: 5px 11px; border: 1px solid #fecaca; border-radius: 8px; background: #fff; color: #b91c1c; font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.audit-online-kick:hover { background: #fef2f2; border-color: #f87171; }
.audit-sys-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }
.audit-sys-badge--padre { background: #dbeafe; color: #1d4ed8; }
.audit-sys-badge--hijo { background: #dcfce7; color: #15803d; }
@media (max-width: 720px) {
  .audit-online-row { grid-template-columns: auto 1fr; grid-template-areas: "avatar id" "where where" "sys ago"; }
  .audit-online-avatar { grid-area: avatar; }
  .audit-online-id { grid-area: id; }
  .audit-online-sys { grid-area: sys; }
  .audit-online-where { grid-area: where; }
  .audit-online-ago { grid-area: ago; text-align: right; }
}

/* Anular / devolver factura (desplegable en Cuentas por pagar) */
/* Anulación de CxP: ahora es un modal (antes era un desplegable <details>) */
.pagos-anular-warn {
  display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px;
  padding: 10px 13px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger, #dc2626) 8%, #fff);
  border: 1px solid color-mix(in srgb, var(--danger, #dc2626) 22%, var(--border, #e2e8f0));
  color: var(--danger, #b91c1c); font-size: .83rem; line-height: 1.4;
}
.pagos-anular-modal-form { display: flex; flex-direction: column; gap: 12px; }
.pagos-anular-modal-form textarea,
.pagos-anular-modal-form input[type="password"] {
  width: 100%; resize: vertical; font: inherit; padding: 8px 10px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px; background: #fff; color: inherit;
}
.pagos-anular-modal-form input[type="password"] { resize: none; }
.pagos-anular-modal-form .field-label { display: block; margin-bottom: 4px; }
.pagos-anular-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 2px; }

/* Código de orden clicable: abre el modal con el contenido de la factura.
   Se muestra como "chip" clicable en reposo (fondo + borde visibles) para que
   sea evidente que se puede pulsar, no solo al pasar el mouse. */
.pagos-card-code--link {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--primary, #1e40af) 30%, var(--border, #e2e8f0));
  background: color-mix(in srgb, var(--primary, #1e40af) 7%, #fff);
  padding: 4px 9px; border-radius: 8px; font: inherit;
  color: var(--primary, #1e40af); font-weight: 800; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary, #1e40af) 40%, transparent);
  text-underline-offset: 3px;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pagos-card-code--link svg { opacity: .85; transition: transform .15s ease, opacity .15s ease; }
.pagos-card-code--link:hover {
  background: color-mix(in srgb, var(--primary, #1e40af) 14%, #fff);
  border-color: color-mix(in srgb, var(--primary, #1e40af) 55%, var(--border, #e2e8f0));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary, #1e40af) 18%, transparent);
  text-decoration-color: currentColor;
}
.pagos-card-code--link:hover svg { opacity: 1; transform: translateX(2px); }
.pagos-card-code--link:focus-visible { outline: 2px solid var(--primary, #1e40af); outline-offset: 1px; }
/* Pista permanente bajo el código: refuerza que es clicable. */
.pagos-card-hint {
  display: inline-flex; align-items: center; gap: 3px; margin-top: 3px;
  font-size: 11px; font-weight: 600; color: var(--primary, #1e40af); opacity: .7;
}
.pagos-card-hint svg { opacity: .8; }

/* Nota de anulación visible para todos: quién anuló y el motivo */
.pagos-anulada-note {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  padding: 10px 13px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger, #dc2626) 7%, #fff);
  border: 1px solid color-mix(in srgb, var(--danger, #dc2626) 22%, var(--border, #e2e8f0));
  color: var(--danger, #b91c1c); font-size: .84rem;
}
.pagos-anulada-note strong { display: block; font-weight: 800; }
.pagos-anulada-motivo { display: block; margin-top: 2px; color: var(--text, #334155); font-weight: 500; }

/* Factura recibida del proveedor. Neutra cuando el monto facturado coincidió con
   la orden; ámbar cuando hubo que ajustar la deuda (es lo que hay que notar). */
.pagos-factura-note {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  padding: 10px 13px; border-radius: 10px;
  background: color-mix(in srgb, var(--success, #16a34a) 6%, #fff);
  border: 1px solid color-mix(in srgb, var(--success, #16a34a) 20%, var(--border, #e2e8f0));
  color: var(--success, #15803d); font-size: .84rem;
}
.pagos-factura-note--ajuste {
  background: color-mix(in srgb, #d97706 8%, #fff);
  border-color: color-mix(in srgb, #d97706 26%, var(--border, #e2e8f0));
  color: #b45309;
}
.pagos-factura-note strong { display: block; font-weight: 800; }
.pagos-factura-desvio { display: block; margin-top: 2px; color: var(--text, #334155); font-weight: 500; }

/* Comparación factura vs. orden dentro del modal de recepción. */
.pagos-factura-compare {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; margin: 14px 0 4px; padding: 11px 13px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}
.pagos-factura-compare > div { min-width: 0; }
.pagos-factura-compare span {
  display: block; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .02em; color: var(--muted, #64748b);
}
.pagos-factura-compare strong {
  display: block; margin-top: 2px; font-size: .88rem; font-weight: 800;
  overflow-wrap: anywhere;
}
.pagos-diff-up { color: #b45309; }
.pagos-diff-down { color: var(--danger, #b91c1c); }
@media (max-width: 640px) {
  .pagos-factura-compare { grid-template-columns: 1fr; gap: 7px; }
}

/* === ALERTS / FLASH === */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 18px; border-radius: var(--radius-sm);
  margin-bottom: 14px; font-size: .9rem;
}
/* legacy classes from flashes() */
.success {
  background: var(--success-bg); color: var(--success);
  border-left: 4px solid var(--success);
  padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: .9rem;
}
.danger {
  background: var(--danger-bg); color: var(--danger);
  border-left: 4px solid var(--danger);
  padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: .9rem;
}
.warning {
  background: var(--warning-bg); color: var(--warning);
  border-left: 4px solid var(--warning);
  padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: .9rem;
}
.info {
  background: var(--info-bg); color: var(--info);
  border-left: 4px solid var(--info);
  padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: .9rem;
}

/* Panel "Coordinar y asignar" (decision del Coordinador). Se evita .alert aqui
   porque su display:flex fragmentaba el texto con <strong> en columnas. */
.coord-intro { margin: 0 0 18px; font-size: .92rem; line-height: 1.55; color: var(--muted); max-width: 780px; }
.coord-intro strong { color: var(--text); font-weight: 700; }
.coord-field { max-width: 680px; margin-bottom: 20px; }
.coord-modes { display: grid; gap: 10px; }
.coord-mode { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--card); cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.coord-mode:hover { border-color: #93c5fd; }
.coord-mode input[type="radio"] { margin: 2px 0 0; width: 18px; height: 18px; accent-color: #2563eb; cursor: pointer; }
.coord-mode:has(input[type="radio"]:checked) { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.coord-mode-body { display: grid; gap: 4px; }
.coord-mode-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: .95rem; }
.coord-mode-title svg { width: 16px; height: 16px; color: #2563eb; flex-shrink: 0; }
.coord-mode-text { font-size: .84rem; color: var(--muted); line-height: 1.45; }

/* === FORMS === */
[hidden] {
  display: none !important;
}

/* Error dentro de un formulario (no como modal aparte, para no perder lo escrito). */
.form-inline-error {
  margin: 0 0 16px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid rgba(220, 38, 38, .25);
  border-left: 4px solid var(--danger);
  background: var(--danger-bg); color: var(--danger);
  font-size: .9rem; font-weight: 600; line-height: 1.4;
}

.form-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px; max-width: 1080px; margin-bottom: 24px;
}
.form-card form { display: contents; }

.form-card.almacen-excepcion-form {
  max-width: none;
  width: 100%;
}

/* Formulario a ancho completo (registrar pago): aprovecha toda la pantalla */
.form-card--full { max-width: none; width: 100%; }
@media (min-width: 1024px) {
  .form-card--full .field-grid { grid-template-columns: repeat(3, 1fr); }
  .form-card--full .g-span2 { grid-column: span 3; }
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-grid.g3 { grid-template-columns: 1fr 1fr 1fr; }
.g-span2 { grid-column: span 2; }
.g-span3 { grid-column: span 3; }

.payments-adjustment-panel {
  grid-column: 1 / -1;
  width: 100%;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 10px 24px rgba(15,23,42,.05);
}
.payments-adjustment-panel .field {
  margin-top: 6px;
}
.payments-adjustment-body .field {
  margin-bottom: 0;
}

/* Los dos toggles (pago adicional + retenciones) lado a lado para ahorrar alto */
.payments-adjustment-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
}
.payments-adjustment-cols .payments-adjustment-panel { margin: 0; height: 100%; }
@media (max-width: 720px) {
  .payments-adjustment-cols { grid-template-columns: 1fr; }
}

/* Retenciones / impuestos (SENIAT): líneas dinámicas dentro del panel de ajuste */
.pago-ret-list { display: flex; flex-direction: column; gap: 10px; }
.pago-ret-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: end;
  padding: 10px; border: 1px solid #dbeafe; border-radius: 12px; background: rgba(255,255,255,.7);
}
.pago-ret-row .field { margin: 0; }
.pago-ret-row > .field:first-child { flex: 1 1 100%; }   /* descripción en su propia línea */
.pago-ret-sobre { flex: 0 0 120px; }
.pago-ret-pct { flex: 0 0 80px; }
.pago-ret-amount { flex: 1 1 120px; }

/* Fila de configuración del IVA (alícuota + IVA calculado) */
.pago-ret-config {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
  padding-bottom: 12px; border-bottom: 1px dashed #dbeafe;
}
.pago-ret-config .field { margin: 0; }
.pago-ret-del {
  width: 34px !important; height: 40px; padding: 0 !important; border: 1px solid var(--border) !important;
  border-radius: 9px !important; background: #fff !important; color: var(--danger, #dc2626) !important;
  display: inline-flex !important; align-items: center; justify-content: center; cursor: pointer; box-shadow: none !important;
}
.pago-ret-del:hover { background: #fee2e2 !important; }
.pago-ret-totals {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px;
}
.pago-ret-total {
  flex: 1 1 160px; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid #dbeafe;
}
.pago-ret-total span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #64748b); }
.pago-ret-total strong { font-size: 1.05rem; font-weight: 800; color: var(--text, #0f172a); font-variant-numeric: tabular-nums; }
.pago-ret-total strong.pago-ret-neto { color: #0f766e; }
@media (max-width: 640px) {
  .pago-ret-row { grid-template-columns: 1fr 1fr; }
  .pago-ret-row .pago-ret-amount { grid-column: 1 / 2; }
  .pago-ret-del { grid-column: 2 / 3; justify-self: end; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: .82rem; font-weight: 700; color: var(--text);
}
.field input, .field select, .field textarea {
  padding: 12px 15px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .93rem; font-family: inherit; color: var(--text);
  background: white; outline: none; transition: border-color .18s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
.field textarea { min-height: 90px; resize: vertical; }

.almacen-excepcion-form .exception-input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .93rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  box-shadow: var(--shadow-soft);
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}

.almacen-excepcion-form select.exception-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 42px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.almacen-excepcion-form .exception-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1), var(--shadow-soft);
  background: #fff;
}

.almacen-excepcion-form .exception-input::placeholder {
  color: #94a3b8;
}

.almacen-excepcion-form .exception-input[readonly] {
  background: #f8fafc;
  color: #475569;
}

.exception-table-scroll {
  border-top: 1px solid var(--border);
}

.exception-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.exception-table th,
.exception-table td {
  vertical-align: top;
  overflow: visible;
  padding: 12px 10px;
}

.exception-table td:first-child {
  overflow: visible;
}

.exception-table td > .searchable-select,
.exception-table td > .exception-input {
  width: 100%;
  min-width: 0;
}

.exception-table .col-producto { width: 29%; }
.exception-table .col-cantidad { width: 9%; }
.exception-table .col-unidad { width: 9%; }
.exception-table .col-precio { width: 11%; }
.exception-table .col-subtotal { width: 11%; }
.exception-table .col-observacion { width: 23%; }
.exception-table .col-accion { width: 8%; }

.exception-table .exception-product,
.exception-table .exception-note {
  min-height: 48px;
}

.exception-table .exception-remove {
  width: 100%;
  white-space: nowrap;
  padding-inline: 10px;
}

.almacen-excepcion-form .searchable-select {
  width: 100%;
  min-width: 0;
  display: block;
  position: relative;
}

.almacen-excepcion-form .searchable-select-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-soft);
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}

.almacen-excepcion-form .searchable-select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1), var(--shadow-soft);
}

.almacen-excepcion-form .searchable-select::after {
  top: 50%;
  margin-top: -2px;
}

.exception-table .searchable-select-list {
  min-width: 100%;
  width: 100%;
}

.exception-table .searchable-select {
  z-index: 2;
}

@media (max-width: 900px) {
  .exception-table-scroll {
    overflow-x: auto;
  }

  .exception-table {
    min-width: 920px;
  }
}

.almacen-excepcion-form .btn-sm {
  min-height: 44px;
}

@media (min-width: 721px) {
  .exception-table-scroll {
    overflow-x: visible;
  }
}
.field-hint { font-size: .78rem; color: var(--muted); }
.searchable-select {
  position: relative;
}
.searchable-select .searchable-select-native {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.searchable-select-input {
  width: 100%;
  padding-right: 42px !important;
}
.searchable-select::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 19px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.searchable-select-list {
  position: absolute;
  z-index: 220;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 6px;
}
.searchable-select-list[hidden] {
  display: none !important;
}
.searchable-select .searchable-select-option,
.searchable-select .searchable-select-empty {
  width: 100%;
  border: 0;
  background: transparent !important;
  color: var(--text) !important;
  display: block !important;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.searchable-select .searchable-select-option:hover,
.searchable-select .searchable-select-option.is-active {
  background: #eff6ff !important;
  color: var(--primary) !important;
}
.searchable-select .searchable-select-empty {
  color: var(--muted) !important;
  cursor: default;
}
.field-check {
  min-height: 46px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.field-check input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--primary);
}

.form-section-title {
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--primary);
  padding-bottom: 10px; border-bottom: 1.5px solid var(--primary-light);
  margin-bottom: 18px; grid-column: 1 / -1;
}
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; grid-column: 1 / -1; margin-top: 6px; }

.product-import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.product-import-dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border: 2px dashed #bcd0f5;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  cursor: pointer;
  transition: border-color .18s, background .18s, box-shadow .18s, transform .18s;
  text-align: left;
  min-height: 168px;
}
.product-import-dropzone:hover,
.product-import-dropzone:focus-within {
  border-color: var(--primary);
  background: #eef4ff;
  box-shadow: 0 6px 18px rgba(30, 64, 175, .12);
}
.product-import-dropzone.is-dragover {
  border-style: solid;
  border-color: var(--primary);
  background: #e6efff;
  transform: scale(1.01);
}
.product-import-dropzone.has-file {
  border-style: solid;
  border-color: #16a34a;
  background: #f0fbf3;
}
.product-import-dropzone__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(30, 64, 175, .1);
  color: var(--primary);
}
.product-import-dropzone.has-file .product-import-dropzone__icon {
  background: rgba(22, 163, 74, .12);
  color: #16a34a;
}
.product-import-dropzone__icon svg {
  width: 28px;
  height: 28px;
}
.product-import-dropzone__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.product-import-dropzone__copy strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.product-import-dropzone__copy span {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.4;
}
.product-import-dropzone__file {
  margin-top: 6px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.product-import-dropzone.has-file .product-import-dropzone__file {
  color: #15803d;
}
.product-import-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.product-import-format {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fafcff;
  min-width: 0;
}
.product-import-format__title {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.product-import-format__code {
  display: block;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .76rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: normal;
}
.product-import-format__list {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
  font-size: .82rem;
  line-height: 1.45;
}
.product-import-format__list strong {
  font-weight: 700;
}

.product-import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 16px;
}
.product-import-stat {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.product-import-stat span {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.product-import-stat strong {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.product-import-note {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: #fafcff;
}
.product-import-note strong {
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.product-import-note p {
  margin: 0;
  line-height: 1.5;
  color: var(--text);
}
.product-import-preview-scroll td {
  vertical-align: top;
}
.product-import-preview-scroll td:nth-child(7),
.product-import-preview-scroll td:nth-child(8) {
  white-space: normal;
  min-width: 220px;
}
.product-import-preview-scroll td:last-child {
  min-width: 180px;
}
.product-import-row.is-ready {
  background: #f8fbff;
}
.product-import-row.is-skip {
  background: #fffbeb;
}

/* Legacy label/form compatibility */
label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: .82rem; font-weight: 700; margin: 0;
}
label input, label select, label textarea {
  padding: 12px 15px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: .93rem; font-family: inherit;
  color: var(--text); background: white; outline: none;
  transition: border-color .18s; margin: 0;
}
label input:focus, label select:focus, label textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
label textarea { min-height: 90px; resize: vertical; }

form.form {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px; max-width: 960px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-bottom: 24px;
}
form.form h3 {
  grid-column: span 2; font-size: .78rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--primary);
  padding-bottom: 10px; border-bottom: 1.5px solid var(--primary-light);
  margin-top: 8px;
}
form.form > button, form.form > .btn { grid-column: span 2; justify-self: start; }

form.compact {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; max-width: 700px; margin-top: 16px;
  display: grid; gap: 16px;
}
form.compact > button, form.compact > .btn { justify-self: start; }

/* === DYNAMIC ITEM ROWS === */
.items-container { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.item-row {
  display: grid;
  grid-template-columns: 1fr 110px 140px auto;
  gap: 10px; align-items: end;
  padding: 14px; background: #f8fafc;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.item-row label { margin: 0; font-size: .78rem; font-weight: 700; }
.item-row input, .item-row select { margin: 0; }
.item-row .del-btn {
  background: var(--danger-bg); color: var(--danger);
  border: none; padding: 8px 11px; border-radius: 7px;
  cursor: pointer; font-size: .85rem; font-family: inherit;
  font-weight: 700; align-self: end;
}
.item-row .del-btn:hover { background: #fecaca; }

.cotizaciones-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr);
  gap: 22px;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.16), transparent 34%),
    linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
}
.cotizaciones-hero-copy h2 {
  font-size: 1.6rem;
  line-height: 1.15;
  margin-bottom: 10px;
}
.cotizaciones-hero-copy p {
  color: var(--muted);
  max-width: 720px;
}
.cotizaciones-hero-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(30,64,175,.08);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.cotizaciones-hero-stats {
  display: grid;
  gap: 14px;
}
.cotizaciones-filters-card {
  padding: 22px 24px 20px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: rgba(148,163,184,.24);
  box-shadow: 0 18px 40px rgba(15,23,42,.08);
}
.cotizaciones-filters-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.cotizaciones-filters-head h3 {
  margin: 5px 0 0;
  font-size: 1.02rem;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.cotizaciones-filters-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(30,64,175,.08);
  color: var(--primary);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.cotizaciones-filters-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1d4ed8;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.cotizaciones-filters-form {
  display: grid;
}
.field-grid--cotizaciones-filters {
  align-items: end;
  grid-template-columns: 1.3fr .9fr .9fr auto;
  gap: 14px;
}
.cotizaciones-filters-cta {
  display: flex;
  align-items: flex-end;
}
.cotizaciones-filters-actions {
  width: 100%;
  justify-content: flex-end;
  margin-top: 0;
}
.cotizaciones-filters-actions .btn {
  min-width: 112px;
}
.cotizaciones-stat {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 30px rgba(15,23,42,.06);
}
.cotizaciones-stat strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 6px;
}
.cotizaciones-stat span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
}
.cotizaciones-filters-card .field-label {
  color: #334155;
}
.cotizaciones-filters-card .field input,
.cotizaciones-filters-card .field select {
  min-height: 50px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95);
}
.cotizaciones-detail-table td[data-label]::before {
  content: none;
}

.modal-xl { width: min(1120px, 100%); max-width: 1120px; }
.modal-xxl { width: min(1280px, 100%); max-width: 1380px; }
/* ── Nueva Solicitud: layout ── */
.solicitud-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 100%;
}
.solicitud-wrap form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  align-items: stretch;
  min-width: 0;
}
.solicitud-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.solicitud-desc-field textarea {
  resize: vertical;
  min-height: 72px;
}
.solicitud-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 340px);
  min-height: 460px;
}
.page-solicitud-insumos {
  max-width: none;
  width: 100%;
}
.page-solicitud-insumos .solicitud-builder {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
  gap: 14px;
  height: auto;
  min-height: 0;
  align-items: start;
  width: 100%;
}
.page-solicitud-insumos .solicitud-panel {
  min-width: 0;
}
.page-solicitud-insumos .solicitud-builder,
.page-solicitud-insumos .solicitud-panel,
.page-solicitud-insumos .solicitud-cart-list {
  overflow: hidden;
}
.page-solicitud-insumos .solicitud-panel {
  height: auto;
}
.page-solicitud-insumos .solicitud-catalog-list,
.page-solicitud-insumos .solicitud-cart-list {
  max-height: none;
}
.solicitud-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fcfdff;
  overflow: hidden;
}
.solicitud-panel-right {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.solicitud-panel-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.solicitud-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.solicitud-panel-title h3 {
  font-size: .95rem;
  margin: 0;
}
.solicitud-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  padding: 18px 20px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.12), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 16px 34px rgba(15,23,42,.06);
}
.solicitud-hero-copy {
  display: grid;
  gap: 6px;
  align-content: start;
}
.solicitud-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(30,64,175,.08);
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.solicitud-hero-copy h2 {
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0;
}
.solicitud-hero-copy p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}
.solicitud-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  align-items: stretch;
}
.solicitud-stat {
  min-width: 122px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(148,163,184,.18);
  box-shadow: 0 8px 22px rgba(15,23,42,.05);
  display: grid;
  gap: 2px;
  align-content: center;
}
.solicitud-stat strong {
  font-size: 1.35rem;
  line-height: 1;
}
.solicitud-stat span {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.solicitud-cart-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* Search input */
.solicitud-search-wrap {
  position: relative;
}
.solicitud-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.solicitud-search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .875rem;
  font-family: inherit;
  background: white;
  transition: border-color .15s, box-shadow .15s;
}
.solicitud-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
.solicitud-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 16px;
  height: calc(100vh - 330px);
  min-height: 500px;
}
/* Catalog list */
.solicitud-catalog-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.solicitud-catalog-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent !important;
  border-radius: 16px;
  background: white !important;
  color: var(--text) !important;
  font-family: inherit;
  cursor: pointer;
  transition: transform .14s, background .12s, border-color .12s, box-shadow .12s;
  box-shadow: 0 6px 18px rgba(15,23,42,.04);
}
.solicitud-catalog-item:hover {
  background: #eff6ff !important;
  border-color: rgba(30,64,175,.22) !important;
  box-shadow: 0 2px 8px rgba(30,64,175,.07);
  transform: translateY(-1px);
}
.solicitud-catalog-item.is-added {
  background: #f0fdf4 !important;
  border-color: rgba(22,163,74,.28) !important;
}
.solicitud-catalog-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.solicitud-catalog-item-name {
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.solicitud-catalog-item-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.solicitud-catalog-item-tags span {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  background: #eff6ff;
  color: var(--primary);
}
.solicitud-catalog-item.is-added .solicitud-catalog-item-tags span {
  background: #dcfce7;
  color: #166534;
}
.solicitud-catalog-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.solicitud-cart-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}
.solicitud-cart-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 220px;
  margin: 0 14px 14px;
  border: 1px dashed rgba(148,163,184,.28);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: var(--muted);
  text-align: center;
  padding: 18px;
}
.solicitud-cart-empty strong {
  color: var(--text);
  font-size: .98rem;
}
.solicitud-cart-empty p {
  margin: 0;
  font-size: .85rem;
}
body .solicitud-cart-row.item-row {
  grid-template-columns: minmax(0, 1.2fr) 120px auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(191,219,254,.72);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 12px 24px rgba(15,23,42,.05);
}
body .solicitud-cart-row.item-row .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
body .solicitud-cart-row.item-row .field-label {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.solicitud-cart-select,
.solicitud-cart-qty {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
  background: #fff;
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
}
.solicitud-cart-select:focus,
.solicitud-cart-qty:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
body .solicitud-cart-row.item-row .del-btn {
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
  border-radius: 12px;
  min-height: 44px;
}
body .solicitud-cart-row.item-row.is-selected {
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 16px 28px rgba(37,99,235,.14);
  transform: translateY(-1px);
}
.solicitud-notes {
  padding: 18px 20px 20px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.18);
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
  background: #fff;
}
.solicitud-notes textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  font: inherit;
  color: var(--text);
}
.solicitud-notes textarea:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
.solicitud-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.solicitud-history-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  gap: 18px;
  align-items: stretch;
  padding: 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.solicitud-history-hero-copy {
  display: grid;
  gap: 8px;
  align-content: start;
}
.solicitud-history-hero-copy h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}
.solicitud-history-hero-copy p {
  margin: 0;
  color: var(--muted);
  max-width: 65ch;
}
.solicitud-history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.solicitud-history-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.solicitud-history-stat {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 112px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}
.solicitud-history-stat span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.solicitud-history-stat strong {
  font-size: 2rem;
  line-height: 1;
}
.solicitud-history-card {
  overflow: hidden;
}
.solicitud-history-card-head {
  padding-bottom: 16px;
}
.solicitud-history-card-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.solicitud-history-table-scroll {
  border-top: 1px solid rgba(148,163,184,.16);
}
.solicitud-history-table-scroll .td-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}
.solicitud-history-table-scroll .td-actions > form,
.solicitud-history-table-scroll .td-actions > details {
  width: 100%;
}
.solicitud-history-table-scroll .td-details {
  display: block;
  width: 100%;
}
.solicitud-history-table-scroll .td-details summary {
  width: 100%;
  justify-content: center;
}
.solicitud-history-table-scroll .td-details-panel {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.04);
}
.solicitud-history-table-scroll .simple-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}
.solicitud-history-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 54px 20px;
  text-align: center;
}
.solicitud-history-empty-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--primary-light);
  color: var(--primary);
}
.solicitud-history-empty-icon svg {
  width: 30px;
  height: 30px;
}
.solicitud-history-empty h3 {
  margin: 0;
  font-size: 1.05rem;
}
.solicitud-history-empty p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}
.bandeja-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 18px;
  align-items: stretch;
  padding: 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.bandeja-hero-copy {
  display: grid;
  gap: 8px;
  align-content: start;
}
.bandeja-hero-copy h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}
.bandeja-hero-copy p {
  margin: 0;
  color: var(--muted);
  max-width: 68ch;
}
.bandeja-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.bandeja-stat {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 112px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}
.bandeja-stat span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.bandeja-stat strong {
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.bandeja-list-card {
  overflow: hidden;
}
.bandeja-list-head {
  align-items: flex-end;
}
.bandeja-list-tools {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.bandeja-search {
  display: grid;
  gap: 6px;
}
.bandeja-search input {
  min-width: 260px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
  background: #fff;
  font: inherit;
  color: var(--text);
}
.bandeja-search input:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
.bandeja-grid {
  display: grid;
  gap: 14px;
  padding: 18px;
}
.bandeja-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.22);
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
}
.bandeja-card-top {
  display: grid;
  grid-template-columns: minmax(150px, .75fr) minmax(0, 1.1fr) auto;
  gap: 14px;
  align-items: start;
}
.bandeja-card-request,
.bandeja-card-user {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.bandeja-card-label {
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.bandeja-card-code {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.bandeja-card-user strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.bandeja-card-user small {
  color: var(--muted);
  font-size: .78rem;
}
.bandeja-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}
.bandeja-card-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.bandeja-card-meta > div {
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--border);
  display: grid;
  gap: 4px;
}
.bandeja-card-meta strong {
  font-size: .98rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bandeja-card-observation {
  display: grid;
  gap: 6px;
}
.bandeja-card-observation p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}
.bandeja-card-products {
  display: grid;
  gap: 8px;
}
.bandeja-product-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bandeja-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}
.bandeja-convert-form {
  display: flex;
  width: 100%;
}
.bandeja-reject-form {
  display: flex;
  width: 100%;
}
.bandeja-card-actions .btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}
.bandeja-product-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid rgba(59,130,246,.10);
  font-size: .82rem;
  font-weight: 700;
}
.bandeja-product-chip--muted {
  background: #f8fafc;
  color: var(--muted);
  border-color: var(--border);
}
.bandeja-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 20px;
  text-align: center;
}
.bandeja-empty-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--primary-light);
  color: var(--primary);
}
.bandeja-empty-icon svg {
  width: 30px;
  height: 30px;
}
.bandeja-empty h3 {
  margin: 0;
  font-size: 1.05rem;
}
.bandeja-empty p {
  margin: 0;
  color: var(--muted);
  max-width: 56ch;
}
button.solicitud-meli-icon-btn,
button.solicitud-catalog-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #ffffff;
  color: var(--primary);
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}
button.solicitud-meli-icon-btn {
  margin-top: 0;
  text-decoration: none;
}
button.solicitud-meli-icon-btn svg,
button.solicitud-catalog-add-btn svg {
  width: 15px;
  height: 15px;
}
button.solicitud-meli-icon-btn:hover,
button.solicitud-catalog-add-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--primary-dark);
}
button.solicitud-catalog-add-btn.is-added {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--primary);
}
.solicitud-catalog-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: transparent;
  color: inherit;
}
/* Shortcut chips */
.solicitud-shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.solicitud-shortcut {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: .7rem;
  font-weight: 700;
}
/* Empty state */
.solicitud-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.solicitud-empty svg {
  width: 38px;
  height: 38px;
  opacity: .45;
}
.solicitud-empty p {
  font-size: .875rem;
  line-height: 1.5;
  margin: 0;
}
/* Selected table */
.solicitud-selected-scroll {
  flex: 1;
  overflow-y: auto;
}
.solicitud-selected-scroll table {
  width: 100%;
  border-collapse: collapse;
}
.solicitud-selected-scroll th,
.solicitud-selected-scroll td {
  padding: 10px 14px;
  font-size: .84rem;
  border-bottom: 1px solid var(--border);
}
.solicitud-selected-scroll thead th {
  background: #f8fafc;
  font-weight: 700;
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
  z-index: 1;
}
/* Footer */
.solicitud-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}
.quote-selected-name {
  display: grid;
  gap: 4px;
}
.quote-selected-name small {
  color: var(--muted);
  font-size: .78rem;
}
.quote-qty-wrap {
  display: inline-grid;
  grid-template-columns: 34px minmax(72px, 92px) 34px;
  align-items: center;
  gap: 6px;
}
.quote-qty-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white !important;
  color: var(--text) !important;
  padding: 0;
  justify-content: center;
  font-family: inherit;
}
.quote-qty-input {
  text-align: center;
  padding: 8px 10px;
}
.quote-remove-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  padding: 0;
  justify-content: center;
}

.misc-admin-focus {
  margin-top: 18px;
}
.misc-approval-list {
  display: grid;
  gap: 14px;
}
.misc-approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: 0 14px 36px rgba(15,23,42,.05);
}
.misc-approval-main {
  min-width: 0;
  display: grid;
  gap: 12px;
}
.request-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.request-title-row strong {
  font-size: 1rem;
}
.misc-request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: .86rem;
}
.misc-item-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.misc-item-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 700;
}
.request-actions {
  display: grid;
  gap: 10px;
  align-content: start;
}
.request-actions form {
  margin: 0;
}
.misc-approval-actions .btn {
  width: 100%;
}
.misc-reject-form {
  display: grid;
  gap: 8px;
}
.misc-reject-form textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
.misc-reject-form textarea:focus {
  outline: none;
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.cotizacion-summary-card {
  background:
    linear-gradient(135deg, rgba(219,234,254,.55), rgba(255,255,255,.92)),
    white;
  overflow: hidden;
}
/* Datos de la solicitud en tiles legibles y bien espaciados. */
.cotizacion-summary-card .detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px 16px;
  padding: 26px;
}
.cotizacion-summary-card .detail-item {
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.cotizacion-summary-card .detail-value {
  font-size: .95rem;
  line-height: 1.4;
  word-break: break-word;
}
/* Concepto de gestión con comisión: se destaca con el azul del sistema. */
.cotizacion-summary-card .detail-item--accent {
  background: linear-gradient(180deg, rgba(219,234,254,.65), rgba(255,255,255,.85));
  border-color: rgba(37,99,235,.30);
}
/* Descripción a todo el ancho de la tarjeta. */
.cotizacion-summary-card .detail-item--wide { grid-column: 1 / -1; }

/* Footer: fijar / cambiar concepto de gestión, alineado a los tiles. */
.cotizacion-summary-card .gestion-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  margin: 0;
  padding: 20px 26px;
  border-top: 1px solid rgba(148,163,184,.28);
  background: rgba(248,250,252,.75);
}
.gestion-form__field { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.gestion-form__hint { align-self: center; color: var(--muted); font-size: .85rem; }
.gestion-form__hint strong { color: var(--primary); font-weight: 700; }
.gestion-form .btn { align-self: flex-end; }

@media (max-width: 640px) {
  .cotizacion-summary-card .detail-grid { padding: 18px; gap: 12px; }
  .cotizacion-summary-card .gestion-form { padding: 16px 18px; }
  .gestion-form__field { min-width: 100%; }
  .gestion-form .btn { width: 100%; justify-content: center; }
}

.quote-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.quote-request-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, .6fr) minmax(220px, .6fr);
  gap: 14px;
  margin-bottom: 20px;
}
.quote-request-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 16px 18px;
  display: grid;
  gap: 6px;
}
.quote-request-card strong {
  font-size: 1rem;
}
.quote-request-card p,
.quote-request-card span {
  color: var(--muted);
  font-size: .84rem;
}
.quote-entry-summary {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.quote-detail-section {
  margin-top: 22px;
}
.quote-entry-summary-horizontal {
  grid-template-columns: minmax(130px, auto) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
}
.quote-entry-summary-count {
  display: grid;
  gap: 4px;
}
.quote-entry-summary strong {
  font-size: 1.8rem;
  line-height: 1;
}
.quote-entry-summary p {
  color: var(--muted);
  font-size: .85rem;
  margin: 0;
  line-height: 1.45;
}
.quote-entry-summary-horizontal .btn {
  white-space: nowrap;
}
.quote-detail-table input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font: inherit;
}
.quote-subtotal {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}
.quote-row-na td { background: #fffbeb; }
.quote-row-na td:not(:first-child) { opacity: .6; }
.quote-row-na input[type="number"][readonly],
.quote-row-na input[type="text"][readonly] { background: #f1f5f9; cursor: not-allowed; pointer-events:none; }
.quote-row-na .quote-subtotal { background:#fef3c7; color:#b45309; }
.quote-row-na .solicitud-meli-chip { opacity: .4; pointer-events:none; }

/* Chip toggle "No dispone" — limpio, compacto, estado activo en amber */
.quote-na-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 5px 11px 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
  line-height: 1;
}
.quote-na-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.quote-na-chip-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  transition: all .15s ease;
}
.quote-na-chip:hover {
  border-color: #cbd5e1;
  color: #334155;
  background: #f8fafc;
}
.quote-na-chip:has(input:checked),
.quote-na-chip.is-active {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
}
.quote-na-chip:has(input:checked) .quote-na-chip-dot,
.quote-na-chip.is-active .quote-na-chip-dot {
  background: #d97706;
  border-color: #d97706;
}
.quote-na-chip:has(input:checked) .quote-na-chip-dot::after,
.quote-na-chip.is-active .quote-na-chip-dot::after {
  content: '';
  position: absolute;
  left: 3px; top: 5.5px;
  width: 5px; height: 2.5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.quote-na-chip input:focus-visible + .quote-na-chip-dot {
  box-shadow: 0 0 0 3px rgba(217,119,6,.25);
}
.quote-detail-table th:nth-child(1),
.quote-detail-table td:nth-child(1) {
  min-width: 240px;
}
.quote-detail-table th:nth-child(2),
.quote-detail-table td:nth-child(2),
.quote-detail-table th:nth-child(3),
.quote-detail-table td:nth-child(3) {
  min-width: 150px;
}
.quote-detail-table th:nth-child(4),
.quote-detail-table td:nth-child(4) {
  min-width: 130px;
}
.quote-provider-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.process-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 18px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
}
.process-card.is-complete {
  border-color: rgba(21,128,61,.24);
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}
.process-card h3 {
  font-size: 1rem;
  margin: 0;
}
.process-card p {
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.6;
}
.process-card strong {
  font-size: .92rem;
}
.process-step-badge {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 6px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.rank-card {
  border: 1px dashed rgba(148,163,184,.55);
  border-radius: 18px;
  background: #fbfdff;
  padding: 18px;
  display: grid;
  gap: 8px;
}
.rank-card.is-filled {
  border-style: solid;
  border-color: rgba(30,64,175,.14);
  box-shadow: var(--shadow);
}
.rank-card strong {
  font-size: 1rem;
}
.rank-card p {
  color: var(--muted);
  font-size: .84rem;
}

.priority-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 800;
}
.priority-rank-1 {
  background: #dcfce7;
  color: #15803d;
}
.priority-rank-2 {
  background: #eff6ff;
  color: var(--primary);
}
.priority-rank-3 {
  background: #fff7ed;
  color: #c2410c;
}

.review-route-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.review-route-banner > div {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 18px;
  display: grid;
  gap: 6px;
}
.review-route-banner strong {
  font-size: 1rem;
}
.review-route-banner p {
  color: var(--muted);
  font-size: .84rem;
}

.approval-decision-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.currency-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 24px;
  align-items: start;
}
.currency-config-form {
  display: grid;
  gap: 18px;
}
.currency-converter {
  display: grid;
  gap: 18px;
}
.currency-rate-note {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: .85rem;
}
.currency-rate-note strong {
  color: var(--text);
}
.currency-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.currency-info-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 18px;
  display: grid;
  gap: 8px;
}
.currency-info-card strong {
  font-size: .95rem;
}
.currency-info-card p {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.6;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 22px;
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 26px;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.14), transparent 32%),
    radial-gradient(circle at bottom right, rgba(30,64,175,.1), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 18px 40px rgba(15,23,42,.06);
}
.dashboard-hero > * {
  min-height: 100%;
}
.dashboard-kicker {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(30,64,175,.08);
  color: var(--primary);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dashboard-hero-copy h1 {
  font-size: clamp(2rem, 3.6vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -.04em;
  max-width: 760px;
  margin-bottom: 14px;
}
.dashboard-hero-copy p {
  color: var(--muted);
  max-width: 700px;
  font-size: .98rem;
}
.dashboard-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.dashboard-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 700;
}
.dashboard-hero-panel {
  display: grid;
  gap: 14px;
  grid-template-rows: minmax(0, 1fr) auto;
}
.dashboard-spotlight,
.dashboard-mini-metrics > div {
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 22px;
  background: rgba(255,255,255,.86);
  padding: 20px;
}
.dashboard-spotlight strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin: 8px 0;
}
.dashboard-spotlight p,
.dashboard-mini-metrics span {
  color: var(--muted);
}
.dashboard-mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dashboard-mini-metrics strong {
  display: block;
  font-size: 1.4rem;
  margin-top: 6px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .9fr);
  gap: 24px;
  align-items: start;
}
.dashboard-main,
.dashboard-side {
  display: grid;
  gap: 24px;
}
.dashboard-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.dashboard-section-head h2 {
  font-size: 1.35rem;
  line-height: 1.1;
}
.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.dashboard-metric-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: var(--shadow);
  min-height: 108px;
}
.dashboard-metric-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: var(--primary);
}
.dashboard-metric-icon svg {
  width: 24px;
  height: 24px;
}
.dashboard-metric-copy strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 6px;
}
.dashboard-metric-copy span {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 600;
}
.dashboard-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.dashboard-alert-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 15px 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.24);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
  overflow: hidden;
}
.dashboard-alert-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 999px;
  background: var(--primary-light);
}
.dashboard-alert-card strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text);
}
.dashboard-alert-card p {
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.55;
}
.dashboard-alert-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--primary);
}
.dashboard-alert-link:hover {
  text-decoration: none;
}
.dashboard-alert-top {
  display: grid;
  gap: 6px;
}
.dashboard-alert-label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dashboard-alert-card--critical::before { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.dashboard-alert-card--warning::before { background: linear-gradient(180deg, #f59e0b, #b45309); }
.dashboard-alert-card--primary::before { background: linear-gradient(180deg, #3b82f6, #1d4ed8); }
.dashboard-alert-card--info::before { background: linear-gradient(180deg, #0ea5e9, #0369a1); }
.dashboard-alert-card--success::before { background: linear-gradient(180deg, #22c55e, #15803d); }
.dashboard-alert-card--neutral::before { background: linear-gradient(180deg, #94a3b8, #64748b); }

.dashboard-flow-card,
.dashboard-activity-card {
  margin-bottom: 0;
}
.dashboard-flow-list {
  display: grid;
  gap: 12px;
}
.dashboard-flow-step {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dashboard-flow-step:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: rgba(30,64,175,.2);
  box-shadow: 0 14px 24px rgba(15,23,42,.08);
}
.dashboard-flow-step-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.dashboard-flow-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: .96rem;
  color: var(--text);
}
.dashboard-flow-step span {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.dashboard-flow-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex-shrink: 0;
}
.dashboard-flow-count {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}
.dashboard-flow-link {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.dashboard-flow-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.dashboard-flow-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-mid), var(--primary));
}
.dashboard-activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  min-height: 126px;
  scroll-snap-align: start;
}
.dashboard-activity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dashboard-activity-copy {
  min-width: 0;
}
.dashboard-activity-copy strong {
  display: block;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--text);
}
.dashboard-activity-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
.dashboard-activity-item time {
  align-self: start;
  font-size: .76rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.dashboard-activity-card .card-body {
  padding-top: 16px;
}
.dashboard-activity-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}
.dashboard-activity-list::-webkit-scrollbar {
  height: 10px;
}
.dashboard-activity-list::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,.5);
  border-radius: 999px;
}
.dashboard-guide-card .card-body,
.dashboard-shortcuts-card .card-body,
.dashboard-notes-card .card-body {
  padding: 20px;
}
.dashboard-guide-card,
.dashboard-shortcuts-card,
.dashboard-notes-card {
  margin-bottom: 0;
}
.dashboard-guide-list {
  display: grid;
  gap: 14px;
}
.dashboard-guide-step {
  padding: 16px 18px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.dashboard-guide-step strong {
  display: block;
  margin-bottom: 6px;
  font-size: .96rem;
}
.dashboard-guide-step p,
.dashboard-shortcut p,
.dashboard-note p {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.6;
}
.dashboard-shortcuts {
  display: grid;
  gap: 12px;
}
.dashboard-shortcut {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  min-height: 96px;
}
.dashboard-shortcut:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: rgba(30,64,175,.2);
  box-shadow: 0 14px 24px rgba(15,23,42,.08);
}
.dashboard-shortcut strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}
.dashboard-shortcut-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: var(--primary);
}
.dashboard-shortcut-icon svg {
  width: 20px;
  height: 20px;
}
.dashboard-notes-card .card-body {
  display: grid;
  gap: 14px;
}
.dashboard-note {
  padding: 16px 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  min-height: 110px;
}
.dashboard-note strong {
  display: block;
  margin-bottom: 6px;
}

/* Legacy row */
.row {
  display: grid; grid-template-columns: 1fr 110px;
  gap: 10px; align-items: end;
  background: #f8fafc; padding: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  margin-bottom: 8px;
}
.row select, .row input { margin: 0; }

/* === DETAIL / INFO GRID === */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px; padding: 22px;
}
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.detail-value { font-size: .95rem; font-weight: 600; }

/* === SECTION DIVIDER === */
.section-title {
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--primary);
  padding: 0 22px 10px; border-bottom: 1.5px solid var(--primary-light);
  margin: 0 0 0;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 22px; flex-wrap: wrap;
}
.section-header h3 { font-size: .95rem; font-weight: 700; margin: 0; }









/* === LOGIN === */









/* === EMPTY STATE === */
.empty {
  padding: 60px 24px; text-align: center; color: var(--muted);
}
.empty svg {
  width: 54px; height: 54px; margin: 0 auto 16px;
  display: block; opacity: .28;
}
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 1rem; }
.empty p { font-size: .9rem; }

/* === REPORT CARDS === */
.reports-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(148,163,184,.22);
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.08), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 16px 34px rgba(15,23,42,.06);
}
.reports-hero-copy {
  min-width: 0;
}
.reports-hero-copy h2 {
  margin: 6px 0 10px;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -.03em;
}
.reports-hero-copy p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}
.reports-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.reports-hero-tags span {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.reports-hero-side {
  display: grid;
  gap: 14px;
  align-content: start;
}
.reports-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary);
  border: 1px solid rgba(59,130,246,.12);
}
.reports-hero-icon i {
  font-size: 28px;
}
.reports-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.reports-hero-btn {
  min-width: 168px;
  justify-content: center;
}
.reports-hero-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reports-hero-mini div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(148,163,184,.22);
}
.reports-hero-mini strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.reports-hero-mini small {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.report-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; padding: 22px;
}
.report-card {
  background: #fff;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 12px 28px rgba(15,23,42,.05);
}
.report-card-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.report-card-icon svg { width: 22px; height: 22px; }
.report-card h3 { font-size: .97rem; margin-bottom: 8px; }
.report-card p { color: var(--muted); font-size: .85rem; margin-bottom: 16px; line-height: 1.5; }

.an-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* === COMPARISON TABLE (cuadro comparativo) === */
.selected-row { background: #f0fdf4 !important; }
.selected-row td { border-bottom: 1px solid #bbf7d0; }

/* === HISTORY TABLE === */
.timeline-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
}

/* === BALANCE CHIP === */
.balance-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 700;
  background: var(--primary-light); color: var(--primary);
}

/* === ARCHIVOS Y PLANOS === */
.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.55;
}

.archive-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.archive-search-card {
  margin-bottom: 18px;
}

.archive-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.archive-search-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.archive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr);
  gap: 18px;
  align-items: start;
}

.archive-layout--history {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
}

.archive-main,
.archive-side {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.archive-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(148,163,184,.2);
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: 0 12px 28px rgba(15,23,42,.05);
}

.archive-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.archive-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.archive-card h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.archive-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}

.archive-card-meta {
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: .82rem;
}

.archive-card-meta span,
.archive-list-item small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.archive-card-meta i,
.archive-list-item i {
  color: var(--primary);
}

.archive-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  padding-top: 4px;
  border-top: 1px solid rgba(148,163,184,.16);
}

.archive-card-status {
  display: grid;
  gap: 4px;
}

.archive-card-status strong {
  font-size: .9rem;
}

.archive-card-status small,
.archive-card-action-disabled span {
  color: var(--muted);
  font-size: .78rem;
}

.archive-card-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.archive-card-action-disabled {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.archive-list {
  display: grid;
  gap: 10px;
}

.archive-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.archive-list-item strong {
  display: block;
  font-size: .92rem;
}

.archive-list-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
}

.archive-list-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 120px;
}

.archive-admin-form .field-grid {
  margin-bottom: 14px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: .9rem;
}

.checkbox-inline input {
  width: 16px;
  height: 16px;
}

.archive-admin-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.archive-report-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.archive-report-columns h4 {
  margin-bottom: 10px;
  font-size: .92rem;
}

/* === RESPONSIVE === */
/* Login: panel izquierdo compacto en tablet */
@media (min-width: 561px) and (max-width: 900px) {
  .lp-card { grid-template-columns: .8fr 1.3fr; min-height: 520px; }
  .lp-panel { padding: 32px 24px; }
  .lp-logo-circle { width: 110px; height: 78px; border-radius: 24px; }
  .lp-brand-name { font-size: 1.5rem; }
  .lp-panel-tagline { display: none; }
  .lp-mobile-brand { display: none; }
  .lp-form-topbrand { padding: 20px 32px 0; }
  .lp-form-inner { padding: 24px 32px 32px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .content { margin-left: 0; }
  .navbar,
  body.sidebar-compact .navbar { left: 0; }
  .navbar {
    padding: 0 16px;
    gap: 10px;
  }
  .hamburger { display: flex; }
  .sidebar-compact-btn { display: none !important; }
  .nav-context-chip { display: none; }
  .nav-user {
    gap: 8px;
    margin-left: auto;
    cursor: default;
    max-width: 100%;
    align-items: center;
  }
  .nav-info {
    display: flex;
    min-width: 0;
  }
  .nav-name {
    max-width: 32vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-role { display: none; }
  .avatar {
    width: 36px;
    height: 36px;
    font-size: .78rem;
  }
  .nav-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    flex-shrink: 0;
  }
  .nav-logout-form {
    display: inline-flex;
    flex-shrink: 0;
  }
  .nav-logout span {
    display: none;
  }
  .nav-logout svg {
    width: 18px;
    height: 18px;
  }
  .navbar-brand span {
    font-size: 1rem;
  }
  .navbar-brand-mark {
    width: 50px;
    height: 38px;
    padding: 5px 7px;
    border-radius: 13px;
  }
  .page { padding: 20px 16px; }
  .reports-hero {
    grid-template-columns: 1fr;
    padding: 18px;
    border-radius: 22px;
  }
  .reports-hero-side {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
  }
  .reports-hero-actions {
    grid-column: 1 / -1;
  }
  .reports-hero-btn {
    min-width: 0;
    flex: 1 1 160px;
  }
  .reports-hero-mini {
    grid-column: 1 / -1;
  }
  .archive-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .archive-search-form,
  .archive-layout,
  .archive-layout--history,
  .archive-admin-panels,
  .archive-report-columns {
    grid-template-columns: 1fr;
  }
  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .archive-card-footer,
  .archive-list-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .archive-list-actions {
    align-items: flex-start;
    min-width: 0;
  }
  .report-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }
  .report-card {
    padding: 18px;
    border-radius: 18px;
  }
  .app-footer { padding: 0 16px 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid { grid-template-columns: 1fr !important; }
  .g-span2, .g-span3 { grid-column: span 1; }
  form.form { grid-template-columns: 1fr; }
  form.form h3 { grid-column: span 1; }
  form.form > button, form.form > .btn { grid-column: span 1; }
  .item-row { grid-template-columns: 1fr 90px; }
  .item-row .del-btn { grid-column: 1 / -1; justify-self: start; }
  .nav-info { display: none; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  body.sidebar-compact .content { margin-left: 0; }
  .cotizaciones-hero,
  .solicitud-topbar,
  .solicitud-builder,
  .quote-entry-grid,
  .quote-request-banner,
  .quote-entry-summary-horizontal,
  .quote-provider-meta,
  .currency-layout,
  .dashboard-hero,
  .dashboard-shell { grid-template-columns: 1fr; }
  .dashboard-alert-grid {
    grid-template-columns: 1fr 1fr;
  }
  .quote-entry-summary-horizontal .btn { width: 100%; justify-content: center; }
  .solicitud-builder { height: auto; min-height: 0; }
  .solicitud-panel { height: 380px; }
  .page-solicitud-insumos .solicitud-builder {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .page-solicitud-insumos .solicitud-panel {
    height: auto;
  }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .archive-stats,
  .archive-grid {
    grid-template-columns: 1fr;
  }
  .archive-search-form {
    grid-template-columns: 1fr;
  }
  .page-header h1 { font-size: 1.3rem; }
  .navbar-brand span { display: none; }
  .navbar-brand {
    gap: 0;
  }
  .navbar-brand-mark {
    width: 46px;
    height: 34px;
    padding: 4px 6px;
    border-radius: 12px;
  }
  .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  /* ── Login móvil: experiencia tipo app nativa ── */
  .auth-wrap {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    min-height: 100vh;
    min-height: 100dvh;
    background-image: none;
    background:
      radial-gradient(120% 60% at 50% 0%, #1e3a8a 0%, #142244 55%, #0d1526 100%);
  }
  .auth-wrap::before { display: none; }
  .auth-shell {
    max-width: none;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    gap: 0;
    display: flex;
    flex-direction: column;
  }
  .auth-flash {
    margin: 12px 14px 0;
    border-radius: 12px;
  }
  .lp-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    border-radius: 0;
    background: transparent;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 0;
    box-shadow: none;
    overflow: visible;
    flex: 1;
  }
  /* Hero superior — área de marca */
  .lp-panel {
    display: flex;
    padding: 38px 24px 30px;
    justify-content: center;
    align-items: center;
    background: transparent;
  }
  .lp-panel-inner {
    flex-direction: column;
    gap: 14px;
    text-align: center;
    align-items: center;
    justify-content: center;
  }
  .lp-logo-wrap {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  .lp-logo-circle {
    width: 88px; height: 88px;
    border-radius: 24px;
    padding: 12px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.06));
    box-shadow:
      0 18px 38px rgba(0,0,0,.30),
      inset 0 1px 0 rgba(255,255,255,.18);
  }
  .lp-logo-circle .img-logo { width: 100%; height: 100%; }
  .lp-logo-circle svg { width: 32px !important; height: 32px !important; }
  .lp-brand-name {
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: .08em;
  }
  .lp-panel-tagline {
    display: block;
    font-size: .68rem;
    color: rgba(255,255,255,.55);
    letter-spacing: .14em;
    margin-top: 2px;
  }
  .lp-dots { display: none; }

  /* Hoja blanca tipo bottom-sheet */
  .lp-form-panel {
    margin: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,.25);
    background: #ffffff;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .lp-form-topbrand { display: none; }
  .lp-mobile-brand { display: none; }
  .lp-form-inner {
    padding: 28px 22px 22px;
    flex: 1;
    justify-content: flex-start;
  }
  .lp-form-head { margin-bottom: 22px; }
  .lp-form-title {
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 4px;
  }
  .lp-form { gap: 18px; }
  .lp-field { gap: 6px; }
  .lp-label {
    font-size: .7rem;
    letter-spacing: .08em;
    color: #94a3b8;
  }
  .lp-field input,
  .lp-field select {
    padding: 14px 14px;
    font-size: 16px; /* evita zoom en iOS */
    background: #f1f5f9;
    border: 1.5px solid transparent;
    border-radius: 12px;
    color: #0f172a;
    transition: background .15s, border-color .15s, box-shadow .15s;
  }
  .lp-field input::placeholder { color: #94a3b8; }
  .lp-field input:focus,
  .lp-field select:focus {
    background: #ffffff;
    border-color: #1565c0;
    box-shadow: 0 0 0 4px rgba(21,101,192,.12);
  }
  .lp-select-wrap {
    min-height: 54px;
    border-radius: 14px;
    background: #f8fafc;
  }
  .lp-branch-field select {
    min-height: 54px;
    padding: 0 46px 0 54px;
    border: 0;
    background: transparent;
  }
  .lp-branch-field select:focus {
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .lp-pass-wrap input { padding-right: 46px; }
  .lp-eye {
    bottom: auto;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    padding: 6px;
  }
  .lp-eye svg { width: 20px; height: 20px; }
  .lp-btn {
    padding: 16px 20px;
    margin-top: 10px;
    font-size: .9rem;
    letter-spacing: .08em;
    border-radius: 14px;
    box-shadow: 0 14px 28px rgba(21,101,192,.36);
  }
  .lp-demo {
    margin-top: 18px;
    border-radius: 14px;
    border-style: solid;
    border-color: #e2e8f0;
    background: #f8fafc;
  }
  .lp-demo-label {
    padding: 7px 14px;
    font-size: .65rem;
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
  }
  .lp-demo-body {
    padding: 10px 14px;
    font-size: .76rem;
    line-height: 1.65;
  }
  .lp-credit {
    margin-top: auto;
    padding-top: 18px;
    font-size: .68rem;
    line-height: 1.55;
  }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .card-head,
  .card-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .app-footer { flex-direction: column; align-items: flex-start; gap: 4px; }
  .detail-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  table { min-width: 580px; }
  .cotizaciones-hero {
    padding: 18px;
    gap: 16px;
  }
  .cotizaciones-filters-card {
    padding: 18px;
  }
  .cotizaciones-filters-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .cotizaciones-filters-chip {
    width: 100%;
    justify-content: center;
  }
  .field-grid--cotizaciones-filters {
    grid-template-columns: 1fr;
  }
  .cotizaciones-filters-cta {
    align-items: stretch;
  }
  .cotizaciones-filters-actions {
    justify-content: stretch;
  }
  .cotizaciones-filters-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
  .cotizaciones-hero-copy h2 {
    font-size: 1.25rem;
  }
  .cotizaciones-detail-table {
    min-width: 0;
  }
  .cotizaciones-detail-table thead {
    display: none;
  }
  .cotizaciones-detail-table tbody,
  .cotizaciones-detail-table tr,
  .cotizaciones-detail-table td {
    display: block;
    width: 100%;
  }
  .cotizaciones-detail-table tbody {
    display: grid;
    gap: 12px;
  }
  .cotizaciones-detail-table tr {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  }
  .cotizaciones-detail-table td {
    min-width: 0;
    padding: 0;
    border-bottom: none;
  }
  .cotizaciones-detail-table td + td {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .cotizaciones-detail-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
  }
  .cotizaciones-detail-table .td-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .cotizaciones-detail-table .td-actions .btn {
    justify-content: center;
    width: 100%;
  }
  .review-route-banner {
    grid-template-columns: 1fr;
  }
  .cotizacion-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .cotizacion-stats-grid .stat-card {
    min-height: 168px;
    padding: 18px;
  }
  .cotizacion-stats-grid .stat-card:last-child {
    grid-column: 1 / -1;
  }
  .cotizacion-stats-grid .stat-icon {
    margin-bottom: 14px;
  }
  .cotizacion-stats-grid .stat-value {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
    line-height: .96;
    margin-bottom: 10px;
    text-wrap: balance;
  }
  .cotizacion-stats-grid .stat-label {
    margin-top: auto;
  }
  .review-route-banner > div,
  .field-grid,
  .field,
  .form-actions {
    min-width: 0;
  }
  .field input,
  .field select,
  .field textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .product-picker-grid { grid-template-columns: 1fr; }
  .quote-qty-wrap { grid-template-columns: 30px minmax(64px, 1fr) 30px; }
  .nav-context-chip { display: none; }
  .dashboard-mini-metrics { grid-template-columns: 1fr; }
  .roles-page-shell { grid-template-columns: 1fr; }
  .roles-rail {
    position: static;
    top: auto;
    overflow: visible;
    margin-bottom: 2px;
  }
  .roles-rail-body {
    gap: 12px;
  }
  .roles-rail .card-head {
    gap: 10px;
  }
  .roles-search-box {
    border-radius: 16px;
  }
  .roles-list {
    display: flex;
    gap: 10px;
    margin: 0 -2px;
    padding: 2px 2px 10px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .roles-list::-webkit-scrollbar { height: 0; }
  .role-item {
    min-width: 240px;
    max-width: 280px;
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 14px 14px 15px 16px;
    border-radius: 18px;
  }
  .role-item::before {
    inset: 10px auto 10px 10px;
  }
  .role-item-copy strong {
    font-size: .94rem;
  }
  .role-item-copy p {
    font-size: .82rem;
  }
  .role-item-badges {
    gap: 6px;
  }
  .roles-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px 14px;
    position: sticky;
    top: calc(var(--nav-h) + var(--safe-top));
    z-index: 12;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
  }
  .roles-tab {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
    padding: 10px 12px;
    white-space: nowrap;
  }
  .roles-editor-hero {
    grid-template-columns: 1fr;
    padding: 16px;
    border-radius: 18px;
    gap: 14px;
  }
  .roles-tabs-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .roles-editor-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .roles-mini-stat:last-child {
    grid-column: 1 / -1;
  }
  .roles-permissions-toolbar {
    padding: 14px;
    border-radius: 18px;
  }
  .roles-permissions-toolbar-copy p {
    font-size: .86rem;
  }
  .roles-permissions-toolbar-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .roles-permissions-toolbar-actions .btn {
    min-height: 44px;
  }
  .roles-permission-groups {
    gap: 14px;
  }
  .roles-permission-group-head {
    flex-direction: column;
  }
  .roles-permission-group-head {
    gap: 10px;
    align-items: flex-start;
  }
  .roles-group-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .roles-permission-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .permission-item {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    padding: 13px 14px;
    border-radius: 14px;
  }
  .permission-item input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
  }
  .roles-summary-grid {
    grid-template-columns: 1fr;
  }
  .roles-summary-stats {
    grid-template-columns: 1fr 1fr;
  }
  .roles-summary-stats .roles-mini-stat:last-child {
    grid-column: 1 / -1;
  }
  .roles-create-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    border-radius: 18px;
    margin-bottom: 14px;
  }
  .roles-create-hero .balance-chip {
    align-self: flex-start;
  }
  .users-modal-actions {
    grid-template-columns: 1fr;
  }
  .roles-summary-hero-actions .btn,
  .roles-summary-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .roles-summary-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .roles-summary-actions .btn,
  .roles-summary-actions .roles-restore-form {
    width: 100%;
  }
  .roles-summary-card {
    padding: 16px;
  }
  .roles-summary-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .roles-summary-hero-actions .btn {
    min-width: 0;
  }
  .roles-create-form {
    gap: 14px;
  }
  .roles-form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .roles-form-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .roles-restore-form {
    margin-top: 0;
  }
}

.search-hint {
  font-size: .82rem;
  color: var(--muted);
}

.approval-history-toolbar {
  padding: 22px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 18px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 26%),
    linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
}
.approval-history-toolbar-copy {
  display: grid;
  gap: 6px;
  max-width: 900px;
}
.approval-history-kicker {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(30,64,175,.08);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.approval-history-toolbar-copy h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.2;
}
.approval-history-toolbar-copy p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  max-width: 820px;
}
.approval-history-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) repeat(2, minmax(180px, .75fr)) auto;
  gap: 14px;
  align-items: end;
}
.approval-history-filters-compact {
  grid-template-columns: minmax(0, 1fr) auto;
}
.approval-history-filter {
  display: grid;
  gap: 8px;
}
.approval-history-filter-search {
  min-width: 0;
}
.approval-history-filter-label {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.approval-history-filter .search-box,
.approval-history-filter input[type="date"] {
  width: 100%;
  max-width: none;
}
.approval-history-filter .search-box {
  background: white;
  border-color: rgba(148,163,184,.35);
  min-height: 48px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.approval-history-filter .search-box:focus-within {
  border-color: rgba(30,64,175,.45);
  box-shadow: 0 0 0 4px rgba(30,64,175,.10);
}
.approval-history-filter input[type="date"] {
  min-height: 48px;
  border: 1.5px solid rgba(148,163,184,.35);
  border-radius: 12px;
  background: white;
  padding: 0 14px;
  color: var(--text);
  font: inherit;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.approval-history-filter input[type="date"]:focus {
  border-color: rgba(30,64,175,.45);
  box-shadow: 0 0 0 4px rgba(30,64,175,.10);
}
.approval-history-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.approval-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
/* Historial de aprobaciones: 12 columnas → usa todo el ancho disponible para
   que no se compriman/solapen (el resto se resuelve con scroll horizontal). */
.page-approval-history { max-width: none; }

.approval-history-table {
  /* min-width >= suma de anchos de columna: si es menor, table-layout:fixed
     comprime las columnas y el contenido se solapa (p.ej. "Estado expediente"
     pegado a "Estado OC"). */
  min-width: 2080px;
  table-layout: fixed;
  width: 100%;
}
.approval-history-table th,
.approval-history-table td {
  padding-left: 20px;
  padding-right: 20px;
}
.approval-history-table tbody td {
  vertical-align: top;
}
.approval-history-solicitud-cell,
.approval-history-order-cell,
.approval-history-user-cell,
.approval-history-observation-cell {
  white-space: normal;
}
.approval-history-solicitud-cell strong,
.approval-history-order-cell strong,
.approval-history-user-cell strong {
  display: block;
  margin-bottom: 2px;
}
.approval-history-solicitud-cell small,
.approval-history-order-cell small,
.approval-history-user-cell small {
  display: block;
  line-height: 1.4;
}
.approval-history-subline {
  font-size: .76rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.approval-history-provider-cell,
.approval-history-action-cell,
.approval-history-exp-state-cell,
.approval-history-order-state-cell,
.approval-history-pdf-cell,
.approval-history-date-cell {
  white-space: nowrap;
}
.approval-history-provider-cell,
.approval-history-user-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.approval-history-provider-cell .td-bold,
.approval-history-user-cell .td-bold {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.approval-history-exp-state-cell .badge {
  max-width: 210px;
  white-space: normal;
  line-height: 1.22;
  text-align: center;
}
.approval-history-order-state-cell .badge {
  max-width: 120px;
  white-space: normal;
  line-height: 1.22;
  text-align: center;
}
.approval-history-pdf-cell .btn {
  min-width: 102px;
  justify-content: center;
}
.approval-history-observation-cell {
  min-width: 260px;
  line-height: 1.45;
  white-space: normal;
}
.approval-history-observation-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
}
.approval-history-detail-cell {
  width: 160px;
  vertical-align: top;
}
.approval-history-details {
  display: block;
}
.approval-history-details summary {
  list-style: none;
}
.approval-history-details summary::-webkit-details-marker {
  display: none;
}
.approval-history-detail-panel {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fbff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .05);
}
.approval-history-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.approval-history-detail-panel .simple-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}
.approval-history-detail-panel .simple-list li {
  display: grid;
  gap: 2px;
}
.approval-history-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.approval-history-detail-entry {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  display: grid;
  gap: 4px;
}
.approval-history-detail-entry strong {
  font-size: .95rem;
}
.approval-history-detail-entry .td-mono {
  font-size: .82rem;
}

.approval-history-table .approval-history-date-cell {
  width: 150px;
}
.approval-history-table .approval-history-solicitud-cell {
  width: 190px;
}
.approval-history-table .approval-history-order-cell {
  width: 180px;
}
.approval-history-table .approval-history-provider-cell {
  width: 220px;
}
.approval-history-table .approval-history-user-cell {
  width: 210px;
}
.approval-history-table .approval-history-action-cell {
  width: 108px;
}
.approval-history-table .approval-history-exp-state-cell {
  width: 200px;
}
.approval-history-table .approval-history-order-state-cell {
  width: 130px;
}
.approval-history-table .approval-history-pdf-cell {
  width: 110px;
}
.approval-history-table .approval-history-detail-cell {
  width: 160px;
}
.approval-history-table .approval-history-observation-cell {
  width: 260px;
}
.approval-history-table .approval-history-revert-cell {
  width: 140px;
}
.approval-history-cards {
  display: none;
}
.approval-history-card {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.22);
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.06), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.approval-history-card-top {
  display: grid;
  grid-template-columns: minmax(160px, .85fr) minmax(0, 1.25fr) auto;
  gap: 14px;
  align-items: start;
}
.approval-history-card-block,
.approval-history-card-stat,
.approval-history-card-observation {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.approval-history-card-label {
  display: inline-flex;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.approval-history-card-value {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.approval-history-card-code {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.approval-history-card-subline {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.approval-history-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}
.approval-history-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.approval-history-card-stat {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f8fbff;
  min-width: 0;
}
.approval-history-card-stat .badge {
  width: fit-content;
  white-space: nowrap;
}
.approval-history-card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.approval-history-card-observation {
  flex: 1;
  min-width: 0;
}

body.modal-open { overflow: hidden; }
.modal-backdrop[hidden] {
  display: none !important;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-dialog {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}
.modal-lg { max-width: 920px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  font-size: 1.4rem;
  line-height: 1.2;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 24px;
}
.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  padding: 0;
  justify-content: center;
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--bg);
}
.modal-close .bi {
  font-size: 18px;
  line-height: 1;
}
.modal-close svg {
  width: 18px;
  height: 18px;
}
.empty-inline {
  border-top: 1px solid var(--border);
}

.auditorias-table {
  table-layout: auto;
  min-width: 100%;
}

.auditorias-desc-cell {
  width: 38%;
  min-width: 320px;
}

.auditorias-desc-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  justify-content: flex-start;
}

.auditorias-desc-text {
  min-width: 0;
  flex: 1;
  white-space: normal;
  line-height: 1.4;
  color: var(--text);
  word-break: break-word;
}

.auditorias-desc-btn {
  flex-shrink: 0;
  white-space: nowrap;
  align-self: flex-start;
}

.auditorias-desc-modal-text {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--text);
  font-size: .98rem;
}

.auditorias-route-cell {
  max-width: 210px;
}

.auditorias-route-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: .84rem;
  line-height: 1.35;
}

@media (max-width: 560px) {
  .modal-backdrop { padding: 12px; }
  .modal-head, .modal-body, .modal-footer { padding-left: 18px; padding-right: 18px; }
  .modal-footer { padding-bottom: 18px; }
  .auditorias-desc-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .auditorias-desc-cell {
    width: auto;
    min-width: 0;
  }
  #aprobacionesBandejaApp .approval-history-toolbar,
  #aprobacionesBandejaApp .approval-history-filters,
  #aprobacionesBandejaApp .approval-history-filters-compact,
  #aprobacionesBandejaApp .approval-history-meta {
    display: grid;
    gap: 12px;
  }
  #aprobacionesBandejaApp .approval-history-meta {
    justify-items: start;
  }
  #aprobacionesBandejaApp .approval-history-actions {
    width: 100%;
  }
  #aprobacionesBandejaApp .approval-history-actions .btn {
    width: 100%;
    justify-content: center;
  }
  #aprobacionesBandejaApp .table-scroll .td-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .approval-decision-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .approval-decision-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .approval-comparison-scroll .btn {
    width: 100%;
    justify-content: center;
  }
  .approval-history-toolbar {
    padding: 18px;
  }
  .approval-history-toolbar-copy h2 {
    font-size: 1.02rem;
  }
  .approval-history-actions {
    width: 100%;
  }
  .approval-history-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

@media (min-width: 1440px) {
  /* Columnas más anchas en este tier → sube el min-width en proporción. */
  .approval-history-table {
    min-width: 2220px;
  }
  .approval-history-table th,
  .approval-history-table td {
    padding-left: 24px;
    padding-right: 24px;
  }
  .approval-history-table .approval-history-provider-cell {
    width: 240px;
  }
  .approval-history-table .approval-history-user-cell {
    width: 230px;
  }
  .approval-history-table .approval-history-exp-state-cell {
    width: 240px;
  }
  .approval-history-table .approval-history-order-state-cell {
    width: 140px;
  }
  .approval-history-table .approval-history-detail-cell {
    width: 170px;
  }
}

@media (min-width: 1680px) {
  .approval-history-table {
    min-width: 2220px;
  }
}

@media (max-width: 980px) {
  .approval-history-filters {
    grid-template-columns: 1fr 1fr;
  }
  .approval-history-filter-search,
  .approval-history-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .approval-history-filters {
    grid-template-columns: 1fr;
  }
}

/* === ROLES / PERMISOLOGÍA === */
@media (max-width: 720px) {
  .approval-history-table {
    display: none;
  }
  .approval-history-cards {
    display: grid;
    gap: 14px;
  }
  .approval-history-card {
    padding: 16px 18px;
    border-radius: 18px;
  }
  .approval-history-card-top {
    grid-template-columns: 1fr;
  }
  .approval-history-card-badges {
    justify-content: flex-start;
  }
  .approval-history-card-stats {
    grid-template-columns: 1fr 1fr;
  }
  .approval-history-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .approval-history-card .btn {
    width: 100%;
    justify-content: center;
  }
  .approval-history-table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
  }

  .approval-history-table thead {
    display: none;
  }

  .approval-history-table tbody tr {
    display: grid;
    gap: 0;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    width: 100%;
    margin: 0 0 12px;
    box-shadow: 0 4px 14px rgba(15,23,42,.05);
  }

  .approval-history-table tbody td {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    text-align: left;
    min-height: 0;
    white-space: normal;
    font-size: .9rem;
    word-break: break-word;
  }

  .approval-history-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .approval-history-table td[data-label]::before,
  .approval-history-table td[data-mobile-label]::before {
    max-width: none;
    margin-bottom: 0;
    font-size: .68rem;
    line-height: 1.25;
    padding-top: 2px;
    width: auto;
    min-width: 92px;
    flex: 0 0 auto;
    text-align: left;
  }

  .approval-history-table tbody td > *,
  .approval-history-table .approval-history-cell-value {
    min-width: 0;
  }

  .approval-history-cell-value {
    flex: 1 1 auto;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
  }

  .approval-history-table .approval-history-solicitud-cell .td-mono,
  .approval-history-table .approval-history-order-cell .td-mono,
  .approval-history-table .approval-history-user-cell .td-bold,
  .approval-history-table .approval-history-provider-cell .td-bold {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .approval-history-table .approval-history-subline,
  .approval-history-table .approval-history-observation-text {
    -webkit-line-clamp: 2;
  }

  .approval-history-table .approval-history-order-cell .approval-history-subline,
  .approval-history-table .approval-history-user-cell .approval-history-subline,
  .approval-history-table .approval-history-solicitud-cell .approval-history-subline {
    margin-top: 2px;
  }

  .approval-history-table .approval-history-exp-state-cell .badge,
  .approval-history-table .approval-history-order-state-cell .badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.22;
    align-self: flex-start;
  }

  .approval-history-table .approval-history-pdf-cell .btn {
    width: fit-content;
    min-width: 104px;
  }

  .approval-history-table .approval-history-date-cell .approval-history-cell-value {
    font-size: .96rem;
    color: var(--text);
  }

  .approval-history-table .approval-history-provider-cell .td-bold,
  .approval-history-table .approval-history-user-cell .td-bold,
  .approval-history-table .approval-history-solicitud-cell .td-mono,
  .approval-history-table .approval-history-order-cell .td-mono {
    line-height: 1.3;
  }
}

.roles-page-subtitle {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
  font-size: .94rem;
}

.roles-page-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.roles-rail {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  align-self: start;
  overflow: hidden;
}

.roles-rail .card-head {
  align-items: flex-start;
}

.roles-rail-copy {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 4px;
}

.roles-rail-body {
  display: grid;
  gap: 14px;
}

.roles-search {
  display: grid;
  gap: 8px;
}

.roles-search-box {
  max-width: none;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.roles-list {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - var(--nav-h) - 232px);
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.role-item {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  padding: 14px 16px 14px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 18px rgba(15,23,42,.04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.role-item::before {
  content: '';
  position: absolute;
  inset: 10px auto 10px 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, var(--primary-mid), var(--primary));
  opacity: 0;
  transform: scaleY(.4);
  transform-origin: center;
  transition: opacity .18s ease, transform .18s ease;
}

.role-item:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(30,64,175,.34);
  background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow:
    0 18px 28px rgba(15,23,42,.10),
    0 0 0 1px rgba(30,64,175,.05);
}

.role-item:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.role-item.is-active {
  border-color: rgba(30,64,175,.42);
  background: linear-gradient(135deg, #eaf3ff 0%, #ffffff 100%);
  box-shadow:
    0 18px 30px rgba(30,64,175,.12),
    0 0 0 1px rgba(30,64,175,.10);
}

.role-item.is-active::before {
  opacity: 1;
  transform: scaleY(1);
}

.role-item-copy {
  min-width: 0;
}

.role-item-copy strong {
  display: block;
  color: var(--text);
  font-size: .96rem;
  margin-bottom: 4px;
}

.role-item-copy p {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}

.role-item-copy small {
  display: inline-block;
  margin-top: 6px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}

.role-item-badges {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.roles-empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
}

.roles-empty-state strong {
  display: block;
  margin-bottom: 4px;
}

.roles-empty-state p {
  color: var(--muted);
  font-size: .86rem;
}

.roles-workbench {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.roles-section-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: .85rem;
}

.roles-form-grid {
  align-items: start;
}

.roles-form-actions {
  margin-top: 20px;
}

.roles-editor-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.12), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
  border: 1px solid #dbeafe;
  margin-bottom: 20px;
}

.roles-editor-copy h2 {
  margin-top: 2px;
  font-size: clamp(1.28rem, 2vw, 1.65rem);
  line-height: 1.18;
}

.roles-editor-copy p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 720px;
}

.roles-editor-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.roles-editor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
}

.roles-mini-stat {
  min-width: 92px;
  padding: 14px 15px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 10px 20px rgba(15,23,42,.05);
  text-align: center;
}

.roles-mini-stat strong {
  display: block;
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 5px;
  color: var(--primary);
}

.roles-mini-stat span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.roles-permissions-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  margin: 22px 0 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.roles-permissions-toolbar-copy {
  display: grid;
  gap: 5px;
  max-width: 860px;
}

.roles-permissions-toolbar-copy p {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
}

.roles-permissions-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) repeat(2, minmax(150px, 170px));
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.roles-permissions-search {
  min-width: 0;
}

.roles-permissions-search .search-box {
  max-width: none;
  background: white;
}

.roles-permissions-toolbar-actions .btn {
  width: 100%;
  justify-content: center;
}

.users-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.users-modal-actions .btn {
  width: 100%;
  justify-content: center;
}

.roles-permission-groups {
  display: grid;
  gap: 18px;
}

.roles-permission-group {
  margin-bottom: 0;
  overflow: hidden;
}

.roles-permission-group-head {
  align-items: center;
}

.roles-permission-group-head p {
  color: var(--muted);
  font-size: .84rem;
  margin-top: 4px;
}

.roles-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.roles-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.permission-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}

.permission-item:hover {
  transform: translateY(-1px);
  border-color: rgba(30,64,175,.2);
  box-shadow: 0 12px 24px rgba(15,23,42,.07);
}

.permission-item.is-checked {
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  border-color: rgba(30,64,175,.36);
  box-shadow: 0 12px 24px rgba(30,64,175,.08);
}

.permission-item input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.permission-item-copy {
  min-width: 0;
}

.permission-item-copy strong {
  display: block;
  color: var(--text);
  margin-bottom: 5px;
}

.permission-item-copy p {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.55;
}

.permission-item-copy small {
  display: inline-block;
  margin-top: 6px;
  color: var(--primary);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.roles-permissions-empty {
  margin-top: 18px;
}

.roles-restore-form {
  margin-top: 14px;
}

.roles-tabs-card {
  min-width: 0;
  overflow: visible;
}

.roles-tabs-head {
  align-items: flex-start;
}

.roles-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 22px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
  align-items: center;
}

.roles-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.roles-tab:hover {
  background: #f8fafc;
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15,23,42,.08);
}

.roles-tab.is-active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}

.roles-tab-panel {
  display: none;
  overflow: visible;
}

.roles-tab-panel.is-active {
  display: grid;
  gap: 16px;
}

.roles-tab-panels {
  display: grid;
  gap: 16px;
  overflow: visible;
}

.roles-edit-form {
  display: grid;
  gap: 16px;
}

.roles-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.roles-form-actions-bottom {
  margin-top: 4px;
}

.roles-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 16px;
  align-items: start;
}

.roles-summary-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.roles-summary-card-hero {
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
  border-color: #dbeafe;
}

.roles-summary-card h4 {
  margin-bottom: 12px;
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
}

.roles-summary-card-hero h2 {
  margin-top: 4px;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.18;
}

.roles-summary-card-hero p {
  margin-top: 8px;
  color: var(--muted);
}

.roles-summary-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.roles-summary-hero-actions .btn {
  min-width: 160px;
  justify-content: center;
}

.roles-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.roles-summary-panels {
  display: grid;
  gap: 16px;
}

.roles-summary-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.roles-summary-empty {
  color: var(--muted);
  font-size: .9rem;
}

.roles-summary-progress-list {
  display: grid;
  gap: 12px;
}

.roles-summary-progress-item {
  display: grid;
  gap: 8px;
}

.roles-summary-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.roles-summary-progress-head strong {
  font-size: .92rem;
}

.roles-summary-progress-head span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.roles-progress {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.roles-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary-mid), var(--primary));
}

.roles-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.roles-create-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid #dbeafe;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
  margin-bottom: 18px;
}

.roles-create-hero h2 {
  margin-top: 4px;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.18;
}

.roles-create-hero p {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
}

.roles-create-form {
  display: grid;
  gap: 16px;
}

/* =========================================
   MOBILE POLISH — solo afecta breakpoints mobile
   No modifica nada del desktop (>900px).
   ========================================= */

/* Safe-area + scroll inertia + hammerless touches */
@media (max-width: 900px) {
  :root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
  }
  body {
    -webkit-tap-highlight-color: transparent;
  }
  .navbar {
    padding-top: var(--safe-top);
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
    height: calc(var(--nav-h) + var(--safe-top));
  }
  .content {
    padding-top: calc(var(--nav-h) + var(--safe-top));
  }
  .sidebar {
    top: calc(var(--nav-h) + var(--safe-top));
    padding-bottom: calc(24px + var(--safe-bottom));
    -webkit-overflow-scrolling: touch;
  }
  .table-scroll {
    -webkit-overflow-scrolling: touch;
  }
  .page {
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }
  .app-footer {
    padding-bottom: calc(18px + var(--safe-bottom));
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }
  /* hamburger más cómodo al tap */
  .hamburger {
    width: 44px;
    height: 44px;
  }
  .hamburger:active {
    background: var(--bg);
  }
  .nav-user:active {
    background: var(--bg);
  }
  .nav-user {
    padding: 6px 8px;
    border-radius: 12px;
    transition: background .15s;
  }
  /* Drawer overlay con fade y sombra al abrir */
  .sidebar-overlay {
    transition: opacity .22s ease;
    opacity: 0;
  }
  .sidebar-overlay.open {
    opacity: 1;
  }
  .sidebar.open {
    box-shadow: 18px 0 38px rgba(0,0,0,.35);
  }
  /* Tap feedback en sidebar */
  .sidebar-link:active {
    background: rgba(255,255,255,.12);
    transform: none;
  }
}

/* Tablas → cards apilables (genérico + opt-out) */
@media (max-width: 720px) {
  .table-scroll {
    overflow: visible;
  }
  .table-scroll table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  .table-scroll thead {
    display: none;
  }
  .table-scroll tbody,
  .table-scroll tr,
  .table-scroll td {
    display: block;
    width: 100%;
  }
  /* Respetar el atributo hidden inyectado por los filtros de búsqueda */
  .table-scroll tbody tr[hidden],
  .table-scroll tbody td[hidden] {
    display: none !important;
  }
  .table-scroll tbody tr {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    margin: 0 0 12px;
    box-shadow: 0 4px 14px rgba(15,23,42,.05);
  }
  .table-scroll tbody tr:hover {
    background: var(--card);
  }
  .table-scroll tbody tr:last-child {
    margin-bottom: 0;
  }
  .table-scroll tbody td {
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    font-size: .9rem;
    text-align: right;
    word-break: break-word;
  }
  .table-scroll tbody tr td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .table-scroll tbody tr td:first-child {
    padding-top: 0;
  }
  .table-scroll td[data-label]::before,
  .table-scroll td[data-mobile-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: left;
    flex: 0 0 auto;
    max-width: 45%;
  }
  .table-scroll td[data-mobile-label]::before {
    content: attr(data-mobile-label);
  }
  .table-scroll .td-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .table-scroll .td-actions::before {
    margin-bottom: 4px;
  }
  .table-scroll .td-actions .btn,
  .table-scroll .td-actions a.btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }
  .table-scroll .td-actions .badge {
    align-self: flex-start;
  }
  /* Celdas con contenido "rico" (nota en bloque, formulario o varios chips):
     en flex-row el valor competía con la etiqueta y se comprimía a ~1 carácter,
     rompiéndose en vertical letra por letra. Se apilan: etiqueta arriba y el
     valor a lo ancho debajo, que envuelve con normalidad. */
  .table-scroll tbody td:has(> small),
  .table-scroll tbody td:has(> form),
  .table-scroll tbody td:has(> div + div),
  .table-scroll tbody td:has(> .badge ~ .badge) {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 6px;
  }
  .table-scroll tbody td:has(> small)::before,
  .table-scroll tbody td:has(> form)::before,
  .table-scroll tbody td:has(> div + div)::before,
  .table-scroll tbody td:has(> .badge ~ .badge)::before {
    max-width: 100%;
  }
  .table-scroll tbody td:has(> div + div) > div {
    width: 100%;
    overflow-wrap: anywhere;
  }
  .table-scroll tbody td:has(> form) form,
  .table-scroll tbody td:has(> form) select,
  .table-scroll tbody td:has(> form) input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
  }
  /* fila vacía (1 td colspan): no convertir en card */
  .table-scroll tbody tr[data-no-card="true"],
  .table-scroll tbody tr:has(> td[colspan]:only-child) {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .table-scroll tbody tr[data-no-card="true"] > td,
  .table-scroll tbody tr:has(> td[colspan]:only-child) > td {
    display: block;
    padding: 0;
    border: none;
    min-height: 0;
    text-align: center;
  }
  .table-scroll tbody tr[data-no-card="true"] > td::before,
  .table-scroll tbody tr:has(> td[colspan]:only-child) > td::before {
    content: none;
  }
  /* La tabla .cotizaciones-detail-table conserva su propio layout
     definido en el bloque @560px (cards con data-label). */

  .misc-approval-card {
    grid-template-columns: 1fr;
  }
  .request-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Refinamientos finos para móvil estrecho */
@media (max-width: 560px) {
  /* Inputs nativos: 16px evita zoom en iOS */
  .field input,
  .field select,
  .field textarea,
  label input,
  label select,
  label textarea,
  .search-box input,
  .approval-history-filter input[type="date"] {
    font-size: 16px;
  }
  /* Touch targets cómodos (solo botones de acción, no los links compactos) */
  .btn,
  button:where(:not(.hamburger):not(.rpt-fac-link)) {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 38px;
    padding: 9px 14px;
    font-size: .82rem;
  }
  /* Card: márgenes más coherentes */
  .card {
    border-radius: 16px;
    margin-bottom: 16px;
  }
  .card-head {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  /* Stats / dashboard hero comprimido */
  .dashboard-hero {
    padding: 20px 18px;
    border-radius: 22px;
    margin-bottom: 18px;
  }
  .dashboard-hero-copy h1 {
    font-size: clamp(1.55rem, 7vw, 2rem);
    line-height: 1.1;
    letter-spacing: -.02em;
  }
  .dashboard-hero-copy p {
    font-size: .9rem;
  }
  .dashboard-spotlight,
  .dashboard-mini-metrics > div {
    padding: 16px;
    border-radius: 18px;
  }
  .dashboard-spotlight strong {
    font-size: 2.2rem;
  }
  .dashboard-alert-grid {
    grid-template-columns: 1fr;
    margin-bottom: 18px;
  }
  .dashboard-alert-card {
    padding: 16px;
    border-radius: 18px;
  }
  .dashboard-alert-card strong {
    font-size: 1.35rem;
  }
  .dashboard-activity-list {
    grid-auto-columns: minmax(190px, 82vw);
  }
  .dashboard-flow-step,
  .dashboard-activity-item {
    padding: 14px 15px;
    border-radius: 16px;
  }
  .dashboard-flow-step-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-flow-meta {
    justify-items: start;
  }
  .dashboard-activity-item {
    grid-template-columns: 1fr;
  }
  .dashboard-activity-item time {
    justify-self: start;
  }
  .dashboard-section-head h2 {
    font-size: 1.1rem;
  }
  .dashboard-metric-card {
    grid-template-columns: 48px 1fr;
    gap: 12px;
    padding: 14px;
    min-height: 0;
    border-radius: 16px;
  }
  .dashboard-metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .dashboard-metric-icon svg {
    width: 20px;
    height: 20px;
  }
  .dashboard-metric-copy strong {
    font-size: 1.4rem;
  }
  .dashboard-metric-copy span {
    font-size: .8rem;
  }
  .dashboard-shortcut {
    min-height: 0;
    padding: 12px 14px;
    border-radius: 16px;
  }
  /* Page title y eyebrows */
  .page { padding: 16px 14px; }
  .page-header { margin-bottom: 18px; }
  .page-header h1 { font-size: 1.25rem; }
  .page-eyebrow { font-size: .68rem; }
  .page-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .page-actions .btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    padding: 10px 12px;
    font-size: .82rem;
  }
  /* Si solo hay 1 acción, que ocupe ancho completo */
  .page-actions .btn:only-child {
    grid-column: 1 / -1;
  }
  /* Stat-card global más compacto */
  .stats-grid { gap: 12px; margin-bottom: 18px; }
  .stat-card { padding: 16px; border-radius: 16px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 11px; margin-bottom: 12px; }
  .stat-icon svg { width: 18px; height: 18px; }
  .stat-value { font-size: 1.6rem; }
  .stat-label { font-size: .76rem; }
  /* Search wrap más confortable */
  .search-wrap { padding: 12px 14px; }
  .search-box { max-width: none; min-height: 44px; }
  .search-box input { padding: 12px 12px 12px 0; }

  /* === Modal bottom-sheet en móvil === */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    border: none;
    box-shadow: 0 -16px 36px rgba(0,0,0,.28);
    padding-bottom: var(--safe-bottom);
    animation: mobileSheetUp .24s cubic-bezier(.2,.7,.3,1);
  }
  .modal-dialog::before {
    content: '';
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 8px auto 4px;
  }
  .modal-head {
    padding: 12px 18px 14px;
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 1;
  }
  .modal-head h2 { font-size: 1.1rem; }
  .modal-body { padding: 18px; }
  .modal-close {
    width: 38px;
    height: 38px;
  }
  @keyframes mobileSheetUp {
    from { transform: translateY(40px); opacity: .6; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* === Flashes / alerts: bordes coherentes y sin overflow === */
  .success, .danger, .warning, .info, .alert {
    border-radius: 12px;
    margin-left: 0;
    margin-right: 0;
    font-size: .88rem;
  }

  /* Chip BCV / sucursal: en mobile ya estaba oculto, aseguramos */
  .nav-context-chip { display: none !important; }

  /* Item-row (cotización ítems) más cómodo */
  .item-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
  }
  .item-row .del-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-size: .85rem;
  }

  /* Solicitud: panel del catálogo más alto y sin perderse */
  .solicitud-panel {
    height: auto;
    min-height: 320px;
    max-height: 60vh;
  }

  /* Quote qty: botones tap-friendly */
  .quote-qty-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
  }
  .quote-qty-input { font-size: 16px; }

  /* Field grid: que respiren */
  .field-grid { gap: 14px; }
  .form-card { padding: 18px; border-radius: 16px; }
  form.form { padding: 18px; border-radius: 16px; }
  .role-item {
    grid-template-columns: 1fr;
  }
  .role-item-badges {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .roles-permission-grid {
    grid-template-columns: 1fr;
  }
  .roles-editor-stats {
    grid-template-columns: 1fr 1fr;
  }
  .roles-mini-stat:last-child {
    grid-column: 1 / -1;
  }
  .roles-permissions-toolbar {
    padding: 14px;
  }
  .roles-group-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .roles-permissions-toolbar-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Cuando tabla está dentro de una card y se vuelve cards apilables,
     bajar el padding interno de la card para que las tarjetas hijas no queden
     ahogadas. */
  .product-import-summary {
    grid-template-columns: 1fr;
  }
  .product-import-layout {
    grid-template-columns: 1fr;
  }
  .product-import-dropzone {
    padding: 18px;
    min-height: 0;
  }
  .product-import-format {
    padding: 14px;
  }
  .product-import-preview-scroll td:nth-child(7),
  .product-import-preview-scroll td:nth-child(8),
  .product-import-preview-scroll td:last-child {
    min-width: 0;
  }
  .card > .table-scroll {
    padding: 12px;
  }
}

/* === DASHBOARD ADDITIONS === */
.dashboard-metric-amount {
  display: block;
  font-size: .76rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-pending-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.dashboard-pending-banner > svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--primary);
}
.dashboard-pending-banner-copy {
  flex: 1;
  min-width: 0;
}
.dashboard-pending-banner-copy strong {
  display: block;
  color: var(--primary-dark);
  font-size: .95rem;
}
.dashboard-pending-banner-copy span {
  color: var(--muted);
  font-size: .83rem;
}
@media (max-width: 600px) {
  .dashboard-pending-banner {
    flex-wrap: wrap;
  }
}

/* === DASHBOARD V2: limpio, dinamico y por rol === */
@keyframes dashRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dashFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dashGlow {
  0%, 100% { transform: translate(-30%, -30%) scale(1); opacity: .55; }
  50%      { transform: translate(-25%, -35%) scale(1.05); opacity: .75; }
}
@keyframes dashFlowFill {
  from { width: 0; }
}

/* ============================================================
   DASHBOARD — lenguaje "centro de control" (mismo del hijo).
   Tarjetas limpias sin bordes de color pintados; el acento vive
   solo en el hero de prioridad y en los chips de icono tintados.
   ============================================================ */
.cdash-head { margin-bottom: 16px; }
.cdash-head h1 { margin: 6px 0; font-size: clamp(26px, 3.2vw, 34px); font-weight: 900; line-height: 1.08; color: #0f172a; }
.cdash-head h1 span { color: var(--primary); }
.cdash-head p { margin: 0; max-width: 720px; color: #475569; font-size: 15px; line-height: 1.45; }
.cdash-context { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cdash-context span { padding: 6px 10px; border-radius: 999px; background: #f8fafc; border: 1px solid #eef2f7; color: #475569; font-size: 12px; font-weight: 800; }

/* — Prioridad (hero) + banda de KPIs — */
.cdash-priority { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.55fr); gap: 14px; margin-bottom: 14px; align-items: stretch; }
.cdash-hero {
  position: relative; overflow: hidden; display: grid; align-content: space-between; gap: 18px;
  min-height: 232px; padding: 24px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #2563eb 55%, #1e40af);
  box-shadow: 0 18px 42px rgba(37, 99, 235, .28);
}
.cdash-hero::before { content: ''; position: absolute; inset: -40% -20% auto auto; width: 60%; height: 160%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 60%); pointer-events: none; }
.cdash-hero.is-clear { background: linear-gradient(135deg, #0f766e, #16a34a 60%, #15803d); box-shadow: 0 18px 42px rgba(22, 163, 74, .26); }
.cdash-hero > * { position: relative; z-index: 1; }
.cdash-hero-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .9); }
.cdash-hero-eyebrow svg { width: 16px; height: 16px; }
.cdash-hero-main { display: flex; align-items: center; gap: 16px; }
.cdash-hero-main strong { font-size: clamp(40px, 5.4vw, 60px); font-weight: 900; line-height: .92; }
.cdash-hero.is-money .cdash-hero-main strong { font-size: clamp(26px, 3.4vw, 38px); }
.cdash-hero-text p { margin: 0; font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .94); }
.cdash-hero-note { display: inline-block; margin-top: 7px; font-size: 12.5px; color: rgba(255, 255, 255, .82); }
.cdash-hero-cta {
  justify-self: start; display: inline-flex; align-items: center; padding: 11px 18px; border-radius: 12px;
  background: #fff; color: #1d4ed8; font-weight: 800; text-decoration: none; box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
  transition: transform .15s ease;
}
.cdash-hero-cta:hover { transform: translateY(-2px); color: #1d4ed8; text-decoration: none; }
.cdash-hero.is-clear .cdash-hero-cta { color: #15803d; }

.cdash-kpi-band { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: stretch; }
.cdash-kpi {
  display: grid; align-content: start; gap: 6px; padding: 15px 16px;
  border: 1px solid #e6ebf2; border-radius: 14px; background: #fff; color: inherit; text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.cdash-kpi:hover { transform: translateY(-2px); border-color: #c7d2fe; box-shadow: 0 10px 24px rgba(15, 23, 42, .08); text-decoration: none; }
.cdash-kpi-top { display: flex; align-items: center; gap: 8px; }
.cdash-kpi-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #eff6ff; color: #2563eb; }
.cdash-kpi-icon svg { width: 16px; height: 16px; }
.cdash-kpi-label { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.cdash-kpi-value { font-size: 30px; font-weight: 900; line-height: 1; color: #0f172a; }
.cdash-kpi-value--money { font-size: 21px; }
.cdash-kpi small { color: #94a3b8; font-size: 12px; }
.cdash-kpi-icon--primary, .cdash-kpi-icon--info { background: #eff6ff; color: #1d4ed8; }
.cdash-kpi-icon--success { background: #ecfdf5; color: #059669; }
.cdash-kpi-icon--warning { background: #fff7ed; color: #ea580c; }
.cdash-kpi-icon--critical { background: #fef2f2; color: #dc2626; }
.cdash-kpi-icon--neutral { background: #f1f5f9; color: #475569; }

/* — Workspace: principal + lateral — */
.cdash-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cdash-main { display: grid; gap: 14px; }
.cdash-side { display: grid; gap: 14px; }
.cdash-section { padding: 18px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.cdash-section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cdash-section-head h2 { margin: 4px 0 0; color: #0f172a; font-size: 20px; }
.cdash-chip { flex: 0 0 auto; padding: 5px 11px; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 11.5px; font-weight: 800; }

/* — Flujo operativo (barras rankeadas) — */
.cdash-flow-list { display: grid; gap: 8px; }
.cdash-flow {
  display: grid; grid-template-columns: minmax(0, 1fr) 44px auto; align-items: center; gap: 14px;
  padding: 12px 14px; border: 1px solid #e6ebf2; border-radius: 12px; color: inherit; text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.cdash-flow:hover { transform: translateY(-1px); border-color: #c7d2fe; box-shadow: 0 8px 20px rgba(15, 23, 42, .08); text-decoration: none; }
.cdash-flow-body { min-width: 0; display: grid; gap: 8px; }
.cdash-flow-top { display: grid; gap: 1px; min-width: 0; }
.cdash-flow-top strong { font-size: 14px; font-weight: 800; color: #0f172a; }
.cdash-flow-top small { font-size: 12px; color: #64748b; }
.cdash-flow-track { height: 7px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.cdash-flow-track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.cdash-flow.is-focus .cdash-flow-track span { background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.cdash-flow-count { font-weight: 900; font-size: 18px; color: #0f172a; text-align: right; }
.cdash-flow-cta { font-size: 12px; font-weight: 800; color: #2563eb; white-space: nowrap; }

/* — Foco del día (worklist) — */
.cdash-worklist { display: grid; gap: 8px; }
.cdash-work {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid #eef2f7; border-radius: 12px; color: inherit; text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.cdash-work:hover { border-color: #c7d2fe; background: #f8fbff; text-decoration: none; }
.cdash-work-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: #eff6ff; color: #2563eb; }
.cdash-work-icon svg { width: 18px; height: 18px; }
.cdash-work-icon--primary, .cdash-work-icon--info { background: #eff6ff; color: #1d4ed8; }
.cdash-work-icon--success { background: #ecfdf5; color: #059669; }
.cdash-work-icon--warning { background: #fff7ed; color: #ea580c; }
.cdash-work-icon--critical { background: #fef2f2; color: #dc2626; }
.cdash-work-body { min-width: 0; display: grid; gap: 2px; }
.cdash-work-body strong { font-size: 14px; font-weight: 700; color: #0f172a; }
.cdash-work-body small { font-size: 12.5px; color: #64748b; line-height: 1.4; }
.cdash-work-cta { flex: 0 0 auto; font-size: 12px; font-weight: 800; color: #2563eb; white-space: nowrap; }

/* — Atajos — */
.cdash-shortcuts { display: grid; gap: 10px; }
.cdash-shortcut {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center;
  padding: 11px 13px; border: 1px solid #eef2f7; border-radius: 12px; background: #fff; color: var(--text); text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.cdash-shortcut:hover { transform: translateY(-1px); border-color: #c7d2fe; box-shadow: 0 8px 18px rgba(15, 23, 42, .07); text-decoration: none; }
.cdash-shortcut-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #eff6ff; color: #1d4ed8; }
.cdash-shortcut-icon svg { width: 19px; height: 19px; }
.cdash-shortcut-copy strong { display: block; font-size: .9rem; color: #0f172a; }
.cdash-shortcut-copy small { display: block; font-size: .76rem; color: #64748b; line-height: 1.4; margin-top: 1px; }

.cdash-empty { margin: 0; padding: 18px; border: 1px dashed #cbd5e1; border-radius: 14px; background: #f8fafc; color: #64748b; text-align: center; font-size: 13px; }

/* — Responsive del dashboard — */
@media (max-width: 1000px) { .cdash-priority { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .cdash-workspace { grid-template-columns: 1fr; } }
@media (max-width: 560px)  {
  .cdash-kpi-band { grid-template-columns: 1fr 1fr; }
  .cdash-flow { grid-template-columns: minmax(0, 1fr) auto; }
  .cdash-flow-cta { display: none; }
  .cdash-hero { min-height: 0; }
}

@media (max-width: 1024px) {
  .solicitud-hero,
  .solicitud-builder {
    grid-template-columns: 1fr;
  }
  .solicitud-history-hero {
    grid-template-columns: 1fr;
  }
  .bandeja-hero {
    grid-template-columns: 1fr;
  }
  .bandeja-card-top,
  .bandeja-card-meta {
    grid-template-columns: 1fr 1fr;
  }
  .bandeja-card-badges {
    justify-content: flex-start;
  }
  .bandeja-card-actions {
    grid-template-columns: 1fr;
  }
  .solicitud-builder {
    height: auto;
    min-height: 0;
  }
  body .solicitud-cart-row.item-row {
    grid-template-columns: 1fr 110px;
  }
  body .solicitud-cart-row.item-row .del-btn {
    grid-column: 1 / -1;
  }
}
@media (max-width: 600px) {
  .solicitud-hero {
    padding: 16px;
  }
  .solicitud-hero-stats {
    grid-template-columns: 1fr;
  }
  .solicitud-history-stats {
    grid-template-columns: 1fr;
  }
  .bandeja-hero-stats {
    grid-template-columns: 1fr;
  }
  .bandeja-search input {
    min-width: 0;
    width: 100%;
  }
  .bandeja-grid {
    padding: 14px;
  }
  .bandeja-card {
    padding: 16px;
  }
  .solicitud-panel,
  .solicitud-notes {
    border-radius: 18px;
  }
  .solicitud-cart-actions {
    justify-content: stretch;
  }
  .solicitud-cart-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
  .bandeja-card-top,
  .bandeja-card-meta {
    grid-template-columns: 1fr;
  }
  .bandeja-list-tools {
    width: 100%;
  }
  .bandeja-search {
    width: 100%;
  }
  body .solicitud-cart-row.item-row {
    grid-template-columns: 1fr;
  }
  body .solicitud-cart-row.item-row .del-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .reports-hero {
    padding: 16px;
  }
  .reports-hero-side {
    grid-template-columns: 1fr;
  }
  .reports-hero-actions .btn {
    width: 100%;
    min-width: 0;
  }
  .reports-hero-mini {
    grid-template-columns: 1fr;
  }
  .reports-hero-tags span {
    width: 100%;
    justify-content: center;
  }
  .report-grid {
    padding: 14px;
  }
  .report-card {
    padding: 16px;
  }
  .an-table-wrap {
    overflow: visible;
  }
  .an-table--analytics {
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }
  .an-table--analytics thead {
    display: none;
  }
  .an-table--analytics tbody,
  .an-table--analytics tr,
  .an-table--analytics td,
  .an-table--analytics tfoot {
    display: block;
    width: 100%;
  }
  .an-table--analytics tbody {
    display: grid;
    gap: 12px;
  }
  .an-table--analytics tbody tr {
    padding: 12px 14px;
    border: 1px solid rgba(148,163,184,.22);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15,23,42,.06);
  }
  .an-table--analytics tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #e2e8f0;
    text-align: left;
    white-space: normal;
  }
  .an-table--analytics tbody td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .an-table--analytics tbody td::before,
  .an-table--analytics tfoot td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    min-width: 86px;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
  }
  .an-table--analytics tbody td.c,
  .an-table--analytics tbody td.r,
  .an-table--analytics tfoot td.r {
    text-align: left;
  }
  .an-table--analytics tfoot {
    margin-top: 4px;
  }
  .an-table--analytics tfoot tr {
    padding: 12px 14px;
    border: 1px solid #ddd6fe;
    border-radius: 16px;
    background: #f5f3ff;
  }
  .an-table--analytics tfoot td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border: 0;
  }
  .an-table--analytics tfoot td:first-child {
    font-weight: 700;
    color: #3730a3;
  }
}

/* =====================================================
   PAGINATION — mobile-first
   ===================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 0 4px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 13px;
  min-height: 38px;
  min-width: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .13s, border-color .13s, color .13s;
  white-space: nowrap;
  user-select: none;
}
.pagination-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-mid);
  color: var(--primary);
}
.pagination-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: default;
  pointer-events: none;
}
.pagination-btn.is-disabled {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 38px;
  color: var(--muted);
  font-size: .82rem;
  pointer-events: none;
  user-select: none;
}
.pagination-mobile-counter {
  display: none;
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 4px;
}

@media (max-width: 600px) {
  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px 0 4px;
  }
  .pagination-info {
    text-align: center;
    font-size: .85rem;
  }
  .pagination-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
  }
  .pagination-btn {
    min-height: 44px;
    font-size: .88rem;
    padding: 10px 14px;
  }
  .pagination-btn:first-child {
    justify-self: start;
    width: 100%;
  }
  .pagination-btn:last-child {
    justify-self: end;
    width: 100%;
  }
  .pagination-pages {
    display: none;
  }
  .pagination-mobile-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
  }
}

/* ── Meli / Price-reference panel ─────────────────────────────── */
button.solicitud-meli-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  margin-top: 5px;
  border: 0;
  background: transparent;
  font-size: .67rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  user-select: none;
  opacity: .6;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
  transition: opacity .15s, color .15s, text-decoration-color .15s;
}
button.solicitud-meli-chip:hover {
  opacity: 1;
  color: var(--primary);
  background: transparent;
  text-decoration-color: rgba(99,102,241,.35);
}
button.solicitud-meli-chip svg { color: inherit; }

.meli-ref-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 360px;
  max-height: 450px;
  background: linear-gradient(160deg, #1e2d48 0%, #16223a 100%);
  border: 1px solid rgba(99,179,237,.18);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 4px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
  z-index: 990;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: meliIn .18s ease;
}
@keyframes meliIn {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}
.meli-ref-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(99,179,237,.1);
  flex-shrink: 0;
  background: rgba(255,255,255,.02);
}
.meli-ref-kicker {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #7dd3fc;
  margin-bottom: 4px;
}
.meli-ref-product-name {
  font-size: .875rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
  display: block;
}
.meli-ref-close {
  background: none;
  border: none;
  /* padding:0 obligatorio: el reset global de <button> mete 10px 20px y, con
     box-sizing:border-box, empujaba la X fuera de esta caja de 26x26. */
  padding: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 800;
}
.meli-ref-close:hover { background: rgba(255,255,255,.08); color: #e2e8f0; }
.meli-ref-body { flex: 1; overflow-y: auto; padding: 6px 8px; }
.meli-ref-section { padding: 4px 0 8px; }
.meli-ref-section + .meli-ref-section {
  position: relative;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid rgba(99,179,237,.32);
  box-shadow: 0 -1px 0 rgba(0,0,0,.25);
}
.meli-ref-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 8px;
}
.meli-ref-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1;
}
.meli-ref-badge--meli {
  color: #fde68a;
  background: rgba(250,204,21,.10);
  border-color: rgba(250,204,21,.28);
}
.meli-ref-badge--meli::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 6px rgba(251,191,36,.55);
}
.meli-ref-badge--proveedor {
  color: #bae6fd;
  background: rgba(56,189,248,.10);
  border-color: rgba(56,189,248,.28);
}
.meli-ref-badge--proveedor::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56,189,248,.55);
}
.meli-ref-section-count {
  font-size: .65rem;
  color: #64748b;
  font-weight: 600;
}
.meli-ref-section-list { display: flex; flex-direction: column; }
.meli-ref-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 10px;
  color: #94a3b8;
  font-size: .84rem;
}
.meli-ref-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,.12);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: meliSpin .75s linear infinite;
  flex-shrink: 0;
}
@keyframes meliSpin { to { transform: rotate(360deg); } }
.meli-ref-empty {
  padding: 18px 10px;
  color: #64748b;
  font-size: .84rem;
  text-align: center;
  margin: 0;
}
.meli-ref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.meli-ref-item:last-child { border-bottom: none; }
.meli-ref-item:hover { background: rgba(255,255,255,.06); }
.meli-ref-item-info { flex: 1; min-width: 0; }
.meli-ref-item-title {
  display: block;
  font-size: .8rem;
  color: #cbd5e1;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meli-ref-item-snippet {
  display: block;
  font-size: .68rem;
  color: #64748b;
  line-height: 1.35;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meli-ref-item-price {
  font-size: .9rem;
  font-weight: 700;
  color: #34d399;
  white-space: nowrap;
  flex-shrink: 0;
}
.meli-ref-item-pricebox {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  text-align: right;
}
.meli-ref-item-price-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #64748b;
}
.meli-ref-item-price--muted { color: #94a3b8; }
.meli-ref-foot {
  padding: 9px 16px;
  font-size: .67rem;
  color: #3d5068;
  border-top: 1px solid rgba(99,179,237,.07);
  background: rgba(0,0,0,.12);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
@media (max-width: 500px) {
  .meli-ref-panel { right: 8px; bottom: 8px; left: 8px; width: auto; }
}
}

/* =========================================
   CAMBIO DE SEDE ACTIVA — chip clickable + modal
   ========================================= */
.nav-context-item--switch {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  padding: 4px 8px;
  margin: -4px -6px -4px 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #166534;
  cursor: pointer;
  user-select: none;
  transition: background .16s, border-color .16s;
}
.nav-context-item--switch:hover {
  background: rgba(22, 101, 52, .08);
  border-color: rgba(22, 101, 52, .28);
}
.nav-context-item--switch:focus-visible {
  outline: 2px solid rgba(22, 101, 52, .5);
  outline-offset: 1px;
}
.nav-context-item--switch .nav-context-label { grid-column: 1; grid-row: 1; }
.nav-context-item--switch .nav-context-value {
  grid-column: 1;
  grid-row: 2;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-context-item--switch .nav-context-switch-icon {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 14px;
  height: 14px;
  opacity: .65;
}

.branch-switch-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(13, 21, 38, .55);
  backdrop-filter: blur(3px);
}
.branch-switch-overlay[hidden] { display: none; }
body.branch-switch-lock { overflow: hidden; }

.branch-switch-dialog {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(13, 21, 38, .35);
  padding: 22px 24px 24px;
  animation: branchSwitchIn .18s ease;
}
@keyframes branchSwitchIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.branch-switch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.branch-switch-eyebrow {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #166534;
}
.branch-switch-head h2 {
  margin: 2px 0 0;
  font-size: 1.18rem;
  color: var(--text, #0f172a);
}
button.branch-switch-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
}
button.branch-switch-close:hover { background: transparent; color: #475569; }
.branch-switch-note {
  margin: 12px 0 18px;
  font-size: .86rem;
  color: #64748b;
  line-height: 1.5;
}
.branch-switch-form { display: grid; gap: 14px; }
.branch-switch-field { display: grid; gap: 6px; }
.branch-switch-field > span {
  font-size: .78rem;
  font-weight: 700;
  color: #334155;
}
.branch-switch-field select,
.branch-switch-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font: inherit;
  font-size: .9rem;
  background: #fff;
  color: var(--text, #0f172a);
}
.branch-switch-field select:focus,
.branch-switch-field input:focus {
  outline: none;
  border-color: var(--primary, #1e40af);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, .12);
}
.branch-switch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* =============================================================================
   TABLERO DE REPORTES (.rep-*) — portado del sistema de inventario (grupobande).
   Sistema visual compartido: cabecera, toolbar de filtros colapsable con presets
   y chips, tira de KPIs, pestanas, tarjetas de grafica (Chart.js) y tablas.
   Usa las variables de :root del padre (--card, --border, --muted, --text,
   --primary, --nav-h). El acento por vista se pasa inline con --ac.
   ============================================================================= */

/* Botones de exportacion */
.inv-report-export { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.inv-export-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 800; color: #334155; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.inv-export-btn svg { width: 17px; height: 17px; }
.inv-export-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, .08); text-decoration: none; }
.inv-export-btn--pdf { color: #b91c1c; border-color: #fecaca; }
.inv-export-btn--pdf:hover { background: #fef2f2; border-color: #f87171; }
.inv-export-btn--xls { color: #15803d; border-color: #bbf7d0; }
.inv-export-btn--xls:hover { background: #f0fdf4; border-color: #4ade80; }
.inv-export-btn--csv { color: #0f766e; border-color: #99f6e4; }
.inv-export-btn--csv:hover { background: #f0fdfa; border-color: #2dd4bf; }

/* Estados vacios y badges de estado de pago */
.inv-empty-state { margin: 0; padding: 22px; border: 1px dashed #cbd5e1; border-radius: 16px; color: #64748b; text-align: center; background: #f8fafc; }
.inv-empty-state--good { color: #15803d; font-style: normal; font-weight: 600; }
.inv-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.inv-badge--pend { background: #fef3c7; color: #92400e; }
.inv-badge--ok   { background: #dcfce7; color: #166534; }
.inv-badge--no   { background: #fee2e2; color: #991b1b; }

/* Tablas del reporte */
.inv-table--report { width: 100%; border-collapse: collapse; font-size: .9rem; }
.inv-table--report th, .inv-table--report td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.inv-table--report th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; }
.inv-table--report td.num, .inv-table--report th.num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-table--report td small { color: var(--muted); }
.inv-table--report tbody tr:hover { background: #f8fafc; }
.inv-table--report td.num.is-bad { color: #dc2626; font-weight: 700; }
.inv-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }

/* .inv-table--report vive fuera de .table-scroll (usa .inv-table-wrap con
   white-space:nowrap → desborda en móvil). Aquí la volvemos tarjetas apiladas,
   igual que el patrón genérico. Los data-label los inyecta el auto-etiquetador
   de app.js (ampliado para incluir table.inv-table--report). */
@media (max-width: 720px) {
  table.inv-table--report,
  .inv-table--report tbody,
  .inv-table--report tr,
  .inv-table--report td { display: block; width: 100%; }
  /* Anula el `table { min-width: 580px }` global (≤560px) que, al heredarse,
     forzaba estas tarjetas a 580px y provocaba scroll lateral de la página. */
  table.inv-table--report { min-width: 0; }
  .inv-table--report thead { display: none; }
  .inv-table--report tbody tr {
    border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
    margin-bottom: 10px; background: var(--card, #fff); box-shadow: 0 4px 14px rgba(15,23,42,.05);
  }
  .inv-table--report td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 7px 0; border: 0; border-bottom: 1px dashed var(--border);
    text-align: right; white-space: normal; word-break: break-word;
  }
  .inv-table--report td:last-child { border-bottom: 0; }
  .inv-table--report td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 800;
    letter-spacing: .06em; text-transform: uppercase; text-align: left; flex: 0 0 auto; max-width: 45%;
  }
  /* Celdas con contenido apilado (varios divs / small): el valor cae a lo ancho
     bajo la etiqueta en vez de comprimirse a 1 carácter y romperse en vertical. */
  .inv-table--report td:has(> div + div),
  .inv-table--report td:has(> small) {
    flex-direction: column; align-items: flex-start; text-align: left; gap: 4px;
  }
  .inv-table--report td:has(> div + div)::before,
  .inv-table--report td:has(> small)::before { max-width: 100%; }
  .inv-table--report td:has(> div + div) > div { width: 100%; overflow-wrap: anywhere; }
  /* fila vacía con colspan: no la convertimos en tarjeta */
  .inv-table--report tbody tr[data-no-card="true"] {
    border: 0; box-shadow: none; padding: 0; margin: 0; background: transparent;
  }
  .inv-table--report tbody tr[data-no-card="true"] > td {
    border: 0; text-align: center; justify-content: center;
  }
  .inv-table--report tbody tr[data-no-card="true"] > td::before { content: none; }
  /* el wrapper ya no necesita su borde cuando las filas son tarjetas */
  .inv-table-wrap:has(.inv-table--report) { border: 0; border-radius: 0; overflow: visible; }
}

/* Cabecera */
.rep-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.rep-head-text h1 { margin: 4px 0 6px; font-size: 1.6rem; }
.rep-head-text p { color: var(--muted); max-width: 64ch; margin: 0; }
.rep-head .inv-report-export { margin-top: 0; }

/* Toolbar de filtros — barra liviana, pegajosa y colapsable */
.rep-toolbar {
  position: sticky; top: calc(var(--nav-h) + 8px); z-index: 20;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px; margin: 6px 0 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
  transition: box-shadow .2s ease, border-color .2s ease, top .28s ease;
}
.rep-toolbar:focus-within { box-shadow: 0 8px 26px rgba(15, 23, 42, .10); border-color: color-mix(in srgb, var(--ac) 30%, var(--border)); }
.rep-toolbar-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.rep-toolbar-toggle {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 9px; padding: 7px 12px; font: inherit; font-weight: 600; font-size: .86rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.rep-toolbar-toggle:hover { border-color: var(--ac); color: var(--ac); }
.rep-toolbar-toggle svg { width: 16px; height: 16px; }
.rep-toolbar-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; font-size: .7rem; font-weight: 800; font-style: normal; color: #fff; background: var(--ac); border-radius: 999px; }
.rep-toolbar-chev { transition: transform .25s ease; opacity: .6; }
.rep-toolbar:not(.is-collapsed) .rep-toolbar-chev { transform: rotate(180deg); }
.rep-presets { display: flex; gap: 6px; }
.rep-preset {
  border: 1px solid var(--border); background: #f8fafc; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s ease;
}
.rep-preset:hover { border-color: var(--ac); color: var(--ac); background: color-mix(in srgb, var(--ac) 8%, #fff); }
/* Selector de trimestre (desplegable) — atajo de rango compacto, ideal en móvil */
.rep-quarter {
  display: inline-flex; border: 1px solid var(--border); border-radius: 999px;
  background: #f8fafc; transition: border-color .15s ease, background .15s ease;
}
.rep-quarter:hover, .rep-quarter:focus-within { border-color: var(--ac); background: color-mix(in srgb, var(--ac) 8%, #fff); }
.rep-quarter.is-active { border-color: var(--ac); background: color-mix(in srgb, var(--ac) 8%, #fff); }
.rep-quarter-select {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
}
.rep-quarter-select:focus { outline: none; }
.rep-quarter:hover .rep-quarter-select, .rep-quarter.is-active .rep-quarter-select { color: var(--ac); }
.rep-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.rep-toolbar:not(.is-collapsed) .rep-active { display: none; }
.rep-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 220px;
  padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  color: var(--text); background: #eef2f7; border: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rep-chip svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .65; }
.rep-chip--range { color: var(--ac); background: color-mix(in srgb, var(--ac) 10%, #fff); border-color: color-mix(in srgb, var(--ac) 28%, var(--border)); }
.rep-chip--range svg { opacity: 1; }
.rep-toolbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.rep-apply { height: 36px; padding: 0 20px; border: 0; border-radius: 9px; cursor: pointer; background: var(--ac); color: #fff; font: inherit; font-weight: 700; transition: filter .15s ease, transform .04s ease; }
.rep-apply:hover { filter: brightness(1.08); }
.rep-apply:active { transform: translateY(1px); }
.rep-reset { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .88rem; }
.rep-reset:hover { color: var(--text); text-decoration: underline; }
.rep-toolbar-fields { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .26s ease, opacity .2s ease, margin-top .26s ease; margin-top: 12px; }
.rep-fields-inner { overflow: hidden; min-height: 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding-top: 2px; }
.rep-toolbar.is-collapsed .rep-toolbar-fields { grid-template-rows: 0fr; opacity: 0; margin-top: 0; pointer-events: none; }
.rep-field { display: flex; flex-direction: column; gap: 5px; }
.rep-field label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rep-field input, .rep-field select { height: 40px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); font: inherit; min-width: 140px; max-width: 220px; }
.rep-field input:focus, .rep-field select:focus { outline: none; border-color: var(--ac); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac) 18%, transparent); }

/* KPIs */
.rep-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.rep-kpi {
  --c: var(--ac);
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
  display: flex; flex-direction: column; gap: 5px; overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.rep-kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15, 23, 42, .10); border-color: color-mix(in srgb, var(--c) 35%, var(--border)); }
.rep-kpi--buy { --c: #2563eb; } .rep-kpi--due { --c: #dc2626; } .rep-kpi--paid { --c: #0d9488; }
.rep-kpi--rhythm { --c: #7c3aed; } .rep-kpi--fx { --c: #d97706; }
.rep-kpi.is-alert { border-color: color-mix(in srgb, #dc2626 45%, var(--border)); background: #fff7f7; }
.rep-kpi.is-alert .rep-kpi-value { color: #dc2626; }
.rep-kpi-ico {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-bottom: 4px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: 0 7px 16px color-mix(in srgb, var(--c) 38%, transparent);
}
.rep-kpi-ico svg { width: 22px; height: 22px; }
.rep-kpi-label { min-width: 0; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rep-kpi-value { min-width: 0; max-width: 100%; font-size: clamp(1.4rem, 1rem + 1vw, 1.9rem); font-weight: 800; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rep-kpi-foot { min-width: 0; font-size: .78rem; color: var(--muted); line-height: 1.3; }
/* Bandas de 4 KPIs (Impuestos): sin esto la rejilla de 5 deja un hueco al final. */
.rep-kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Una cifra en bolívares con separadores de miles no cabe al tamaño de un
   contador; el nowrap del valor la recortaría contra el borde de la tarjeta. */
.rep-kpi-value--money { font-size: clamp(1.05rem, .82rem + .55vw, 1.4rem); }

/* Barra de tableros: pestanas + toggle de metrica */
.rep-board-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.rep-tabs { display: inline-flex; gap: 4px; background: #eef2f7; border-radius: 11px; padding: 4px; }
.rep-tab { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; font-size: .9rem; transition: all .15s ease; }
.rep-tab:hover { color: var(--text); }
.rep-tab.is-active { background: #fff; color: var(--ac); box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.rep-metric-btn { border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer; padding: 7px 13px; font: inherit; font-weight: 600; font-size: .82rem; }
.rep-metric-btn:first-of-type { border-radius: 8px 0 0 8px; }
.rep-metric-btn:last-of-type { border-radius: 0 8px 8px 0; border-left: 0; }
.rep-metric-btn.is-active { background: var(--ac); color: #fff; border-color: var(--ac); }
.rep-cgran { display: inline-flex; align-self: center; }

/* Paneles y tarjetas de grafica */
.rep-panel[hidden] { display: none; }
.rep-context-note { background: color-mix(in srgb, var(--ac) 8%, #fff); border: 1px solid color-mix(in srgb, var(--ac) 25%, var(--border)); color: var(--text); border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; font-size: .9rem; }
.rep-context-note--warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.rep-card { background: var(--card); border: 1px solid var(--border); border-radius: 15px; padding: 16px 18px 14px; box-shadow: 0 6px 18px rgba(15, 23, 42, .05); }
.rep-card--wide { grid-column: 1 / -1; }
.rep-card--table { margin-bottom: 16px; }
.rep-card--good { border-color: #bbf7d0; background: #f0fdf4; }
.rep-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rep-card-head h2 { font-size: 1.02rem; margin: 0; }
.rep-card-head span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.rep-canvas { position: relative; height: 300px; }
.rep-card--wide .rep-canvas { height: 320px; }

@media (max-width: 980px) {
  .rep-kpis { grid-template-columns: repeat(2, 1fr); }
  .rep-grid { grid-template-columns: 1fr; }
  .rep-toolbar { position: static; }
  .rep-fields-inner { gap: 10px 12px; }
  /* Campos en cuadrícula fluida (2+ por fila) en vez de apilados a lo alto:
     el filtro ocupa mucho menos alto en móvil sin perder usabilidad. */
  .rep-field { flex: 1 1 140px; min-width: 0; }
  .rep-field input, .rep-field select { min-width: 0; width: 100%; max-width: none; }
  .rep-active { width: 100%; }
  .rep-toolbar-actions { margin-left: auto; }
  .rep-board-bar { flex-direction: column; align-items: stretch; }
  .rep-tabs { justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 640px) {
  .rep-head-text h1 { font-size: 1.3rem; }
  .rep-head-text p { font-size: .9rem; }
  .rep-kpis { grid-template-columns: 1fr; gap: 12px; }
  .rep-kpi { padding: 14px 16px; }
  .rep-card { padding: 14px 14px 12px; }
  .rep-card-head { flex-wrap: wrap; }
  .rep-card-head h2 { min-width: 0; overflow-wrap: anywhere; }
  .rep-canvas, .rep-card--wide .rep-canvas { height: 240px; }
}

/* ── Guard anti-desbordamiento horizontal en móvil ──────────────────────
   Un solo elemento ancho (un canvas de Chart.js mal medido, una tabla sin
   colapsar, un código largo) hacía que TODA la página tuviera scroll lateral:
   se veía todo corrido, las tarjetas cortadas y el sidebar descolocado (parecía
   que "desaparecía" Reportes). `overflow-x: clip` recorta ese desborde sin
   crear un contenedor de scroll (no rompe la barra de filtros sticky), y el
   canvas nunca supera el ancho de su tarjeta. Solo móvil: desktop intacto. */
@media (max-width: 900px) {
  .content { overflow-x: clip; }
  .rep-grid, .rep-card, .rep-canvas { min-width: 0; max-width: 100%; }
  .rep-canvas > canvas,
  canvas { max-width: 100% !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   REPORTES — grupo desplegable del sidebar + pestañas + secciones colapsables
   (paridad con el módulo de reportes del hijo, con el lenguaje visual del padre)
   ═══════════════════════════════════════════════════════════════════ */

/* --- Grupo desplegable del sidebar (Reportes) --- */
.sidebar-group { margin: 3px 6px; }
.sidebar-group > summary {
  list-style: none;
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,.9);
  font-size: .9rem; font-weight: 600;
  cursor: pointer;
  line-height: 1.35;
  transition: background .18s, color .18s, transform .18s ease;
}
.sidebar-group > summary::-webkit-details-marker { display: none; }
.sidebar-group > summary:hover {
  background: rgba(255,255,255,.055);
  color: #fff;
  transform: translateX(2px);
}
.sidebar-group > summary .sg-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  opacity: .72; color: rgba(191,219,254,.86);
}
.sidebar-group > summary:hover .sg-icon { opacity: 1; }
.sidebar-group > summary .sg-caret {
  margin-left: auto; width: 15px; height: 15px; flex-shrink: 0;
  opacity: .65; transition: transform .2s ease;
}
.sidebar-group[open] > summary { color: #fff; }
.sidebar-group[open] > summary .sg-caret { transform: rotate(90deg); opacity: 1; }

.sidebar-sublist {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 0 6px;
}
.sidebar-sublink {
  position: relative;
  display: block;
  margin: 0 6px 0 32px;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  font-size: .84rem; font-weight: 600;
  transition: background .16s, color .16s;
}
.sidebar-sublink::before {
  content: '';
  position: absolute; left: -14px; top: 4px; bottom: 4px;
  width: 1.5px; border-radius: 999px;
  background: rgba(148,163,184,.3);
}
.sidebar-sublink:hover {
  background: rgba(255,255,255,.06);
  color: #fff; text-decoration: none;
}
.sidebar-sublink.active {
  background: linear-gradient(135deg, #2563eb 0%, #3156d3 100%);
  color: #fff;
}
.sidebar-sublink.active::before { background: rgba(255,255,255,.92); }

/* --- Barra de pestañas de acceso directo --- */
.report-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px; padding: 5px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 14px);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.report-tab {
  padding: 8px 16px; border-radius: var(--radius-sm, 9px);
  font-size: .86rem; font-weight: 700;
  color: var(--muted, #64748b);
  transition: background .16s, color .16s;
}
.report-tab:hover {
  background: var(--primary-light, #dbeafe);
  color: var(--primary, #1e40af);
  text-decoration: none;
}
.report-tab.is-active {
  background: var(--primary, #1e40af);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37,99,235,.22);
}

/* --- Secciones colapsables (landing de reportes) --- */
.report-collapse {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 14px);
  background: var(--card, #fff);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.report-collapse[open] { box-shadow: 0 10px 26px rgba(15,23,42,.07); }
.report-collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px;
}
.report-collapse > summary::-webkit-details-marker { display: none; }
.report-collapse > summary:hover { background: rgba(37,99,235,.03); }
.report-collapse-ic {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.report-collapse-ic svg { width: 20px; height: 20px; }
.report-collapse-txt { flex: 1; min-width: 0; }
.report-collapse-txt > strong {
  display: block; font-size: 1rem; font-weight: 800;
  color: var(--text, #0f172a);
}
.report-collapse-txt > span {
  display: block; font-size: .84rem; color: var(--muted, #64748b);
  margin-top: 3px; line-height: 1.45;
}
.report-collapse-tags {
  display: flex !important; flex-wrap: wrap; gap: 5px; margin-top: 9px;
}
.report-collapse-tags span {
  font-size: .68rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: var(--primary-light, #dbeafe);
  color: var(--primary, #1e40af);
}
.report-collapse-caret {
  margin-left: auto; width: 18px; height: 18px; flex-shrink: 0;
  color: var(--muted, #94a3b8);
  transition: transform .2s ease;
  margin-top: 12px;
}
.report-collapse[open] .report-collapse-caret { transform: rotate(90deg); }
.report-collapse-body {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.report-collapse-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.report-collapse-body .report-grid { margin: 0; }

/* ═══════════════════════════════════════════════════════════════════
   Detalle de factura clickeable + modal (tablero analítico reportes/analytics)
   ═══════════════════════════════════════════════════════════════════ */
.rpt-fac-link {
  font-family: monospace; font-size: 11.5px; font-weight: 700;
  color: #1e40af; background: none; border: none; padding: 2px 4px;
  cursor: pointer; border-radius: 6px; text-align: left;
  transition: background .15s, color .15s;
}
.rpt-fac-link:hover { background: #dbeafe; color: #1e3a8a; text-decoration: underline; }
.rpt-fac-link:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }

.rptfac-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; overflow-y: auto;
  background: rgba(15,23,42,.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.rptfac-overlay[hidden] { display: none; }
.rptfac-dialog {
  position: relative; width: 100%; max-width: 760px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15,23,42,.28);
  padding: 26px 26px 24px; animation: rptfacIn .18s ease;
}
@keyframes rptfacIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.rptfac-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px; border-radius: 9px; border: none;
  background: #f1f5f9; color: #475569; font-size: 22px; line-height: 1;
  cursor: pointer; transition: background .15s;
}
.rptfac-close:hover { background: #e2e8f0; color: #0f172a; }

.rptfac-state { padding: 42px 10px; text-align: center; color: var(--muted,#64748b); font-size: 14px; }
.rptfac-state--err { color: #b91c1c; }
.rptfac-empty { padding: 18px; text-align: center; color: var(--muted,#64748b); font-size: 13px; background: #f8fafc; border-radius: 10px; }

.rptfac-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-right: 34px; }
.rptfac-eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted,#94a3b8); }
.rptfac-orden { margin: 3px 0 4px; font-size: 20px; font-weight: 800; color: var(--text,#0f172a); font-family: monospace; }
.rptfac-prov { font-size: 13px; color: #475569; font-weight: 600; }
.rptfac-prov .bi { color: #64748b; }

.rptfac-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 18px 0 20px;
}
.rptfac-grid > div {
  background: #f8fafc; border: 1px solid var(--border,#e2e8f0);
  border-radius: 11px; padding: 11px 13px;
}
.rptfac-grid span { display: block; font-size: 11px; color: var(--muted,#64748b); font-weight: 600; margin-bottom: 3px; }
.rptfac-grid strong { font-size: 15px; color: var(--text,#0f172a); }

.rptfac-subt { font-size: 12.5px; font-weight: 800; color: var(--text,#0f172a); margin-bottom: 8px; }
.rptfac-tblwrap { overflow-x: auto; border: 1px solid var(--border,#e2e8f0); border-radius: 11px; }
.rptfac-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.rptfac-tbl th, .rptfac-tbl td { padding: 8px 10px; text-align: left; white-space: nowrap; }
.rptfac-tbl thead th { background: #f8fafc; color: var(--muted,#64748b); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border,#e2e8f0); }
.rptfac-tbl tbody tr + tr td { border-top: 1px solid #f1f5f9; }
.rptfac-tbl .r { text-align: right; }
.rptfac-tbl .c { text-align: center; }
.rptfac-file { color: #1e40af; font-weight: 700; }
.rptfac-muted { color: #94a3b8; }

.rptfac-obs { margin-top: 16px; }
.rptfac-obs span { display: block; font-size: 11px; font-weight: 700; color: var(--muted,#64748b); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.rptfac-obs p { margin: 0; font-size: 12.5px; color: #475569; background: #f8fafc; border-radius: 9px; padding: 10px 12px; }

@media (max-width: 560px) {
  .rptfac-grid { grid-template-columns: repeat(2, 1fr); }
  .rptfac-dialog { padding: 20px 16px; }
}

/* ============================================================
   PROGRAMACIÓN DE PAGOS — matriz "Solicitud de fondos"
   Jerarquía Empresa → Solicitud → Concepto, edición inline.
   ============================================================ */
.sf-summary {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.sf-sum {
  display: grid; align-content: start; gap: 4px;
  padding: 14px 16px; border: 1px solid #e6ebf2; border-radius: 14px; background: #fff;
}
.sf-sum > span { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.sf-sum strong { font-size: 24px; font-weight: 900; color: #0f172a; line-height: 1; }
.sf-sum small { font-size: 11.5px; color: #94a3b8; }
.sf-sum--total { background: linear-gradient(135deg, #fef2f2, #fff); border-color: #fecaca; }
.sf-sum--total strong { color: #b91c1c; }

.sf-wrap { padding: 0; overflow: hidden; }
.sf-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.sf-matrix thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: #475569; font-weight: 800; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; padding: 11px 12px; white-space: nowrap;
  border-bottom: 2px solid #e2e8f0;
}
.sf-tree-h { text-align: left; }
.sf-num-h { text-align: right; }
.sf-est-h { text-align: center; }
.sf-total-h { color: #0f766e; }

.sf-matrix td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.sf-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sf-total { font-weight: 800; color: #0f172a; }
.sf-tree { text-align: left; }
.sf-tasa { color: #94a3b8; font-weight: 600; }

/* Empresa (nivel 0) — banda suave, sin azul fuerte */
.sf-emp > td { background: #f1f5f9; border-top: 1px solid #e5e9f0; border-bottom: 1px solid #e5e9f0; }
.sf-emp .sf-emp-name { font-weight: 800; color: #0f172a; font-size: 13.5px; }
.sf-emp .sf-num { font-weight: 800; color: #334155; }

/* Solicitud (nivel 1) */
.sf-sol > td { background: #fbfcfe; }
.sf-sol .sf-tree { padding-left: 30px; }
.sf-sol-code { font-weight: 800; color: #0f766e; }
.sf-sol-desc { color: #94a3b8; margin-left: 8px; font-size: 12px; font-weight: 400; }
.sf-sol .sf-num { font-weight: 700; color: #475569; }

/* Concepto (nivel 2) */
.sf-con .sf-tree { padding-left: 52px; }
.sf-con-name { color: #0f172a; font-weight: 600; }
.sf-con-oc { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 11px; font-weight: 700; font-family: Consolas, monospace; }
/* Nº de orden clickable → abre el desglose */
.sf-oc-btn {
  display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 9px;
  border: 1px solid #99f6e4; border-radius: 999px; background: #f0fdfa; color: #0f766e;
  font-size: 11px; font-weight: 800; font-family: Consolas, monospace; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.sf-oc-btn:hover { background: #ccfbf1; border-color: #5eead4; }
.sf-oc-btn:focus-visible { outline: 2px solid #0f766e; outline-offset: 1px; }
.sf-con:hover > td { background: #f8fafc; }

/* Total general — claro, con línea superior en vez del bloque navy */
.sf-grand > td { background: #f8fafc; color: #0f172a; font-weight: 900; border-top: 2px solid #cbd5e1; border-bottom: 0; }
.sf-grand .sf-num { color: #0f172a; }
.sf-grand .sf-total { color: #0f766e; }
.sf-grand .sf-tree { color: #334155; letter-spacing: .04em; }

/* Input de tasa (referencia) un poco más tenue */
.sf-inp--rate { color: #475569; }

/* Botón de nota (ícono discreto en la fila del concepto) */
.sf-note-btn {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  margin-left: 6px; width: 24px; height: 22px; padding: 0; cursor: pointer;
  border: 1px solid #e2e8f0; border-radius: 7px; background: #fff; color: #94a3b8;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.sf-note-btn svg { width: 13px; height: 13px; }
.sf-note-btn:hover { border-color: #5eead4; color: #0f766e; background: #f0fdfa; }
.sf-note-btn.has-note { border-color: #5eead4; background: #f0fdfa; color: #0f766e; }
.sf-note-btn:focus-visible { outline: 2px solid #0f766e; outline-offset: 1px; }

/* Modal de nota (pequeño) */
.sf-modal-dialog--sm { width: min(460px, 100%); }
.sf-nota-text {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 13.5px; color: #0f172a; resize: vertical; min-height: 110px;
}
.sf-nota-text:focus { outline: none; border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.sf-nota-read { margin: 0; color: #334155; font-size: 13.5px; white-space: pre-wrap; }
.sf-nota-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.sf-nota-flag { font-size: 12px; font-weight: 700; }
.sf-nota-flag.is-saving { color: #92400e; }
.sf-nota-flag.is-ok { color: #166534; }
.sf-nota-flag.is-err { color: #b91c1c; }

/* Toggle */
.sf-toggle {
  width: 22px; height: 22px; margin-right: 6px; padding: 0; vertical-align: middle;
  border: 0; background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.sf-toggle svg { width: 15px; height: 15px; transition: transform .15s ease; }
.sf-toggle.is-collapsed svg { transform: rotate(-90deg); }
/* Hover propio: sin esto hereda el reset global button:where():hover
   (fondo azul oscuro) y quedaba ícono oscuro sobre fondo oscuro. */
.sf-toggle:hover { background: #e2e8f0; color: #0f766e; }
.sf-toggle:focus-visible { outline: 2px solid #0f766e; outline-offset: 1px; }
/* Debe ganar SIEMPRE a las reglas móviles (.sf-matrix tr{display:block/flex}),
   que si no la pisan por orden de fuente y dejan visibles las filas "ocultas". */
.sf-matrix tr.is-hidden { display: none !important; }

/* Inputs de edición */
.sf-inp {
  width: 92px; padding: 5px 7px; text-align: right; border: 1px solid #d7dee8; border-radius: 8px;
  font-size: 12.5px; font-variant-numeric: tabular-nums; background: #fff; color: #0f172a;
}
.sf-inp:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.sf-status { padding: 5px 8px; border: 1px solid #d7dee8; border-radius: 8px; font-size: 12px; font-weight: 700; background: #fff; }
.sf-est-cell { text-align: center; }

/* Feedback de guardado por fila */
.sf-con.is-saving > td { background: #fffbeb; }
.sf-con.is-saved > td { background: #ecfdf5; transition: background .3s ease; }
.sf-con.is-error > td { background: #fef2f2; }
/* Feedback al guardar el estatus/nota de la FACTURA (fila de solicitud). */
.sf-sol.is-saving > td { background: #fffbeb; }
.sf-sol.is-saved > td { background: #ecfdf5; transition: background .3s ease; }
.sf-sol.is-error > td { background: #fef2f2; }

/* Badges de estatus (solo lectura) */
.sf-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.sf-badge--pend { background: #fef3c7; color: #92400e; }
.sf-badge--info { background: #dbeafe; color: #1e40af; }
.sf-badge--ok   { background: #dcfce7; color: #166534; }
.sf-badge--wait { background: #f1f5f9; color: #475569; }

/* Botón de export "Historial" (mismo patrón que los demás) */
.inv-export-btn--hist { --x: #0f766e; }

/* Modal de desglose de orden */
body.sf-modal-open { overflow: hidden; }
.sf-modal { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.sf-modal[hidden] { display: none; }
.sf-modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.sf-modal-dialog {
  position: relative; width: min(720px, 100%); max-height: 88vh; overflow: hidden;
  display: flex; flex-direction: column; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15,23,42,.35); animation: sfModalIn .16s ease;
}
@keyframes sfModalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sf-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid #eef2f7; }
.sf-modal-eyebrow { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #0f766e; }
.sf-modal-head h2 { margin: 3px 0 0; font-size: 18px; color: #0f172a; font-family: Consolas, monospace; }
.sf-modal-desc { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; color: #0f172a; }
.sf-modal-sub { margin: 4px 0 0; font-size: 12.5px; color: #64748b; }
/* padding:0 obligatorio: el reset global button:where(:not(.hamburger)) mete
   padding 10px 20px y, con box-sizing:border-box, aplastaba el SVG de la X a 0px
   (se veia un cuadro gris vacio en los modales). */
.sf-modal-x { flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 10px; background: #f1f5f9; color: #475569; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.sf-modal-x:hover { background: #e2e8f0; color: #0f172a; }
.sf-modal-x svg { width: 18px; height: 18px; }
.sf-modal-body { padding: 16px 20px 20px; overflow: auto; }
.sf-modal-loading, .sf-modal-empty { color: #64748b; font-size: 13px; text-align: center; padding: 24px 0; }
.sf-modal-tablewrap { overflow-x: auto; }
.sf-modal-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sf-modal-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #eef2f7; color: #64748b; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.sf-modal-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; color: #0f172a; }
.sf-modal-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sf-modal-table tfoot td { font-weight: 800; border-top: 2px solid #e2e8f0; border-bottom: 0; }
.sf-modal-table tfoot .sf-modal-saldo td { color: #b45309; font-size: 13.5px; }
.sf-modal-table tfoot .pd-final td { color: #0f766e; font-size: 15px; font-weight: 900; border-top: 2px solid #99f6e4; }
.sf-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; }
.sf-tag--prod { background: #e0f2fe; color: #075985; }
.sf-tag--srv { background: #f3e8ff; color: #6b21a8; }

/* En móvil la tabla de desglose (5 columnas de dinero) desbordaba y salía
   scroll horizontal cortando columnas. La volvemos tarjetas apiladas usando
   los data-label que inyecta programacion-pagos.js.
   Patrón FLOAT (no flex): la etiqueta flota a la izquierda y el valor —texto
   real de la celda— siempre queda visible, alineado a la derecha. */
@media (max-width: 640px) {
  .sf-modal-tablewrap { overflow-x: visible; }
  .sf-modal-table,
  .sf-modal-table tbody,
  .sf-modal-table tfoot,
  .sf-modal-table tr { display: block; width: 100%; }
  /* Anula el `table { min-width: 580px }` global (≤560px), que forzaba la tabla
     del modal a ser más ancha que el diálogo y recortaba los valores. */
  .sf-modal-table { min-width: 0; }
  .sf-modal-table thead { display: none; }
  .sf-modal-table tbody tr {
    border: 1px solid #eef2f7; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px;
  }
  .sf-modal-table tbody td {
    display: block; width: auto; padding: 6px 0; border: 0;
    text-align: right; white-space: normal; overflow: visible; overflow-wrap: anywhere;
  }
  /* Los valores (montos cortos) van en una línea, pero un código o nombre largo
     debe poder envolver en vez de recortarse en el borde del diálogo. */
  .sf-modal-table tbody td.r { white-space: normal; overflow-wrap: anywhere; }
  .sf-modal-table tbody td[data-label]::before {
    content: attr(data-label); float: left; margin-right: 12px;
    color: #94a3b8; font-weight: 800; font-size: 10.5px;
    letter-spacing: .04em; text-transform: uppercase; text-align: left;
  }
  .sf-modal-table tbody td:first-child {
    text-align: left; font-weight: 700; padding-bottom: 8px; margin-bottom: 4px;
    border-bottom: 1px dashed #e2e8f0;
  }
  .sf-modal-table tbody td:first-child::before { content: none; }
  /* pie: dos <td> reales (sin pseudo), aquí flex es seguro */
  .sf-modal-table tfoot tr {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 14px;
  }
  .sf-modal-table tfoot td { display: block; padding: 2px 0; border: 0; text-align: right; }
  .sf-modal-table tfoot td[colspan] { text-align: left; }
}

/* Cabecera del modal: acciones (Exportar PDF + cerrar) */
.sf-modal-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sf-modal-pdf { white-space: nowrap; }

/* ── Pagos aplicados dentro del modal de CxP ── */
.pd-pagos { margin-top: 20px; }
.pd-pagos-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  font-size: 14px; font-weight: 800; color: #0f172a;
}
.pd-pagos-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  padding: 0 7px; border-radius: 999px; background: #0f766e; color: #fff; font-size: 12px; font-weight: 800;
}
.pd-pago {
  border: 1px solid #e5e9f0; border-radius: 14px; margin-bottom: 12px; overflow: hidden;
  background: #fff; box-shadow: 0 4px 12px rgba(15,23,42,.04);
}
.pd-pago-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #eef2f7;
}
.pd-pago-when { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pd-pago-n { font-weight: 800; color: #0f172a; font-size: 13px; }
.pd-pago-date { color: #64748b; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pd-pago-tag {
  flex: none; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap;
}
.pd-pago-tag--full { background: #dcfce7; color: #166534; }
.pd-pago-tag--partial { background: #fef3c7; color: #92400e; }
.pd-pago-grid { padding: 6px 14px 8px; }
.pd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px dashed #f1f5f9;
}
.pd-row:last-child { border-bottom: 0; }
.pd-row > span { color: #64748b; font-size: 12px; font-weight: 600; }
.pd-row > strong { color: #0f172a; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.pd-row > strong em { color: #94a3b8; font-weight: 500; font-style: italic; }
.pd-row.pd-strong { border-top: 2px solid #f1f5f9; margin-top: 2px; padding-top: 8px; border-bottom: 0; }
.pd-row.pd-strong > span { color: #0f172a; font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
.pd-row.pd-strong > strong { color: #0f766e; font-size: 15px; font-weight: 900; }
.pd-row.pd-neg > strong { color: #b91c1c; }
.pd-rets { margin: 2px 14px 10px; padding: 8px 12px; background: #fef2f2; border-radius: 10px; }
.pd-rets-title {
  display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #b91c1c; margin-bottom: 4px;
}
.pd-ret {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 3px 0; font-size: 12px;
}
.pd-ret > span { color: #7f1d1d; }
.pd-ret > span em { color: #b45c5c; font-style: italic; }
.pd-ret > strong { color: #991b1b; font-weight: 800; font-variant-numeric: tabular-nums; }
.pd-pago-meta {
  padding: 8px 14px; border-top: 1px solid #eef2f7; background: #fbfcfe;
  color: #64748b; font-size: 11.5px;
}

@media (max-width: 720px) {
  .sf-modal-pdf { padding: 6px 10px; }
  .sf-modal-pdf svg { margin: 0; }
  .pd-row { flex-wrap: wrap; gap: 2px 12px; }
}

/* Tabla de historial */
.sf-hist { width: 100%; border-collapse: collapse; font-size: 13px; }
.sf-hist thead th { text-align: left; padding: 10px 12px; background: #f8fafc; border-bottom: 2px solid #eef2f7; color: #64748b; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.sf-hist thead th.r, .sf-hist td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sf-hist td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; color: #0f172a; }
.sf-hist tbody tr:hover td { background: #f8fafc; }
.sf-hist-oc { font-family: Consolas, monospace; font-weight: 700; color: #334155; }

@media (max-width: 900px) {
  .sf-summary { grid-template-columns: 1fr 1fr; }
  .sf-summary .sf-sum--total { grid-column: 1 / -1; }
  .sf-matrix { font-size: 12px; }
  .sf-inp { width: 74px; }
  .sf-sol .sf-tree { padding-left: 22px; }
  .sf-con .sf-tree { padding-left: 36px; }
  .rep-presets { flex-wrap: wrap; }
}

/* ── Móvil/tablet: tablero e historial se vuelven listas/tarjetas tipo app
   nativa. Antes el corte era 720px y entre 721–900px la matriz quedaba como
   tabla ancha que desbordaba y cortaba contenido (bug reportado). Se sube a
   900px para que teléfonos grandes y tablets reciban la vista táctil. ── */
@media (max-width: 900px) {
  .sf-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sf-summary .sf-sum--total { grid-column: 1 / -1; }
  .sf-sum { padding: 12px 14px; }
  .sf-sum strong { font-size: 21px; }
  .inv-table-wrap { overflow: visible; }
  .inv-report-export { flex-wrap: wrap; }

  /* ===== MATRIZ (programación pendiente) → lista agrupada tocable ===== */
  .sf-wrap { padding: 10px; background: #f8fafc; }
  .sf-matrix { font-size: 13.5px; }
  .sf-matrix thead { display: none; }
  .sf-matrix, .sf-matrix tbody, .sf-matrix tfoot, .sf-matrix tr, .sf-matrix td { display: block; width: 100%; }
  .sf-matrix { min-width: 0; } /* anula el `table { min-width:580px }` global (≤560px) */

  /* Empresa / Solicitud / Total general = cabeceras: toda la fila es tocable */
  .sf-matrix tr.sf-emp, .sf-matrix tr.sf-sol, .sf-matrix tr.sf-grand {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; cursor: pointer; -webkit-tap-highlight-color: rgba(15,118,110,.08);
  }
  .sf-emp > td, .sf-sol > td, .sf-grand > td { border: 0; padding: 0; background: none; }
  .sf-emp .sf-tree, .sf-sol .sf-tree, .sf-grand .sf-tree {
    flex: 1 1 auto; min-width: 0; padding-left: 0 !important;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  }
  .sf-emp .sf-num:not(.sf-total), .sf-sol .sf-num:not(.sf-total), .sf-grand .sf-num:not(.sf-total),
  .sf-emp .sf-est-cell, .sf-grand .sf-est-cell { display: none; }
  /* Estatus de la FACTURA: baja a una fila propia a lo ancho bajo el código,
     cómoda para tocar. (El código no debe partirse en varias líneas.) */
  .sf-sol { flex-wrap: wrap; }
  .sf-sol-code { white-space: nowrap; }
  .sf-sol .sf-est-cell {
    display: flex; align-items: center; flex-basis: 100%;
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed #eef2f7;
  }
  .sf-sol .sf-est-cell .sf-status { width: 100%; min-height: 42px; font-size: 14px; }
  .sf-sol .sf-est-cell .sf-badge { margin-left: 0; }
  /* Los conceptos ya no tienen estatus: su celda queda vacía → se oculta. */
  .sf-con .sf-est-cell:empty { display: none; }
  .sf-emp .sf-total, .sf-sol .sf-total, .sf-grand .sf-total {
    flex: none; float: none; padding: 0; white-space: nowrap;
  }
  .sf-emp .sf-total::before, .sf-sol .sf-total::before, .sf-grand .sf-total::before { content: none; }
  .sf-toggle { flex: none; width: 26px; height: 26px; margin-right: 2px; }

  .sf-emp {
    margin: 14px 0 0; padding: 12px 14px; background: #eef2f7;
    border: 1px solid #e2e8f0; border-radius: 12px;
  }
  .sf-emp .sf-emp-name { font-size: 14px; }
  .sf-emp .sf-total { font-size: 14px; }
  .sf-sol {
    margin: 8px 0 0; padding: 12px 14px; background: #fff;
    border: 1px solid #eef2f7; border-left: 3px solid #5eead4; border-radius: 10px;
  }
  .sf-sol .sf-sol-desc { flex-basis: 100%; margin-left: 0; }
  .sf-sol .sf-total { font-size: 14px; }
  .sf-grand {
    margin: 14px 0 0; padding: 14px; background: #f0fdfa;
    border: 1px solid #99f6e4; border-radius: 12px;
  }
  .sf-grand .sf-tree { font-weight: 900; }
  .sf-grand .sf-total { font-size: 16px; }

  /* Concepto = tarjeta indentada bajo su solicitud */
  .sf-con {
    border: 1px solid #e5e9f0; border-left: 3px solid #cbd5e1; border-radius: 12px;
    margin: 8px 0 0 14px; padding: 10px 14px 12px; background: #fff;
    box-shadow: 0 4px 12px rgba(15,23,42,.05);
  }
  .sf-con .sf-tree {
    padding-left: 0 !important; font-weight: 700; font-size: 13.5px; margin-bottom: 4px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
  }
  .sf-con .sf-num, .sf-con .sf-est-cell {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    text-align: right; padding: 7px 0; border-bottom: 1px dashed #eef2f7; min-height: 34px;
  }
  .sf-con .sf-num::before, .sf-con .sf-est-cell::before {
    content: attr(data-label); color: #64748b; font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; text-align: left;
  }
  .sf-con .sf-total {
    border-bottom: 0; border-top: 2px solid #f1f5f9; margin-top: 2px;
    padding-top: 10px; font-size: 16px; color: #0f766e;
  }
  .sf-con .sf-est-cell { border-bottom: 0; }
  .sf-con .sf-inp { width: auto; flex: 0 0 140px; text-align: right; min-height: 40px; font-size: 14px; }
  .sf-con .sf-status { width: auto; flex: 0 0 auto; min-height: 40px; }

  /* ===== HISTORIAL → tarjetas (antes la tabla colapsaba y se cortaba) ===== */
  .sf-hist thead { display: none; }
  .sf-hist, .sf-hist tbody { display: block; width: 100%; }
  .sf-hist { min-width: 0; } /* anula el `table { min-width:580px }` global (≤560px) */
  .sf-hist tr {
    display: block; border: 1px solid #e5e9f0; border-radius: 14px; margin: 0 0 12px;
    padding: 13px 15px; background: #fff; box-shadow: 0 4px 12px rgba(15,23,42,.05);
  }
  .sf-hist tbody tr:hover td { background: none; }
  .sf-hist td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 6px 0; border-bottom: 1px dashed #eef2f7; text-align: right; white-space: normal;
  }
  .sf-hist td::before {
    content: attr(data-label); color: #64748b; font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: .03em; text-align: left; white-space: nowrap;
  }
  .sf-hist td:last-child { border-bottom: 0; }
  .sf-hist .sf-hist-oc {
    display: block; text-align: left; font-size: 16px; color: #0f766e;
    padding: 0 0 10px; margin-bottom: 6px; border-bottom: 1px solid #f1f5f9;
  }
  .sf-hist .sf-hist-oc::before {
    content: attr(data-label); display: block; font-family: system-ui, -apple-system, sans-serif;
    font-size: 10px; letter-spacing: .05em; color: #94a3b8; font-weight: 800; margin-bottom: 3px;
  }
  .sf-hist .sf-hist-paid { color: #0f766e; font-weight: 800; font-size: 15px; }

  /* Modales tipo hoja inferior en móvil */
  .sf-modal { padding: 0; align-items: flex-end; }
  .sf-modal-dialog, .sf-modal-dialog--sm { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; animation: none; }
}

/* =============================================================================
   NUEVA SOLICITUD — workspace de 2 paneles portado del hijo (grupobande).
   Catalogo en tarjetas + carrito "Tu solicitud". Interfaz identica a la
   solicitud del inventario (area/request.php). Solo aplica en cotizaciones/crear.
   ============================================================================= */
/* ── Nueva solicitud REESTRUCTURADA: general arriba + carrito/catálogo abajo ── */
.sol-form { display: flex; flex-direction: column; gap: 16px; height: calc(100dvh - var(--nav-h, 66px) - 120px); min-height: 620px; }
.sol-general {
  flex: none; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; align-items: start;
  padding: 16px 18px; border: 1px solid rgba(148,163,184,.24); border-radius: 16px;
  background: #fff; box-shadow: 0 8px 22px rgba(15,23,42,.05);
}
.sol-general .inv-request-note { gap: 6px; font-size: 11px; }
.sol-general .inv-request-note textarea { min-height: 64px; padding: 10px 12px; font-size: 13px; }
.sol-general .inv-request-note select { min-height: 44px; }
/* La fila de abajo hereda TODOS los estilos táctiles del workspace; solo ajusto
   alto (llena lo que queda) y columnas (carrito angosto, catálogo protagonista). */
.sol-body.inv-request-workspace--touch { height: auto; flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 18px; }
.sol-cart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sol-cart-head h2 { margin: 2px 0 0; font-size: 18px; }
.sol-cart .inv-cart-summary { padding: 6px 12px; border-radius: 12px; }
.sol-cart .inv-cart-summary span { font-size: 11px; }
.sol-cart .inv-cart-summary strong { min-width: 30px; min-height: 30px; font-size: 15px; border-radius: 9px; }

@media (max-width: 900px) {
  .sol-form { height: auto; min-height: 0; }
  .sol-general { grid-template-columns: 1fr; }
  .sol-body.inv-request-workspace--touch { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .sol-body.inv-request-workspace--touch .inv-request-panel,
  .sol-body.inv-request-workspace--touch .inv-catalog-panel { height: auto; overflow: visible; }
  .sol-body.inv-request-workspace--touch .inv-catalog-grid { height: auto; overflow: visible; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .sol-body.inv-request-workspace--touch .inv-cart-list { max-height: 320px; overflow: auto; }
}

.inv-request-workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: stretch; width: 100%; }
.inv-request-panel,
.inv-catalog-panel { border: 1px solid rgba(148, 163, 184, .24); border-radius: 18px; background: #fff; box-shadow: 0 12px 28px rgba(15, 23, 42, .05); }
.inv-request-panel { position: sticky; top: 92px; display: grid; gap: 16px; padding: 18px; }
.inv-request-panel header { display: grid; gap: 2px; }
.inv-request-panel h2 { margin: 4px 0 0; font-size: 18px; }

/* Nota / descripcion (label + control) */
.inv-request-routing { display: grid; gap: 14px; }
.inv-request-workspace--touch .inv-request-routing { gap: 10px; }
.inv-request-note { display: grid; gap: 7px; color: #64748b; font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.inv-request-note textarea,
.inv-request-note select { width: 100%; resize: vertical; min-height: 92px; padding: 12px; border: 1px solid #dbeafe; border-radius: 14px; color: #0f172a; font: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; outline: 0; background: #fff; }
.inv-request-note select { min-height: 46px; resize: none; }
.inv-request-note textarea:focus,
.inv-request-note select:focus,
.inv-catalog-search:focus { border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
.inv-request-note .field-hint { font-weight: 600; letter-spacing: 0; text-transform: none; color: #94a3b8; font-size: 11.5px; }

/* Boton enviar */
.inv-request-submit { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; background: #1d4ed8; color: #fff; font-weight: 900; text-decoration: none; cursor: pointer; }
.inv-request-submit:hover { background: #1e40af; color: #fff; text-decoration: none; }
.inv-request-submit:disabled { opacity: .58; cursor: not-allowed; }

/* Variante tactil (2 paneles, alto completo con scroll interno) */
.inv-request-workspace--touch { grid-template-columns: minmax(420px, 2.1fr) minmax(0, 3fr); gap: 26px; height: calc(100dvh - var(--nav-h, 66px) - 150px); min-height: 560px; overflow: hidden; }
.inv-request-workspace--touch .inv-request-panel { position: static; display: flex; flex-direction: column; height: 100%; min-height: 0; gap: 18px; padding: 24px; overflow: hidden; }
.inv-request-workspace--touch .inv-cart-list { flex: 1 1 auto; min-height: 0; }
.inv-request-workspace--touch .inv-request-note,
.inv-request-workspace--touch .inv-request-submit,
.inv-request-workspace--touch .inv-cart-summary,
.inv-request-workspace--touch .inv-cart-empty { flex: none; }

/* Descripcion y resumen a segundo plano: la lista de productos es la protagonista
   para que el analista los verifique comodamente. */
.inv-request-workspace--touch .inv-request-note { gap: 5px; font-size: 11px; }
.inv-request-workspace--touch .inv-request-note textarea { min-height: 58px; padding: 10px 12px; font-size: 13px; }
.inv-request-workspace--touch .inv-cart-summary { padding: 8px 14px; border-radius: 12px; }
.inv-request-workspace--touch .inv-cart-summary span { font-size: 11px; }
.inv-request-workspace--touch .inv-cart-summary strong { min-width: 28px; min-height: 28px; font-size: 15px; border-radius: 9px; }
/* El listado de seleccionados manda: ocupa todo el alto sobrante */
.inv-request-workspace--touch .inv-cart-list { flex: 1 1 auto; }

/* Resumen del carrito */
.inv-cart-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid #dbeafe; border-radius: 14px; background: #f8fafc; }
.inv-cart-summary span { color: #64748b; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.inv-cart-summary strong { min-width: 42px; min-height: 42px; display: grid; place-items: center; border-radius: 12px; background: #1d4ed8; color: #fff; font-size: 22px; line-height: 1; }

/* Catalogo */
.inv-catalog-panel { padding: 18px; min-width: 0; }
.inv-catalog-head { display: flex; justify-content: space-between; gap: 14px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.inv-catalog-head-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-width: 0; }
.inv-catalog-search { width: min(100%, 360px); min-height: 42px; padding: 0 14px; border: 1px solid #dbeafe; border-radius: 12px; outline: 0; font: inherit; }
.inv-catalog-searchbox { position: relative; display: flex; align-items: center; gap: 11px; flex: 1 1 320px; min-width: 0; max-width: 560px; min-height: 56px; padding: 0 12px 0 16px; border: 2px solid color-mix(in srgb, var(--ac, #2563eb) 28%, #e2e8f0); border-radius: 16px; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--ac, #2563eb) 5%, #fff)); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 14px 30px -22px color-mix(in srgb, var(--ac, #2563eb) 75%, transparent); transition: border-color .15s ease, box-shadow .15s ease; }
.inv-catalog-searchbox:hover { border-color: color-mix(in srgb, var(--ac, #2563eb) 45%, #e2e8f0); }
.inv-catalog-searchbox:focus-within { border-color: var(--ac, #2563eb); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac, #2563eb) 16%, transparent), 0 16px 32px -20px color-mix(in srgb, var(--ac, #2563eb) 80%, transparent); }
.inv-catalog-searchbox-icon { flex: none; width: 22px; height: 22px; color: var(--ac, #2563eb); }
.inv-catalog-searchbox .inv-catalog-search { flex: 1 1 auto; width: auto; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: #0f172a; }
.inv-catalog-searchbox .inv-catalog-search::placeholder { color: #94a3b8; font-weight: 500; }
.inv-catalog-searchbox .inv-catalog-search:focus { box-shadow: none; }
.inv-catalog-searchbox-count { flex: none; padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--ac, #2563eb) 12%, #fff); color: color-mix(in srgb, var(--ac, #2563eb) 72%, #0f172a); font-size: 12px; font-weight: 800; white-space: nowrap; }
.inv-catalog-head--search-only .inv-catalog-head-actions { flex: 1 1 100%; width: 100%; }
.inv-catalog-head--search-only .inv-catalog-searchbox { flex: 1 1 240px; min-width: 0; max-width: none; }
/* Movil: buscador y boton "Registrar nuevo" a ancho completo, apilados, sin desbordar. */
@media (max-width: 560px) {
  .inv-catalog-head-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .inv-catalog-head--search-only .inv-catalog-searchbox { flex: 1 1 auto; width: 100%; min-height: 50px; }
  .sol-quick-toggle { width: 100%; justify-content: center; }
}
.inv-catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* Tarjeta de producto (base) */
.inv-product-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 16px; background: linear-gradient(180deg, #fff, #f8fbff); }
.inv-product-visual { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: #eff6ff; color: #1d4ed8; font-size: 22px; font-weight: 900; }
.inv-product-copy { min-width: 0; }
.inv-product-copy h3 { margin: 0 0 5px; font-size: 16px; line-height: 1.25; }
.inv-product-copy p { margin: 0; color: #64748b; font-size: 13px; line-height: 1.45; }
.inv-product-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid #e2e8f0; }

/* Tarjeta tactil */
.inv-request-workspace--touch .inv-catalog-panel { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 24px; overflow: hidden; }
.inv-request-workspace--touch .inv-catalog-grid { min-height: 0; height: 100%; overflow: auto; overflow-anchor: none; overscroll-behavior: contain; align-content: start; padding: 2px 6px 2px 2px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-auto-rows: max-content; gap: 16px; }
.inv-request-workspace--touch .inv-product-card { min-height: 198px; display: flex; flex-direction: column; gap: 10px; padding: 12px; cursor: pointer; touch-action: manipulation; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.inv-request-workspace--touch .inv-product-card:hover,
.inv-request-workspace--touch .inv-product-card:focus-within { transform: translateY(-2px); border-color: #93c5fd; box-shadow: 0 14px 28px rgba(37, 99, 235, .12); }
.inv-request-workspace--touch .inv-product-card.is-selected { border-color: #2563eb; background: linear-gradient(180deg, #eff6ff, #fff); box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
.inv-request-workspace--touch .inv-product-visual { width: 100%; height: 64px; border-radius: 14px; border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; }
.inv-request-workspace--touch .inv-product-card .inv-product-visual--icon { display: grid; place-items: center; border-color: #e2e8f0; background: #f8fafc; color: #475569; }
.inv-request-workspace--touch .inv-product-card.is-selected .inv-product-visual { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.inv-product-visual--icon svg { width: 28px; height: 28px; stroke-width: 1.7; }
.inv-request-workspace--touch .inv-product-copy { display: grid; align-content: start; gap: 5px; flex: 1 1 auto; }
.inv-request-workspace--touch .inv-product-sku { justify-self: start; font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace; font-size: 11px; font-weight: 800; letter-spacing: .03em; color: #475569; background: #f1f5f9; border: 1px solid #e2e8f0; padding: 2px 8px; border-radius: 7px; }
.inv-request-workspace--touch .inv-product-copy h3 { margin: 1px 0 0; font-size: 16px; font-weight: 800; line-height: 1.2; color: #0f172a; overflow-wrap: anywhere; }
.inv-request-workspace--touch .inv-product-actions { padding-top: 10px; margin-top: auto; gap: 8px; flex-wrap: wrap; }

/* Detalle completo en la tarjeta (del <style> inline de la solicitud del hijo) */
.inv-request-workspace--touch .inv-product-copy p,
.inv-request-workspace--touch .inv-product-copy .inv-product-desc,
.inv-request-workspace--touch .inv-product-copy .inv-product-specs { display: block; overflow: visible; font-style: normal; overflow-wrap: anywhere; }
.inv-product-desc { margin: 0; color: #475569; font-size: 12.5px; line-height: 1.45; white-space: pre-line; }
.inv-product-specs { margin: 0; color: #334155; font-size: 12px; line-height: 1.45; white-space: pre-line; }
.inv-product-detail-tag { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.inv-product-wh { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 11.5px; font-weight: 700; color: #64748b; }
.inv-product-wh svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* Pill de stock / unidad */
.inv-req-stock { display: inline-flex; align-items: baseline; gap: 4px; flex: 0 0 auto; max-width: 100%; padding: 5px 11px; border-radius: 999px; line-height: 1; }
.inv-req-stock strong { font-size: 15px; font-weight: 900; }
.inv-req-stock small { font-size: 11px; font-weight: 800; text-transform: lowercase; opacity: .85; overflow: hidden; text-overflow: ellipsis; }
.inv-req-stock.is-ok { background: #ecfdf5; color: #047857; }
.inv-req-stock.is-out { background: #fef2f2; color: #b91c1c; }
.inv-req-stock.is-na { background: #f1f5f9; color: #64748b; }

/* Boton "Agregar" */
.inv-touch-add { min-height: 42px; min-width: 108px; padding: 0 14px; border: 0; border-radius: 12px; background: #1d4ed8; color: #fff; font-weight: 900; cursor: pointer; }
.inv-request-workspace--touch .inv-touch-add { flex: 0 0 auto; min-width: 0; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: #1d4ed8; font-size: 13px; font-weight: 800; transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease; }
.inv-request-workspace--touch .inv-touch-add svg { width: 16px; height: 16px; }
.inv-request-workspace--touch .inv-touch-add:hover { background: #dbeafe; border-color: #93c5fd; }
.inv-request-workspace--touch .inv-touch-add:active { transform: translateY(1px); }
.inv-request-workspace--touch .inv-product-card.is-selected .inv-touch-add { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .25); }

/* Carrito */
.inv-cart-empty { display: grid; gap: 6px; padding: 18px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #f8fafc; color: #64748b; line-height: 1.35; }
.inv-cart-empty strong { color: #0f172a; }

/* Revision de "Nueva solicitud" dentro de SweetAlert (segunda validacion).
   La tabla de productos scrollea aparte para soportar 100+ items sin colapsar. */
.sol-review-swal { text-align: left; }
.sol-review { display: grid; gap: 12px; }
.sol-review-head { display: grid; gap: 10px; }
.sol-review-field { display: grid; gap: 3px; }
.sol-review-field span { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #64748b; }
.sol-review-field p { margin: 0; font-size: 14px; color: #0f172a; line-height: 1.4; overflow-wrap: anywhere; }
.sol-review-field strong { font-size: 14px; color: #0f172a; }
.sol-review-count { align-self: start; font-size: 13px; color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 999px; padding: 4px 12px; justify-self: start; }
.sol-review-count strong { font-size: 15px; }
.sol-review-list-wrap { max-height: 44vh; overflow: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
.sol-review-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sol-review-table thead th { position: sticky; top: 0; z-index: 1; background: #f8fafc; color: #64748b; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; text-align: left; padding: 8px 12px; border-bottom: 1px solid #e2e8f0; }
.sol-review-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.sol-review-table tbody tr:last-child td { border-bottom: 0; }
.sol-review-num { width: 34px; color: #94a3b8; font-variant-numeric: tabular-nums; text-align: right; }
.sol-review-name strong { display: block; font-size: 13.5px; color: #0f172a; font-weight: 700; overflow-wrap: anywhere; }
.sol-review-name span { display: block; font-size: 11.5px; color: #94a3b8; margin-top: 1px; }
.sol-review-qty { width: 64px; text-align: right; font-weight: 800; color: #1d4ed8; font-variant-numeric: tabular-nums; }
.sol-review-table thead th.sol-review-qty, .sol-review-table thead th.sol-review-num { text-align: right; }
.inv-cart-list { display: grid; align-content: start; gap: 12px; min-height: 0; max-height: none; overflow: auto; padding-right: 4px; }
.inv-cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 14px 16px; border: 1px solid #dbeafe; border-radius: 16px; background: #fff; }
.inv-cart-row.is-highlighted { border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.inv-cart-row-main { min-width: 0; display: grid; gap: 4px; }
.inv-cart-row-main strong { color: #0f172a; line-height: 1.2; overflow-wrap: anywhere; }
.inv-cart-row-main small { color: #64748b; font-size: 12px; font-weight: 800; }
.inv-cart-desc { display: block; margin-top: 2px; color: #475569; font-size: 11.5px; font-weight: 600; line-height: 1.4; white-space: pre-line; }
.inv-cart-specs { display: block; margin-top: 2px; color: #334155; font-size: 11px; line-height: 1.4; white-space: pre-line; }
.inv-cart-specs .inv-product-detail-tag { font-style: normal; }
.inv-cart-wh { display: block; margin-top: 2px; color: #64748b; font-size: 11px; font-weight: 700; }
.inv-cart-qty { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 8px; align-items: center; margin-top: 8px; }
.inv-cart-qty button { min-height: 42px; font-size: 20px; border: 1px solid #cbd5e1; border-radius: 11px; background: #fff; color: #0f172a; font-weight: 900; cursor: pointer; }
.inv-cart-qty input { width: 100%; min-width: 0; min-height: 42px; padding: 0 10px; border: 1px solid #dbeafe; border-radius: 11px; text-align: center; font: inherit; font-size: 16px; font-weight: 900; }
/* Ya hay botones -/+: ocultamos las flechas nativas del type=number que
   recortaban el numero (se veia "10C" al escribir 100). */
.inv-cart-qty input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.inv-cart-qty input[type="number"]::-webkit-outer-spin-button,
.inv-cart-qty input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
button.inv-cart-remove { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; line-height: 1; border: 1px solid #cbd5e1; border-radius: 11px; background: #fff; color: #be123c; font-size: 16px; font-weight: 900; cursor: pointer; }
button.inv-cart-remove:hover { border-color: #fecdd3; background: #fff1f2; }

/* Estado vacio del catalogo */
.inv-empty-state { margin: 8px 0 0; padding: 18px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #f8fafc; color: #64748b; text-align: center; }

/* Responsive: apila los paneles y libera el alto fijo en pantallas chicas */
@media (max-width: 860px) {
  .inv-request-workspace,
  .inv-request-workspace--touch { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .inv-request-workspace--touch .inv-request-panel,
  .inv-request-workspace--touch .inv-catalog-panel { height: auto; overflow: visible; display: flex; flex-direction: column; }
  .inv-request-workspace--touch .inv-catalog-grid { height: auto; overflow: visible; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .inv-request-panel { position: static; }
}

/* ============================================================================
   AUDITORÍA GLOBAL — interfaz portada del sistema hijo (grupobande).
   Tarjeta de filtros, tabla con filas expandibles, badges de nivel y paginación.
   ============================================================================ */
.inv-audit-head { align-items: flex-start; margin-bottom: 20px; }
.inv-audit-head h1 { margin-bottom: 4px; }
.inv-audit-head .page-actions { display: flex; align-items: center; justify-content: flex-end; }
.inv-audit-filter-card {
  padding: 18px; margin-bottom: 18px; border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px; background: #fff; box-shadow: 0 14px 34px rgba(15,23,42,.06);
}
.inv-audit-filters { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; align-items: end; }
.inv-audit-filters .field { display: grid; gap: 7px; margin: 0; }
.inv-audit-filters .field-label { margin: 0; color: #475569; font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.inv-audit-filters input,
.inv-audit-filters select {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #dbe3ef; border-radius: 10px;
  background: #fff; color: #0f172a; font: inherit; font-size: 14px; font-weight: 600; outline: 0;
}
.inv-audit-filters input:focus,
.inv-audit-filters select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.inv-audit-search { grid-column: span 2; }
.inv-audit-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.inv-audit-actions .btn { min-height: 40px; }
.inv-audit-table-card {
  padding: 0; overflow: hidden; border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px; background: #fff; box-shadow: 0 14px 34px rgba(15,23,42,.05);
}
.inv-audit-table-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid #e2e8f0;
}
.inv-audit-table-head h2 { margin: 4px 0 0; color: #0f172a; font-size: 18px; line-height: 1.2; }
.inv-audit-count {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 900; white-space: nowrap;
}
.inv-audit-table-wrap { border: 0; margin: 0; }
.inv-audit-table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.inv-audit-table th {
  padding: 13px 16px; background: #f8fafc; color: #64748b; font-size: 11px; font-weight: 900;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-align: left;
}
.inv-audit-table td { padding: 14px 16px; vertical-align: top; border-top: 1px solid #edf2f7; }
.inv-audit-table tbody tr:hover { background: #f8fbff; }
.inv-audit-table td strong { display: block; margin-bottom: 3px; color: #0f172a; }

.inv-audit-th-toggle { width: 44px; }
.inv-audit-toggle-cell { width: 44px; text-align: center; }
button.inv-audit-expand {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #475569; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.inv-audit-expand svg { width: 16px; height: 16px; transition: transform .15s ease; }
button.inv-audit-expand:hover { border-color: #1d4ed8; background: #eff6ff; color: #1d4ed8; }
.inv-audit-row.is-open .inv-audit-expand { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }
.inv-audit-row.is-open .inv-audit-expand svg { transform: rotate(180deg); }
.inv-audit-row.is-open > td { background: #f8fbff; }

.inv-audit-detail-row > td { border-top: 0; padding-top: 0; background: #f8fbff; }
.inv-audit-detail { border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; padding: 16px; display: grid; gap: 14px; }
.inv-audit-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 18px; }
.inv-audit-detail-grid > div { display: grid; gap: 3px; }
.inv-audit-detail-wide { grid-column: 1 / -1; }
.inv-audit-detail-k { font-size: 11px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; color: #94a3b8; }
.inv-audit-detail-v { color: #0f172a; font-weight: 700; word-break: break-word; }
.inv-audit-detail-meta { display: grid; gap: 6px; }
.inv-audit-meta-pre {
  margin: 0; padding: 12px 14px; background: #0f172a; color: #e2e8f0; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}

.inv-audit-pagination {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 16px; border-top: 1px solid #edf2f7;
}
.inv-audit-page-status { font-size: 13px; font-weight: 800; color: #475569; }
.inv-audit-page-nav.is-disabled { opacity: .45; pointer-events: none; cursor: default; }
.inv-audit-page-group { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.inv-audit-page-number,
.inv-audit-page-ellipsis {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 13px; font-weight: 900;
}
.inv-audit-page-number { border: 1px solid #e2e8f0; background: #fff; color: #475569; text-decoration: none; }
.inv-audit-page-number:hover { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; text-decoration: none; }
.inv-audit-page-number.is-active { border-color: #2563eb; background: #2563eb; color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.22); }
.inv-audit-page-ellipsis { color: #94a3b8; min-width: 22px; }
.inv-audit-page-jump { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0; }
.inv-audit-page-jump label { margin: 0; font-size: 12px; font-weight: 900; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.inv-audit-page-jump input {
  width: 76px; height: 36px; padding: 0 9px; border: 1px solid #dbeafe; border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 800; color: #0f172a; outline: 0;
}
.inv-audit-page-jump input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(147,197,253,.25); }

@media (max-width: 900px) {
  .inv-audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-audit-search { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .inv-audit-head .page-actions,
  .inv-audit-head .btn { width: 100%; }
  .inv-audit-filters { grid-template-columns: 1fr; }
  .inv-audit-actions,
  .inv-audit-actions .btn { width: 100%; }
}

/* ══ Almacén espejo (solo lectura) — portado de grupobande ══
   Antes vivía en un <style> al final de views/almacen/index.php, lo que causaba
   FOUC (el HTML se pintaba sin estilos y el CSS entraba al final). Movido aquí,
   al app.css render-blocking del <head>, para que esté presente en el primer
   paint. Todo va scopeado bajo #almacenEspejo, igual que antes. */
#almacenEspejo .inv-admin-stack { display: grid; gap: 18px; }
#almacenEspejo .inv-admin-panel { padding: 18px; border: 1px solid rgba(148,163,184,.24); border-radius: 18px; background: #fff; box-shadow: 0 12px 28px rgba(15,23,42,.05); }
#almacenEspejo .inv-admin-section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
#almacenEspejo .inv-admin-section-head h2 { margin: 4px 0 0; font-size: 18px; }
#almacenEspejo .inv-admin-list { display: grid; gap: 10px; }
#almacenEspejo .inv-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
#almacenEspejo .inv-admin-code { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 11px; font-weight: 900; }
#almacenEspejo .inv-admin-row-meta { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; text-align: right; }
#almacenEspejo .inv-admin-row-meta small { color: #64748b; font-size: 12.5px; }
#almacenEspejo .inv-admin-row-meta strong { color: #0f172a; }
#almacenEspejo .inv-prod-name { min-width: 0; }
#almacenEspejo .inv-prod-name strong { display: block; margin: 2px 0; color: #0f172a; font-weight: 700; font-size: 14.5px; }
#almacenEspejo .inv-prod-name small { display: block; color: #64748b; font-size: 12px; }
#almacenEspejo .inv-prod-desc { display: block; margin-top: 2px; color: #475569; font-size: 11.5px; font-weight: 600; line-height: 1.35; }
#almacenEspejo .inv-prod-spec { display: block; margin-top: 2px; color: #334155; font-size: 11.5px; line-height: 1.35; }
#almacenEspejo .inv-product-detail-tag { display: block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
#almacenEspejo .inv-empty-state { margin: 0; padding: 22px; border: 1px dashed #cbd5e1; border-radius: 16px; color: #64748b; text-align: center; background: #f8fafc; }

/* Selector de sede (el almacén de cada sede se consulta aparte, en el servidor) */
#almacenEspejo .alm-sede { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
#almacenEspejo .alm-sede label { color: #64748b; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
#almacenEspejo .alm-sede select { min-width: 220px; max-width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: #0f172a; font-size: 13.5px; font-weight: 700; }
#almacenEspejo .alm-sede select:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 1px; border-color: #1d4ed8; }
/* Aviso de que lo que se ve NO es la sede de trabajo del usuario. */
#almacenEspejo .alm-sede-flag { display: inline-flex; padding: 4px 10px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 900; }
@media (max-width: 560px) {
  #almacenEspejo .alm-sede select { flex: 1 1 100%; min-width: 0; }
}

/* Tabs */
#almacenEspejo .alm-tabs, #almacenEspejo .alm-subtabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
#almacenEspejo .alm-subtabs { margin-bottom: 14px; }
#almacenEspejo .alm-tab, #almacenEspejo .alm-subtab { padding: 9px 16px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: #475569; font-weight: 700; font-size: 13.5px; cursor: pointer; }
#almacenEspejo .alm-subtab { padding: 7px 13px; font-size: 12.5px; border-radius: 999px; }
#almacenEspejo .alm-tab:hover, #almacenEspejo .alm-subtab:hover { border-color: #bfdbfe; }
#almacenEspejo .alm-tab.is-active { border-color: #1d4ed8; background: #dbeafe; color: #1e3a8a; }
#almacenEspejo .alm-subtab.is-active { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }
#almacenEspejo .alm-pane, #almacenEspejo .alm-subpane { display: none; }
#almacenEspejo .alm-pane.is-active, #almacenEspejo .alm-subpane.is-active { display: block; }

/* Tarjetas de almacén */
#almacenEspejo .wh-hint { color: #94a3b8; font-size: 12.5px; font-weight: 700; }
#almacenEspejo .wh-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
#almacenEspejo .wh-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1.5px solid #e2e8f0; border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .16s, box-shadow .16s; text-align: left; }
#almacenEspejo .wh-card:hover { border-color: #bfdbfe; box-shadow: 0 6px 18px rgba(15,23,42,.07); }
#almacenEspejo .wh-card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
#almacenEspejo .wh-card.is-selected { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.16); background: #f5f9ff; }
#almacenEspejo .wh-card.is-inactive { opacity: .72; }
#almacenEspejo .wh-card--all { background: #f8fafc; }
#almacenEspejo .wh-card-top { display: grid; gap: 3px; }
#almacenEspejo .wh-card-top strong { font-size: 15px; color: #0f172a; }
#almacenEspejo .wh-card-top small { font-size: 12px; color: #64748b; }
#almacenEspejo .wh-card-desc { margin: 4px 0 0; font-size: 12px; color: #94a3b8; line-height: 1.4; }
#almacenEspejo .wh-card-badge { align-self: flex-start; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
#almacenEspejo .wh-card-badge--ok { background: #dcfce7; color: #166534; }
#almacenEspejo .wh-card-badge--off { background: #fee2e2; color: #b91c1c; }
#almacenEspejo .wh-card-badge--all { background: #dbeafe; color: #1d4ed8; }
#almacenEspejo .wh-card-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: auto; }
#almacenEspejo .wh-card-stats span { font-size: 12px; color: #64748b; font-weight: 700; }
#almacenEspejo .wh-card-stats strong { font-size: 18px; color: #0f172a; font-weight: 900; }
#almacenEspejo .wh-inv-search { max-width: 280px; }
#almacenEspejo .wh-inv-row[hidden] { display: none !important; }

/* Computación (eqx-*) */
#almacenEspejo .eqx-summary { margin: 0 0 14px; padding: 10px 14px; border-left: 4px solid #1e40af; border-radius: 8px; background: #f5f8ff; color: #334155; font-size: 13px; }
#almacenEspejo .eqx-summary strong { color: #0f172a; }
#almacenEspejo .eqx-models { display: grid; gap: 10px; }
#almacenEspejo .eqx-model { border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; overflow: hidden; }
#almacenEspejo .eqx-model[hidden] { display: none !important; }
#almacenEspejo .eqx-model-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; background: #fff; border: 0; cursor: pointer; text-align: left; flex-wrap: wrap; }
#almacenEspejo .eqx-model-head:hover { background: #f8fafc; }
#almacenEspejo .eqx-model-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
#almacenEspejo .eqx-model-name strong { font-size: 14.5px; color: #0f172a; }
#almacenEspejo .eqx-model-name small { color: #64748b; font-size: 12px; }
#almacenEspejo .eqx-caret { color: #94a3b8; font-weight: 900; transition: transform .15s; display: inline-block; }
#almacenEspejo .eqx-model.is-open .eqx-caret { transform: rotate(90deg); }
#almacenEspejo .eqx-model-meta { display: flex; gap: 6px; flex-wrap: wrap; }
#almacenEspejo .eqx-model-locs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 15px 12px; }
#almacenEspejo .eqx-locpill { padding: 3px 9px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 11.5px; font-weight: 700; }
#almacenEspejo .eqx-locpill--asig { background: #fef3c7; color: #92400e; }
#almacenEspejo .eqx-cchip { padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; background: #f1f5f9; color: #475569; }
#almacenEspejo .eqx-cond--optimo { background: #dcfce7; color: #166534; }
#almacenEspejo .eqx-cond--bueno { background: #dbeafe; color: #1d4ed8; }
#almacenEspejo .eqx-cond--regular { background: #fef9c3; color: #854d0e; }
#almacenEspejo .eqx-cond--danado { background: #fee2e2; color: #b91c1c; }
#almacenEspejo .eqx-cond--desechado { background: #e2e8f0; color: #334155; }
#almacenEspejo .eqx-cond--none { background: #f1f5f9; color: #94a3b8; }
#almacenEspejo .eqx-unitrow { border-top: 1px solid #f1f5f9; padding: 6px 12px 12px; overflow-x: auto; }
#almacenEspejo .eqx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#almacenEspejo .eqx-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #eef2f7; color: #64748b; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
#almacenEspejo .eqx-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; color: #0f172a; vertical-align: middle; }
#almacenEspejo .eqx-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#almacenEspejo .eqx-strong { font-weight: 700; }

/* En móvil las .eqx-table sueltas (equipos por usuario, etc.) tienen 5 columnas
   con encabezado nowrap y NO están en un contenedor con scroll (a diferencia de
   .eqx-units, que va dentro de .eqx-unitrow). Se hacen bloque con scroll propio:
   así se desplazan dentro de su caja sin empujar el ancho de toda la página. */
@media (max-width: 720px) {
  #almacenEspejo .eqx-table:not(.eqx-units) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* El reset global de <button> del padre (button:where(:not(.hamburger))) pinta
   de azul cualquier botón sin clase .btn-*. Estos overrides con selector
   #id button.clase (especificidad 1,1,1) lo neutralizan de forma explícita. */
#almacenEspejo button.alm-tab,
#almacenEspejo button.alm-subtab { background: #fff !important; color: #475569 !important; }
#almacenEspejo button.alm-tab:hover,
#almacenEspejo button.alm-subtab:hover { border-color: #bfdbfe; }
#almacenEspejo button.alm-tab.is-active { background: #dbeafe !important; color: #1e3a8a !important; }
#almacenEspejo button.alm-subtab.is-active { background: #1d4ed8 !important; color: #fff !important; }
#almacenEspejo button.eqx-model-head { background: #fff !important; color: #0f172a !important; }
#almacenEspejo button.eqx-model-head:hover { background: #f8fafc !important; }

/* Volver a la fila donde se estaba trabajando (anclas #oc-<id> / #cxp-<id>):
   deja aire bajo la barra superior fija para que la fila no quede tapada, y
   la resalta un instante para ubicarla de un vistazo. */
tr[data-order-row], .pagos-card { scroll-margin-top: calc(var(--nav-h) + 24px); }
tr[data-order-row]:target > td, .pagos-card:target { animation: row-target-flash 2.2s ease-out 1; }
@keyframes row-target-flash {
  0%, 35% { background-color: #fef9c3; }
  100%    { background-color: transparent; }
}

/* ── Comprobante de Retencion de IVA (formato SENIAT) ───────────────────────
   Estilos del parcial app/views/impuestos/_documento.php. Viven aqui (y no en
   un <style> dentro de la vista) porque el mismo documento se pinta en dos
   sitios: la pagina del comprobante guardado y la VISTA PREVIA inyectada en el
   modal del formulario de pago. Asi la previsualizacion se ve identica al
   comprobante definitivo, sin duplicar CSS ni reinyectar <style> en cada
   apertura del modal. El documento es siempre claro (papel), no sigue el tema. */
.crt-wrap{padding:8px 0}
.crt-doc{background:#fff;color:#111;max-width:1000px;margin:0 auto;border:1px solid #999;padding:18px 20px;font-size:12px}
.crt-head{display:flex;gap:16px;align-items:center;margin-bottom:12px}
.crt-logo{width:120px;flex:none;text-align:center}
.crt-logo img{max-width:120px;max-height:70px;object-fit:contain}
.crt-head-title{flex:1;text-align:center}
.crt-head-title strong{font-size:13px;display:block}
.crt-head-title p{font-size:8.5px;margin:4px 0 0;color:#333;line-height:1.3}
.crt-row{display:flex;border:1px solid #333;border-bottom:none}
.crt-row:last-of-type{border-bottom:1px solid #333}
.crt-cell{padding:3px 6px;border-right:1px solid #333;min-width:0}
.crt-cell:last-child{border-right:none}
.crt-cell.grow{flex:1}
.crt-cell.w-rif{width:210px;flex:none}
.crt-cell.w-num{width:150px;flex:none}
.crt-cell.w-date{width:150px;flex:none}
.crt-cell span{display:block;font-size:8px;color:#555;text-transform:uppercase}
.crt-cell strong{font-size:12px}
.crt-cell strong.thin{font-weight:500;font-size:10px}
.crt-tablewrap{overflow-x:auto;margin-top:12px}
.crt-table{width:100%;border-collapse:collapse;font-size:9px}
.crt-table th,.crt-table td{border:1px solid #333;padding:3px 4px;text-align:center;vertical-align:middle}
.crt-table thead th{background:#f0f0f0;font-size:8px;line-height:1.2}
.crt-group th{background:#dfe6ef;font-size:8.5px}
.crt-group th:first-child,.crt-group th:last-child{background:#fff;border:none}
.crt-table td.r{text-align:right}
.crt-table td.c{text-align:center}
.crt-totals td{font-weight:700;background:#f7f7f7}
.crt-money-note{font-size:9px;color:#555;margin:6px 2px}
.crt-signs{display:flex;justify-content:space-around;margin:34px 0 8px;text-align:center;font-size:11px}
.crt-signs .line{display:block;width:200px;border-top:1px solid #333;margin:0 auto 4px}
.crt-signs em{font-size:9px;color:#555}
.crt-legal{font-size:8px;color:#555;font-style:italic;text-align:center;margin-top:14px;border-top:1px solid #ccc;padding-top:6px}
@media print{.no-print{display:none!important}.crt-doc{border:none}}

/* Dentro de un modal el documento no lleva borde propio ni tope de ancho: el
   dialogo ya lo enmarca. Aplica a la vista previa del pago y al comprobante
   guardado que se abre desde el listado de Impuestos. */
#comprobantePreviewBody .crt-doc,
#crtModalBody .crt-doc{border:none;padding:0;max-width:none}
