/* Panel de la A.D. Llerenense: pensado primero para el móvil (puerta y banquillo), cómodo también en el ordenador */
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2-variations'); }
@font-face { font-family: 'Oswald'; font-weight: 200 700; font-display: swap; src: url(/fonts/oswald-latin-wght-normal.woff2) format('woff2-variations'); }

:root {
  --granate: #7A1414; --oscuro: #1F0707; --oro: #E3B04B; --crema: #FBF6E3;
  --texto: #1F0707; --suave: #6b5b55; --linea: #eadfd3; --fondo: #f6f1e7; --blanco: #fff;
  --ok: #15803d; --warn: #c2410c; --no: #be123c;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.5 Inter, system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; }
h1, h2, h3 { font-family: Oswald, Inter, sans-serif; text-transform: uppercase; line-height: 1.1; margin: 0; letter-spacing: .01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
p { margin: 0; }
.cargando { padding: 3rem 1rem; text-align: center; color: var(--suave); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Entrar ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(120% 80% at 50% 0%, #4a1010 0%, var(--oscuro) 70%); }
.login form { width: 100%; max-width: 380px; background: var(--blanco); border-radius: 24px; padding: 1.75rem 1.5rem; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.login .escudo { display: block; width: 72px; margin: -3.5rem auto .5rem; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); }
.login h1 { text-align: center; font-size: 1.5rem; }
.login p.sub { text-align: center; color: var(--suave); font-size: .9rem; margin-top: .25rem; }

label.campo { display: block; font-size: .85rem; font-weight: 600; margin-top: 1rem; }
.campo input, .campo select, input.in, select.in, textarea.in { display: block; width: 100%; margin-top: .35rem; padding: .75rem .9rem; border: 1px solid var(--linea); border-radius: 12px; background: var(--blanco); font-size: 1rem; }
.campo input:focus, .campo select:focus, input.in:focus, select.in:focus { outline: none; border-color: var(--granate); box-shadow: 0 0 0 4px rgba(122,20,20,.12); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 999px; padding: .75rem 1.25rem; font-weight: 650; background: var(--oscuro); color: #fff; text-decoration: none; transition: background .15s, transform .1s; }
.btn:hover { background: var(--granate); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.oro { background: var(--oro); color: var(--oscuro); }
.btn.oro:hover { background: #f0c463; }
.btn.verde { background: var(--ok); }
.btn.claro { background: var(--blanco); color: var(--texto); box-shadow: inset 0 0 0 1px var(--linea); }
.btn.claro:hover { box-shadow: inset 0 0 0 1px var(--granate); background: var(--blanco); }
.btn.peq { padding: .45rem .85rem; font-size: .85rem; }
.btn.ancho { width: 100%; }
.enlace { background: none; border: 0; padding: 0; color: var(--granate); font-weight: 600; text-decoration: underline; font-size: .85rem; }
.enlace.rojo { color: var(--no); }
.error { margin-top: 1rem; padding: .7rem .9rem; border-radius: 12px; background: #fff1f2; color: var(--no); font-size: .9rem; }
.error:empty { display: none; }

/* ---------- Marco ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--oscuro); color: #fff; padding: calc(.6rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .6rem max(1rem, env(safe-area-inset-left)); display: flex; align-items: center; gap: .75rem; }
.instalar { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--linea); text-align: center; font-size: .88rem; color: var(--suave); }
.instalar:empty { display: none; }
.instalar .btn { margin-top: .5rem; }
.top img { width: 36px; height: 36px; }
.top .quien { flex: 1; min-width: 0; }
.top .quien b { display: block; font-family: Oswald, Inter, sans-serif; text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; }
.top .quien span { font-size: .78rem; color: rgba(255,255,255,.65); }
.top .salir { background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 999px; padding: .45rem .9rem; font-size: .85rem; font-weight: 600; }
.tabs { position: sticky; top: 52px; z-index: 9; display: flex; gap: .35rem; overflow-x: auto; padding: .5rem 1rem; background: var(--crema); border-bottom: 1px solid var(--linea); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex-shrink: 0; border: 0; background: transparent; padding: .5rem .85rem; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--suave); }
.tabs button[aria-current="page"] { background: var(--oscuro); color: #fff; }
main { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.cab { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.cab p { color: var(--suave); font-size: .92rem; margin-top: .25rem; max-width: 46rem; }

.card { background: var(--blanco); border-radius: var(--r); padding: 1rem 1.1rem; box-shadow: 0 0 0 1px var(--linea); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: .9rem; }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.dato p { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }
.dato b { display: block; font: 700 2.4rem/1.1 Oswald, Inter, sans-serif; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.dato small { color: var(--suave); font-size: .8rem; }
.aviso { padding: .8rem 1rem; border-radius: 14px; font-size: .92rem; }
.aviso.oro { background: #fbefd3; box-shadow: inset 0 0 0 1px #ecd08f; }
.aviso.gris { background: #f1ece4; color: var(--suave); }
.aviso.verde { background: #ecfdf3; color: #14532d; box-shadow: inset 0 0 0 1px #bbf7d0; }
.aviso + * { margin-top: .9rem; }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #f1ece4; color: var(--suave); white-space: nowrap; }
.chip.oro { background: #fbefd3; color: #7a5a00; }
.chip.verde { background: #dcfce7; color: #166534; }
.chip.rojo { background: #ffe4e6; color: #9f1239; }
.partido { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; }
.partido h3 { font-size: 1.35rem; }
.muted { color: var(--suave); font-size: .88rem; }

ul.lista { list-style: none; margin: .5rem 0 0; padding: 0; }
ul.lista li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--linea); font-size: .92rem; }
ul.lista li:first-child { border-top: 0; }
ul.lista li .n { flex: 1; min-width: 0; }
ul.lista li .n b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.punto.ok { background: var(--ok); } .punto.warn { background: var(--warn); } .punto.no { background: var(--no); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); padding: .5rem .5rem; border-bottom: 1px solid var(--linea); }
td { padding: .55rem .5rem; border-bottom: 1px solid var(--linea); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla { overflow-x: auto; }
.cod { font: 700 1.05rem Oswald, Inter, sans-serif; letter-spacing: .08em; color: var(--granate); }
tr.baja td { opacity: .45; }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem .9rem; justify-content: flex-end; }

.fila { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.fila > .crece { flex: 1 1 220px; }
.fila .campo { margin-top: 0; }

/* ---------- Puerta ---------- */
.puerta { display: grid; gap: 1rem; }
@media (min-width: 820px) { .puerta { grid-template-columns: 360px 1fr; align-items: start; } }
.camara { position: relative; aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; background: #111; color: #fff; }
.camara video, .camara canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camara canvas { display: none; }
.camara .marco { position: absolute; inset: 22% 14%; border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); border: 3px solid rgba(255,255,255,.85); pointer-events: none; }
.camara .apagada { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1.5rem; gap: 1rem; align-content: center; }
.camara .apagada p { color: rgba(255,255,255,.75); font-size: .9rem; }
.res { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1.25rem; color: #fff; }
.res.ver { display: flex; animation: entra .18s ease-out; }
.res.ok { background: rgba(21,128,61,.96); } .res.warn { background: rgba(194,65,12,.96); } .res.no { background: rgba(190,18,60,.96); }
.res .ico { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; }
.res h3 { margin-top: 1rem; font-size: 1.7rem; }
.res .quien { margin-top: .4rem; font-weight: 700; font-size: 1.1rem; }
.res .det { margin-top: .3rem; font-size: .92rem; opacity: .9; }
@keyframes entra { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.contador { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.contador b { font: 700 2.6rem/1 Oswald, Inter, sans-serif; font-variant-numeric: tabular-nums; }

/* ---------- Clave nueva ---------- */
.clave { margin-top: .75rem; padding: .9rem 1rem; border-radius: 14px; background: #fbefd3; box-shadow: inset 0 0 0 1px #ecd08f; }
.clave code { display: block; font: 700 1.5rem Consolas, ui-monospace, monospace; letter-spacing: .06em; margin: .3rem 0; }

/* ---------- Impresión de la lista de la puerta ---------- */
#imprimir { display: none; }
@media print {
  body { background: #fff; }
  #app { display: none; }
  #imprimir { display: block; font-size: 9pt; }
  #imprimir h1 { font-size: 14pt; color: var(--granate); margin-bottom: 2mm; }
  #imprimir .cols { column-count: 2; column-gap: 7mm; }
  #imprimir .l { break-inside: avoid; font-weight: 700; color: var(--granate); border-bottom: .4mm solid var(--granate); margin: 2mm 0 .5mm; }
  #imprimir .s { display: flex; gap: 2mm; break-inside: avoid; border-bottom: .2mm dashed #bbb; padding: .8mm 0; }
  #imprimir .s span:first-child { flex: 1; font-weight: 600; }
  #imprimir .s span:nth-child(2) { color: #555; font-size: 7.5pt; }
  #imprimir .s span:last-child { font: 700 10pt Consolas, monospace; color: var(--granate); }
  @page { size: A4; margin: 12mm 10mm; }
}

/* ---------- Pegatinas con el QR (carnet en papel): etiquetas A4 de 70 × 37 mm, 3 × 8 ---------- */
@page pegatinas { size: A4; margin: 0; }
@media print {
  #imprimir.pegatinas { page: pegatinas; }
  #imprimir.pegatinas .hoja { display: grid; grid-template-columns: repeat(3, 70mm); grid-auto-rows: 37mm; padding-top: .5mm; }
  #imprimir.pegatinas .peg { display: flex; align-items: center; gap: 2.5mm; padding: 2.5mm 3mm; overflow: hidden; break-inside: avoid; }
  #imprimir.pegatinas .qr { width: 30mm; height: 30mm; flex-shrink: 0; }
  #imprimir.pegatinas .qr svg { width: 100%; height: 100%; display: block; }
  #imprimir.pegatinas .txt { display: flex; flex-direction: column; gap: .6mm; min-width: 0; font-size: 7pt; line-height: 1.2; color: #333; }
  #imprimir.pegatinas .txt .club { font-size: 6pt; text-transform: uppercase; letter-spacing: .04em; color: var(--granate); font-weight: 700; }
  #imprimir.pegatinas .txt b { font-size: 8.5pt; color: #000; }
  #imprimir.pegatinas .txt .c { font: 700 9pt Consolas, monospace; color: var(--granate); }
}

/* ---------- Cartel y noticias ---------- */
img.mini { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 1px var(--linea); flex-shrink: 0; }
textarea.in { resize: vertical; font: inherit; line-height: 1.5; }
label.btn input[type=file] { display: none; }
