/* ============================================================
   HallazgoX — Base CSS
   Plataforma de Control y Análisis
   Versión: 3.0 — Dos temas (dark / light) + fuente configurable
   Default: dark (nuevos usuarios inician en oscuro)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Roboto:wght@400;500;700;900&display=swap');

/* ── TOKENS NO DE COLOR + PALETA DEFAULT = DARK ────────────── */
:root {
  /* Fuentes — configurables por usuario */
  --font-family-user: "Inter";   /* override desde sesión */
  --font: var(--font-family-user), system-ui, -apple-system, sans-serif;
  --mono: "DM Mono", "Cascadia Code", "Courier New", monospace;
  --font-scale: 1;               /* compacto=.9 · normal=1 · grande=1.1 */

  /* Forma */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  /* ── ESCALA TIPOGRÁFICA CANÓNICA ────────────────────────── */
  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 13px;
  --fs-md:   14px;
  --fs-lg:   15px;
  --fs-xl:   16px;
  --fs-2xl:  20px;
  --fs-3xl:  22px;
  --fs-4xl:  24px;

  /* ── ESCALA DE ESPACIADO CANÓNICA ──────────────────────── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-7:  28px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* ── PALETA DARK (default) ────────────────────────────── */
  --bg:        #0b1220;
  --surface:   #0f1a2e;
  --surface2:  #0d1728;
  --surface3:  #08101e;
  --border:    #1e2a44;

  --accent:       #3b82f6;
  --accent-lt:    #60a5fa;
  --accent-dk:    #1e3a8a;
  --accent-rgb:   59, 130, 246;
  --accent-dk-rgb:30, 58, 138;
  --accent-bg:    rgba(var(--accent-rgb), .10);

  --accent-2:     #a78bfa;
  --accent-2-rgb: 167, 139, 250;

  --action:       #f97316;
  --action-rgb:   249, 115, 22;

  --green:        #22c55e;
  --red:          #ef4444;
  --yellow:       #f59e0b;
  --blue:         #3b82f6;
  --green-rgb:    34, 197, 94;
  --red-rgb:      239, 68, 68;
  --yellow-rgb:   245, 158, 11;
  --blue-rgb:     59, 130, 246;

  --text:         #e6edf7;
  --text-inverse: #0b1220;
  --muted:        #7c8fb0;
  --muted2:       #374151;
  --muted-rgb:    124, 143, 176;
  --border-rgb:   30, 42, 68;

  --shadow:       0 4px 24px rgba(0, 0, 0, .6);
  --shadow-sm:    0 2px 10px rgba(0, 0, 0, .4);
}

/* ═══════════════════════════════════════════════════════════
   TEMA · LIGHT (override cuando usuario elige claro)
   ═══════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:        #f4f7fb;
  --surface:   #ffffff;
  --surface2:  #edf1f8;
  --surface3:  #e4eaf4;
  --border:    #d6e0f0;

  --accent:       #2563eb;
  --accent-lt:    #60a5fa;
  --accent-dk:    #1e3a8a;
  --accent-rgb:   37, 99, 235;
  --accent-dk-rgb:30, 58, 138;
  --accent-bg:    rgba(var(--accent-rgb), .08);

  --accent-2:     #7c3aed;
  --accent-2-rgb: 124, 58, 237;

  --action:       #f97316;
  --action-rgb:   249, 115, 22;

  --green:        #16a34a;
  --red:          #dc2626;
  --yellow:       #d97706;
  --blue:         #2563eb;
  --green-rgb:    22, 163, 74;
  --red-rgb:      220, 38, 38;
  --yellow-rgb:   217, 119, 6;
  --blue-rgb:     37, 99, 235;

  --text:         #1e293b;
  --text-inverse: #ffffff;
  --muted:        #64748b;
  --muted2:       #94a3b8;
  --muted-rgb:    100, 116, 139;
  --border-rgb:   214, 224, 240;

  --shadow:       0 4px 20px rgba(30, 58, 138, .08);
  --shadow-sm:    0 2px 8px rgba(30, 58, 138, .05);
}

/* [data-theme="dark"] cae al :root — no requiere override */

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

html, body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: calc(var(--fs-lg) * var(--font-scale));
  font-weight: 400;
  letter-spacing: .1px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── NAVBAR ─────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar-brand {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--accent);
  text-decoration: none;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-base);
}
.navbar-usuario {
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-base);
}
.navbar-empresa {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), .08);
  border: 1px solid rgba(var(--accent-rgb), .2);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: .3px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-nav {
  padding: 6px 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* ── TABLA ORDENABLE ─────────────────────────────────────────── */
thead th.th-sortable { cursor: pointer; user-select: none; position: relative; padding-right: 22px; }
thead th.th-sortable::after {
  content: "⇅";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .3;
  font-size: .7em;
}
thead th[data-sort-asc]::after  { content: "▲"; opacity: 1; color: var(--accent); }
thead th[data-sort-desc]::after { content: "▼"; opacity: 1; color: var(--accent); }

/* ── NAV MÓDULO ACTIVO ───────────────────────────────────────── */
.nav-menu-panel a.nav-activo {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ── NAV DROPDOWN MENU ───────────────────────────────────────── */
.navbar-left { display: flex; align-items: center; }
.nav-menu-wrap { position: relative; display: inline-block; margin-left: 12px; }
.nav-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 220px;
  z-index: 200;
  padding: 6px;
}
.nav-menu-panel a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-sm);
  border-radius: 8px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-menu-panel a:hover { background: var(--surface2); color: var(--accent); }
