@font-face {
  font-family: "Archivo";
  src: url("../assets/fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --tinta: #14171a;
  --nieve: #ffffff;
  --roca: #e8ebee;
  --linea: #c5cbd1;
  --gris: #4f5961;
  --naranja: #f7941e;
  --naranja-tinta: #8f4a00;
  --cuerda: #1d7fbf;
  --rojo: #b3261e;
  --verde: #1e7a3c;
  --ancho: 34rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--roca);
  color: var(--tinta);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}
h1, h2, p, ol { margin: 0; padding: 0; }
ol { list-style: none; }
:focus-visible { outline: 3px solid var(--cuerda); outline-offset: 2px; }

.app { max-width: var(--ancho); margin: 0 auto; min-height: 100dvh; }

.barra {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 0.75rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem;
  background: var(--tinta); color: var(--nieve);
}
.barra h1 { font-size: 1.2rem; font-weight: 800; font-stretch: 115%; line-height: 1.15; }
.barra .quien { font-size: 0.85rem; opacity: 0.8; }
.logo { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--nieve); object-fit: contain; }
.volver {
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: var(--nieve); font-size: 1.8rem; line-height: 1; cursor: pointer;
}

.contenido { display: grid; gap: 1rem; padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
.nota { color: var(--gris); font-size: 0.95rem; }
.pie { text-align: center; color: var(--gris); font-size: 0.85rem; }
.titulo-seccion { margin: 0.5rem 0 0.5rem; font-size: 1.05rem; font-weight: 800; font-stretch: 112%; }

.tarjeta { background: var(--nieve); border-radius: 0.75rem; padding: 1rem; border: 1px solid var(--linea); }
.tarjeta h2 { font-size: 1rem; font-weight: 800; margin-bottom: 0.25rem; }

.aviso { background: #fff4e5; border-left: 4px solid var(--naranja); padding: 0.75rem 0.9rem; border-radius: 0.5rem; color: var(--naranja-tinta); font-size: 0.95rem; }
.aviso.suave { background: #eef5fb; border-color: var(--cuerda); color: #0d4a73; }

button { font: inherit; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
.principal {
  width: 100%; padding: 0.85rem 1rem; border: 0; border-radius: 0.6rem;
  background: var(--naranja); color: var(--tinta); font-weight: 800; font-stretch: 110%;
}
.principal.grande { padding: 1.1rem 1rem; font-size: 1.1rem; }
.secundario {
  padding: 0.6rem 0.9rem; border: 1px solid var(--tinta); border-radius: 0.5rem;
  background: var(--nieve); color: var(--tinta); font-weight: 700; white-space: nowrap;
}
.enlace { border: 0; background: none; color: var(--cuerda); text-decoration: underline; padding: 0.25rem; }
.enlace.peligro { color: var(--rojo); justify-self: center; }

label, legend { font-weight: 700; font-size: 0.95rem; }
legend { font-size: 1rem; font-weight: 800; font-stretch: 112%; padding: 0 0.25rem; }
fieldset.tarjeta { display: grid; gap: 0.9rem; margin: 0; min-width: 0; }
#ingreso { display: grid; gap: 0.9rem; }
#ingreso label { display: grid; gap: 0.3rem; }
#registro { display: grid; gap: 1rem; }
.campo { display: grid; gap: 0.3rem; }
input, select, textarea {
  width: 100%; padding: 0.7rem 0.75rem; border: 1px solid var(--linea); border-radius: 0.5rem;
  background: var(--nieve); color: var(--tinta); font: inherit; font-size: 1rem;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cuerda); outline: none; box-shadow: 0 0 0 3px rgba(29,127,191,0.2); }
.con-boton { display: flex; gap: 0.5rem; }
.ayuda { font-size: 0.85rem; color: var(--gris); }
.obl { color: var(--rojo); }

.pendiente { border-left: 4px solid var(--naranja); display: grid; gap: 0.5rem; }
.error { border-left: 4px solid var(--rojo); display: grid; gap: 0.5rem; }
.listo.enviado { border-left: 4px solid var(--verde); }
.listo.pendiente { border-left: 4px solid var(--naranja); }
.listo.fallido { border-left: 4px solid var(--rojo); }

.recientes { display: grid; gap: 0.6rem; }
.recientes li { display: grid; gap: 0.2rem; }
.fila-arriba { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--gris); }
.id { font-weight: 700; letter-spacing: 0.02em; }
.lugar { font-weight: 700; }
.detalle { font-size: 0.9rem; color: var(--gris); }
.etiquetas { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.2rem; }
.etiqueta { font-size: 0.78rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 1rem; background: var(--roca); }
.sev-alta { background: #fbe1df; color: var(--rojo); }
.sev-media { background: #fff0d9; color: var(--naranja-tinta); }
.sev-baja { background: #e3f3e8; color: var(--verde); }

/* Fichas de los últimos registros */
.ficha details { margin-top: 0.5rem; border-top: 1px solid var(--roca); padding-top: 0.5rem; }
.ficha summary { cursor: pointer; color: var(--cuerda); font-weight: 700; font-size: 0.95rem; }
.ficha h3 { margin: 0.9rem 0 0.3rem; font-size: 0.9rem; font-weight: 800; font-stretch: 110%; color: var(--gris); text-transform: uppercase; letter-spacing: 0.03em; }
.tabla-ficha { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tabla-ficha th, .tabla-ficha td { text-align: left; vertical-align: top; padding: 0.35rem 0; border-bottom: 1px solid var(--roca); }
.tabla-ficha th { width: 42%; padding-right: 0.6rem; font-weight: 600; color: var(--gris); }
.tabla-ficha td { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 40rem) { :root { --ancho: 44rem; } }
