/* GGP Fulfillment — estilos centralizados.
   Identidad visual tomada de "Identidad GGP" de Seguimiento Comercial (versión publicada 13-oct-2026):
   vino #aa1838 como acento, ciruela #4a1e30 para navegación activa y destacados, neutros cálidos.
   Todos los módulos y el portal usan solo estos tokens y componentes. */
:root {
  /* Marca y acentos */
  --marca: #af1532;            /* sello "G" */
  --primario: #aa1838;         /* botones principales, enlaces */
  --primario-osc: #861b34;
  --ciruela: #4a1e30;          /* navegación activa, pestañas activas */
  --ciruela-osc: #471e30;      /* tarjeta destacada */
  --suave: #fbf0f3;            /* fondos de acento */
  --suave-2: #fdf7f9;
  --texto-acento: #8f2340;
  --borde-acento: #c98d9e;
  --foco: #ad3151;
  /* Neutros cálidos */
  --fondo: #faf7f8;
  --superficie: #ffffff;
  --tinta: #3c2230;
  --titulo: #421e2d;
  --gris: #806e77;
  --gris-2: #85767e;
  --linea: #eadbe0;
  --linea-2: #f0e4e8;
  --campo: #ded7d3;
  --cabecera-tabla: #fcf9fa;
  /* Estados (siempre acompañados de texto) */
  --verde: #1b7447; --verde-claro: #e6f5eb;
  --ambar: #8a4a00; --ambar-claro: #fff3e0;
  --rojo-estado: #a82345; --rojo-claro: #fdecef;
  --naranja: #a34e27; --naranja-claro: #fff0e9;
  --azul: #1f4f8a; --azul-claro: #e8f0fb;
  /* Compatibilidad con estilos en línea existentes */
  --rojo: var(--primario);
  --radio: 12px;
  --sombra: 0 5px 18px #58223807;
  --sombra-panel: 0 7px 22px #58223808;
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: var(--tinta);
}
* { box-sizing: border-box; }
html { background: var(--fondo); }
body { margin: 0; min-height: 100vh; color: var(--tinta); background: linear-gradient(#f9f5f6 0, #fcfafb 450px); -webkit-font-smoothing: antialiased; }
a { color: var(--primario); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; color: var(--titulo); }
h1 { font-size: 22px; font-weight: 780; }
h2 { font-size: 16px; font-weight: 760; }
h3 { font-size: 14px; }
[hidden] { display: none !important; }
.franja-prueba { position: sticky; top: 0; z-index: 60; background: repeating-linear-gradient(135deg, #3a0a10, #3a0a10 14px, #4a0f17 14px, #4a0f17 28px); color: #fff; text-align: center; font-weight: 750; font-size: 12px; letter-spacing: .06em; padding: 5px 12px; }

/* ---------- Ingreso ---------- */
.ingreso { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(105deg, #381a29 0%, #5d2035 47%, #ad2043 100%); }
.ingreso .tarjeta { width: 100%; max-width: 390px; padding: 30px 28px; border-radius: 17px; box-shadow: 0 25px 70px #33152535; border: 0; }
.marca { display: flex; align-items: center; gap: 13px; color: inherit; }
.marca:hover { text-decoration: none; }
.sello { width: 41px; height: 41px; border-radius: 11px; background: var(--marca); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; box-shadow: 0 4px 11px #8b1b3433; flex: none; }
/* Etiqueta discreta de etapa (producción en pruebas iniciales) */
.etiqueta-entorno { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 750; letter-spacing: .04em; color: var(--texto-acento); background: var(--suave); border: 1px solid var(--linea); white-space: nowrap; }
.barra-sup > .etiqueta-entorno { margin-top: 0; }
/* Logo oficial tricolor: completo, sin recorte ni deformación (cuadrado 1:1) */
.logo-marca { flex: none; display: grid; place-items: center; width: 54px; height: 54px; }
.logo-marca img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ingreso .logo-marca { width: 60px; height: 60px; }
.marca b { display: block; font-size: 19px; letter-spacing: -.025em; color: #371b27; line-height: 1.05; }
.marca small { display: block; margin-top: 5px; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: #85747d; }

/* ---------- Estructura ---------- */
.barra { background: var(--superficie); border-bottom: 1px solid #eadde1; position: sticky; top: 0; z-index: 40; }
body.con-franja .barra { top: 26px; }
.barra-sup { display: flex; align-items: center; gap: 16px; height: 74px; padding: 0 max(25px, calc((100vw - 1180px) / 2)); }
.barra-sup .espacio { flex: 1; }
.estado-conexion { font-size: 12px; color: var(--gris); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.estado-conexion i { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); display: inline-block; }
.estado-conexion.caida i { background: var(--rojo-estado); }
.estado-conexion.caida { color: var(--rojo-estado); font-weight: 650; }
.usuario-menu { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #7b6a73; }
.usuario-menu .nombre { color: var(--titulo); font-weight: 650; }
.usuario-menu .rol { color: var(--gris); font-size: 12px; }
/* Navegación principal: contenedor blanco con la sección activa en ciruela */
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 9px 12px; border-radius: 8px; color: #725b67; font-weight: 700; white-space: nowrap; font-size: 13px; }
.nav a:hover { background: var(--suave); color: var(--texto-acento); text-decoration: none; }
.nav a.activo { background: var(--ciruela); color: #fff; box-shadow: 0 5px 11px #3e172630; }
.barra .nav { margin: 0 max(25px, calc((100vw - 1180px) / 2)) 10px; padding: 6px 8px; background: #fff; border: 1px solid var(--linea); border-radius: 12px; box-shadow: 0 5px 15px #58223808; }
/* Pestañas dentro de una página (mismo estilo) */
.contenido .nav { padding: 6px 8px !important; margin-bottom: 16px; background: #fff; border: 1px solid var(--linea); border-radius: 12px; box-shadow: 0 5px 15px #58223808; width: max-content; max-width: 100%; }
.contenido { max-width: 1230px; margin: 0 auto; padding: 20px 25px 70px; }

/* Encabezado de página: franja vino-ciruela de la identidad GGP */
.encabezado { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 20px 26px; min-height: 96px; border-radius: 17px; color: #fff; background: linear-gradient(105deg, #381a29 0%, #5d2035 47%, #ad2043 100%); box-shadow: 0 14px 27px #57132918; }
.encabezado::after { content: ""; position: absolute; top: -160px; right: 8%; width: 260px; height: 260px; border-radius: 50%; background: #ffffff0a; pointer-events: none; }
.encabezado > * { position: relative; z-index: 1; }
.encabezado > div:first-child { flex: 1 1 380px; min-width: 0; }
.encabezado > select, .encabezado .acciones select, .encabezado .acciones input { width: auto; min-width: 200px; max-width: 280px; }
.encabezado .acciones { justify-content: flex-end; }
.encabezado h1 { color: #fff; font-size: clamp(21px, 2.4vw, 28px); letter-spacing: -.035em; }
.encabezado .sub { color: #f5dfe5; font-size: 13.5px; margin-top: 4px; max-width: 760px; line-height: 1.5; }
.encabezado .migas, .encabezado .migas a { color: #f2c8d2; }
.encabezado .btn { background: #ffffff1a; border-color: #ffffff59; color: #fff; box-shadow: none; }
.encabezado .btn:hover { background: #ffffff2e; }
.encabezado .btn.primario { background: #fff; border-color: #fff; color: #9f1c3c; box-shadow: 0 5px 20px #2b0c1b33; }
.encabezado .btn.primario:hover { background: #fff4f6; }
.encabezado .btn.exito { background: var(--verde); border-color: var(--verde); color: #fff; }
.encabezado .btn.peligro { color: #ffd9e1; border-color: #ffd9e166; }
.encabezado .et { background: #ffffff24; color: #fff; border: 1px solid #ffffff38; }
.encabezado select, .encabezado input { border-color: transparent; }
.migas { font-size: 12.5px; color: var(--gris); margin-bottom: 4px; }
.migas a { color: var(--gris); }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Paneles */
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: 15px; box-shadow: var(--sombra-panel); min-width: 0; }
.tarjeta > .cab { padding: 16px 22px; border-bottom: 1px solid var(--linea-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tarjeta > .cuerpo { padding: 16px 22px; }
.tarjeta.cuerpo { padding: 16px 22px; }
details.tarjeta > summary { list-style: none; }
details.tarjeta > summary::-webkit-details-marker { display: none; }
.rejilla { display: grid; gap: 12px; }
.rejilla.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rejilla.cuatro { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pila > * + * { margin-top: 14px; }

/* Indicadores (resumen) */
.prioridad { display: flex; flex-direction: column; min-height: 103px; padding: 17px 19px; border-radius: 12px; color: inherit; box-shadow: var(--sombra); }
.prioridad:hover { text-decoration: none; border-color: var(--borde-acento); }
.prioridad .et { all: unset; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--gris); }
.prioridad .num { font-size: 27px; font-weight: 780; color: #421f2e; margin-top: 7px; line-height: 1.15; letter-spacing: -.03em; }
.prioridad .det { font-size: 11.5px; color: var(--gris-2); margin-top: auto; padding-top: 5px; }
.prioridad.alerta { background: var(--ciruela-osc); border-color: var(--ciruela-osc); box-shadow: 0 8px 18px #411a2b22; }
.prioridad.alerta .et { color: #f4d6df; }
.prioridad.alerta .num { color: #fff; }
.prioridad.alerta .det { color: #f4d9e0; }

/* ---------- Botones y formularios ---------- */
.btn { appearance: none; border: 1px solid var(--borde-acento); background: #fff; color: var(--texto-acento); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: #fbf1f4; text-decoration: none; }
.btn.primario { background: var(--primario); border-color: var(--primario); color: #fff; box-shadow: 0 5px 13px #a31b3824; }
.btn.primario:hover { background: var(--primario-osc); border-color: var(--primario-osc); }
.btn.peligro { color: var(--rojo-estado); border-color: #e4b3c0; }
.btn.peligro:hover { background: var(--rojo-claro); }
/* En ventanas de confirmación la acción irreversible se distingue claramente de "Volver" */
.modal .pie .btn.peligro { background: var(--rojo-estado); border-color: var(--rojo-estado); color: #fff; }
.modal .pie .btn.peligro:hover { background: #8a1c38; }
.btn.exito { background: var(--verde); border-color: var(--verde); color: #fff; box-shadow: 0 5px 13px #1b744722; }
.btn.exito:hover { background: #155f3a; }
.btn.chico { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled], .btn.ocupado { opacity: .55; pointer-events: none; }
.btn-texto { background: none; border: 0; color: var(--primario); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
label.campo { display: block; }
label.campo > span { display: block; font-size: 12.5px; font-weight: 650; color: #5c4552; margin-bottom: 5px; }
label.campo > span em { color: var(--primario); font-style: normal; }
input, select, textarea { font: inherit; color: #27201f; width: 100%; padding: 8px 11px; border: 1px solid var(--campo); border-radius: 8px; background: #fff; min-height: 38px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--foco); box-shadow: 0 0 0 3px #ad315119; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--primario); }
input.num { text-align: right; max-width: 96px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 550; cursor: pointer; }
.form-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.form-rejilla .ancho { grid-column: 1 / -1; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filtros input[type=search] { max-width: 290px; }
.filtros select { max-width: 230px; }
.ayuda { font-size: 12.5px; color: var(--gris); }
.error-campo { color: var(--rojo-estado); font-size: 12.5px; margin-top: 4px; }

/* ---------- Tablas ---------- */
.tabla-env { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: #806571; font-weight: 750; padding: 10px 12px; border-bottom: 1px solid #eee2e7; background: var(--cabecera-tabla); white-space: nowrap; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #f3eaee; vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: var(--suave-2); }
.tabla .n, .tabla th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tfoot td { font-weight: 750; background: var(--cabecera-tabla); color: var(--titulo); }
.mini { font-size: 12px; color: var(--gris); }
.codigo { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; background: #f6eef1; color: #5a3445; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.vacio { padding: 28px 16px; text-align: center; color: var(--gris); }
.paginacion { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--linea-2); font-size: 12.5px; color: var(--gris); }

/* ---------- Etiquetas de estado (color + texto) ---------- */
.et { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 750; white-space: nowrap; background: #f3edf0; color: #6b5561; }
.et.rojo { background: var(--rojo-claro); color: var(--rojo-estado); }
.et.verde { background: var(--verde-claro); color: var(--verde); }
.et.ambar { background: var(--ambar-claro); color: var(--ambar); }
.et.azul { background: var(--azul-claro); color: var(--azul); }
.cifras { display: flex; gap: 8px; flex-wrap: wrap; }
.cifra { border: 1px solid var(--linea); border-radius: 12px; padding: 11px 15px; min-width: 112px; background: #fff; box-shadow: var(--sombra); }
.cifra .t { font-size: 11px; color: var(--gris); font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.cifra .v { font-size: 21px; font-weight: 780; margin-top: 3px; font-variant-numeric: tabular-nums; color: #421f2e; letter-spacing: -.02em; }
.cifra.disp .v { color: var(--verde); }
.cifra.res .v { color: var(--azul); }
.cifra.rev .v { color: var(--ambar); }
.cifra.dan .v { color: var(--rojo-estado); }
.nota { border-left: 3px solid #b52245; background: var(--suave-2); color: #4a2f3c; padding: 10px 13px; border-radius: 8px; font-size: 13px; }
.nota.roja { border-color: var(--rojo-estado); background: var(--rojo-claro); color: #6e1a31; }
.nota.azul { border-color: #8aa7cf; background: #f3f6fb; color: #1d3c63; }
.nota.verde { border-color: var(--verde); background: var(--verde-claro); color: #164f33; }
.dato .t { font-size: 11px; color: var(--gris); font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.dato .v { margin-top: 3px; font-weight: 600; word-break: break-word; color: var(--titulo); }
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 18px; }

/* ---------- Fotos ---------- */
.fotos { display: flex; gap: 8px; flex-wrap: wrap; }
.foto { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--linea); background: #f6eef1; display: block; position: relative; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto .pdf { display: grid; place-items: center; height: 100%; font-weight: 750; color: var(--primario); font-size: 12px; }
.miniatura { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f6eef1; border: 1px solid var(--linea); display: block; }
.miniatura.vacia { display: grid; place-items: center; color: #c3aab5; font-size: 11px; font-weight: 700; }
.subir-foto { width: 84px; height: 84px; border: 1.5px dashed #d8bfc8; border-radius: 10px; display: grid; place-items: center; color: var(--gris); cursor: pointer; font-size: 12px; text-align: center; padding: 6px; }
.subir-foto:hover { border-color: var(--primario); color: var(--primario); background: var(--suave-2); }
.subir-foto input { display: none; }

/* ---------- Buscador de productos ---------- */
.buscador { position: relative; }
.resultados { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--linea); border-radius: 10px; box-shadow: 0 14px 34px #3315251f; z-index: 30; max-height: 320px; overflow-y: auto; }
.resultados button { display: flex; width: 100%; text-align: left; gap: 10px; padding: 9px 12px; border: 0; background: #fff; font: inherit; color: inherit; cursor: pointer; align-items: center; border-bottom: 1px solid var(--linea-2); }
.resultados button:hover, .resultados button:focus { background: var(--suave); outline: none; }
.resultados .disp { margin-left: auto; font-size: 12px; color: var(--gris); white-space: nowrap; }

/* ---------- Ventanas y avisos ---------- */
.modal { position: fixed; inset: 0; background: rgba(40, 18, 28, .48); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal .caja { background: #fff; border-radius: 15px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 25px 70px #33152535; }
.modal .caja.ancha { max-width: 860px; }
.modal .caja > .cab { padding: 15px 20px; border-bottom: 1px solid var(--linea-2); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal .caja > .cab h2 { color: #401e2e; }
.modal .caja > .cuerpo { padding: 16px 20px; }
.modal .caja > .pie { padding: 12px 20px; border-top: 1px solid var(--linea-2); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.cerrar { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--gris); line-height: 1; }
.avisos { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.aviso { background: var(--ciruela); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 26px #3315252e; font-size: 13.5px; animation: entra .18s ease-out; }
.aviso.error { background: var(--rojo-estado); }
.aviso.exito { background: var(--verde); }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.cargando { padding: 40px; text-align: center; color: var(--gris); }
.progreso { height: 8px; border-radius: 99px; background: #f4e7ec; overflow: hidden; }
.progreso > i { display: block; height: 100%; background: linear-gradient(90deg, #61253d, #ad2043); transition: width .2s; }
video.escaner { width: 100%; border-radius: 10px; background: #000; max-height: 50vh; }

/* ---------- Celular ---------- */
@media (max-width: 950px) {
  .rejilla.tres, .rejilla.cuatro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rejilla.dos { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .barra-sup { height: 64px; padding: 0 14px; gap: 10px; }
  body.con-franja .barra { top: 40px; }
  .barra .nav { margin: 0 12px 10px; }
  .contenido { padding: 14px 12px 60px; }
  .usuario-menu .rol, .usuario-menu .nombre { display: none; }
  .marca b { font-size: 16px; }
  .barra .logo-marca { width: 46px; height: 46px; }
  .barra .marca { gap: 10px; }
  .marca small { font-size: 9px; }
  .encabezado { padding: 18px 18px; min-height: 0; border-radius: 15px; }
  .encabezado h1 { font-size: 21px; }
  .rejilla.tres, .rejilla.cuatro { grid-template-columns: 1fr 1fr; gap: 9px; }
  .prioridad { padding: 14px; min-height: 100px; }
  .prioridad .num { font-size: 23px; }
  .prioridad .et { font-size: 10px; }
  .tarjeta > .cab, .tarjeta > .cuerpo, .tarjeta.cuerpo { padding-left: 16px; padding-right: 16px; }
  table.tabla.apilable thead { display: none; }
  table.tabla.apilable tr { display: block; border-bottom: 1px solid var(--linea); padding: 6px 0; }
  table.tabla.apilable td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; text-align: right; }
  table.tabla.apilable td::before { content: attr(data-et); color: var(--gris); font-size: 12px; font-weight: 650; text-align: left; }
  table.tabla.apilable td.sin-et::before { content: none; }
  .filtros input[type=search], .filtros select { max-width: none; flex: 1 1 140px; }
  .estado-conexion span { display: none; }
  .barra-sup > .etiqueta-entorno { display: none; }
}
@media print {
  .barra, .nav, .acciones, .franja-prueba { display: none !important; }
  .encabezado { background: none; color: var(--tinta); box-shadow: none; padding: 0; }
  .encabezado h1 { color: var(--tinta); }
}