.nav-sep { height: 1px; background: var(--border); margin: 4px 8px; }

/* ── NOTIFICACIONES ─────────────────────────────────────────── */
.noti-wrap { position: relative; display: inline-block; }
.noti-btn {
  padding: 6px 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  font-size: var(--fs-sm);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font);
  transition: all .2s;
}
.noti-btn:hover { border-color: var(--accent); color: var(--accent); }
.noti-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
}
.noti-badge.noti-critica { background: #dc2626; animation: noti-pulse .8s ease-in-out infinite alternate; }
.noti-badge.noti-alta    { background: #ea580c; }
@keyframes noti-pulse { from { opacity: 1; } to { opacity: .55; } }
.noti-panel {
  display: none;
  position: absolute;
  right: 0;
  top: 44px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 280px;
  z-index: 999;
  overflow: hidden;
}
.noti-panel a {
  display: block;
  padding: 12px 16px;
  font-size: var(--fs-base);
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.noti-panel a:hover { background: var(--surface3); }

/* ── CONTENIDO ──────────────────────────────────────────────── */
/*
   Contenedores canónicos (usar estos):
     .contenido    → páginas estándar        (1440px)
     .contenido-sm → formularios / detalles  ( 720px)
     .contenido-xl → tablas anchas           (1600px)

   Aliases mantenidos por compatibilidad (no usar en código nuevo):
     .contenido-xs ≈ más angosto que sm      ( 600px)
     .contenido-md ≈ entre std y xl          (1100px)
     .page-wrap    = idéntico a .contenido   (1440px)
     .page-wrap-sm = idéntico a .contenido-sm( 720px)
     .page-wrap-md ≈ entre std y xl          (1000px)
*/
.contenido    { max-width: 1440px; margin: 0 auto; padding: 32px 28px; }
.contenido-sm { max-width:  720px; margin: 0 auto; padding: 32px 24px; }
.contenido-xl { max-width: 1600px; margin: 0 auto; padding: 32px 28px; }

/* ── Aliases de compatibilidad — no usar en código nuevo ────── */
.contenido-xs { max-width: 600px;  margin: 60px auto; padding: 0 24px; }
.contenido-md { max-width: 1100px; margin: 0 auto;    padding: 32px 24px; }

/* ── TIPOGRAFÍA ─────────────────────────────────────────────── */
/* Escala canónica: 4 niveles — NO sobreescribir en archivos locales */
h1, .titulo-pagina, .page-title {
  font-size: var(--fs-4xl);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.2;
  text-align: left;
}
h2 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
h3 {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
h4 {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.breadcrumb { font-size: var(--fs-base); color: var(--muted2); margin-bottom: 20px; }
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color .15s; }
.breadcrumb a:hover { color: var(--accent); }

/* ── CARDS ──────────────────────────────────────────────────── */
.card, .panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.card-carga {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 40px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card h3, .panel h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  text-align: left;
}

/* ── TABLAS ─────────────────────────────────────────────────── */
.tabla-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 20px;
  width: 100%;
}
.tabla-wrap-scroll {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: auto;
  margin-bottom: 20px;
  width: 100%;
}

/*
  table-layout: auto — el navegador distribuye el ancho según el contenido.
  overflow-x: auto en .tabla-wrap habilita scroll horizontal cuando la
  tabla supera el viewport en pantallas pequeñas.
  Los th con min-width evitan que columnas clave colapsen demasiado.
*/
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

/* ── Anchos mínimos por tipo de columna ──────────────────────────
   Aplica la clase al <th> correspondiente en cada template.
   El navegador respetará estos mínimos y distribuirá el resto
   proporcional al contenido real de cada columna.              */
thead th              { min-width: 60px; }               /* mínimo global   */
thead th.col-id,
thead th.col-folio    { min-width: 60px;  width: 6%; }   /* ID / Folio      */
thead th.col-sku      { min-width: 130px; width: 10%; }  /* SKU             */
thead th.col-desc,
thead th.col-descripcion { min-width: 200px; }           /* Descripción     */
thead th.col-nombre   { min-width: 160px; }              /* Nombre largo    */
thead th.col-sucursal { min-width: 150px; width: 14%; }  /* Sucursal        */
thead th.col-creado   { min-width: 140px; width: 12%; }  /* Creado por      */
thead th.col-fecha    { min-width: 100px; width: 9%; }   /* Fecha           */
thead th.col-hora     { min-width: 70px;  width: 6%; }   /* Hora            */
thead th.col-estado   { min-width: 110px; width: 10%; }  /* Estado/badge    */
thead th.col-num      { min-width: 70px;  width: 7%; }   /* Número corto    */
thead th.col-skus     { min-width: 70px;  width: 7%; }   /* SKUs / count    */
thead th.col-accion   { min-width: 90px;  width: 8%; }   /* Acción/botón    */
thead th.col-dinero   { min-width: 100px; width: 9%; }   /* Monto/costo     */
thead th.col-pct      { min-width: 80px;  width: 7%; }   /* Porcentaje      */

thead th {
  background: var(--surface2);
  padding: 13px 12px;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
thead th:hover { color: var(--accent); }

tbody td {
  padding: 14px 12px;
  text-align: left;
  font-size: var(--fs-md);
  line-height: 1.4;
  border-bottom: 1px solid rgba(var(--border-rgb), .5);
  color: var(--text);
  vertical-align: middle;
  /* Sin truncado global — cada columna controla su propio overflow */
}
/* Columnas de texto largo — muestran el contenido completo con wrap */
tbody td.td-wrap,
tbody td.td-desc,
tbody td.td-nombre { white-space: normal; overflow: visible; text-overflow: unset; }
/* Columnas cortas (código, fecha, badge) — no hacen wrap pero no truncan */
tbody td.td-nowrap { white-space: nowrap; }
/* Truncado INTENCIONAL para notas/campos muy largos — siempre acompañar de title="" */
tbody td.td-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  cursor: help;
}
/* Columnas de valores numéricos — alineación derecha canónica */
tbody td.td-num,
tbody td.td-dinero,
tbody td.td-pct    { text-align: right; font-family: var(--mono); white-space: nowrap; }
tfoot td {
  padding: 13px 16px;
  text-align: left;
  font-size: var(--fs-md);
  font-weight: 700;
  background: var(--surface2);
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
.tabla-vacia, .vacio { text-align: center; padding: 48px; color: var(--muted); font-size: var(--fs-md); }

/* ── BOTONES ────────────────────────────────────────────────── */
.btn, button {
  padding: 8px 18px;
  background: var(--accent-dk);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  font-family: var(--font);
}
.btn:hover, button:hover { background: var(--accent); color: #062040; }

.btn-secundario { background: var(--surface3); color: var(--text); border: 1px solid var(--border); }
.btn-secundario:hover { background: var(--surface2); color: var(--accent); border-color: var(--accent); }

.btn-peligro { background: rgba(var(--red-rgb), .08); color: var(--red); border: 1px solid rgba(var(--red-rgb), .3); }
.btn-peligro:hover { background: rgba(var(--red-rgb), .16); }

.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); background: var(--accent-bg); }

.btn-ghost { background: var(--surface2); color: var(--muted); border: none; }
.btn-ghost:hover { background: var(--surface3); color: var(--accent); }

.btn-sm   { padding: 4px 10px; font-size: var(--fs-sm); border-radius: 6px; }
.btn-lg   { padding: 12px 28px; font-size: var(--fs-md); border-radius: 10px; }
.btn-full { width: 100%; justify-content: center; }

/* .btn-exportar — ALIAS DEPRECADO de .btn.btn-lg — no usar en código nuevo */
.btn-exportar {
  padding: 9px 18px;
  background: var(--accent-dk);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  font-family: var(--font);
}
.btn-exportar:hover { background: var(--accent); color: #062040; }

/* ── FORMULARIOS ────────────────────────────────────────────── */
/* Definición canónica única de etiqueta */
label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 12px;
}
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: var(--fs-base);
  outline: none;
  background: var(--surface2);
  font-family: var(--font);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12);
}
input:disabled, select:disabled, textarea:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: var(--surface3);
}
input[readonly], select[readonly], textarea[readonly] {
  background: var(--surface3);
  cursor: default;
  color: var(--muted);
}
input::placeholder, textarea::placeholder { color: var(--muted2); }
select option { background: var(--surface2); color: var(--text); }
textarea { min-height: 70px; resize: vertical; }
.form-row { margin-bottom: 14px; }
.form-row label { margin-top: 0; }

