/* ===========================================================
   App de Reportes de Campo · ASPIK / ASPX
   Estética: "terminal de operaciones de campo"
   Fondo negro profundo + acento CIAN eléctrico.
   =========================================================== */
:root {
  /* Marca — acento ROSA SALMÓN sobre fondo NEGRO (tema oscuro) */
  --acento: #fb7e68;
  --acento-strong: #e96247;
  --acento-soft: rgba(251, 126, 104, .14);
  --acento-line: rgba(251, 126, 104, .42);

  /* Color de marca (alias, por si lo usa algún detalle) */
  --marca: #fb7e68;
  --marca-strong: #e96247;
  --marca-soft: rgba(251, 126, 104, .18);

  /* Fondos y superficies (negros profundos) */
  --bg: #0a0a0c;
  --bg-2: #101012;
  --card: #15161a;
  --card-2: #1b1c21;
  --field: #101013;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .11);

  /* Texto */
  --ink: #f6f1ef;
  --muted: #a59993;
  --faint: #756c66;

  /* Estados (sobre fondo oscuro) */
  --ok: #34d399;   --ok-bg: rgba(52, 211, 153, .12);   --ok-line: rgba(52, 211, 153, .35);
  --err: #f87171;  --err-bg: rgba(248, 113, 113, .12); --err-line: rgba(248, 113, 113, .35);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .12); --warn-line: rgba(251, 191, 36, .35);
  --info: #60a5fa; --info-bg: rgba(96, 165, 250, .12); --info-line: rgba(96, 165, 250, .35);

  --radius: 18px;
  --radius-sm: 13px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.45);

  --fuente: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
/* Garantiza que TODO elemento con atributo hidden quede oculto, aunque su
   clase defina un display (p. ej. .conteo). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--fuente);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}
/* Atmósfera: resplandor ámbar tenue arriba + viñeta + grano sutil */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(251, 126, 104, .12), transparent 60%),
    radial-gradient(100% 80% at 100% 0%, rgba(233, 98, 71, .06), transparent 55%),
    var(--bg);
}
/* (Sin grano de ruido — ahorra render en celulares.) */

/* ---------- Encabezado ---------- */
.barra {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  position: sticky;
  top: 0; z-index: 20;
  background: linear-gradient(180deg, #14161c, #0c0d11);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--acento-line), 0 8px 24px rgba(0,0,0,.5);
}
.barra .logo {
  width: 42px; height: 42px; border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(251,126,104,.10), 0 6px 16px rgba(0,0,0,.6);
}
.marca { display: flex; flex-direction: column; line-height: 1.12; }
.marca-nombre {
  font-size: 1.32rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: #fff;
}
.marca-cod {
  font-family: var(--mono); font-size: .68rem; font-weight: 700;
  letter-spacing: .42em; color: var(--acento); margin-top: 3px;
}
.marca-desc { font-size: .78rem; color: var(--muted); margin-top: 4px; letter-spacing: .01em; }
/* compatibilidad con encabezados antiguos */
.barra h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.barra .sub { margin: 1px 0 0; font-size: .8rem; color: var(--muted); }

/* ============================================================
   Pestañas — minimalistas (texto + subrayado animado bajo la activa)
   ============================================================ */
.tabs {
  position: sticky; top: 76px; z-index: 19;
  display: flex; align-items: stretch; gap: 0;
  max-width: 620px; margin: 0 auto; padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  -webkit-user-select: none; user-select: none;
}
.tabs .tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 14px 8px;
  border: 0; background: transparent;
  color: var(--muted); font-family: inherit;
  font-weight: 600; font-size: .92rem; letter-spacing: .01em;
  cursor: pointer; position: relative;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.activa { color: var(--acento); }
.tab-ico {
  display: inline-flex; font-size: 1rem; opacity: .85;
  transition: opacity .15s;
}
.tabs .tab.activa .tab-ico { opacity: 1; }
.tab-txt { white-space: nowrap; }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--err); color: #fff; font-size: .68rem; font-weight: 800;
  font-family: var(--mono); margin-left: 2px;
}
/* Subrayado animado que se mueve entre pestañas */
.tab-indicador {
  position: absolute; left: 0; bottom: -1px; height: 2px;
  width: 50%; background: var(--acento); border-radius: 2px;
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  pointer-events: none; will-change: transform;
  /* posición inicial: pestaña 1 (Nuevo reporte) */
  transform: translateX(0%);
}
.tabs[data-activa="envios"] .tab-indicador { transform: translateX(100%); }

