/* SIMPA · Sistema Integral María Pizarro Azulejos
   Marca: negro, blanco y el rojo del sol. Primero celular, con escritorio de verdad. */

@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fuentes/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fuentes/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fuentes/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fuentes/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fuentes/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fuentes/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fuentes/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --tinta: #141414;
  --texto: #1d1d1b;
  --suave: #6b6a65;
  --tenue: #9b9a94;
  --fondo: #f5f5f2;
  --superficie: #ffffff;
  --superficie-2: #f0efeb;
  --linea: #e6e5e0;
  --linea-fuerte: #cfcec8;
  --rojo: #e00808;
  --rojo-texto: #c0110c;
  --rojo-suave: #fdecea;
  --ok: #1f8a4c;
  --ok-texto: #156b3a;
  --ok-suave: #e5f4ea;
  --alerta: #f0a500;
  --alerta-texto: #9a5f00;
  --alerta-suave: #fff5df;
  --gris-punto: #a3a29c;
  --f-texto: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-titulo: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --radio: 18px;
  --radio-m: 12px;
  --sombra: 0 1px 2px rgba(20, 20, 20, .04), 0 10px 30px -18px rgba(20, 20, 20, .22);
  --sombra-alta: 0 24px 60px -24px rgba(20, 20, 20, .35);
  --nav: 66px;
  --lateral: 248px;
  --anillo: 0 0 0 4px rgba(20, 20, 20, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh;
  font: 17px/1.5 var(--f-texto); font-weight: 400;
  color: var(--texto); background: var(--fondo);
  -webkit-font-smoothing: antialiased;
}
body.con-nav .principal { padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom) + 20px); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-titulo); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: .005em; text-wrap: balance; }
h1 { font-size: 2.1rem; margin: .1rem 0 .5rem; }
h2 { font-size: 1.45rem; margin: 0 0 .5rem; }
h3 { font-size: 1.2rem; margin: 0 0 .5rem; }
p { margin: .25rem 0 .7rem; }
b, strong { font-weight: 600; }
.nota { color: var(--suave); font-size: .92rem; line-height: 1.45; }
.centro { text-align: center; }
.derecha { text-align: right; }
.rojo { color: var(--rojo-texto); }
.verde { color: var(--ok-texto); }
.eti { font-family: var(--f-titulo); font-weight: 600; font-size: .86rem; letter-spacing: .12em; text-transform: uppercase; color: var(--suave); }
.num, .folio, .kpi b, .cifra b, .etq-folio { font-family: var(--f-titulo); font-variant-numeric: tabular-nums; }

/* Iconos */
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -5px; }
.ico-grande { width: 32px; height: 32px; }

/* ------------------------------------------------------------ Armazón */
.principal { min-width: 0; }
.cabecera {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  min-height: 58px; padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top));
  background: rgba(255, 255, 255, .86); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--linea);
}
.cabecera a { text-decoration: none; }
.marca { display: flex; align-items: center; gap: 10px; font-family: var(--f-titulo); font-weight: 700; font-size: 1.25rem; letter-spacing: .14em; padding-left: 4px; }
.marca img { height: 32px; width: auto; }
.volver { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -6px; border-radius: 12px; color: var(--tinta); }
.volver:active { background: var(--superficie-2); }
.cab-titulo { flex: 1; min-width: 0; font-family: var(--f-titulo); font-weight: 600; font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quien { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px 4px 8px; border-radius: 999px; border: 1px solid var(--linea); background: var(--superficie); font-weight: 600; font-size: .92rem; }
.quien .ico { width: 20px; height: 20px; }

.contenido { max-width: 760px; margin: 0 auto; padding: 16px 16px 0; }
.contenido { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Menú abajo (celular) */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom);
}
.barra a {
  flex: 1; min-height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--suave); text-decoration: none; font-size: .76rem; font-weight: 600; position: relative;
}
.barra a .ico { width: 25px; height: 25px; }
.barra a.activo { color: var(--tinta); }
.barra a.activo::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--rojo); }