/* ── CAMPO REQUERIDO — indicador visual ─────────────────────── */
label.requerido::after,
label[data-req]::after {
  content: " *";
  color: var(--red);
  font-weight: 700;
}

/* ── ZONA DE CARGA ──────────────────────────────────────────── */
.zona-carga {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 20px;
  position: relative;
}
.zona-carga:hover  { border-color: var(--accent); background: var(--accent-bg); }
.zona-carga.activa { border-color: var(--accent); background: var(--accent-bg); }
.zona-carga input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.zona-icono    { font-size: 28px; margin-bottom: 8px; }
.zona-texto    { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: 4px; }
.zona-subtexto { font-size: var(--fs-sm); color: var(--muted); }
.nombre-archivo {
  font-size: var(--fs-base); color: var(--green); font-weight: 600;
  margin-bottom: 16px; display: none;
  padding: 8px 14px; background: rgba(var(--green-rgb), .08); border-radius: 8px;
  border: 1px solid rgba(var(--green-rgb), .2);
}

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.badge-borrador              { background: rgba(var(--muted-rgb), .1);   color: var(--muted);   border: 1px solid rgba(var(--muted-rgb), .2);   }
.badge-revision              { background: rgba(var(--yellow-rgb), .1);  color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .25); }
.badge-en-revision           { background: rgba(var(--yellow-rgb), .1);  color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .25); }
.badge-validado              { background: rgba(var(--blue-rgb), .1);    color: var(--blue);    border: 1px solid rgba(var(--blue-rgb), .25);   }
.badge-aprobado              { background: rgba(var(--green-rgb), .1);   color: var(--green);   border: 1px solid rgba(var(--green-rgb), .25);  }
.badge-ajuste-aprobado       { background: rgba(var(--green-rgb), .1);   color: var(--green);   border: 1px solid rgba(var(--green-rgb), .25);  }
.badge-ajuste-parcial        { background: rgba(var(--accent-rgb), .1);  color: var(--accent);  border: 1px solid rgba(var(--accent-rgb), .25); }
.badge-rechazado             { background: rgba(var(--red-rgb), .1);     color: var(--red);     border: 1px solid rgba(var(--red-rgb), .25);    }
.badge-cancelado             { background: rgba(var(--red-rgb), .1);     color: var(--red);     border: 1px solid rgba(var(--red-rgb), .25);    }
.badge-oculto                { background: rgba(var(--muted-rgb), .1);   color: var(--muted);   border: 1px solid rgba(var(--muted-rgb), .2);   }
.badge-abierto               { background: rgba(var(--blue-rgb), .1);    color: var(--blue);    border: 1px solid rgba(var(--blue-rgb), .25);   }
.badge-cerrado               { background: rgba(var(--green-rgb), .1);   color: var(--green);   border: 1px solid rgba(var(--green-rgb), .25);  }
.badge-solicitado            { background: rgba(var(--blue-rgb), .1);    color: var(--blue);    border: 1px solid rgba(var(--blue-rgb), .25);   }
.badge-tomado                { background: rgba(var(--yellow-rgb), .1);  color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .25); }
.badge-alto                  { background: rgba(var(--red-rgb), .12);    color: var(--red);     border: 1px solid rgba(var(--red-rgb), .3);     }
.badge-medio                 { background: rgba(var(--yellow-rgb), .12); color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .3);  }
.badge-bajo                  { background: rgba(var(--green-rgb), .1);   color: var(--green);   border: 1px solid rgba(var(--green-rgb), .25);  }
.badge-completado            { background: rgba(var(--green-rgb), .1);   color: var(--green);   border: 1px solid rgba(var(--green-rgb), .25);  }
.badge-editado               { background: rgba(var(--yellow-rgb), .1);  color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .25); }
.badge-cancelacion-pendiente { background: rgba(var(--yellow-rgb), .1);  color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .25); }
.badge-reactivacion-pendiente{ background: rgba(var(--accent-rgb), .1);  color: var(--accent);  border: 1px solid rgba(var(--accent-rgb), .25); }
.badge-alerta                { background: rgba(var(--red-rgb), .1);     color: var(--red);     border: 1px solid rgba(var(--red-rgb), .2);     }
.badge-atencion              { background: rgba(var(--yellow-rgb), .1);  color: var(--yellow);  border: 1px solid rgba(var(--yellow-rgb), .2);  }
.badge-ok                    { background: rgba(var(--green-rgb), .1);   color: var(--green);   border: 1px solid rgba(var(--green-rgb), .2);   }
.badge-yacontado             { background: rgba(var(--accent-rgb), .1);  color: var(--accent);  border: 1px solid rgba(var(--accent-rgb), .2);  }
.badge-detectado             { background: rgba(var(--blue-rgb), .1);    color: var(--blue);    border: 1px solid rgba(var(--blue-rgb), .2);    }
.badge-vacio                 { background: rgba(var(--muted-rgb), .1);   color: var(--muted);   border: 1px solid rgba(var(--muted-rgb), .2);   }

