/* Cerca — sistema de diseño de la app
   Deal del kit (tasteskill): paleta mint-pink-accounts · tipo host
   (Host Grotesk + JetBrains Mono) · radius soft. Los tokens :root son los
   impresos por assets/system.css del kit; la capa de componentes es de la app. */

:root {
  --p-bg: #f8f8f8; --p-surface: #eeeeee; --p-ink: #0a0a0a; --p-muted: #6a6a6a;
  --p-accent: #1f6b3a; --p-accent-ink: #ffffff; --p-action: #1f6b3a; --p-action-ink: #ffffff;
  --p-inv-bg: #0a0a0a; --p-inv-surface: #171717; --p-inv-ink: #f8f8f8; --p-inv-muted: #939393;
  --p-inv-accent: #4be08d; --p-inv-accent-ink: #063d1e;
  --font-display: "Host Grotesk", system-ui, sans-serif;
  --font-text: "Host Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --display-weight: 500;
  --display-tracking: -0.035em;
  --display-tracking-xl: -0.04em;

  /* Derivados de la app */
  --borde: #e3e3e3;
  --ok-suave: #e7f3ec;
  --ok-ink: #175c33;
  --aviso-suave: #fdf3d8;
  --aviso-ink: #7a5b14;
  --error-suave: #fbe9e4;
  --error-ink: #a3391f;
  --info-suave: #e9eef6;
  --sombra: 0 1px 2px rgba(10, 10, 10, .05), 0 10px 30px rgba(10, 10, 10, .06);
  --radio: 14px;
  --paso: 160ms cubic-bezier(.2, .6, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-text);
  color: var(--p-ink);
  background: var(--p-bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--p-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ok-ink); }
:focus-visible { outline: 2px solid var(--p-accent); outline-offset: 2px; border-radius: 4px; }