/* Menú lateral (escritorio) */
.lateral { display: none; }
@media (min-width: 960px) {
  .lateral {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: var(--lateral); z-index: 40;
    background: var(--superficie); border-right: 1px solid var(--linea); padding: 22px 14px 16px;
  }
  .lateral-marca { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; text-decoration: none; font-family: var(--f-titulo); font-weight: 700; font-size: 1.5rem; letter-spacing: .16em; }
  .lateral-marca img { height: 38px; width: auto; }
  .lateral-nav { display: flex; flex-direction: column; gap: 4px; }
  .lateral-nav a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 12px; text-decoration: none; color: var(--suave); font-weight: 600; }
  .lateral-nav a:hover { background: var(--superficie-2); color: var(--tinta); }
  .lateral-nav a.activo { background: var(--tinta); color: #fff; }
  .lateral-nav a .ico { width: 22px; height: 22px; }
  .lateral-pie { margin-top: auto; border-top: 1px solid var(--linea); padding-top: 12px; }
  .lateral-usuario { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; text-decoration: none; }
  .lateral-usuario:hover { background: var(--superficie-2); }
  .lateral-usuario span { display: flex; flex-direction: column; line-height: 1.15; }
  .lateral-usuario small { color: var(--suave); font-size: .8rem; }
  body.con-nav .principal { margin-left: var(--lateral); }
  body.con-nav .principal { padding-bottom: 40px; }
  .barra { display: none; }
  .cabecera { background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; min-height: 0; padding: 22px 40px 0; position: static; }
  .cabecera .marca, .cabecera .quien { display: none; }
  .cabecera:not(.con-atras) { display: none; }
  .cab-titulo { font-size: 1rem; color: var(--suave); }
  .contenido { max-width: 1180px; margin: 0; padding: 22px 40px 0; }
  .ancho .contenido { max-width: none; }
  h1 { font-size: 2.4rem; }
}