.badge.abierto   { background: rgba(var(--red-rgb), .1);    color: var(--red);    border: 1px solid rgba(var(--red-rgb), .25);    }
.badge.proceso   { background: rgba(var(--yellow-rgb), .1); color: var(--yellow); border: 1px solid rgba(var(--yellow-rgb), .25); }
.badge.cerrado   { background: rgba(var(--green-rgb), .1);  color: var(--green);  border: 1px solid rgba(var(--green-rgb), .25);  }
.badge.cancelado { background: rgba(var(--muted-rgb), .1);  color: var(--muted);  border: 1px solid rgba(var(--muted-rgb), .2);   }

/* ── DIFERENCIAS ────────────────────────────────────────────── */
.dif-neg       { color: var(--red);    font-weight: 700; }
.dif-pos       { color: var(--green);  font-weight: 700; }
.dif-ok        { color: var(--accent); font-weight: 700; }
.fila-faltante { background: rgba(var(--red-rgb),  .05) !important; }
.fila-sobrante { background: rgba(var(--green-rgb),.05) !important; }
.sin-stock     { color: var(--red); font-weight: 600; }

/* ── MENSAJES ───────────────────────────────────────────────── */
.error        { background: rgba(var(--red-rgb), .08);    color: var(--red);    border: 1px solid rgba(var(--red-rgb), .25);    border-radius: 8px; padding: 10px 14px; font-size: var(--fs-base); margin-bottom: 12px; }
.exito        { background: rgba(var(--green-rgb), .08);  color: var(--green);  border: 1px solid rgba(var(--green-rgb), .25);  border-radius: 8px; padding: 10px 14px; font-size: var(--fs-base); margin-bottom: 12px; }
.aviso        { background: rgba(var(--yellow-rgb), .08); color: var(--yellow); border: 1px solid rgba(var(--yellow-rgb), .25); border-radius: 8px; padding: 10px 14px; font-size: var(--fs-base); margin-bottom: 12px; }
.aviso-naranja { background: rgba(var(--yellow-rgb), .07); border: 1px solid rgba(var(--yellow-rgb), .2); border-radius: 10px; padding: 12px 16px; font-size: var(--fs-base); color: var(--yellow); margin-bottom: 16px; }
.aviso-verde   { background: rgba(var(--green-rgb), .07);  border: 1px solid rgba(var(--green-rgb), .2);  border-radius: 10px; padding: 12px 16px; font-size: var(--fs-base); color: var(--green);  margin-bottom: 16px; }