/* ===================== barra ===================== */
.barra {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  padding: .75rem 1.4rem;
  background: var(--p-surface);
  border-bottom: 1px solid var(--borde);
  flex-wrap: wrap;
}
.salto {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.salto:focus {
  position: fixed; left: .6rem; top: .6rem; width: auto; height: auto;
  clip-path: none; background: var(--p-accent); color: var(--p-accent-ink);
  padding: .55rem 1rem; border-radius: 10px; z-index: 60;
}
.marca {
  font-family: var(--font-display); font-weight: var(--display-weight);
  font-size: 1.35rem; letter-spacing: var(--display-tracking);
  text-decoration: none; color: var(--p-ink);
  display: inline-flex; align-items: center; gap: .5rem;
}
.marca::before {
  content: ""; width: .62em; height: .62em; border-radius: 50%;
  background: var(--p-accent); box-shadow: 0 0 0 .18em var(--ok-suave);
  transition: box-shadow var(--paso);
}
.marca:hover::before { box-shadow: 0 0 0 .28em var(--ok-suave); }
.barra nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.barra nav a, .barra nav .enlace {
  text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--p-muted);
  padding: .4rem .55rem; border-radius: 8px; position: relative;
}
.barra nav a::after, .barra nav .enlace::after {
  content: ""; position: absolute; left: .55rem; right: .55rem; bottom: .22rem;
  height: 2px; background: var(--p-accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: left; transition: transform var(--paso);
}
.barra nav a:hover, .barra nav .enlace:hover { color: var(--p-ink); }
.barra nav a:hover::after, .barra nav .enlace:hover::after { transform: scaleX(1); }
.usuario { color: var(--p-muted); font-size: .92rem; margin-left: .4rem; }
.en-linea { display: inline; }

/* ===================== estructura ===================== */
.contenedor { max-width: 1060px; margin: 0 auto; padding: 2rem 1.25rem 3.5rem; }
.pie {
  background: var(--p-inv-bg); color: var(--p-inv-ink);
  font-size: .85rem; padding: 1.6rem 1.4rem;
}
.pie .interior {
  max-width: 1060px; margin: 0 auto; display: flex; gap: 1rem;
  justify-content: space-between; flex-wrap: wrap; align-items: center;
}
.pie a { color: var(--p-inv-ink); }
.pie .tenue { color: var(--p-inv-muted); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.15;
}
h1 { font-size: clamp(1.7rem, 3.4vw, 2.35rem); margin: 0 0 .45rem; }
h2 { font-size: 1.32rem; margin: 1.8rem 0 .6rem; }
h3 { font-size: 1.06rem; margin: .95rem 0 .4rem; }
.ayuda { color: var(--p-muted); margin-top: 0; }
.detalle { margin: .22rem 0; }
.dato { color: var(--p-muted); font-size: .9rem; }
.mono { font-family: var(--font-mono); }
.centrado { text-align: center; }

.hero { margin: .5rem 0 1.4rem; max-width: 62ch; }
.hero h1 { letter-spacing: var(--display-tracking-xl); }

/* entrada del héroe (una sola vez, en carga) */
[data-enter] { animation: cer-entrar .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes cer-entrar {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { [data-enter] { animation: none; } }

/* ===================== tarjetas ===================== */
.tarjeta {
  background: var(--p-surface);
  border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.2rem 1.3rem; margin-bottom: 1.1rem;
}
.tarjeta.interactiva { transition: transform var(--paso), box-shadow var(--paso); }
.tarjeta.interactiva:hover { transform: translateY(-2px); box-shadow: var(--sombra); }
.tarjeta.mini { padding: 1rem; }
.numero { font-family: var(--font-display); font-size: 2.1rem; font-weight: 500; letter-spacing: var(--display-tracking); }
.numero.verde { color: var(--p-accent); }
.numero.tenue { color: var(--p-muted); }
.grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.borde-wa { border-left: 5px solid #25D366; }

/* ===================== formularios ===================== */
label { display: block; font-weight: 600; margin: .85rem 0 .3rem; font-size: .95rem; }
label.radio { font-weight: 500; margin: 0; display: inline; }
input[type="text"], input[type="password"], input[type="tel"], input[type="date"], input[type="file"], select, textarea {
  width: 100%; padding: .62rem .8rem;
  border: 1.5px solid var(--borde); border-radius: 10px;
  background: #fff; font: inherit; color: var(--p-ink);
  transition: border-color var(--paso), box-shadow var(--paso);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--p-accent); box-shadow: 0 0 0 3px var(--ok-suave);
}
textarea { resize: vertical; }
fieldset {
  border: 1px solid var(--borde); border-radius: 10px; padding: .85rem 1rem; margin: 1.05rem 0;
}
legend { font-weight: 600; padding: 0 .4rem; color: var(--p-muted); }
.radio-estado { display: flex; flex-wrap: wrap; gap: .85rem 1.15rem; align-items: center; }
.radio-opcion { display: inline-flex; align-items: center; gap: .35rem; }
.grilla-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

/* ===================== botones (par: sólido + tonal) ===================== */
.boton, .chip {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .58rem 1.2rem; border: 0; border-radius: 999px;
  cursor: pointer; text-decoration: none; font: inherit; font-weight: 600;
  min-height: 44px;
  transition: transform var(--paso), background var(--paso), box-shadow var(--paso), color var(--paso);
}
.boton { background: var(--p-action); color: var(--p-action-ink); }
.boton:hover { background: #175a30; }
.boton:active { transform: translateY(1px) scale(.99); }
.boton.grande { font-size: 1.05rem; padding: .75rem 1.7rem; margin-top: 1rem; }
.boton.secundario { background: var(--ok-suave); color: var(--ok-ink); }
.boton.secundario:hover { background: #d7eadf; }
.boton.secundario:active { transform: translateY(1px) scale(.99); }
.boton.peligro { background: var(--error-suave); color: var(--error-ink); }
.boton.peligro:hover { background: #f5d9d0; }
#btn-grabar.grabando { background: var(--error-ink); color: #fff; }

.chip {
  background: #fff; border: 1.5px solid var(--borde); color: var(--p-muted);
  min-height: 38px; padding: .32rem .95rem; font-size: .92rem;
}
.chip:hover { border-color: var(--p-accent); color: var(--p-accent); }
.chip.activo { background: var(--p-ink); border-color: var(--p-ink); color: #fff; }

.insignia {
  display: inline-block; padding: .16rem .7rem; border-radius: 999px;
  background: var(--ok-suave); color: var(--ok-ink);
  font-size: .82rem; font-weight: 600;
}
.insignia.cerrado { background: var(--error-suave); color: var(--error-ink); }
.codigo {
  font-family: var(--font-mono); font-size: 1.75rem; letter-spacing: .14em; font-weight: 600;
  background: var(--p-inv-bg); color: var(--p-inv-accent);
  padding: .6rem 1.2rem; border-radius: 12px; display: inline-block; margin: .3rem 0;
}

/* ===================== mensajes ===================== */
.mensajes { list-style: none; padding: 0; margin: 0 0 1.1rem; }
.mensaje {
  padding: .7rem 1rem; border-radius: 10px; margin-bottom: .45rem;
  background: var(--ok-suave); color: var(--ok-ink); border: 1px solid #d3e8db;
}
.mensaje.error { background: var(--error-suave); color: var(--error-ink); border-color: #f0cec2; }
.mensaje.warning { background: var(--aviso-suave); color: var(--aviso-ink); border-color: #f0e2b5; }
.mensaje.info { background: var(--info-suave); }

/* ===================== tablas ===================== */
table { width: 100%; border-collapse: collapse; background: var(--p-surface); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: .62rem .78rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th {
  font-family: var(--font-display); font-size: .76rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--p-muted); background: #f1f1f1;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--paso); }
tbody tr:hover td { background: #ececec; }
@media (max-width: 640px) {
  table { display: block; overflow-x: auto; }
}

/* ===================== líneas / grillas ===================== */
.linea-tiempo { list-style: none; padding: 0 0 0 .2rem; margin: 0; }
.linea-tiempo li {
  border-left: 2px solid var(--borde); padding: .35rem 0 .75rem 1rem; position: relative;
}
.linea-tiempo li::before {
  content: ""; position: absolute; left: -6px; top: .62rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--p-surface); border: 2px solid var(--p-accent);
}
.linea-tiempo .fecha {
  color: var(--p-muted); font-size: .82rem; font-family: var(--font-mono);
}
.acciones { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.acciones input[type="text"] { flex: 1; min-width: 180px; width: auto; }

/* ===================== media ===================== */
.media { display: flex; flex-wrap: wrap; gap: .95rem; align-items: center; }
.media a { display: inline-block; border-radius: 12px; overflow: hidden; }
.media img {
  max-width: 250px; max-height: 190px; border: 1px solid var(--borde);
  transition: transform var(--paso); display: block;
}
.media a:hover img { transform: scale(1.03); }
.media video { max-width: 320px; border-radius: 12px; }
.media audio { width: 260px; }
.media a { word-break: break-all; }

/* ===================== progreso ===================== */
.progreso { list-style: none; display: flex; gap: .45rem; padding: 0; margin: 0 0 .9rem; flex-wrap: wrap; }
.progreso li {
  padding: .22rem .95rem; border-radius: 999px; background: #fff;
  color: var(--p-muted); border: 1.5px solid var(--borde);
  font-size: .9rem; font-weight: 600;
}
.progreso li.hecho { background: var(--ok-suave); color: var(--ok-ink); border-color: #cfe6d8; }
.progreso li.actual { background: var(--p-ink); color: #fff; border-color: var(--p-ink); }

/* ===================== admin-lista / ABM ===================== */
.admin-lista { margin: .2rem 0 .95rem; list-style: none; padding: 0; }
.admin-lista li {
  display: flex; gap: .5rem; align-items: center; justify-content: space-between;
  padding: .4rem .15rem; border-bottom: 1px dashed var(--borde); flex-wrap: wrap;
}
.tarjeta h3 { margin: .95rem 0 .35rem; }

/* ===================== utilidades ===================== */
.ajuste-320 { overflow-wrap: anywhere; }
.barra-search-row { width: 100%; }

@media (max-width: 420px) {
  .boton { width: 100%; }
  .codigo { font-size: 1.35rem; letter-spacing: .1em; }
  .contenedor { padding: 1.25rem .95rem 2.75rem; }
}

/* Targets táctiles ≥ 44px en móvil (hallazgo real del checker) */
@media (max-width: 640px) {
  .barra nav a, .barra nav .enlace { padding: .7rem .6rem; min-height: 44px; }
  .chip { min-height: 44px; }
  table a { display: inline-flex; align-items: center; min-height: 44px; }
  .barra .marca { min-height: 44px; padding: .3rem .2rem; }
  .radio-opcion { padding: .45rem .1rem; }
  input[type="radio"], input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--p-accent); }
}