/* ------------------------------------------------------------ Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 10px 18px; border-radius: var(--radio-m); border: 1.5px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2;
  background: var(--superficie-2); color: var(--tinta);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--tinta); outline-offset: 3px;
}
.btn-primario { background: var(--tinta); color: #fff; }
.btn-primario:hover { background: #000; filter: none; }
.btn-listo { background: var(--ok); color: #fff; }
.btn-alerta { background: var(--rojo-suave); color: var(--rojo-texto); border-color: #f5c9c5; }
.btn-borde { background: var(--superficie); border-color: var(--linea-fuerte); color: var(--tinta); }
.btn-peligro { background: var(--superficie); border-color: #f0b9b5; color: var(--rojo-texto); }
.btn-grande { width: 100%; min-height: 60px; font-size: 1.1rem; margin: 6px 0 12px; border-radius: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 16px; }
.acciones form { margin: 0; }

/* ------------------------------------------------------------ Superficies */
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px; margin: 0 0 14px; box-shadow: var(--sombra); }
.seccion { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; font-size: 1.45rem; }
.seccion:first-child { margin-top: 4px; }
.cuenta { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--superficie-2); color: var(--texto); font: 700 .82rem var(--f-texto); }
.rojo-fondo { background: var(--rojo); color: #fff; margin-left: auto; }
.encabezado { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.encabezado h1 { margin: 0; }
.saludo { margin-bottom: 0; }
.vacio { text-align: center; color: var(--suave); padding: 28px 14px; background: var(--superficie); border: 1px dashed var(--linea-fuerte); border-radius: var(--radio); }
.vacio.chico { padding: 14px; font-size: .95rem; margin: 0; }
.vacio .btn { margin-top: 8px; }
.vacio p:last-child { margin-bottom: 0; }

.lista { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); margin-bottom: 14px; }
.fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; min-height: 58px; border-bottom: 1px solid var(--linea); color: var(--texto); text-decoration: none; }
.fila:last-child { border-bottom: 0; }
a.fila:hover { background: #fafaf8; }
a.fila:active { background: var(--superficie-2); }
.fila.menu { justify-content: flex-start; gap: 14px; }
.fila.menu .ico { color: var(--tinta); width: 24px; height: 24px; }
.fila.apilada { flex-direction: column; align-items: flex-start; gap: 4px; }
.fila.inactivo, .inactivo { opacity: .55; }
.fila.abierto { background: var(--alerta-suave); }

/* ------------------------------------------------------------ Pedidos */
.cuadricula { display: grid; gap: 12px; }
.pedido { background: var(--superficie); border: 1px solid var(--linea); border-left: 5px solid var(--linea-fuerte); border-radius: var(--radio); margin-bottom: 12px; box-shadow: var(--sombra); overflow: hidden; }
.cuadricula .pedido { margin-bottom: 0; }
.pedido-enlace { display: block; padding: 14px 16px; color: var(--texto); text-decoration: none; }
.pedido-enlace:hover { background: #fafaf8; }
.pedido-fila { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.pedido-fila.pie { margin-top: 10px; justify-content: space-between; }
.pedido-que { font-size: 1.1rem; font-weight: 600; margin-top: 6px; line-height: 1.25; }
.pedido-quien { color: var(--suave); margin-top: 2px; }
.folio { font-weight: 700; font-size: 1.15rem; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta); }
.folio.grande { font-size: 1.5rem; }
.etq { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--superficie-2); color: var(--texto); font-size: .78rem; font-weight: 600; }
.etq .ico { width: 15px; height: 15px; vertical-align: -3px; }
.etq-urgente { background: var(--rojo); color: #fff; }
.etq-problema { background: var(--alerta-suave); color: var(--alerta-texto); }
.sem-borde-rojo { border-left-color: var(--rojo); }
.sem-borde-amarillo { border-left-color: var(--alerta); }
.sem-borde-verde { border-left-color: var(--ok); }
.sem-borde-gris { border-left-color: var(--gris-punto); }
.sem { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .9rem; padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--superficie-2); color: var(--suave); }
.sem i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.sem-rojo { color: var(--rojo-texto); background: var(--rojo-suave); }
.sem-amarillo { color: var(--alerta-texto); background: var(--alerta-suave); }
.sem-amarillo i { background: var(--alerta); }
.sem-verde { color: var(--ok-texto); background: var(--ok-suave); }
.sem-gris { color: var(--suave); }

.terminar-compacto { padding: 0 16px 14px; }
.terminar-compacto .btn-grande { margin: 0; min-height: 56px; }
.ficha { border-left-width: 5px; }
.ficha-que { font-size: 1.7rem; margin: .5rem 0 .6rem; font-family: var(--f-titulo); }
.ficha-notas { background: var(--superficie-2); border-radius: var(--radio-m); padding: 10px 12px; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 16px; margin: 0 0 12px; }
.datos dt { color: var(--suave); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-family: var(--f-titulo); font-weight: 600; }
.datos dd { margin: 0; }
.ahora { border: 1.5px solid var(--tinta); }
.ahora.listo { border-color: var(--ok); }
.ahora-etq { margin: 0; }
.ahora-etapa { font-size: 1.9rem; margin: .15rem 0 .25rem; display: flex; align-items: center; gap: 10px; }
.ahora-etapa .ico { width: 30px; height: 30px; color: var(--rojo); }
.ahora .nota .ico { width: 18px; height: 18px; vertical-align: -4px; }
.terminar { margin-top: 12px; }
.terminar .btn-foto { width: 100%; margin-bottom: 10px; }
.btn-foto.btn-listo { background: var(--ok-suave); border-color: var(--ok); color: var(--ok-texto); }
.campo-nota { display: block; margin-bottom: 4px; }

.ruta { list-style: none; padding: 0; margin: 0 0 12px; }
.ruta li { display: flex; gap: 14px; padding: 0 0 16px; position: relative; }
.ruta li::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: var(--linea); }
.ruta li:last-child::before { display: none; }
.ruta .punto { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--superficie); border: 2px solid var(--linea-fuerte); color: var(--suave); font: 700 .95rem var(--f-titulo); }
.ruta .punto .ico { width: 20px; height: 20px; stroke-width: 2.4; }
.ruta li.hecha .punto { background: var(--ok); border-color: var(--ok); color: #fff; }
.ruta li.actual .punto { background: var(--tinta); border-color: var(--tinta); color: #fff; box-shadow: 0 0 0 5px rgba(20, 20, 20, .08); }
.ruta li.actual b { color: var(--tinta); }
.ruta li > div { padding-top: 6px; min-width: 0; }
.ruta .nota { display: block; }

.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.galeria a { display: block; text-decoration: none; color: var(--suave); font-size: .8rem; }
.galeria img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radio-m); border: 1px solid var(--linea); display: block; }
.foto-problema { max-width: 100%; max-height: 260px; border-radius: var(--radio-m); display: block; margin: 6px 0; }