/* ---------- Vistas (panel de cada pestaña) — transición ligera ---------- */
.vista { display: block; }
.vista[hidden] { display: none; }
.vista.entrando { animation: vista-in .18s ease-out; }
@keyframes vista-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.vista-titulo { margin: 0 0 4px; font-size: 1.25rem; color: #fff; letter-spacing: .01em; }
.vista-sub { margin: 0 0 18px; color: var(--muted); font-size: .9rem; }

/* Aviso destacado (no eliminar reportes en curso, etc.) */
.aviso-importante {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; margin: 10px 0 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm); color: var(--warn);
  font-size: .85rem; font-weight: 600;
}
.aviso-importante .ico { font-size: 1.1rem; line-height: 1; }
.aviso-importante strong { color: var(--ink); }

/* ---------- Estado vacío ---------- */
.vacio-msg {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 30px 18px; margin: 0; text-align: center;
  color: var(--muted); animation: surge .4s cubic-bezier(.2,.7,.2,1);
}
.vacio-ico {
  font-size: 2.4rem; line-height: 1; margin-bottom: 4px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); }
}
.vacio-titulo { color: var(--ink); font-weight: 700; font-size: 1rem; }
.vacio-sub { font-size: .85rem; }

/* ---------- Contenedor ---------- */
.contenedor { max-width: 620px; margin: 0 auto; padding: 22px 16px 48px; }
.contenedor > .vista > form,
.contenedor > .vista > .tarjeta { animation: surge .22s ease-out both; }
@keyframes surge { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Campos ---------- */
.campo { margin-bottom: 18px; }
.fila { display: flex; gap: 14px; }
.fila .campo { flex: 1; }

label {
  display: block; font-weight: 600; margin-bottom: 8px;
  font-size: .82rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.obl { color: var(--acento); margin-left: 3px; }
.opc { color: var(--faint); font-weight: 400; font-size: .75rem; text-transform: none; letter-spacing: 0; }

input[type="text"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], input[type="search"],
select, textarea, input[type="file"] {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--field);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="file"] { padding: 11px 12px; color: var(--muted); }
input[type="date"], input[type="time"] { color-scheme: dark; }
textarea { resize: vertical; min-height: 76px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--acento);
  background: #0c0e12;
  box-shadow: 0 0 0 4px var(--acento-soft);
}
.campo-invalido input, .campo-invalido select, .campo-invalido textarea {
  border-color: var(--err);
  box-shadow: 0 0 0 4px var(--err-bg);
}

/* Campos de texto libre que se escriben en MAYÚSCULAS */
.mayus { text-transform: uppercase; }
.mayus::placeholder { text-transform: none; }   /* el placeholder en normal */
/* Hora 24h: centrada y monoespaciada para que se lea HH:MM clarito */
.hora24 { font-family: var(--mono); letter-spacing: .04em; }

.ayuda { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }
.ayuda strong { color: var(--ink); }
.conteo {
  display: inline-block; margin-top: 10px; padding: 5px 12px;
  background: var(--acento-soft); color: var(--acento);
  border: 1px solid var(--acento-line);
  border-radius: 999px; font-size: .82rem; font-weight: 700;
  font-family: var(--mono); letter-spacing: .02em;
}

/* ---------- Personal: desplegable compacto con casillas ---------- */
.multiselect { position: relative; }
.ms-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 14px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); background: var(--field); color: var(--ink);
  font-size: 1rem; font-family: inherit; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.ms-trigger:hover { border-color: var(--acento-line); }
.ms-trigger[aria-expanded="true"] {
  border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-soft);
}
#trabajadores-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#trabajadores-texto.placeholder { color: var(--faint); }
.ms-flecha { color: var(--acento); flex: none; transition: transform .15s; }
.ms-trigger[aria-expanded="true"] .ms-flecha { transform: rotate(180deg); }
.ms-panel { margin-top: 6px; }
.campo-invalido .ms-trigger { border-color: var(--err); box-shadow: 0 0 0 4px var(--err-bg); }

/* ---------- Lista de personal (uno o varios) ---------- */
.checklist {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--field); max-height: 240px; overflow-y: auto; padding: 6px;
}
.check-item {
  display: flex; align-items: center; gap: 11px; margin: 0;
  padding: 12px; border-radius: 10px; cursor: pointer;
  font-weight: 600; color: var(--ink);
  text-transform: none; letter-spacing: 0; font-size: 1rem;
}
.check-item + .check-item { margin-top: 2px; }
.check-item:hover { background: var(--acento-soft); }
.check-item input { width: auto; margin: 0; accent-color: var(--acento); transform: scale(1.25); }
.checklist-vacio { color: var(--muted); padding: 10px; margin: 0; }
.campo-invalido .checklist {
  border-color: var(--err); box-shadow: 0 0 0 4px var(--err-bg);
}