/* ── MODALES ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 5000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.visible,
.modal-overlay.activo { display: flex; }
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.modal-content h3 {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--text);
  text-align: center;
}
.modal-titulo {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
  text-align: center;
}
.modal-content p  { font-size: var(--fs-base); color: var(--muted); margin-bottom: 16px; }
.modal-botones, .modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── PANEL ACCIÓN ───────────────────────────────────────────── */
.panel-accion {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-accion p { font-size: var(--fs-md); color: var(--text); font-weight: 500; margin: 0; }
.panel-accion-botones { display: flex; gap: 10px; flex-wrap: wrap; }
.panel-accion-danger  { background: rgba(var(--red-rgb),    .04); border-color: rgba(var(--red-rgb), .2);    }
.panel-accion-warning { background: rgba(var(--yellow-rgb), .04); border-color: rgba(var(--yellow-rgb), .2); }

/* ── HISTORIAL ──────────────────────────────────────────────── */
.historial {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}
.historial h3 { font-size: var(--fs-md); font-weight: 700; margin-bottom: 14px; color: var(--text); text-align: center; }
.historial-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-base);
}
.historial-item:last-child { border-bottom: none; }
.historial-fecha   { color: var(--muted2); min-width: 140px; font-size: var(--fs-sm); }
.historial-usuario { font-weight: 600; color: var(--accent); min-width: 140px; }
.historial-accion  { color: var(--muted); }

/* ── CONTEO HEADER ──────────────────────────────────────────── */
.conteo-header {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.conteo-header-top {
  display: flex; justify-content: space-between;
  align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 20px;
}
/* Corregido: alineado con el h2 global (--fs-2xl: 20px) */
.conteo-titulo h2 { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); text-align: center; }
.conteo-titulo p  { font-size: var(--fs-base); color: var(--muted); margin-top: 4px; text-align: center; }

/* ── FLUJO DE ETAPAS ────────────────────────────────────────── */
.flujo { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; }
.etapa {
  display: flex; flex-direction: column; align-items: center;
  min-width: 160px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface2); flex: 1;
}
.etapa.completada { background: rgba(var(--green-rgb),  .06); border-color: rgba(var(--green-rgb), .3);  }
.etapa.activa     { background: rgba(var(--accent-rgb), .06); border-color: rgba(var(--accent-rgb), .35);}
.etapa-icono  { font-size: 20px; margin-bottom: 4px; }
.etapa-rol    { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted2); margin-bottom: 2px; }
.etapa-nombre { font-size: var(--fs-sm); font-weight: 600; color: var(--text); text-align: center; }
.etapa-fecha  { font-size: var(--fs-xs); color: var(--muted2); margin-top: 2px; }

/* ── KPIs ───────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; box-shadow: var(--shadow-sm); text-align: center; }
.kpi-valor         { font-size: 26px; font-weight: 800; color: var(--text); }
.kpi-valor.rojo    { color: var(--red);    }
.kpi-valor.verde   { color: var(--green);  }
.kpi-valor.naranja { color: var(--yellow); }
.kpi-valor.morado  { color: var(--accent); }
.kpi-label { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; margin-top: 4px; }
.kpi-sub   { font-size: var(--fs-sm); color: var(--muted2); margin-top: 4px; }

/* ── BARRA PROGRESO ─────────────────────────────────────────── */
.barra-wrap { height: 8px; background: var(--surface3); border-radius: 999px; overflow: hidden; margin: 0 0 16px; }
.barra { height: 100%; width: 0%; background: var(--accent-dk); transition: width .3s; border-radius: 999px; }

/* ── GRIDS ──────────────────────────────────────────────────── */
.grid-1 { display: grid; grid-template-columns: 1fr;     gap: 20px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── TOAST (legacy) ─────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 22px;
  font-size: var(--fs-base);
  font-weight: 500;
  z-index: 9999;
  transition: transform .28s ease;
  box-shadow: var(--shadow);
  color: var(--text);
  white-space: nowrap;
}
#toast.show        { transform: translateX(-50%) translateY(0); }
#toast.toast-ok    { border-color: rgba(var(--green-rgb),  .4); color: var(--green);  }
#toast.toast-error { border-color: rgba(var(--red-rgb),    .4); color: var(--red);    }
#toast.toast-warn  { border-color: rgba(var(--yellow-rgb), .4); color: var(--yellow); }