/* ------------------------------------------------------------ Formularios */
.formulario label { display: block; font-weight: 600; margin-bottom: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 52px;
  font: inherit; color: var(--texto); background: var(--superficie); border: 1.5px solid var(--linea-fuerte); border-radius: var(--radio-m);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--tenue); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--tinta); outline: none; box-shadow: var(--anillo); }
input[readonly] { background: var(--superficie-2); color: var(--suave); }
.input-grande { font: 700 1.9rem var(--f-titulo); text-align: center; letter-spacing: .02em; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.dos > * { margin-bottom: 14px; }
.formulario .casilla { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.casilla input { width: 24px; height: 24px; min-height: 0; margin: 0; flex: none; accent-color: var(--tinta); }
.fila-form { display: flex; gap: 8px; margin-top: 8px; }
.fila-form input { margin: 0; flex: 1; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chip { position: relative; margin: 0 !important; }
.chip input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; min-height: 46px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--linea-fuerte); background: var(--superficie); font-weight: 600; cursor: pointer; }
.chip input:checked + span { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--tinta); outline-offset: 3px; }
.chip-urgente input:checked + span { background: var(--rojo); border-color: var(--rojo); }
.columna-chips .chip { width: 100%; }
.columna-chips .chip span { width: 100%; border-radius: var(--radio-m); }
.segmento { display: flex; gap: 4px; background: var(--superficie-2); padding: 4px; border-radius: 14px; }
.segmento legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.segmento label { flex: 1; margin: 0; }
.segmento input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmento span { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 50px; border-radius: 11px; font-weight: 600; cursor: pointer; color: var(--suave); }
.segmento input:checked + span { background: var(--superficie); color: var(--tinta); box-shadow: var(--sombra); }
.segmento input:focus-visible + span { outline: 2px solid var(--tinta); }
.tarjeta-interna { background: var(--superficie-2); border-radius: var(--radio-m); padding: 12px 12px 2px; margin-bottom: 14px; }
.tarjeta-interna legend { float: left; width: 100%; margin-bottom: 8px; }
.tarjeta-interna legend + * { clear: both; }
.pin { font: 700 1.6rem var(--f-titulo); letter-spacing: .18em; }

.buscador { display: flex; gap: 8px; margin: 10px 0 14px; }
.buscador input { margin: 0; flex: 1; }
.buscador .btn { min-width: 54px; padding: 0; }