/* ---------- Sección "Recursos usados" ---------- */
.sub-seccion {
  margin: 26px 0 14px; font-size: .9rem; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: .08em;
  padding-bottom: 8px; border-bottom: 1px solid var(--acento-line);
}
/* Sub-campos que dependen de un desplegable (litros / combustible). */
.sub-campo {
  margin-left: 10px; padding-left: 14px;
  border-left: 2px solid var(--acento-line);
}

/* ---------- Buscador de sitios ---------- */
.resultados {
  list-style: none; margin: 8px 0 0; padding: 6px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--card); max-height: 300px; overflow-y: auto;
  box-shadow: var(--shadow);
}
.resultados li {
  padding: 12px; border-radius: 10px; cursor: pointer;
  transition: background .12s; color: var(--ink);
}
.resultados li + li { margin-top: 2px; }
.resultados li:hover, .resultados li.activo { background: var(--acento-soft); }
.resultados li small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.resultados .vacio { color: var(--muted); cursor: default; }
.resultados .vacio:hover { background: transparent; }
.elegido {
  margin: 10px 0 0; padding: 11px 13px;
  background: var(--ok-bg); border: 1px solid var(--ok-line);
  border-radius: var(--radius-sm); font-weight: 600; color: var(--ok);
}
/* Recuadros automáticos con el ID y la Zona del sitio elegido */
.sitio-datos { display: flex; gap: 10px; margin-top: 10px; }
.sitio-dato {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 13px;
  background: var(--card-2); border: 1px solid var(--acento-line);
  border-radius: var(--radius-sm);
}
.sitio-dato-lbl {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.sitio-dato-val {
  font-family: var(--mono); font-size: 1.02rem; font-weight: 700;
  color: var(--acento); word-break: break-word;
}

/* ---------- Botón principal ---------- */
.btn-primario {
  width: 100%; padding: 16px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--acento), var(--acento-strong));
  color: #220906; font-size: 1.02rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  cursor: pointer; transition: filter .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 6px 22px rgba(251,126,104,.26), 0 1px 0 rgba(255,255,255,.25) inset;
}
.btn-primario:hover { filter: brightness(1.06); box-shadow: 0 8px 28px rgba(251,126,104,.40); }
.btn-primario:active { transform: translateY(1px); }
.btn-primario:disabled { opacity: .55; cursor: progress; filter: saturate(.6); box-shadow: none; }