/* ── DASHBOARD MÓDULOS ──────────────────────────────────────── */
.modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.modulo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.modulo-card:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(var(--accent-rgb), .15); transform: translateY(-2px); }
.modulo-icon  { font-size: 32px; margin-bottom: 12px; }
.modulo-nombre{ font-size: var(--fs-xl); font-weight: 700; color: var(--text); margin-bottom: 6px; }
.modulo-desc  { font-size: var(--fs-base); color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.modulo-tag   { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; background: rgba(var(--green-rgb), .1); color: var(--green); border: 1px solid rgba(var(--green-rgb), .2); }

.bienvenida { margin-bottom: 28px; }
.subtitulo  { font-size: var(--fs-md); color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 10px; }

/* ── BADGE ROL ──────────────────────────────────────────────── */
.badge-rol     { padding: 3px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; }
.rol-ALMACEN   { background: rgba(var(--blue-rgb),   .1); color: var(--blue);   border: 1px solid rgba(var(--blue-rgb),   .2); }
.rol-GERENTE   { background: rgba(var(--yellow-rgb), .1); color: var(--yellow); border: 1px solid rgba(var(--yellow-rgb), .2); }
.rol-AUDITOR   { background: rgba(var(--accent-rgb), .1); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .2); }
.rol-DIRECCION { background: rgba(var(--green-rgb),  .1); color: var(--green);  border: 1px solid rgba(var(--green-rgb),  .2); }
.rol-SISTEMAS  { background: rgba(var(--muted-rgb),  .1); color: var(--muted);  border: 1px solid rgba(var(--muted-rgb),  .2); }