.pestanas { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0 16px; padding: 2px; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas a { flex: none; padding: 9px 16px; border-radius: 999px; background: var(--superficie); border: 1px solid var(--linea-fuerte); color: var(--texto); text-decoration: none; font-weight: 600; font-size: .95rem; min-height: 42px; display: inline-flex; align-items: center; gap: 6px; }
.pestanas a:hover { background: var(--superficie-2); }
.pestanas a.activo { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.pestanas.saltos a b { color: var(--suave); font-weight: 600; }

/* Avisos flotantes */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); transform: translateX(-50%); z-index: 100;
  display: flex; align-items: center; gap: 10px; width: min(92vw, 560px); padding: 12px 10px 12px 14px; border-radius: 14px;
  background: var(--tinta); color: #fff; font-weight: 500; box-shadow: var(--sombra-alta);
  animation: toast-entra .25s ease-out;
}
.toast-error { background: var(--rojo-texto); }
.toast .ico { width: 22px; height: 22px; }
.toast span { flex: 1; min-width: 0; }
.toast-cerrar { background: transparent; border: 0; color: inherit; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; opacity: .8; }
.toast-cerrar:hover { background: rgba(255, 255, 255, .15); opacity: 1; }
body.con-nav .toast { bottom: calc(var(--nav) + env(safe-area-inset-bottom, 0px) + 12px); }
@keyframes toast-entra { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (min-width: 960px) { .toast, body.con-nav .toast { left: auto; right: 28px; bottom: 28px; transform: none; width: min(480px, 40vw); } @keyframes toast-entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } } }
.aviso { padding: 13px 14px; border-radius: var(--radio-m); margin-bottom: 14px; font-weight: 500; border: 1px solid; }
.aviso-ok { background: var(--ok-suave); color: var(--ok-texto); border-color: #bfe3cb; }
.aviso-error { background: var(--rojo-suave); color: var(--rojo-texto); border-color: #f3c4c0; }
.pista { display: flex; gap: 12px; align-items: center; background: var(--superficie); }
.pista p { margin: 0; }
.pista .ico { color: var(--rojo); }
@media (min-width: 960px) { .pista { display: none; } }

/* Hoja desde abajo (Terminé) */
dialog.panel { border: 0; padding: 0; margin: 0; max-width: 100vw; width: 100vw; max-height: 100dvh; background: transparent; }
dialog.panel::backdrop { background: rgba(20, 20, 20, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
dialog.panel[open] { display: flex; align-items: flex-end; justify-content: center; height: 100dvh; }
.panel-cuerpo { width: 100%; max-height: 92dvh; overflow: auto; background: var(--superficie); border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--sombra-alta); animation: panel-sube .28s cubic-bezier(.2, .8, .2, 1); }
.panel-asa { width: 44px; height: 5px; border-radius: 3px; background: var(--linea-fuerte); margin: 4px auto 14px; }
.panel-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-cab h2 { margin: 0; font-size: 1.6rem; }
.panel-cerrar { background: var(--superficie-2); border: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.panel-cuerpo .btn-grande { margin-bottom: 0; }
@keyframes panel-sube { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 720px) {
  dialog.panel[open] { align-items: center; }
  .panel-cuerpo { width: min(540px, 92vw); border-radius: 24px; padding: 14px 24px 24px; max-height: 88dvh; }
  .panel-asa { display: none; }
}

/* ------------------------------------------------------------ Tablero */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0 10px; }
.kpi { display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--radio); background: var(--superficie); border: 1px solid var(--linea); color: var(--texto); text-decoration: none; box-shadow: var(--sombra); min-width: 0; }
.kpi b { font-size: 2.6rem; line-height: 1; font-weight: 700; }
.kpi span { color: var(--suave); font-size: .9rem; margin-top: 6px; line-height: 1.25; }
a.kpi:hover { border-color: var(--linea-fuerte); }
.kpi-rojo { background: var(--rojo-suave); border-color: #f3c4c0; }
.kpi-rojo b { color: var(--rojo-texto); }
.kpi-amarillo { background: var(--alerta-suave); border-color: #f2dfae; }
.kpi-amarillo b { color: var(--alerta-texto); }
.kpi-verde { background: var(--ok-suave); border-color: #bfe3cb; }
.kpi-verde b { color: var(--ok-texto); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.tablero-grid { display: grid; gap: 0 28px; }
@media (min-width: 960px) { .tablero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } .tablero-grid .seccion:first-child { margin-top: 24px; } }

.barras { padding: 8px 16px; }
.barra-fila { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 34px; align-items: center; gap: 10px; padding: 9px 0; color: var(--texto); text-decoration: none; border-bottom: 1px solid var(--linea); }
.barra-fila:last-child { border-bottom: 0; }
.barra-nombre { font-size: .92rem; font-weight: 600; line-height: 1.25; }
.barra-pista { position: relative; height: 12px; background: var(--superficie-2); border-radius: 999px; overflow: hidden; }
.barra-relleno { position: absolute; left: 0; top: 0; bottom: 0; background: var(--tinta); border-radius: 999px; }
.barra-alerta { position: absolute; left: 0; top: 0; bottom: 0; background: var(--rojo); border-radius: 999px; }
.barra-n { text-align: right; font-family: var(--f-titulo); font-size: 1.15rem; }
.comparar .barra-fila { grid-template-columns: minmax(120px, 42%) 1fr; }
.barra-pista.doble { overflow: visible; }
.barra-relleno.mal { background: var(--rojo); }
.barra-normal { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--tinta); border-radius: 2px; }
.muestra { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: 0; }
.muestra.real { background: var(--tinta); }
.muestra.normal { width: 3px; height: 14px; background: var(--tinta); vertical-align: -2px; }

/* ------------------------------------------------------------ Producción por etapa */
.tablero-etapas { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 14px; }
.columna { flex: 0 0 min(86vw, 320px); scroll-snap-align: start; background: var(--superficie-2); border-radius: var(--radio); padding: 12px; min-width: 0; }
.columna h2 { display: flex; align-items: center; gap: 6px; font-size: 1.2rem; }
.columna h2 .ico { color: var(--rojo); width: 20px; height: 20px; }
.columna h2 .cuenta { margin-left: auto; background: var(--superficie); }
.columna .pedido-que { font-size: 1rem; }
.columna .pedido { box-shadow: none; }
.columna .vacio { background: transparent; border-color: var(--linea-fuerte); }
@media (min-width: 960px) {
  .tablero-etapas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); overflow: visible; margin: 0; padding: 0 0 14px; gap: 14px; }
  .columna { flex: none; }
  .pestanas.saltos { display: none; }
}

/* ------------------------------------------------------------ Inventario */
.articulo.nivel-rojo { box-shadow: inset 5px 0 0 var(--rojo); }
.articulo.nivel-amarillo { box-shadow: inset 5px 0 0 var(--alerta); }
.existencia { text-align: right; white-space: nowrap; }
.existencia b { font-family: var(--f-titulo); font-size: 1.25rem; }
.existencia-grande { text-align: center; border-top: 5px solid var(--ok); }
.existencia-grande.nivel-rojo { border-top-color: var(--rojo); }
.existencia-grande.nivel-amarillo { border-top-color: var(--alerta); }
.existencia-grande h1 { margin: 0; }
.cifra { font-size: 1.3rem; margin: .4rem 0; }
.cifra b { font-size: 3rem; font-weight: 700; }
.mover-inv .btn-grande { margin-bottom: 0; }

/* Problemas */
.problema { border-left: 5px solid var(--alerta); }

/* Administración */
.etapa-admin summary, details.tarjeta summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; min-height: 44px; }
details.tarjeta summary::-webkit-details-marker { display: none; }
.etapa-admin .punto { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--tinta); color: #fff; font: 700 1rem var(--f-titulo); flex: none; }
details[open] > summary { margin-bottom: 12px; }
.menu-rejilla { display: grid; gap: 10px; }
.menu-rejilla .fila { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
@media (min-width: 720px) { .menu-rejilla { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .menu-rejilla { grid-template-columns: repeat(3, 1fr); } }
.resultado { border-left: 5px solid var(--tinta); }
.plantilla { padding: 8px 0; border-bottom: 1px solid var(--linea); }
.plantilla summary { cursor: pointer; min-height: 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.burbuja { margin: 10px 0 6px; max-width: 420px; background: #e7f6dd; color: #14210f; border-radius: 4px 14px 14px 14px; padding: 10px 12px 0; font-size: .95rem; line-height: 1.4; box-shadow: var(--sombra); overflow: hidden; }
.pie-burbuja { display: block; color: #5c6b56; font-size: .8rem; margin: 6px 0 8px; }
.boton-burbuja { display: block; margin: 0 -12px; padding: 10px; text-align: center; border-top: 1px solid #c9dcbd; color: #1f6fb2; font-weight: 700; }
.avisos { list-style: none; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--linea); }
.avisos li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.avisos li .nota { width: 100%; }
.acceso p { max-width: 420px; margin-left: auto; margin-right: auto; }
.qr-grande { width: min(78vw, 320px); margin: 12px auto; padding: 10px; background: #fff; border-radius: var(--radio-m); border: 1px solid var(--linea); }
.qr-grande svg { display: block; width: 100%; height: auto; }

/* ------------------------------------------------------------ Entrar */
.pantalla-entrar { background: var(--superficie); }
.pantalla-entrar .cabecera { display: none; }
.pantalla-entrar .contenido { max-width: 440px; margin: 0 auto; padding-top: 6vh; }
.entrar-sol { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% -8%, rgba(224, 8, 8, .055) 0 5deg, transparent 5deg 12deg);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% -8%, #000 20%, transparent 72%); mask-image: radial-gradient(ellipse 80% 60% at 50% -8%, #000 20%, transparent 72%); }
.entrar-marca { text-align: center; margin-bottom: 26px; }
.entrar-marca img { width: min(300px, 80vw); height: auto; display: block; margin: 0 auto 14px; }
.entrar-marca h1 { font-size: 2.6rem; letter-spacing: .2em; margin: 0; font-weight: 700; }
.entrar-marca p { color: var(--suave); margin: 2px 0 0; }
.entrar .tarjeta { box-shadow: var(--sombra-alta); }

/* ------------------------------------------------------------ Página del cliente */
.cliente { background: var(--superficie); }
.cliente .cabecera { justify-content: center; position: static; padding: 18px 16px 14px; }
.cliente .cabecera img { height: 44px; width: auto; }
.cliente .contenido { max-width: 560px; margin: 0 auto; padding-top: 8px; }
.seg-cabeza { border: 0; background: var(--superficie-2); box-shadow: none; }
.seg-cabeza h1 { margin: .2rem 0 .4rem; font-size: 1.9rem; }
.seg-contacto p { margin-bottom: 8px; }
.seg-ruta { margin-top: 14px; }
.cliente .ahora-etapa { font-size: 2rem; }
.cliente .ahora-etapa::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--rojo); }
.cliente .pie-cliente { color: var(--suave); text-align: center; font-size: .9rem; padding: 10px 0 30px; }

/* ------------------------------------------------------------ Etiquetas para imprimir */
.hoja { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hoja.varias { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.etiqueta { display: flex; gap: 12px; align-items: center; width: 100%; max-width: 420px; padding: 12px; background: #fff; border: 2px dashed #9b9286; border-radius: 10px; color: #111; break-inside: avoid; page-break-inside: avoid; }
.etq-qr { width: 46%; flex: none; }
.etq-qr svg { display: block; width: 100%; height: auto; }
.etq-datos { font-size: 15px; line-height: 1.3; min-width: 0; }
.etq-folio { font-size: 30px; font-weight: 700; letter-spacing: .06em; line-height: 1; margin-bottom: 4px; }
.etq-modelo { font-weight: 600; font-size: 16px; margin: 2px 0 4px; }
.etq-imp-urgente { display: inline-block; margin-top: 4px; padding: 2px 8px; background: #e00808; color: #fff; font-weight: 700; letter-spacing: .08em; }
.etq-pie { margin-top: 6px; font-size: 11px; color: #555; }
.etiqueta.chica .etq-qr { width: 38%; }

@media print {
  @page { margin: 10mm; }
  body { background: #fff; font-size: 12pt; }
  .cabecera, .barra, .lateral, .no-imprimir, .toast { display: none !important; }
  .principal { margin: 0 !important; padding: 0 !important; }
  .contenido { max-width: none; padding: 0; }
  .hoja.varias { grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  .etiqueta { border-style: dashed; max-width: none; }
}

/* ------------------------------------------------------------ Escritorio: rejillas */
@media (min-width: 960px) {
  .cuadricula { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .detalle-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .formulario.tarjeta, .form-angosto { max-width: 680px; }
  .btn-reportar { width: auto; min-height: 52px; font-size: 1rem; }
  .galeria { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }

/* v0.3.1 */
.deshacer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 14px; padding: 10px 14px; border: 1px dashed var(--linea-fuerte); border-radius: var(--radio-m); background: var(--superficie); }
.deshacer p { margin: 0; }
.aviso-demo { border-left: 5px solid var(--rojo); }
.aviso-demo p { margin: 0; }

dialog.panel.panel-abierto { display: flex; position: fixed; inset: 0; width: 100vw; height: 100dvh; align-items: flex-end; justify-content: center; background: rgba(20, 20, 20, .5); z-index: 90; }
body.con-panel { overflow: hidden; }
.btn-foto.falta { border-color: var(--rojo); color: var(--rojo-texto); background: var(--rojo-suave); }
.falta-foto { color: var(--rojo-texto); font-weight: 600; margin: -6px 0 10px; }

/* Páginas sin menú (error, código no válido): centradas también en escritorio */
@media (min-width: 960px) {
  body.sin-nav:not(.pantalla-entrar):not(.cliente) .contenido { max-width: 760px; margin: 0 auto; }
  body.sin-nav:not(.cliente) .cabecera { display: none; }
}