/* ---------- Barra de progreso (legado) ---------- */
.progreso { margin-top: 14px; }
.progreso[hidden] { display: none; }
.progreso .pista { height: 12px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progreso .barra-fill { height: 100%; width: 0%; background: var(--acento); border-radius: 999px; transition: width .2s ease; }
.progreso .pct { margin: 7px 0 0; font-size: .85rem; color: var(--muted); font-weight: 600; text-align: center; font-family: var(--mono); }

/* ---------- Estado / avisos ---------- */
.estado {
  margin-top: 16px; padding: 15px 16px; border-radius: var(--radius-sm);
  font-weight: 600; white-space: pre-line; word-break: break-word;
  border: 1px solid transparent; background: var(--card);
}
.estado.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.estado.error { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.estado.cargando { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.tarjeta h2 { margin: 0 0 8px; font-size: 1.05rem; color: #fff; letter-spacing: .01em; }
.estado-info { font-size: 1rem; font-weight: 700; color: var(--ink); }
.campo-check label { display: flex; align-items: center; gap: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink); }
.campo-check input { width: auto; accent-color: var(--acento); }

/* ---------- Pie / enlaces ---------- */
.pie { text-align: center; margin-top: 24px; }
a, .pie a { color: var(--acento); text-decoration: none; font-weight: 600; }
a:hover, .pie a:hover { text-decoration: underline; }

/* ---------- Pantalla de acceso (centrada) ---------- */
.centrado { min-height: calc(100vh - 76px); display: flex; align-items: center; }
.centrado .tarjeta { width: 100%; }

/* ---------- Cola "Mis envíos" ---------- */
.cola { margin-top: 22px; }
.cola-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cola-cabecera h2 { margin: 0; }
#cola-resumen { font-weight: 700; color: var(--acento); margin-top: 2px; font-family: var(--mono); font-size: .85rem; letter-spacing: .02em; }

.cola-lista { list-style: none; margin: 14px 0 0; padding: 0; }
.cola-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 11px; background: var(--field);
}
.cola-item:last-child { margin-bottom: 0; }
.cola-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cola-sitio { font-weight: 700; color: #fff; word-break: break-word; }
.cola-meta { font-size: .82rem; color: var(--muted); margin-top: 4px; font-family: var(--mono); }

.cola-badge {
  flex: none; font-size: .74rem; font-weight: 800; white-space: nowrap;
  padding: 4px 11px; border-radius: 999px; border: 1px solid transparent;
  text-transform: uppercase; letter-spacing: .04em;
}
.b-cola { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.b-env  { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.b-ok   { background: var(--ok-bg);  color: var(--ok);  border-color: var(--ok-line); }
.b-warn { background: var(--warn-bg);color: var(--warn);border-color: var(--warn-line); }
.b-err  { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }

.cola-prog { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cola-prog .pista { flex: 1; height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.cola-prog .barra-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--acento-strong), var(--acento)); border-radius: 999px; transition: width .2s ease; }
.cola-pct { font-size: .8rem; color: var(--muted); font-weight: 700; min-width: 46px; text-align: right; font-family: var(--mono); }

.cola-nota { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.cola-errmsg {
  font-size: .82rem; color: var(--err); margin-top: 8px;
  background: var(--err-bg); border: 1px solid var(--err-line);
  border-radius: 10px; padding: 8px 10px; word-break: break-word;
}
.cola-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-mini {
  padding: 8px 14px; border: 1px solid var(--acento-line); border-radius: 999px;
  background: var(--acento-soft); color: var(--acento); font-size: .84rem; font-weight: 700;
  cursor: pointer; transition: background .12s, filter .12s;
}
.btn-mini:hover { filter: brightness(1.15); }
.btn-mini-rojo { border-color: var(--err-line); color: var(--err); background: var(--err-bg); }

/* ============================================================
   Registros completados (historial local del cel) — animado
   ============================================================ */
.historial { padding: 0; overflow: hidden; }
.hist-cabecera {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 16px 18px; border: 0; background: transparent; color: var(--ink);
  font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  text-align: left; transition: background .15s;
  position: relative; overflow: hidden;
}
.hist-cabecera:hover { background: rgba(255,255,255,.025); }
.hist-cabecera::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at var(--rx,50%) var(--ry,50%),
                              var(--acento-soft), transparent 60%);
  opacity: 0; transition: opacity .25s, transform .4s;
  pointer-events: none; transform: scale(.6);
}
.hist-cabecera:active::after { opacity: 1; transform: scale(1.4); }
.hist-titulo { flex: 1; display: flex; align-items: center; gap: 10px; }
.hist-ico {
  display: inline-flex; width: 30px; height: 30px; align-items: center;
  justify-content: center; border-radius: 9px; background: var(--acento-soft);
  border: 1px solid var(--acento-line); font-size: 1rem;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.hist-cabecera:hover .hist-ico { transform: rotate(-6deg) scale(1.06); }
.hist-cantidad {
  font-family: var(--mono); font-size: .8rem; font-weight: 800; color: var(--acento);
  background: var(--acento-soft); border: 1px solid var(--acento-line);
  padding: 3px 10px; border-radius: 999px;
}
.hist-flecha {
  color: var(--acento); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.hist-cabecera.abierto .hist-flecha { transform: rotate(180deg); }
.hist-panel { padding: 0 18px 18px; animation: hist-down .35s cubic-bezier(.2,.7,.2,1); }
@keyframes hist-down {
  from { opacity: 0; transform: translateY(-8px); max-height: 0; }
  to   { opacity: 1; transform: none; max-height: 2000px; }
}
/* Buscador y filtros del historial */
.hist-buscador { margin: 14px 0 6px; }
.hist-search-wrap {
  position: relative; display: flex; align-items: center;
}
.hist-search-ico {
  position: absolute; left: 14px; color: var(--muted);
  font-size: 1.05rem; pointer-events: none;
}
#hist-busqueda {
  padding-left: 38px; padding-right: 38px;
  border-radius: 999px;       /* pill */
  background: var(--field);
}
.hist-search-clear {
  position: absolute; right: 8px; width: 26px; height: 26px;
  border-radius: 50%; border: 0; background: var(--acento-soft);
  color: var(--acento); font-size: 1.1rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hist-chips {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--line-2); background: var(--card); color: var(--muted);
  padding: 7px 13px; border-radius: 999px; font-family: inherit;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { color: var(--ink); border-color: var(--acento-line); }
.chip.activo {
  color: #220906; background: var(--acento);
  border-color: var(--acento);
}
.hist-conteo {
  margin: 8px 0 0; font-size: .78rem; color: var(--muted);
  font-family: var(--mono);
}

.hist-lista { list-style: none; margin: 12px 0 0; padding: 0; }
.hist-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--field); margin-bottom: 9px; overflow: hidden;
  animation: surge .35s cubic-bezier(.2,.7,.2,1) both;
  transition: transform .15s, border-color .15s;
}
.hist-item:hover { border-color: var(--acento-line); }
.hist-item-cab {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 6px 12px; width: 100%; padding: 12px 14px; border: 0;
  background: transparent; color: var(--ink); font-family: inherit;
  text-align: left; cursor: pointer; transition: background .12s;
}
.hist-item-cab:hover { background: rgba(255,255,255,.025); }
.hist-item-sitio { font-weight: 700; color: #fff; word-break: break-word; }
.hist-item-meta {
  grid-column: 1; font-family: var(--mono); font-size: .78rem;
  color: var(--muted); margin-top: 2px;
}
.hist-item-flecha {
  grid-row: 1 / span 2; color: var(--acento); font-size: 1rem;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.hist-item.abierto .hist-item-flecha { transform: rotate(180deg); }
.hist-item-det {
  padding: 8px 14px 14px; border-top: 1px dashed var(--line);
  background: rgba(251, 126, 104, .04);
  animation: hist-down .25s cubic-bezier(.2,.7,.2,1);
}
.hist-item-det p { margin: 4px 0; font-size: .88rem; color: var(--ink); word-break: break-word; }
.hist-item-det .k { color: var(--muted); font-weight: 700; margin-right: 6px; text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; }
.hist-acciones { display: flex; justify-content: flex-end; margin-top: 10px; }

/* ============================================================
   Mini animación de entrega exitosa (confeti + pulso)
   ============================================================ */
.confeti {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  display: flex; align-items: center; justify-content: center;
}
.confeti-pieza {
  position: absolute; width: 10px; height: 14px; border-radius: 2px;
  background: var(--acento); opacity: .95;
  animation: confeti-fly 1.4s cubic-bezier(.2,.7,.2,1) forwards;
}
.confeti-pieza.p1 { background: var(--acento);        --dx:-90px; --dy:-130px; --rot:-220deg; }
.confeti-pieza.p2 { background: var(--acento-strong); --dx: 90px; --dy:-130px; --rot: 220deg; }
.confeti-pieza.p3 { background: #34d399;              --dx:-50px; --dy: 120px; --rot:-120deg; }
.confeti-pieza.p4 { background: #fbbf24;              --dx: 50px; --dy: 120px; --rot: 120deg; }
@keyframes confeti-fly {
  0%   { transform: translate(0,0) rotate(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
.btn-primario.pulso { animation: btn-pulso .9s ease-out; }
@keyframes btn-pulso {
  0%   { transform: scale(1);   box-shadow: 0 0 0 0 rgba(251,126,104,.55); }
  50%  { transform: scale(1.03);box-shadow: 0 0 0 16px rgba(251,126,104,0); }
  100% { transform: scale(1);   box-shadow: 0 6px 22px rgba(251,126,104,.26); }
}

/* ============================================================
   Micro-interacciones generales
   ============================================================ */
/* Ripple para taps en botones mini y en cabeceras de item */
.btn-mini, .ms-trigger, .hist-item-cab {
  position: relative; overflow: hidden;
}
.btn-mini::after, .hist-item-cab::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--acento); opacity: .35; transform: translate(-50%, -50%) scale(0);
  pointer-events: none; transition: transform .5s, opacity .55s;
}
.btn-mini:active::after, .hist-item-cab:active::after {
  transform: translate(-50%, -50%) scale(40); opacity: 0;
}
/* Tarjeta: solo color del borde al pasar el dedo (sin transform — más fluido). */
.tarjeta { transition: border-color .15s; }
.tarjeta:hover { border-color: var(--acento-line); }
/* Sub-campos: deslizar al abrir/cerrar */
#bloque-generador:not([hidden]),
#bloque-vehiculo:not([hidden]) {
  animation: surge .28s cubic-bezier(.2,.7,.2,1);
}
/* Aparición simple de items de cola (sin cascada — más rápido) */
#cola-lista .cola-item { animation: surge .18s ease-out both; }
/* Checkboxes del personal: leve "tic" al marcar */
@keyframes tic {
  0% { transform: scale(1); } 50% { transform: scale(1.35); } 100% { transform: scale(1); }
}
.check-item input:checked { animation: tic .25s ease-out; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