/* ── LOGIN ──────────────────────────────────────────────────── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  margin: 80px auto;
  box-shadow: var(--shadow);
}
.logo { font-size: var(--fs-4xl); font-weight: 700; color: var(--accent); margin-bottom: 8px; text-align: center; }

/* ── USUARIOS ───────────────────────────────────────────────── */
.usuario-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s;
}
.usuario-card:hover    { border-color: var(--accent); }
.usuario-card.inactivo { opacity: .45; }
.usuario-info    { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 200px; }
.usuario-avatar  {
  width: 42px; height: 42px; border-radius: 999px;
  background: var(--accent-dk); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl); font-weight: 700; flex-shrink: 0;
}
.usuario-avatar.inactivo { background: var(--surface3); }
.usuario-nombre   { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.usuario-email    { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.usuario-meta     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.usuario-sucursal { font-size: var(--fs-sm); color: var(--muted); }
.usuario-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.filtros-usuarios {
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 14px 20px; margin-bottom: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.contador-usuarios { font-size: var(--fs-base); color: var(--muted); margin-left: auto; }

/* ── ERRORES ────────────────────────────────────────────────── */
.error-card     { text-align: center; padding: 80px 40px; max-width: 500px; margin: 0 auto; }
.error-codigo   { font-size: 80px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 16px; }
.error-titulo   { font-size: var(--fs-4xl); font-weight: 700; margin-bottom: 10px; text-align: center; }
.error-desc     { font-size: var(--fs-md); color: var(--muted); margin-bottom: 28px; line-height: 1.7; text-align: center; }
.error-acciones { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.error-rol      { font-size: var(--fs-sm); color: var(--muted2); margin-top: 20px; text-align: center; }

/* ── BITÁCORA / FILTROS ─────────────────────────────────────── */
.filtros {
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 16px 20px; margin-bottom: 20px;
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; box-shadow: var(--shadow-sm);
}
.filtro-label       { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.filtro-item-header { display: flex; flex-direction: column; }

/* ── SOLICITUDES ────────────────────────────────────────────── */
.skus-seleccionados-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0; min-height: 32px; padding: 6px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface2);
}
.tag {
  background: rgba(var(--accent-rgb), .1); color: var(--accent);
  padding: 3px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600;
  border: 1px solid rgba(var(--accent-rgb), .25);
}
.sku-lista { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
.sku-item  {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-base); cursor: pointer; color: var(--text);
}
.sku-item:hover { background: var(--surface2); }
.sku-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* ── INVENTARIO GENERAL ─────────────────────────────────────── */
.header-inv {
  background: var(--surface); border-radius: 16px; border: 1px solid var(--border);
  padding: 20px 28px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.panel-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; }
.stat        { text-align: center; }
.stat-valor  { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-label  { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ── FILTROS DASHBOARD ──────────────────────────────────────── */
.filtros-dashboard {
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 16px 20px; margin-bottom: 24px;
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow-sm);
}
.filtros-dashboard label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.filtros-dashboard select,
.filtros-dashboard input[type="date"] {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  font-size: var(--fs-base); outline: none; background: var(--surface2); font-family: var(--font); color: var(--text);
}
.filtros-dashboard select:focus,
.filtros-dashboard input[type="date"]:focus { border-color: var(--accent); }
.filtros-nota { margin-left: auto; font-size: var(--fs-base); color: var(--muted); align-self: center; }

/* ── CHART CARDS ────────────────────────────────────────────── */
.chart-card { background: var(--surface); border-radius: 16px; border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow-sm); }
.chart-card h3   { font-size: var(--fs-md); font-weight: 700; color: var(--text); margin-bottom: 20px; text-align: center; }
.chart-wrap      { position: relative; height: 280px; }
.chart-wrap-tall { position: relative; height: 340px; }
.seccion-titulo  { font-size: var(--fs-base); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted2); margin: 28px 0 14px; text-align: center; }

/* ── FOOTER ─────────────────────────────────────────────────── */
.footer { text-align: center; margin-top: 60px; font-size: var(--fs-sm); color: var(--muted2); padding-bottom: 32px; }

/* ── UTILIDADES ─────────────────────────────────────────────── */
/* CORREGIDO: .text-left apuntaba a center — era un bug crítico */
.text-left   { text-align: left    !important; }
.text-center { text-align: center  !important; }
.text-right  { text-align: right   !important; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: var(--fs-sm); }
.font-bold   { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-center  { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rojo    { color: var(--red)    !important; }
.verde   { color: var(--green)  !important; }
.naranja { color: var(--yellow) !important; }
.azul    { color: var(--blue)   !important; }
.gray    { color: var(--muted)  !important; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */

/* ── Tablet grande / desktop pequeño (≤ 1024px) ─────────────── */
@media (max-width: 1024px) {
  .contenido, .contenido-xl { padding: 24px 20px; }
  .modulos { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ── Tablet / mobile grande (≤ 768px) ───────────────────────── */
@media (max-width: 768px) {
  .grid-2      { grid-template-columns: 1fr; }
  .contenido, .contenido-md { padding: 20px 16px; }
  .contenido-sm, .contenido-xs { padding: 20px 16px; margin-top: 20px; }
  .navbar      { padding: 0 16px; }
  .flujo       { flex-direction: column; }
  .modulos     { grid-template-columns: 1fr; }
  .kpis        { grid-template-columns: repeat(2, 1fr); }
  .panel-accion { flex-direction: column; align-items: flex-start; }
  .filtros      { flex-direction: column; align-items: stretch; }

  /* Navbar responsive — ocultar items secundarios */
  .navbar-right .btn-nav:not(.btn-nav-keep) { display: none; }
  .navbar-right .navbar-empresa             { display: none; }
}

/* ── Mobile pequeño (≤ 480px) ───────────────────────────────── */
@media (max-width: 480px) {
  .contenido, .contenido-sm, .contenido-md,
  .contenido-xl, .contenido-xs,
  .page-wrap, .page-wrap-sm, .page-wrap-md { padding: 16px 12px; }
  .kpis         { grid-template-columns: 1fr 1fr; }
  .card, .panel { padding: 16px; }
  .modal-content { padding: 20px 16px; border-radius: var(--radius); }
  h1, .titulo-pagina { font-size: var(--fs-2xl); }
  .btn-lg       { padding: 10px 20px; }
}

/* ── TOAST NOTIFICATIONS ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 12px;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  pointer-events: all;
  cursor: pointer;
  opacity: 0;
  transform: translateX(40px);
  animation: toastIn .3s ease forwards;
  border-left: 4px solid transparent;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.toast.saliendo { animation: toastOut .3s ease forwards; }
.toast.exito    { border-left-color: var(--green);  }
.toast.error    { border-left-color: var(--red);    }
.toast.info     { border-left-color: var(--blue);   }
.toast.alerta   { border-left-color: var(--yellow); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; color: var(--text); }
@keyframes toastIn  { to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(50px); } }

/* ── UTILIDADES EXTENDIDAS ──────────────────────────────────── */

/* Botón primario — acento máximo */
.btn-primary {
  background: var(--accent);
  color: #062040;
  border: none;
  font-weight: 700;
}
/* CORREGIDO: --accent-lt ahora está definida en :root */
.btn-primary:hover { background: var(--accent-lt); color: #062040; }

/* Botón peligro sólido */
.btn-danger  { background: var(--red);  color: #fff; border: none; }
.btn-danger:hover { background: #c22020; color: #fff; }

/* Layout — alias de .contenido (compatibilidad) */
.page-wrap    { max-width: 1440px; margin: 0 auto; padding: 32px 28px; }
.page-wrap-sm { max-width:  720px; margin: 0 auto; padding: 32px 24px; }
.page-wrap-md { max-width: 1000px; margin: 0 auto; padding: 32px 24px; }

/* Cabecera de página */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-sub {
  font-size: var(--fs-base);
  color: var(--muted);
  margin: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  opacity: .6;
}
.empty-state p {
  font-size: var(--fs-md);
  margin-bottom: 20px;
}

/* Formularios — aliases compatibles con Bootstrap-like markup */
.form-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: var(--fs-base);
  outline: none;
  background: var(--surface2);
  font-family: var(--font);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12);
}
.form-control::placeholder { color: var(--muted2); }
.form-group { margin-bottom: 16px; }

@media (max-width: 768px) {
  .page-wrap, .page-wrap-sm, .page-wrap-md { padding: 20px 16px; }
  .page-header { flex-direction: column; }
}

/* ── SEMÁFORO DE PERECEDEROS ────────────────────────────────── */
.sem-chip {
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  color: #1a1a1a;  /* oscuro fijo — los chips tienen fondo pastel claro siempre */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.chip-ROJO     { background: #fca5a5; }
.chip-NARANJA  { background: #fdba74; }
.chip-AMARILLO { background: #fde68a; }
.chip-VERDE    { background: #6ee7b7; }
.chip-SIN_FECHA{ background: #e5e7eb; color: #6b7280; }

.sem-row-ROJO     { border-left: 3px solid var(--red);    }
.sem-row-NARANJA  { border-left: 3px solid #fb923c;       }
.sem-row-AMARILLO { border-left: 3px solid var(--yellow); }
.sem-row-VERDE    { border-left: 3px solid var(--green);  }
.sem-row-SIN_FECHA{ border-left: 3px solid #9ca3af;       }

.sem-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.sem-dot-ROJO     { background: var(--red);    }
.sem-dot-NARANJA  { background: #fb923c;       }
.sem-dot-AMARILLO { background: var(--yellow); }
.sem-dot-VERDE    { background: var(--green);  }
.sem-dot-SIN_FECHA{ background: #9ca3af;       }

/* ── CELDAS DE TABLA — inventario / conteos / solicitudes ───── */
.celda-dif         { font-weight: 700; font-family: var(--mono); white-space: nowrap; }
.celda-impacto     { font-weight: 600; white-space: nowrap; text-align: right !important; }
.celda-nivel       { text-align: center !important; }
.celda-unidad      { font-size: var(--fs-xs); color: var(--muted); text-align: center !important; white-space: nowrap; }
.celda-costo-total { font-weight: 700; font-family: var(--mono); text-align: right !important; }
.celda-sistema     { font-family: var(--mono); text-align: right !important; }

.fila-dato         { cursor: default; }
.fila-total td     { font-weight: 700; background: var(--surface2) !important; border-top: 2px solid var(--border); }

/* Modificadores de .stat para contadores faltantes/sobrantes */
.stat.faltantes .stat-valor { color: var(--red);   }
.stat.sobrantes .stat-valor { color: var(--green); }

/* Checkbox de aprobación */
.chk-aprobar {
  width: 18px !important;
  height: 18px !important;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Wrapper de botón de exportar con panel dropdown */
.export-wrap { position: relative; display: inline-block; }

/* ── PERFIL ──────────────────────────────────────────────────── */
.perfil-info h2 { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); margin-bottom: 4px; text-align: center; }
.perfil-info p  { font-size: var(--fs-base); color: var(--muted); }

/* ── KPI SEMÁFORO (perecederos dashboard) ───────────────────── */
.kpi-ROJO     .kpi-num { color: var(--red);    }
.kpi-NARANJA  .kpi-num { color: #fb923c;       }
.kpi-AMARILLO .kpi-num { color: var(--yellow); }
.kpi-VERDE    .kpi-num { color: var(--green);  }

/* ── PERFIL DE USUARIO ──────────────────────────────────────── */
.perfil-wrap {
  max-width: 560px;
  margin: 48px auto;
  padding: 0 24px;
}
.perfil-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.perfil-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.perfil-avatar {
  width: 64px; height: 64px; border-radius: 999px;
  background: var(--accent-dk); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; flex-shrink: 0;
}
.perfil-email { font-size: var(--fs-base); color: var(--muted); margin-bottom: 8px; }
.perfil-meta  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.perfil-campo { margin-bottom: 16px; }
.perfil-campo input {
  width: 100%; padding: 9px 13px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font); font-size: var(--fs-md);
  outline: none; transition: border-color .15s;
}
.perfil-campo input:focus    { border-color: var(--accent); }
.perfil-campo input:disabled { opacity: .5; cursor: not-allowed; }
.hint { font-size: var(--fs-sm); color: var(--muted); margin-top: 6px; }

@media (max-width: 768px) {
  .perfil-wrap   { margin: 20px auto; padding: 0 16px; }
  .perfil-header { flex-direction: column; text-align: center; }
}

/* ── COSO-GAP03: Banner aviso contraseña ──────────────────────────── */
.pwd-aviso-banner {
  background: #78350f;
  color: #fef3c7;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 10px 24px;
  text-align: center;
  border-bottom: 1px solid #92400e;
  letter-spacing: .01em;
}
.pwd-aviso-banner a {
  color: #fde68a;
  text-decoration: underline;
  font-weight: 700;
}
.pwd-aviso-banner a:hover { color: #fff; }

/* ── SPINNER / LOADING ──────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(var(--accent-rgb), .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Estado de carga de página completa */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg), .8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  gap: 12px;
  font-size: var(--fs-base);
  color: var(--muted);
  backdrop-filter: blur(2px);
}

/* Skeleton loader — para listas/tablas */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-row { height: 44px; margin-bottom: 4px; }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }

/* ── SCROLL BEHAVIOR ────────────────────────────────────────── */
html { scroll-behavior: smooth; }

/* Scrollbar estilizada (Webkit) */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ── INDICADOR DE SCROLL HORIZONTAL EN TABLAS ───────────────── */
.tabla-wrap { position: relative; }
.tabla-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to left, var(--surface), transparent);
  pointer-events: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  opacity: 0;
  transition: opacity .2s;
}
.tabla-wrap.tiene-scroll::after { opacity: 1; }

/* ── PRINT STYLES ───────────────────────────────────────────── */
@media print {
  .navbar, .btn, .filtros, .panel-accion,
  #toast-container, .modal-overlay { display: none !important; }
  .contenido, .contenido-xl { padding: 0; max-width: 100%; }
  body { background: #fff; color: #000; font-size: 11pt; }
  table { font-size: 9pt; }
  .tabla-wrap { box-shadow: none; border: 1px solid #ccc; overflow: visible; }
  thead th { background: #f5f5f5 !important; color: #000 !important; }
}
