/* registro.elchecf.es — estilo del club. Mobile-first: la base es el movil y
   los @media (min-width) amplian para tablet/escritorio. Sin fuentes externas
   (CSP estricta y sin enviar IPs a terceros): Roboto si el sistema la tiene. */

:root {
  --verde: #006633;
  --verde-2: #006935;
  --verde-claro: #5ca67e;
  --verde-fondo: #e6f2ec;
  --rojo: #c8102e;
  --azul: #2349a2;
  --tinta: #101316;
  --gris-1: #303a41;
  --gris-2: #51606c;
  --gris-3: #9dacb6;
  --linea: #d9dfe3;
  --fondo: #f1f3f5;
  --blanco: #ffffff;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(16, 19, 22, .06), 0 8px 24px rgba(16, 19, 22, .08);
  --font: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--fondo);
}

a { color: var(--verde); text-underline-offset: 2px; }
a:hover { color: var(--verde-2); }

:focus-visible { outline: 3px solid var(--verde-claro); outline-offset: 2px; }

h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 .5rem; font-weight: 800; letter-spacing: -.01em; }

.muted { color: var(--gris-2); }

/* ---------------------------------------------------------------- cabecera */

.site-header {
  background: var(--verde);
  color: var(--blanco);
  padding-top: env(safe-area-inset-top);
}
.site-header__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.site-header__crest { width: 40px; height: auto; flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.site-header__name { font-weight: 800; font-size: 1.125rem; letter-spacing: .02em; text-transform: uppercase; }

.is-back .site-header__inner { max-width: 1200px; }

/* ------------------------------------------------------------------ pagina */

.page {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}
.page--wide { max-width: 1200px; }

.hero { margin: .5rem 0 1.25rem; }
.hero p { margin: 0; color: var(--gris-2); }

.card {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.25rem 1rem;
}
.card--center { text-align: center; padding: 2rem 1.25rem; }

.site-footer {
  text-align: center;
  font-size: .8125rem;
  color: var(--gris-2);
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
}
.site-footer p { margin: 0; }

/* -------------------------------------------------------------- formulario */

.form { display: flex; flex-direction: column; gap: 1rem; }
.form--narrow { max-width: 420px; margin: 1rem auto 0; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }

.field { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.field label { font-weight: 600; font-size: .9375rem; color: var(--gris-1); }

.field input,
.field select {
  width: 100%;
  min-height: 48px;           /* objetivo tactil comodo */
  padding: .75rem .875rem;
  font: inherit;
  font-size: 16px;            /* evita el zoom automatico de iOS al enfocar */
  color: var(--tinta);
  background: var(--blanco);
  border: 1.5px solid var(--linea);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.field select {
  padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--gris-2) 50%), linear-gradient(135deg, var(--gris-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(0, 102, 51, .18);
}

.field--error input { border-color: var(--rojo); }
.field__error { margin: 0; font-size: .875rem; color: var(--rojo); font-weight: 500; }

.alert {
  padding: .75rem 1rem;
  border-radius: 10px;
  background: #fdecee;
  color: #8a0b20;
  border-left: 4px solid var(--rojo);
  font-weight: 500;
}

/* honeypot: fuera de pantalla, no display:none (algunos bots lo detectan) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* -------------------------------------------------------- consentimientos */

.consents { border: 0; margin: .25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.consents legend { font-weight: 800; font-size: 1rem; margin-bottom: .5rem; padding: 0; }

.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .75rem;
  align-items: start;
  padding: .875rem;
  border: 1.5px solid var(--linea);
  border-radius: 10px;
  background: var(--blanco);
  transition: border-color .15s, background-color .15s;
}
.check:has(input:checked) { border-color: var(--verde); background: var(--verde-fondo); }
.check--error { border-color: var(--rojo); }
.check label { font-size: .875rem; line-height: 1.45; color: var(--gris-1); cursor: pointer; }
.check .field__error { grid-column: 2; }

.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid var(--gris-3);
  border-radius: 6px;
  background: var(--blanco);
  cursor: pointer;
  display: grid;
  place-content: center;
}
.check input::after {
  content: "";
  width: 12px;
  height: 7px;
  border: solid var(--blanco);
  border-width: 0 0 3px 3px;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform .12s;
}
.check input:checked { background: var(--verde); border-color: var(--verde); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }

.req { color: var(--rojo); font-weight: 700; }
.hint { margin: 0; font-size: .8125rem; color: var(--gris-2); text-align: center; }

/* ----------------------------------------------------------------- botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;
  padding: .75rem 1.25rem;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn--primary { background: var(--verde); color: var(--blanco); text-transform: uppercase; letter-spacing: .04em; }
.btn--primary:hover { background: #00522a; color: var(--blanco); }
.btn--ghost { background: transparent; color: var(--verde); border-color: var(--verde); }
.btn--ghost:hover { background: var(--verde-fondo); }
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: .375rem 1rem; font-size: .875rem; }

.badge-ok {
  width: 64px; height: 64px;
  margin: 0 auto 1rem;
  display: grid; place-content: center;
  border-radius: 50%;
  background: var(--verde);
  color: var(--blanco);
  font-size: 2rem;
  font-weight: 800;
}

/* -------------------------------------------------------------- backoffice */

.back-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.back-bar h1 { margin: 0; }
.back-bar__user { display: flex; align-items: center; gap: .75rem; color: var(--gris-2); font-size: .9375rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: .875rem 1rem; border-top: 4px solid var(--verde); }
.stat__n { display: block; font-size: 1.5rem; font-weight: 800; color: var(--verde); line-height: 1.1; }
.stat__l { font-size: .8125rem; color: var(--gris-2); }

.filters { display: grid; grid-template-columns: 1fr; gap: .875rem; margin-bottom: .75rem; }
.filters__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.filters__actions .btn { flex: 1 1 auto; }

.pill { display: inline-block; min-width: 2.5rem; padding: .125rem .5rem; border-radius: 999px; font-size: .8125rem; font-weight: 700; text-align: center; }
.pill--yes { background: var(--verde-fondo); color: var(--verde); }
.pill--no { background: #fdecee; color: #8a0b20; }
.pill--na { background: var(--fondo); color: var(--gris-2); }

/* Movil: cada registro es una tarjeta; la cabecera de tabla se oculta y cada
   celda muestra su etiqueta (data-label). */
.regs { width: 100%; border-collapse: collapse; }
.regs thead { position: absolute; left: -10000px; }
.regs tr {
  display: block;
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: .75rem 1rem;
  margin-bottom: .75rem;
}
.regs td {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .3125rem 0;
  border-bottom: 1px solid var(--fondo);
  font-size: .9375rem;
  text-align: right;
  overflow-wrap: anywhere;
}
.regs td:last-child { border-bottom: 0; }
.regs td::before { content: attr(data-label); font-weight: 600; color: var(--gris-2); text-align: left; flex: none; }
.regs td.regs__name { font-weight: 700; font-size: 1.0625rem; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; color: var(--gris-2); }

.legend { margin-top: 1.5rem; }
.legend summary { cursor: pointer; font-weight: 700; }
.legend dt { margin-top: 1rem; font-weight: 700; }
.legend dd { margin: .25rem 0 0; color: var(--gris-1); font-size: .9375rem; }

/* ------------------------------------------------------------------ tablet */

@media (min-width: 640px) {
  h1 { font-size: 2rem; }
  .page { padding: 2rem 1.5rem 3rem; }
  .card { padding: 2rem; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .site-header__crest { width: 52px; }
  .site-header__name { font-size: 1.25rem; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .filters { grid-template-columns: 2fr 1fr 1fr; align-items: end; }
  .filters__actions { grid-column: 1 / -1; }
  .filters__actions .btn { flex: 0 0 auto; }
}

/* ------------------------------------------- escritorio: tabla de verdad */

@media (min-width: 960px) {
  .table-wrap { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); overflow-x: auto; }
  .regs thead { position: static; }
  .regs tr { display: table-row; box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
  .regs th, .regs td { display: table-cell; padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--linea); vertical-align: middle; }
  .regs td::before { content: none; }
  .regs th { font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gris-2); background: var(--fondo); white-space: nowrap; }
  .regs td.regs__name { font-size: .9375rem; }
  .regs tbody tr:hover { background: #fafbfc; }
}

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